2 Copyright © 2002-2006, The AROS Development Team. All rights reserved.
6 #include <graphics/gfx.h>
7 #include <graphics/view.h>
8 #include <clib/alib_protos.h>
9 #include <libraries/asl.h>
10 #include <libraries/mui.h>
11 #include <proto/exec.h>
12 #include <proto/graphics.h>
13 #include <proto/utility.h>
14 #include <proto/intuition.h>
15 #include <proto/muimaster.h>
18 #include <proto/alib.h>
21 #include "zunestuff.h"
25 /* #include <aros/debug.h> */
27 extern struct Library
*MUIMasterBase
;
29 struct MUI_CyclesPData
31 Object
*cycle_popimage
;
32 Object
*menu_position_cycle
;
33 Object
*menu_level_slider
;
34 Object
*menu_speed_slider
;
35 Object
*menu_popframe
;
36 Object
*background_menu_popimage
;
37 Object
*recessed_entries_checkmark
;
40 static CONST_STRPTR positions_labels
[3];
42 static Object
*MakeLevelSlider (void)
44 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 2, 20);
45 set(obj
, MUIA_CycleChain
, 1);
50 static Object
*MakeSpeedSlider (void)
52 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 50);
53 set(obj
, MUIA_CycleChain
, 1);
58 static IPTR
CyclesP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
60 struct MUI_CyclesPData
*data
;
61 struct MUI_CyclesPData d
;
63 positions_labels
[0] = _(MSG_BELOW
);
64 positions_labels
[1] = _(MSG_ON_ACTIVE
);
66 obj
= (Object
*) DoSuperNewTags
70 MUIA_Group_Horiz
, FALSE
,
72 GroupFrameT(_(MSG_CYCLE_GADGET_DESIGN
)),
73 Child
, (IPTR
) HVSpace
,
74 Child
, (IPTR
) (d
.cycle_popimage
=
78 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
82 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
83 MUIA_Imagedisplay_FreeVert
, FALSE
,
84 MUIA_Window_Title
, (IPTR
) _(MSG_CYCLE
),
87 Child
, (IPTR
) HVSpace
,
88 End
, /* Cycle Gadget Design */
91 GroupFrameT(_(MSG_POPUP_MENU_CONTROL
)),
92 Child
, (IPTR
) VSpace(0),
93 Child
, (IPTR
) ColGroup(2),
94 MUIA_Group_VertSpacing
, 2,
95 Child
, (IPTR
) Label(_(MSG_POSITION
)),
96 Child
, (IPTR
) (d
.menu_position_cycle
= MakeCycle(_(MSG_POSITION
), positions_labels
)),
97 Child
, (IPTR
) Label(_(MSG_LEVEL
)),
98 Child
, (IPTR
) (d
.menu_level_slider
= MakeLevelSlider()),
99 Child
, (IPTR
) Label(_(MSG_SPEED
)),
100 Child
, (IPTR
) (d
.menu_speed_slider
= MakeSpeedSlider()),
102 Child
, (IPTR
) VSpace(0),
103 End
, /* Popup Menu Control */
104 Child
, (IPTR
) VGroup
,
105 MUIA_Group_VertSpacing
, 2,
106 GroupFrameT(_(MSG_POPUP_MENU_DESIGN
)),
107 Child
, (IPTR
) HGroup
,
108 MUIA_Group_SameWidth
, TRUE
,
109 Child
, (IPTR
) VGroup
,
110 MUIA_Group_VertSpacing
, 1,
111 Child
, (IPTR
) (d
.menu_popframe
= MakePopframe()),
112 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
114 Child
, (IPTR
) VGroup
,
115 MUIA_Group_VertSpacing
, 1,
116 Child
, (IPTR
) (d
.background_menu_popimage
= MUI_NewObject
120 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_BACKGROUND
),
123 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
126 Child
, (IPTR
) HGroup
,
127 Child
, (IPTR
) HSpace(0),
128 Child
, (IPTR
) Label1(_(MSG_RECESSED_ENTRIES
)),
129 Child
, (IPTR
) (d
.recessed_entries_checkmark
= MakeCheck(NULL
)),
130 End
, /* HGroup recessed CM */
131 End
, /* Popup Menu Design */
132 End
, /* HGroup Popup Menu */
134 TAG_MORE
, (IPTR
) msg
->ops_AttrList
137 if (!obj
) return FALSE
;
139 data
= INST_DATA(cl
, obj
);
141 set(data
->menu_position_cycle
, MUIA_CycleChain
, 1);
148 * MUIM_Settingsgroup_ConfigToGadgets
150 static IPTR
CyclesP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
151 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
153 struct MUI_CyclesPData
*data
= INST_DATA(cl
, obj
);
157 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
159 set(data
->menu_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
163 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
164 MUICFG_Background_PopUp
);
165 set(data
->background_menu_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
166 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
168 set(data
->cycle_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
171 setslider(data
->menu_level_slider
,
172 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
173 MUICFG_Cycle_MenuCtrl_Level
));
174 setslider(data
->menu_speed_slider
,
175 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
176 MUICFG_Cycle_MenuCtrl_Speed
));
178 setcheckmark(data
->recessed_entries_checkmark
,
179 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
180 MUICFG_Cycle_Menu_Recessed
));
183 setcycle(data
->menu_position_cycle
,
184 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
185 MUICFG_Cycle_MenuCtrl_Position
));
192 * MUIM_Settingsgroup_ConfigToGadgets
194 static IPTR
CyclesP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
195 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
197 struct MUI_CyclesPData
*data
= INST_DATA(cl
, obj
);
201 str
= (STRPTR
)XGET(data
->menu_popframe
, MUIA_Framedisplay_Spec
);
202 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_PopUp
,
205 str
= (STRPTR
)XGET(data
->background_menu_popimage
, MUIA_Imagedisplay_Spec
);
206 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_PopUp
,
208 str
= (STRPTR
)XGET(data
->cycle_popimage
, MUIA_Imagedisplay_Spec
);
209 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_Cycle
,
212 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_MenuCtrl_Level
,
213 XGET(data
->menu_level_slider
, MUIA_Numeric_Value
));
214 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_MenuCtrl_Speed
,
215 XGET(data
->menu_speed_slider
, MUIA_Numeric_Value
));
217 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_Menu_Recessed
,
218 XGET(data
->recessed_entries_checkmark
, MUIA_Selected
));
220 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_MenuCtrl_Position
,
221 XGET(data
->menu_position_cycle
, MUIA_Cycle_Active
));
227 BOOPSI_DISPATCHER(IPTR
, CyclesP_Dispatcher
, cl
, obj
, msg
)
229 switch (msg
->MethodID
)
231 case OM_NEW
: return CyclesP_New(cl
, obj
, (struct opSet
*)msg
);
232 case MUIM_Settingsgroup_ConfigToGadgets
: return CyclesP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
233 case MUIM_Settingsgroup_GadgetsToConfig
: return CyclesP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
236 return DoSuperMethodA(cl
, obj
, msg
);
238 BOOPSI_DISPATCHER_END
243 const struct __MUIBuiltinClass _MUIP_Cycles_desc
= {
246 sizeof(struct MUI_CyclesPData
),
247 (void*)CyclesP_Dispatcher