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, 0x14, // height
257 0x00, 0x00, 0x00, 0x8d, // number of bytes
259 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x1c, 0x54,
260 0x2a, 0x61, 0x00, 0x01, 0xa3, 0xfc, 0x07, 0xa2, 0x23, 0x22, 0x22, 0x62,
261 0x22, 0x22, 0x02, 0x22, 0x50, 0x00, 0x10, 0x20, 0x08, 0x00, 0x00, 0x80,
262 0x00, 0xa0, 0x00, 0x91, 0x0c, 0xd4, 0x93, 0x41, 0xa3, 0x40, 0x00, 0x11,
263 0x29, 0x4c, 0x8d, 0x34, 0x68, 0xda, 0x86, 0x8f, 0x6a, 0x94, 0x3c, 0x00,
264 0x84, 0x13, 0xe8, 0x0a, 0x44, 0x30, 0xa8, 0x91, 0xdc, 0xf3, 0xa7, 0x4d,
265 0x33, 0x38, 0xf7, 0x6f, 0x90, 0xbd, 0xef, 0x7c, 0x85, 0x03, 0x00, 0x21,
266 0x80, 0x14, 0xcf, 0x92, 0xa0, 0x52, 0xa2, 0x40, 0x2a, 0x56, 0x58, 0xd6,
267 0xda, 0xeb, 0xe3, 0x6a, 0xeb, 0xa4, 0x1f, 0xd7, 0xb2, 0x22, 0x6e, 0x52,
268 0xa4, 0x88, 0x0d, 0x2a, 0x05, 0x81, 0xb4, 0x64, 0x46, 0x09, 0xa6, 0xa4,
269 0x92, 0x6c, 0x80, 0x00, 0x01, 0x4a, 0x20, 0x04, 0x20, 0x00, 0x3f, 0x17,
270 0x72, 0x45, 0x38, 0x50, 0x90, 0x1c, 0x54, 0x2a, 0x61,
274 Object
*cyclesclass_get_icon(void)
276 return RawimageObject
,
277 MUIA_Rawimage_Data
, default_icon
,