2 Copyright © 2002-2003, 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>
16 #include "muimaster_intern.h"
18 #include "support_classes.h"
19 #include "poppen_private.h"
21 extern struct Library
*MUIMasterBase
;
24 IPTR
Poppen__OM_NEW(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
26 struct Poppen_DATA
*data
;
27 struct TagItem
*tag
, *tags
;
30 obj
= (Object
*) DoSuperNewTags(cl
, obj
, NULL
,
33 MUIA_Background
, MUII_ButtonBack
,
34 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
35 MUIA_Draggable
, TRUE
, TAG_MORE
, (IPTR
) msg
->ops_AttrList
);
40 data
= INST_DATA(cl
, obj
);
41 data
->wintitle
= NULL
;
43 /* parse initial taglist */
44 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem(&tags
));)
48 case MUIA_Window_Title
:
49 data
->wintitle
= (CONST_STRPTR
) tag
->ti_Data
;
55 DoMethod(obj
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
) obj
, 1,
56 MUIM_Poppen_OpenWindow
);
61 IPTR
Poppen__MUIM_Hide(struct IClass
*cl
, Object
*obj
, struct opGet
*msg
)
63 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
67 set(data
->wnd
, MUIA_Window_Open
, FALSE
);
68 DoMethod(_app(obj
), OM_REMMEMBER
, (IPTR
) data
->wnd
);
69 MUI_DisposeObject(data
->wnd
);
72 return DoSuperMethodA(cl
, obj
, (Msg
) msg
);
75 IPTR
Poppen__MUIM_Poppen_OpenWindow(struct IClass
*cl
, Object
*obj
,
78 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
82 Object
*ok_button
, *cancel_button
;
85 get(obj
, MUIA_Pendisplay_Spec
, &penspec
);
87 data
->wnd
= (Object
*)(WindowObject
,
88 MUIA_Window_Title
, (IPTR
)data
->wintitle
,
89 MUIA_Window_Activate
, TRUE
,
90 WindowContents
, (IPTR
)VGroup
,
91 Child
, (IPTR
)(data
->penadjust
= (Object
*)PenadjustObject
,
93 MUIA_Penadjust_Spec
, (IPTR
)penspec
,
96 Child
, (IPTR
)(ok_button
=
97 MUI_MakeObject(MUIO_Button
,(IPTR
)"_Ok")),
98 Child
, (IPTR
)(cancel_button
=
99 MUI_MakeObject(MUIO_Button
,(IPTR
)"_Cancel")),
106 set(ok_button
, MUIA_CycleChain
, 1);
107 set(cancel_button
, MUIA_CycleChain
, 1);
109 DoMethod(_app(obj
), OM_ADDMEMBER
, (IPTR
) data
->wnd
);
111 DoMethod(ok_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
112 (IPTR
) _app(obj
), 5, MUIM_Application_PushMethod
,
113 (IPTR
) obj
, 2, MUIM_Poppen_CloseWindow
, TRUE
);
114 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
115 (IPTR
) _app(obj
), 5, MUIM_Application_PushMethod
,
116 (IPTR
) obj
, 2, MUIM_Poppen_CloseWindow
, FALSE
);
117 DoMethod(data
->wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
,
118 (IPTR
) _app(obj
), 5, MUIM_Application_PushMethod
,
119 (IPTR
) obj
, 2, MUIM_Poppen_CloseWindow
, FALSE
);
127 set(data
->wnd
, MUIA_Window_Open
, TRUE
);
128 get(data
->wnd
, MUIA_Window_Open
, &opened
);
132 DoMethod(obj
, MUIM_Poppen_CloseWindow
, FALSE
);
139 IPTR
Poppen__MUIM_Poppen_CloseWindow(struct IClass
*cl
, Object
*obj
,
140 struct MUIP_Poppen_CloseWindow
*msg
)
142 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
145 set(data
->wnd
, MUIA_Window_Open
, FALSE
);
151 get(data
->penadjust
, MUIA_Penadjust_Spec
, &spec
);
153 set(obj
, MUIA_Pendisplay_Spec
, (IPTR
) spec
);
156 DoMethod(_app(obj
), OM_REMMEMBER
, (IPTR
) data
->wnd
);
157 MUI_DisposeObject(data
->wnd
);
159 data
->penadjust
= NULL
;
163 IPTR
Poppen__MUIM_DisconnectParent(struct IClass
*cl
, Object
*obj
,
164 struct MUIP_DisconnectParent
*msg
)
166 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
169 DoMethod(obj
, MUIM_Poppen_CloseWindow
, FALSE
);
170 return DoSuperMethodA(cl
, obj
, (Msg
) msg
);
173 #if ZUNE_BUILTIN_POPPEN
174 BOOPSI_DISPATCHER(IPTR
, Poppen_Dispatcher
, cl
, obj
, msg
)
176 switch (msg
->MethodID
)
179 return Poppen__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
181 return Poppen__MUIM_Hide(cl
, obj
, (APTR
) msg
);
182 case MUIM_Poppen_OpenWindow
:
183 return Poppen__MUIM_Poppen_OpenWindow(cl
, obj
, (APTR
) msg
);
184 case MUIM_Poppen_CloseWindow
:
185 return Poppen__MUIM_Poppen_CloseWindow(cl
, obj
, (APTR
) msg
);
186 case MUIM_DisconnectParent
:
187 return Poppen__MUIM_DisconnectParent(cl
, obj
, (APTR
) msg
);
189 return DoSuperMethodA(cl
, obj
, msg
);
192 BOOPSI_DISPATCHER_END
194 const struct __MUIBuiltinClass _MUI_Poppen_desc
=
198 sizeof(struct Poppen_DATA
),
199 (void *) Poppen_Dispatcher
201 #endif /* ZUNE_BUILTIN_POPPEN */