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
,
36 TAG_MORE
, (IPTR
)msg
->ops_AttrList
);
38 if (!obj
) return FALSE
;
40 data
= INST_DATA(cl
, obj
);
41 data
->wintitle
= NULL
;
43 /* parse initial taglist */
44 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem((const struct TagItem
**)&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
, Msg msg
)
77 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
81 Object
*ok_button
, *cancel_button
;
84 get(obj
,MUIA_Pendisplay_Spec
, &penspec
);
86 data
->wnd
= (Object
*)(WindowObject
,
87 MUIA_Window_Title
, (IPTR
)data
->wintitle
,
88 MUIA_Window_Activate
, TRUE
,
89 WindowContents
, (IPTR
)VGroup
,
90 Child
, (IPTR
)(data
->penadjust
= (Object
*)PenadjustObject
,
92 MUIA_Penadjust_Spec
, (IPTR
)penspec
,
95 Child
, (IPTR
)(ok_button
= MUI_MakeObject(MUIO_Button
,(IPTR
)"_Ok")),
96 Child
, (IPTR
)(cancel_button
= MUI_MakeObject(MUIO_Button
,(IPTR
)"_Cancel")),
103 set(ok_button
, MUIA_CycleChain
, 1);
104 set(cancel_button
, MUIA_CycleChain
, 1);
106 DoMethod(_app(obj
),OM_ADDMEMBER
,(IPTR
)data
->wnd
);
108 DoMethod(ok_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)_app(obj
), 5,
109 MUIM_Application_PushMethod
, (IPTR
)obj
, 2,
110 MUIM_Poppen_CloseWindow
, TRUE
);
111 DoMethod(cancel_button
, MUIM_Notify
, MUIA_Pressed
, FALSE
, (IPTR
)_app(obj
), 5,
112 MUIM_Application_PushMethod
, (IPTR
)obj
, 2,
113 MUIM_Poppen_CloseWindow
, FALSE
);
114 DoMethod(data
->wnd
, MUIM_Notify
, MUIA_Window_CloseRequest
, TRUE
, (IPTR
)_app(obj
), 5,
115 MUIM_Application_PushMethod
, (IPTR
)obj
, 2,
116 MUIM_Poppen_CloseWindow
, FALSE
);
124 set(data
->wnd
, MUIA_Window_Open
,TRUE
);
125 get(data
->wnd
, MUIA_Window_Open
, &opened
);
129 DoMethod(obj
, MUIM_Poppen_CloseWindow
, FALSE
);
136 IPTR
Poppen__MUIM_Poppen_CloseWindow(struct IClass
*cl
, Object
*obj
,
137 struct MUIP_Poppen_CloseWindow
*msg
)
139 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
142 set(data
->wnd
, MUIA_Window_Open
, FALSE
);
148 get(data
->penadjust
, MUIA_Penadjust_Spec
, &spec
);
150 set(obj
, MUIA_Pendisplay_Spec
, (IPTR
)spec
);
153 DoMethod(_app(obj
), OM_REMMEMBER
, (IPTR
)data
->wnd
);
154 MUI_DisposeObject(data
->wnd
);
156 data
->penadjust
= NULL
;
160 IPTR
Poppen__MUIM_DisconnectParent(struct IClass
*cl
, Object
*obj
,
161 struct MUIP_DisconnectParent
*msg
)
163 struct Poppen_DATA
*data
= INST_DATA(cl
, obj
);
165 if (data
->wnd
) DoMethod(obj
, MUIM_Poppen_CloseWindow
, FALSE
);
166 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
169 #if ZUNE_BUILTIN_POPPEN
170 BOOPSI_DISPATCHER(IPTR
, Poppen_Dispatcher
, cl
, obj
, msg
)
172 switch (msg
->MethodID
)
174 case OM_NEW
: return Poppen__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
175 case MUIM_Hide
: return Poppen__MUIM_Hide(cl
, obj
, (APTR
)msg
);
176 case MUIM_Poppen_OpenWindow
: return Poppen__MUIM_Poppen_OpenWindow(cl
, obj
, (APTR
)msg
);
177 case MUIM_Poppen_CloseWindow
: return Poppen__MUIM_Poppen_CloseWindow(cl
, obj
, (APTR
)msg
);
178 case MUIM_DisconnectParent
: return Poppen__MUIM_DisconnectParent(cl
, obj
, (APTR
)msg
);
179 default: return DoSuperMethodA(cl
, obj
, msg
);
182 BOOPSI_DISPATCHER_END
184 const struct __MUIBuiltinClass _MUI_Poppen_desc
=
188 sizeof(struct Poppen_DATA
),
189 (void*)Poppen_Dispatcher
191 #endif /* ZUNE_BUILTIN_POPPEN */