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 <mui/Rawimage_mcc.h>
12 #include <proto/exec.h>
13 #include <proto/graphics.h>
14 #include <proto/utility.h>
15 #include <proto/intuition.h>
16 #include <proto/muimaster.h>
19 #include <proto/alib.h>
22 #include "zunestuff.h"
26 /* #include <aros/debug.h> */
28 extern struct Library
*MUIMasterBase
;
30 struct MUI_CyclesPData
32 Object
*cycle_popimage
;
33 Object
*menu_position_cycle
;
34 Object
*menu_level_slider
;
35 Object
*menu_speed_slider
;
36 Object
*menu_popframe
;
37 Object
*background_menu_popimage
;
38 Object
*recessed_entries_checkmark
;
41 static CONST_STRPTR positions_labels
[3];
43 static Object
*MakeLevelSlider (void)
45 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 2, 20);
46 set(obj
, MUIA_CycleChain
, 1);
51 static Object
*MakeSpeedSlider (void)
53 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 50);
54 set(obj
, MUIA_CycleChain
, 1);
59 static IPTR
CyclesP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
61 struct MUI_CyclesPData
*data
;
62 struct MUI_CyclesPData d
;
64 positions_labels
[0] = _(MSG_BELOW
);
65 positions_labels
[1] = _(MSG_ON_ACTIVE
);
67 obj
= (Object
*) DoSuperNewTags
71 MUIA_Group_Horiz
, FALSE
,
73 GroupFrameT(_(MSG_CYCLE_GADGET_DESIGN
)),
74 Child
, (IPTR
) HVSpace
,
75 Child
, (IPTR
) (d
.cycle_popimage
=
79 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
83 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
84 MUIA_Imagedisplay_FreeVert
, FALSE
,
85 MUIA_Window_Title
, (IPTR
) _(MSG_CYCLE
),
88 Child
, (IPTR
) HVSpace
,
89 End
, /* Cycle Gadget Design */
92 GroupFrameT(_(MSG_POPUP_MENU_CONTROL
)),
93 Child
, (IPTR
) VSpace(0),
94 Child
, (IPTR
) ColGroup(2),
95 MUIA_Group_VertSpacing
, 2,
96 Child
, (IPTR
) Label(_(MSG_POSITION
)),
97 Child
, (IPTR
) (d
.menu_position_cycle
= MakeCycle(_(MSG_POSITION
), positions_labels
)),
98 Child
, (IPTR
) Label(_(MSG_LEVEL
)),
99 Child
, (IPTR
) (d
.menu_level_slider
= MakeLevelSlider()),
100 Child
, (IPTR
) Label(_(MSG_SPEED
)),
101 Child
, (IPTR
) (d
.menu_speed_slider
= MakeSpeedSlider()),
103 Child
, (IPTR
) VSpace(0),
104 End
, /* Popup Menu Control */
105 Child
, (IPTR
) VGroup
,
106 MUIA_Group_VertSpacing
, 2,
107 GroupFrameT(_(MSG_POPUP_MENU_DESIGN
)),
108 Child
, (IPTR
) HGroup
,
109 MUIA_Group_SameWidth
, TRUE
,
110 Child
, (IPTR
) VGroup
,
111 MUIA_Group_VertSpacing
, 1,
112 Child
, (IPTR
) (d
.menu_popframe
= MakePopframe()),
113 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
115 Child
, (IPTR
) VGroup
,
116 MUIA_Group_VertSpacing
, 1,
117 Child
, (IPTR
) (d
.background_menu_popimage
= MUI_NewObject
121 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_BACKGROUND
),
124 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
127 Child
, (IPTR
) HGroup
,
128 Child
, (IPTR
) HSpace(0),
129 Child
, (IPTR
) Label1(_(MSG_RECESSED_ENTRIES
)),
130 Child
, (IPTR
) (d
.recessed_entries_checkmark
= MakeCheck(NULL
)),
131 End
, /* HGroup recessed CM */
132 End
, /* Popup Menu Design */
133 End
, /* HGroup Popup Menu */
135 TAG_MORE
, (IPTR
) msg
->ops_AttrList
138 if (!obj
) return FALSE
;
140 data
= INST_DATA(cl
, obj
);
142 set(data
->menu_position_cycle
, MUIA_CycleChain
, 1);
149 * MUIM_Settingsgroup_ConfigToGadgets
151 static IPTR
CyclesP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
152 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
154 struct MUI_CyclesPData
*data
= INST_DATA(cl
, obj
);
158 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
160 set(data
->menu_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
164 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
165 MUICFG_Background_PopUp
);
166 set(data
->background_menu_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
167 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
169 set(data
->cycle_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
172 setslider(data
->menu_level_slider
,
173 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
174 MUICFG_Cycle_MenuCtrl_Level
));
175 setslider(data
->menu_speed_slider
,
176 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
177 MUICFG_Cycle_MenuCtrl_Speed
));
179 setcheckmark(data
->recessed_entries_checkmark
,
180 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
181 MUICFG_Cycle_Menu_Recessed
));
184 setcycle(data
->menu_position_cycle
,
185 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
186 MUICFG_Cycle_MenuCtrl_Position
));
193 * MUIM_Settingsgroup_ConfigToGadgets
195 static IPTR
CyclesP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
196 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
198 struct MUI_CyclesPData
*data
= INST_DATA(cl
, obj
);
202 str
= (STRPTR
)XGET(data
->menu_popframe
, MUIA_Framedisplay_Spec
);
203 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_PopUp
,
206 str
= (STRPTR
)XGET(data
->background_menu_popimage
, MUIA_Imagedisplay_Spec
);
207 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_PopUp
,
209 str
= (STRPTR
)XGET(data
->cycle_popimage
, MUIA_Imagedisplay_Spec
);
210 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_Cycle
,
213 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_MenuCtrl_Level
,
214 XGET(data
->menu_level_slider
, MUIA_Numeric_Value
));
215 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_MenuCtrl_Speed
,
216 XGET(data
->menu_speed_slider
, MUIA_Numeric_Value
));
218 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_Menu_Recessed
,
219 XGET(data
->recessed_entries_checkmark
, MUIA_Selected
));
221 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Cycle_MenuCtrl_Position
,
222 XGET(data
->menu_position_cycle
, MUIA_Cycle_Active
));
228 BOOPSI_DISPATCHER(IPTR
, CyclesP_Dispatcher
, cl
, obj
, msg
)
230 switch (msg
->MethodID
)
232 case OM_NEW
: return CyclesP_New(cl
, obj
, (struct opSet
*)msg
);
233 case MUIM_Settingsgroup_ConfigToGadgets
: return CyclesP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
234 case MUIM_Settingsgroup_GadgetsToConfig
: return CyclesP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
237 return DoSuperMethodA(cl
, obj
, msg
);
239 BOOPSI_DISPATCHER_END
244 const struct __MUIBuiltinClass _MUIP_Cycles_desc
= {
247 sizeof(struct MUI_CyclesPData
),
248 (void*)CyclesP_Dispatcher
252 static unsigned char default_icon
[] =
254 0x00, 0x00, 0x00, 0x18, // width
255 0x00, 0x00, 0x00, 0x13, // height
257 0x00, 0x00, 0x00, 0x79, // number of bytes
259 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x3c, 0xe9,
260 0xa9, 0x76, 0x00, 0x03, 0x24, 0x51, 0x12, 0xa2, 0x22, 0x00, 0x02, 0x20,
261 0x00, 0x00, 0x01, 0x42, 0x40, 0x00, 0x00, 0xb0, 0x00, 0xb8, 0x08, 0x06,
262 0x9a, 0x68, 0x20, 0x1a, 0x69, 0xa0, 0x42, 0x54, 0xd2, 0x0c, 0xf0, 0x12,
263 0x90, 0x6e, 0x4e, 0xb9, 0x3c, 0xb9, 0xce, 0x47, 0x72, 0x3c, 0x83, 0xe0,
264 0x20, 0x10, 0x81, 0xf4, 0x10, 0x3f, 0xa2, 0xa8, 0x78, 0x8a, 0xa1, 0xd0,
265 0xa8, 0x27, 0x9d, 0x8d, 0x29, 0x49, 0x49, 0x50, 0xd1, 0xdc, 0x32, 0xed,
266 0x9a, 0x35, 0x34, 0x05, 0x36, 0x17, 0x48, 0xb8, 0x87, 0x59, 0x95, 0x1a,
267 0x50, 0xa9, 0x21, 0xd3, 0xa7, 0x42, 0x9a, 0xaa, 0x54, 0x02, 0xe8, 0x40,
268 0xe9, 0x03, 0xd1, 0x77, 0x24, 0x53, 0x85, 0x09, 0x03, 0xce, 0x9a, 0x97,
273 Object
*cyclesclass_get_icon(void)
275 return RawimageObject
,
276 MUIA_Rawimage_Data
, default_icon
,