2 Copyright © 2002-2007, The AROS Development Team. All rights reserved.
9 #include <proto/alib.h>
11 #include <clib/alib_protos.h>
13 #include <proto/exec.h>
14 #include <proto/intuition.h>
15 #include <proto/muimaster.h>
19 #include "muimaster_intern.h"
21 extern struct Library
*MUIMasterBase
;
24 AROS_UFH2S(void, cpy_func
,
25 AROS_UFHA(UBYTE
, chr
, D0
),
26 AROS_UFHA(STRPTR
*, strPtrPtr
, A3
))
30 *(*strPtrPtr
)++ = chr
;
35 AROS_UFH2S(void, len_func
,
36 AROS_UFHA(UBYTE
, chr
, D0
),
37 AROS_UFHA(LONG
*, lenPtr
, A3
))
47 /*****************************************************************************
50 AROS_LH7(LONG
, MUI_RequestA
,
53 AROS_LHA(APTR
, app
, D0
),
54 AROS_LHA(APTR
, win
, D1
),
55 AROS_LHA(LONGBITS
, flags
, D2
),
56 AROS_LHA(CONST_STRPTR
, title
, A0
),
57 AROS_LHA(CONST_STRPTR
, gadgets
, A1
),
58 AROS_LHA(CONST_STRPTR
, format
, A2
),
59 AROS_LHA(APTR
, params
, A3
),
62 struct Library
*, MUIMasterBase
, 7, MUIMaster
)
80 *****************************************************************************/
88 static const ULONG len_func
= 0x52934e75; /* addq.l #1,(A3) ; rts */
89 static const ULONG cpy_func
= 0x16c04e75; /* move.b d0,(a3)+ ; rts */
94 Object
*req_but
[32]; /* more than 32 buttongadgets within a requester shouldn`t happen */
99 es
.es_StructSize
= sizeof(struct EasyStruct
);
102 es
.es_TextFormat
= format
;
103 es
.es_GadgetFormat
= gadgets
;
104 return EasyRequestArgs(NULL
,&es
,NULL
,params
);
109 RawDoFmt(format
,params
,(VOID_FUNC
)AROS_ASMSYMNAME(len_func
),&reqtxt_len
);
112 RawDoFmt(format
,params
,(void(*)())&len_func
,&reqtxt_len
);
115 if (!(reqtxt
= AllocVec(reqtxt_len
+1,0))) return 0; /* Return cancel if something failed */
119 char *reqtxtptr
= reqtxt
;
121 RawDoFmt(format
,params
,(VOID_FUNC
)AROS_ASMSYMNAME(cpy_func
),&reqtxtptr
);
124 RawDoFmt(format
,params
,(void(*)())&cpy_func
,reqtxt
);
127 if (title
== NULL
&& app
!= NULL
)
129 title
= (CONST_STRPTR
) XGET(app
, MUIA_Application_Title
);
132 req_wnd
= WindowObject
,
133 MUIA_Window_Title
, title
,
134 MUIA_Window_RefWindow
, win
,
135 MUIA_Window_LeftEdge
, MUIV_Window_LeftEdge_Centered
,
136 MUIA_Window_TopEdge
, MUIV_Window_TopEdge_Centered
,
137 MUIA_Window_CloseGadget
, FALSE
,
138 MUIA_Window_SizeGadget
, FALSE
,
139 WindowContents
, VGroup
,
140 MUIA_Background
, MUII_RequesterBack
,
148 MUIA_Background
, MUII_TextBack
,
149 MUIA_Text_SetMax
, TRUE
,
150 MUIA_Text_Contents
, reqtxt
,
154 Child
, req_group
= HGroup
, End
,
164 char *gadgs
= StrDup(gadgets
);
167 char *current
= gadgs
;
172 // set(app, MUIA_Application_Sleep, TRUE);
173 DoMethod(app
, OM_ADDMEMBER
, (IPTR
)req_wnd
);
177 char *next
= strchr(current
,'|');
178 if (next
) *next
++ = 0;
180 if (current
[0] == '*')
186 if (!(req_but
[num_gads
] = SimpleButton(current
)))
193 DoMethod(req_group
, MUIM_Group_InitChange
);
195 /* if this is only one button lets add it separatly */
198 DoMethod(req_group
, OM_ADDMEMBER
, (IPTR
)HSpace(0));
199 DoMethod(req_group
, OM_ADDMEMBER
, (IPTR
)req_but
[0]);
200 DoMethod(req_group
, OM_ADDMEMBER
, (IPTR
)HSpace(0));
201 DoMethod(req_but
[0], MUIM_Notify
, MUIA_Pressed
, FALSE
,
202 (IPTR
)app
, 2, MUIM_Application_ReturnID
, 2);
208 for(j
= 0; j
< num_gads
; j
++)
212 DoMethod(req_group
, OM_ADDMEMBER
, (IPTR
)HSpace(0));
214 DoMethod(req_group
, OM_ADDMEMBER
, (IPTR
)req_but
[j
]);
215 DoMethod(req_but
[j
], MUIM_Notify
, MUIA_Pressed
, FALSE
,
216 (IPTR
)app
, 2, MUIM_Application_ReturnID
,
217 (j
+2 <= num_gads
) ? j
+2 : 1);
218 set(req_but
[j
], MUIA_CycleChain
, 1);
221 DoMethod(req_group
, MUIM_Group_ExitChange
);
223 /* now activate that button with a starting "*" */
224 if(active
!= -1) set(req_wnd
, MUIA_Window_ActiveObject
, (IPTR
) req_but
[active
]);
226 /* lets collect the waiting returnIDs now */
227 // COLLECT_RETURNIDS;
229 set(req_wnd
, MUIA_Window_Open
, TRUE
);
230 get(req_wnd
, MUIA_Window_Open
, &isopen
);
239 ULONG ret
= DoMethod(app
, MUIM_Application_NewInput
, (IPTR
)&sigs
);
241 /* if a button was hit, lets get outda here. */
242 if (ret
> 0 && ret
<= num_gads
+1)
248 if (sigs
) sigs
= Wait(sigs
);
252 /* now lets reissue the collected returnIDs again */
253 // REISSUE_RETURNIDS;
255 // set(app, MUIA_Application_Sleep, FALSE);
258 DoMethod(app
, OM_REMMEMBER
, (IPTR
)req_wnd
);
259 MUI_DisposeObject(req_wnd
);
265 } /* MUIA_RequestA */