Aros/Developer/Docs/Libraries/ASL

Navbar for the Aros wikibook
Aros User
Aros User Docs
Aros User FAQs
Aros User Applications
Aros User DOS Shell
Aros/User/AmigaLegacy
Aros Dev Docs
Aros Developer Docs
Porting Software from AmigaOS/SDL
For Zune Beginners
Zune .MUI Classes
For SDL Beginners
Aros Developer BuildSystem
Specific platforms
Aros x86 Complete System HCL
Aros x86 Audio/Video Support
Aros x86 Network Support
Aros Intel AMD x86 Installing
Aros Storage Support IDE SATA etc
Aros Poseidon USB Support
x86-64 Support
Motorola 68k Amiga Support
Linux and FreeBSD Support
Windows Mingw and MacOSX Support
Android Support
Arm Raspberry Pi Support
PPC Power Architecture
misc
Aros Public License

Introduction

edit

Besides the Intuition type requesters, there are the Asl.library requesters that have built in requesters for

  • File Open/Save
  • Font
  • Public Screen selection
  • etc

You need to use AllocAslRequestTags to set up an ASL requester, the reqType can be ASL_FileRequest, ASL_FontRequest or ASL_ScreenModeRequest, you can then optional specify parameters for the ASL requester here or in the AslRequest function such as size of requester, title text, initial file, drawer and file pattern, font information or initial screen information as defined in libraries/asl_intern.h header file.

/* Internal requester structure */
struct IntReq
{
    UWORD		ir_ReqType;
    struct Window	*ir_Window;
    struct Screen	*ir_Screen;
    STRPTR		ir_PubScreenName;
    struct Hook 	*ir_IntuiMsgFunc;
    struct TextAttr	*ir_TextAttr;
    struct Locale	*ir_Locale;
    struct Catalog  	*ir_Catalog;
    APTR		ir_MemPool;
    ULONG		ir_MemPoolPuddle;  	/* if 0, no pool is created */
    ULONG		ir_MemPoolThresh;
    LONG    	    	ir_TitleID;
    STRPTR		ir_TitleText;
    STRPTR		ir_PositiveText;
    STRPTR		ir_NegativeText;
    WORD		ir_LeftEdge;
    WORD		ir_TopEdge;
    WORD		ir_Width;
    WORD		ir_Height;
    UBYTE		ir_Flags;

    APTR		ir_BasePtr;	/* Compatability: Saved copy of REG_A4 */
};

The AllocAslRequster will return a pointer and can be a pointer to a FileRequester, FontRequester or ScreenModeRequester structure (these are read only). Once a structure is set up, you can call the AslRequest function to display the requester and retrieve data from the structure afterwards such as Filename, Font or ScreenMode for use in your program. Once you have finished with the requester structure, you should call FreeAslRequest.

Values for TagItem in AslRequest() function

ASL_Dummy
ASL_Hail
ASL_Window
ASL_LeftEdge
ASL_TopEdge
ASL_Width
ASL_Height

ASL_HookFunc

ASL_File
ASL_Dir

ASL_Pattern

ASL_FontName
ASL_FontHeight
ASL_FontStyles
ASL_FontFlags
ASL_FrontPen
ASL_BackPen
ASL_MinHeight
ASL_MaxHeight

ASL_OKText
ASL_CancelText
ASL_FuncFlags
ASL_ModeList


Requesters

edit

File Requester

edit
/* Internal filerequester struct */

struct IntFileReq
{
    struct IntReq	ifr_IntReq;

    STRPTR		ifr_File;
    STRPTR		ifr_Drawer;
    STRPTR		ifr_Pattern;
    STRPTR		ifr_AcceptPattern;
    STRPTR		ifr_RejectPattern;
    UBYTE		ifr_Flags1;
    UBYTE		ifr_Flags2;
    struct Hook 	*ifr_FilterFunc;

    ULONG 		(*ifr_HookFunc)(ULONG mask, APTR object, struct FileRequester *fr);
    			/* ASLFR_HookFunc = Combined callback function */

    ULONG		*ifr_GetSortBy;
    ULONG		*ifr_GetSortOrder;
    ULONG		*ifr_GetSortDrawers;
    UWORD		ifr_SortBy;
    UWORD		ifr_SortOrder;
    UWORD		ifr_SortDrawers;
    BOOL		ifr_InitialShowVolumes;        
};

Font Requester

edit
struct IntFontReq
{
    struct IntReq	ifo_IntReq;
    struct TextAttr	ifo_TextAttr;
    UBYTE		ifo_FrontPen;
    UBYTE		ifo_BackPen;
    UBYTE		ifo_DrawMode;

    UBYTE		ifo_Flags;
    UWORD		ifo_MinHeight;
    UWORD		ifo_MaxHeight;
    struct Hook		*ifo_FilterFunc;

    ULONG		(*ifo_HookFunc)(ULONG, APTR, struct FontRequester *);

    UWORD		ifo_MaxFrontPen;
    UWORD		ifo_MaxBackPen;

    STRPTR		*ifo_ModeList;
    STRPTR  	    	 ifo_SampleText;
    UBYTE		*ifo_FrontPens;
    UBYTE		*ifo_BackPens;

    STRPTR		ifo_DrawModeJAM1Text;
    STRPTR		ifo_DrawModeJAM2Text;
    STRPTR  	    	ifo_DrawModeCOMPText;
    STRPTR		ifo_DrawMode0Text; 
};

ASL funcFlags for FontRequester

FONB_FrontColor
FONF_FrontColor
FONB_BackColor
FONF_BackColor
FONB_Styles
FONF_Styles
FONB_DrawMode
FONF_DrawMode
FONB_FixedWidth
FONF_FixedWidth
FONB_NewIDCMP
FONF_NewIDCMP
FONB_DoMsgFunc
FONF_DoMsgFunc
FONB_DoWildFunc
FONF_DoWildFunc

ScreenMode Requester

edit
struct IntSMReq
{
    struct IntReq	ism_IntReq;
    struct List		*ism_CustomSMList;
    struct Hook		*ism_FilterFunc;		
    ULONG		ism_Flags;
    ULONG		ism_DisplayID;
    ULONG	 	ism_DisplayWidth;
    ULONG		ism_DisplayHeight;
    ULONG		ism_BitMapWidth;
    ULONG		ism_BitMapHeight;
    UWORD		ism_DisplayDepth;
    UWORD		ism_OverscanType;
    BOOL		ism_AutoScroll;
    ULONG		ism_PropertyFlags;
    ULONG		ism_PropertyMask;
    LONG		ism_MinDepth;
    LONG		ism_MaxDepth;
    LONG		ism_MinWidth;
    LONG		ism_MaxWidth;
    LONG		ism_MinHeight;
    LONG		ism_MaxHeight;
    LONG		ism_InfoLeftEdge;
    LONG		ism_InfoTopEdge;
    BOOL		ism_InfoOpened;
    
    STRPTR		ism_Overscan1Text;
    STRPTR		ism_Overscan2Text;
    STRPTR		ism_Overscan3Text;
    STRPTR		ism_Overscan4Text;
    STRPTR		ism_OverscanNullText;
    STRPTR		ism_AutoScrollOFFText;
    STRPTR		ism_AutoScrollONText;
    STRPTR		ism_AutoScroll0Text;
    
    STRPTR		ism_PropertyList_Title;
    STRPTR		ism_PropertyList_NotWB;
    STRPTR		ism_PropertyList_NotGenlock;
    STRPTR		ism_PropertyList_NotDraggable;
    STRPTR		ism_PropertyList_HAM;
    STRPTR		ism_PropertyList_EHB;
    STRPTR		ism_PropertyList_Interlace;
    STRPTR		ism_PropertyList_ECS;
    STRPTR		ism_PropertyList_WB;
    STRPTR		ism_PropertyList_Genlock;
    STRPTR		ism_PropertyList_Draggable;
    STRPTR		ism_PropertyList_DPFPri2;
    STRPTR		ism_PropertyList_RefreshRate;
};

</syntaxhighlight lang="c"> </syntaxhighlight>


Examples

edit
#include <stdio.h>
#include <libraries/asl.h>
#include <proto/exec.h>
#include <proto/asl.h>

struct Library* AslBase;

int main()
{
  AslBase = OpenLibrary("asl.library", 0)

  if(AslBase != NULL)
  {
    struct FileRequester* req = AllocAslRequest(ASL_FileRequest, NULL);

    if(req != NULL)
    {
      AslRequest(req, NULL);
      printf("%s/%s\n", req->fr_Drawer, req->fr_File);
      FreeAslRequest(req);
    }

    CloseLibrary(AslBase);
  }

  return 0;
}

References

edit
BOOL RequestFile(struct FileRequester *fileReq) (A0)
void FreeFileRequest(struct FileRequester *fileReq) (A0)
APTR AllocAslRequest(ULONG reqType, struct TagItem *tagList) (D0, A0)
BOOL AslRequest(APTR requester, struct TagItem *tagList) (A0, A1)
void FreeAslRequest(APTR requester) (A0)
void AbortAslRequest(APTR requester) (A0)
void ActivateAslRequest(APTR requester) (A0)
APTR AllocAslRequestTags( ULONG reqType, Tag tag1, ... );
VOID FreeAslRequest( APTR requester );
BOOL AslRequestTags( APTR requester, struct TagItem *tagList );