Aros/Developer/Docs/Libraries/ASL
外观
< Aros | Developer/Docs
除了 Intuition 类型的请求器外,还有 Asl.library 请求器,它们内置了以下请求器:
- 文件打开/保存
- 字体
- 公共屏幕选择
- 等等
您需要使用 AllocAslRequestTags 设置 ASL 请求器,reqType 可以是 ASL_FileRequest、ASL_FontRequest 或 ASL_ScreenModeRequest,您可以在此处或在 AslRequest 函数中指定 ASL 请求器的可选参数,例如请求器的大小、标题文本、初始文件、抽屉和文件模式、字体信息或初始屏幕信息,如 libraries/asl_intern.h 头文件所定义。
/* 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 */
};
AllocAslRequster 将返回一个指针,该指针可以是指向 FileRequester、FontRequester 或 ScreenModeRequester 结构的指针(这些结构是只读的)。一旦设置了结构,就可以调用 AslRequest 函数来显示请求器,并在之后从结构中检索数据,例如文件名、字体或屏幕模式,以供您的程序使用。完成对请求器结构的操作后,您应该调用 FreeAslRequest。
AslRequest() 函数中 TagItem 的值
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
/* 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;
};
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;
};
FontRequester 的 ASL funcFlags
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
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>
#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;
}
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 ); |