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
36 MUIA_Background
, MUII_ButtonBack
,
37 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
40 TAG_MORE
, (IPTR
) msg
->ops_AttrList
43 if (!obj
) return FALSE
;
45 data
= INST_DATA(cl
, obj
);
46 data
->wintitle
= NULL
;
48 /* parse initial taglist */
49 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem((const struct TagItem
**)&tags
)); )
53 case MUIA_Window_Title
:
54 data
->wintitle
= (CONST_STRPTR
)tag
->ti_Data
;
59 DoMethod(obj
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)obj
, 1,
60 MUIM_Popframe_OpenWindow
);
65 IPTR
Popframe__OM_DISPOSE(struct IClass
*cl
, Object
*obj
, Msg msg
)
67 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
71 D(bug("Popframe_Dispose(%p) : MUI_DisposeObject(%p)\n", obj
, data
->wnd
));
72 MUI_DisposeObject(data
->wnd
);
75 return DoSuperMethodA(cl
,obj
,(Msg
)msg
);
78 IPTR
Popframe__MUIM_Hide(struct IClass
*cl
, Object
*obj
, struct opGet
*msg
)
81 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
84 D(bug("Popframe_Hide(%p) : closing window %p\n", obj
, data
->wnd
));
85 set(data
->wnd
,MUIA_Window_Open
,FALSE
);
86 D(bug("Popframe_Hide(%p) : app REMMEMBER win (%p)\n", obj
, data
->wnd
));
87 DoMethod(_app(obj
),OM_REMMEMBER
,(IPTR
)data
->wnd
);
88 D(bug("Popframe_Hide(%p) : MUI_DisposeObject(%p)\n", obj
, data
->wnd
));
89 MUI_DisposeObject(data
->wnd
);
93 return DoSuperMethodA(cl
,obj
,(Msg
)msg
);
96 IPTR
Popframe__MUIM_Popframe_OpenWindow(struct IClass
*cl
, Object
*obj
, Msg msg
)
98 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
102 Object
*ok_button
, *cancel_button
;
103 struct MUI_Frame_Spec
*frame_spec
;
106 get(_win(obj
), MUIA_Window_LeftEdge
, &x
);
107 get(_win(obj
), MUIA_Window_TopEdge
, &y
);
109 get(obj
, MUIA_Framedisplay_Spec
, &frame_spec
);
111 data
->wnd
= WindowObject
,
112 MUIA_Window_Title
, (IPTR
)data
->wintitle
,
113 MUIA_Window_Activate
, TRUE
,
114 MUIA_Window_IsSubWindow
, TRUE
,
115 MUIA_Window_LeftEdge
, _left(obj
) + x
,
116 MUIA_Window_TopEdge
, _bottom(obj
) + y
+ 1,
117 WindowContents
, (IPTR
)VGroup
,
118 Child
, (IPTR
)(data
->frameadjust
= MUI_NewObject(
121 MUIA_Frameadjust_Spec
, (IPTR
)frame_spec
,
124 MUIA_Group_SameWidth
, TRUE
,
125 Child
, (IPTR
)(ok_button
= MUI_MakeObject(MUIO_Button
, (IPTR
)"_Ok")),
126 Child
, (IPTR
)HVSpace
,
127 Child
, (IPTR
)HVSpace
,
128 Child
, (IPTR
)(cancel_button
= MUI_MakeObject(MUIO_Button
, (IPTR
)"_Cancel")),
135 set(ok_button
, MUIA_CycleChain
, 1);
136 set(cancel_button
, MUIA_CycleChain
, 1);
138 DoMethod(_app(obj
),OM_ADDMEMBER
,(IPTR
)data
->wnd
);
140 DoMethod(ok_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)_app(obj
), 5,
141 MUIM_Application_PushMethod
, (IPTR
)obj
, 2,
142 MUIM_Popframe_CloseWindow
, TRUE
);
143 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)_app(obj
), 5,
144 MUIM_Application_PushMethod
, (IPTR
)obj
, 2,
145 MUIM_Popframe_CloseWindow
, FALSE
);
146 DoMethod(data
->wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
, (IPTR
)_app(obj
), 5,
147 MUIM_Application_PushMethod
, (IPTR
)obj
, 2,
148 MUIM_Popframe_CloseWindow
, FALSE
);
156 set(data
->wnd
, MUIA_Window_Open
,TRUE
);
157 get(data
->wnd
, MUIA_Window_Open
, &opened
);
160 DoMethod(obj
, MUIM_Popframe_CloseWindow
, FALSE
);
167 IPTR
Popframe__MUIM_Popframe_CloseWindow(struct IClass
*cl
, Object
*obj
,
168 struct MUIP_Popframe_CloseWindow
*msg
)
170 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
173 set(data
->wnd
, MUIA_Window_Open
, FALSE
);
178 get(data
->frameadjust
, MUIA_Frameadjust_Spec
, &spec
);
179 /* D(bug("popframe: got %s\n", spec)); */
180 set(obj
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
183 DoMethod(_app(obj
), OM_REMMEMBER
, (IPTR
)data
->wnd
);
184 MUI_DisposeObject(data
->wnd
);
186 data
->frameadjust
= NULL
;
190 IPTR
Popframe__MUIM_DisconnectParent(struct IClass
*cl
, Object
*obj
,
191 struct MUIP_DisconnectParent
*msg
)
193 struct Popframe_DATA
*data
= INST_DATA(cl
, obj
);
195 if (data
->wnd
) DoMethod(obj
, MUIM_Popframe_CloseWindow
, FALSE
);
196 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
199 #if ZUNE_BUILTIN_POPFRAME
200 BOOPSI_DISPATCHER(IPTR
, Popframe_Dispatcher
, cl
, obj
, msg
)
202 switch (msg
->MethodID
)
204 case OM_NEW
: return Popframe__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
205 case OM_DISPOSE
: return Popframe__OM_DISPOSE(cl
, obj
, msg
);
206 case MUIM_Hide
: return Popframe__MUIM_Hide(cl
, obj
, (APTR
)msg
);
207 case MUIM_Popframe_OpenWindow
: return Popframe__MUIM_Popframe_OpenWindow(cl
, obj
, (APTR
)msg
);
208 case MUIM_Popframe_CloseWindow
: return Popframe__MUIM_Popframe_CloseWindow(cl
, obj
, (APTR
)msg
);
209 case MUIM_DisconnectParent
: return Popframe__MUIM_DisconnectParent(cl
, obj
, (APTR
)msg
);
210 default: return DoSuperMethodA(cl
, obj
, msg
);
213 BOOPSI_DISPATCHER_END
215 const struct __MUIBuiltinClass _MUI_Popframe_desc
=
219 sizeof(struct Popframe_DATA
),
220 (void*)Popframe_Dispatcher
222 #endif /* ZUNE_BUILTIN_POPFRAME */