2 Copyright © 2002-2006, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <clib/alib_protos.h>
9 #include <proto/exec.h>
10 #include <proto/graphics.h>
11 #include <proto/utility.h>
12 #include <proto/intuition.h>
13 #include <proto/muimaster.h>
15 /* #define MYDEBUG 1 */
18 #include "muimaster_intern.h"
20 #include "support_classes.h"
21 #include "popframe_private.h"
23 extern struct Library
*MUIMasterBase
;
25 IPTR
Popframe__OM_NEW(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
27 struct Popframe_DATA
*data
;
28 struct TagItem
*tag
, *tags
;
30 obj
= (Object
*) DoSuperNewTags(
34 MUIA_Background
, MUII_ButtonBack
,
35 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
37 TAG_MORE
, (IPTR
) msg
->ops_AttrList
);
42 data
= INST_DATA(cl
, obj
);
43 data
->wintitle
= NULL
;
45 /* parse initial taglist */
46 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem(&tags
));)
50 case MUIA_Window_Title
:
51 data
->wintitle
= (CONST_STRPTR
) tag
->ti_Data
;
56 DoMethod(obj
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) obj
, 1,
57 MUIM_Popframe_OpenWindow
);
62 IPTR
Popframe__OM_DISPOSE(struct IClass
*cl
, Object
*obj
, Msg msg
)
64 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
68 D(bug("Popframe_Dispose(%p) : MUI_DisposeObject(%p)\n", obj
,
70 MUI_DisposeObject(data
->wnd
);
73 return DoSuperMethodA(cl
, obj
, (Msg
) msg
);
76 IPTR
Popframe__MUIM_Hide(struct IClass
*cl
, Object
*obj
,
80 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
83 D(bug("Popframe_Hide(%p) : closing window %p\n", obj
, data
->wnd
));
84 set(data
->wnd
, MUIA_Window_Open
, FALSE
);
85 D(bug("Popframe_Hide(%p) : app REMMEMBER win (%p)\n", obj
,
87 DoMethod(_app(obj
), OM_REMMEMBER
, (IPTR
) data
->wnd
);
88 D(bug("Popframe_Hide(%p) : MUI_DisposeObject(%p)\n", obj
,
90 MUI_DisposeObject(data
->wnd
);
94 return DoSuperMethodA(cl
, obj
, (Msg
) msg
);
97 IPTR
Popframe__MUIM_Popframe_OpenWindow(struct IClass
*cl
, Object
*obj
,
100 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
104 Object
*ok_button
, *cancel_button
;
105 struct MUI_Frame_Spec
*frame_spec
= NULL
;
108 get(_win(obj
), MUIA_Window_LeftEdge
, &x
);
109 get(_win(obj
), MUIA_Window_TopEdge
, &y
);
111 get(obj
, MUIA_Framedisplay_Spec
, &frame_spec
);
113 data
->wnd
= (Object
*)(WindowObject
,
114 MUIA_Window_Title
, (IPTR
)data
->wintitle
,
115 MUIA_Window_Activate
, TRUE
,
116 MUIA_Window_IsSubWindow
, TRUE
,
117 MUIA_Window_LeftEdge
, _left(obj
) + x
,
118 MUIA_Window_TopEdge
, _bottom(obj
) + y
+ 1,
119 WindowContents
, (IPTR
)VGroup
,
120 Child
, (IPTR
)(data
->frameadjust
= MUI_NewObject(
123 MUIA_Frameadjust_Spec
, (IPTR
)frame_spec
,
126 MUIA_Group_SameWidth
, TRUE
,
127 Child
, (IPTR
)(ok_button
=
128 MUI_MakeObject(MUIO_Button
, (IPTR
)"_Ok")),
129 Child
, (IPTR
)HVSpace
,
130 Child
, (IPTR
)HVSpace
,
131 Child
, (IPTR
)(cancel_button
=
132 MUI_MakeObject(MUIO_Button
, (IPTR
)"_Cancel")),
139 set(ok_button
, MUIA_CycleChain
, 1);
140 set(cancel_button
, MUIA_CycleChain
, 1);
142 DoMethod(_app(obj
), OM_ADDMEMBER
, (IPTR
) data
->wnd
);
144 DoMethod(ok_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
145 (IPTR
) _app(obj
), 5, MUIM_Application_PushMethod
,
146 (IPTR
) obj
, 2, MUIM_Popframe_CloseWindow
, TRUE
);
147 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
148 (IPTR
) _app(obj
), 5, MUIM_Application_PushMethod
,
149 (IPTR
) obj
, 2, MUIM_Popframe_CloseWindow
, FALSE
);
150 DoMethod(data
->wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
151 (IPTR
) _app(obj
), 5, MUIM_Application_PushMethod
,
152 (IPTR
) obj
, 2, MUIM_Popframe_CloseWindow
, FALSE
);
158 ULONG opened
= FALSE
;
160 set(data
->wnd
, MUIA_Window_Open
, TRUE
);
161 get(data
->wnd
, MUIA_Window_Open
, &opened
);
164 DoMethod(obj
, MUIM_Popframe_CloseWindow
, FALSE
);
171 IPTR
Popframe__MUIM_Popframe_CloseWindow(struct IClass
*cl
, Object
*obj
,
172 struct MUIP_Popframe_CloseWindow
*msg
)
174 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
177 set(data
->wnd
, MUIA_Window_Open
, FALSE
);
182 get(data
->frameadjust
, MUIA_Frameadjust_Spec
, &spec
);
183 /* D(bug("popframe: got %s\n", spec)); */
184 set(obj
, MUIA_Framedisplay_Spec
, (IPTR
) spec
);
187 DoMethod(_app(obj
), OM_REMMEMBER
, (IPTR
) data
->wnd
);
188 MUI_DisposeObject(data
->wnd
);
190 data
->frameadjust
= NULL
;
194 IPTR
Popframe__MUIM_DisconnectParent(struct IClass
*cl
, Object
*obj
,
195 struct MUIP_DisconnectParent
*msg
)
197 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
200 DoMethod(obj
, MUIM_Popframe_CloseWindow
, FALSE
);
201 return DoSuperMethodA(cl
, obj
, (Msg
) msg
);
204 #if ZUNE_BUILTIN_POPFRAME
205 BOOPSI_DISPATCHER(IPTR
, Popframe_Dispatcher
, cl
, obj
, msg
)
207 switch (msg
->MethodID
)
210 return Popframe__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
212 return Popframe__OM_DISPOSE(cl
, obj
, msg
);
214 return Popframe__MUIM_Hide(cl
, obj
, (APTR
) msg
);
215 case MUIM_Popframe_OpenWindow
:
216 return Popframe__MUIM_Popframe_OpenWindow(cl
, obj
, (APTR
) msg
);
217 case MUIM_Popframe_CloseWindow
:
218 return Popframe__MUIM_Popframe_CloseWindow(cl
, obj
, (APTR
) msg
);
219 case MUIM_DisconnectParent
:
220 return Popframe__MUIM_DisconnectParent(cl
, obj
, (APTR
) msg
);
222 return DoSuperMethodA(cl
, obj
, msg
);
225 BOOPSI_DISPATCHER_END
227 const struct __MUIBuiltinClass _MUI_Popframe_desc
=
231 sizeof(struct Popframe_DATA
),
232 (void *) Popframe_Dispatcher
234 #endif /* ZUNE_BUILTIN_POPFRAME */