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_SlidersPData
32 Object
*container_background_popimage
;
33 Object
*container_popframe
;
34 Object
*knob_background_popimage
;
35 Object
*knob_popframe
;
36 Object
*knob_font_string
;
40 static Object
*MakeSmallHorizSlider(void)
42 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 9);
43 set(obj
, MUIA_CycleChain
, 1);
44 set(obj
, MUIA_Numeric_Value
, 5);
48 static Object
*MakeBigHorizSlider(void)
50 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 99);
51 set(obj
, MUIA_CycleChain
, 1);
52 set(obj
, MUIA_Numeric_Value
, 42);
56 static Object
*MakeSmallVertSlider(void)
59 MUIA_Slider_Horiz
, FALSE
,
63 MUIA_Numeric_Value
, 5,
67 static Object
*MakeBigVertSlider(void)
70 MUIA_Slider_Horiz
, FALSE
,
74 MUIA_Numeric_Value
, 42,
78 static IPTR
SlidersP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
80 struct MUI_SlidersPData
*data
;
81 struct MUI_SlidersPData d
;
83 obj
= (Object
*) DoSuperNewTags
87 MUIA_Group_Horiz
, FALSE
,
92 GroupFrameT(_(MSG_CONTAINER_DESIGN
)),
94 MUIA_Group_SameWidth
, TRUE
,
96 MUIA_Group_VertSpacing
, 1,
97 Child
, (IPTR
) (d
.container_background_popimage
= MakeBackgroundPopimage()),
98 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
100 Child
, (IPTR
) VGroup
,
101 MUIA_Group_VertSpacing
, 1,
102 Child
, (IPTR
) (d
.container_popframe
= MakePopframe()),
103 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
104 End
, /* VGroup Frame */
105 End
, /* HGroup Frame/BG */
106 End
, /* HGroup Container Design */
107 Child
, (IPTR
) VGroup
,
108 GroupFrameT(_(MSG_KNOB_DESIGN
)),
109 Child
, (IPTR
) HGroup
,
110 MUIA_Group_SameWidth
, TRUE
,
111 Child
, (IPTR
) VGroup
,
112 MUIA_Group_VertSpacing
, 1,
113 Child
, (IPTR
) (d
.knob_background_popimage
= MakeBackgroundPopimage()),
114 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
116 Child
, (IPTR
) VGroup
,
117 MUIA_Group_VertSpacing
, 1,
118 Child
, (IPTR
) (d
.knob_popframe
= MakePopframe()),
119 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
120 End
, /* VGroup Frame */
121 End
, /* HGroup Frame/BG */
122 Child
, (IPTR
) HGroup
,
123 Child
, (IPTR
) Label2(_(MSG_FONT
)),
124 Child
, (IPTR
) (d
.knob_font_string
= MakePopfont(FALSE
)),
125 End
, /* HGroup font */
126 End
, /* VGroup Knob Design */
127 End
, /* HGroup Container/Knob design */
129 Child
, (IPTR
) VGroup
,
130 GroupFrameT(_(MSG_EXAMPLE_SLIDERS
)),
131 Child
, (IPTR
) VSpace(0),
132 Child
, (IPTR
) HGroup
,
133 Child
, (IPTR
) VGroup
,
134 Child
, (IPTR
) MakeSmallHorizSlider(),
135 Child
, (IPTR
) MakeBigHorizSlider(),
136 End
, /* VGroup horiz sliders */
137 Child
, (IPTR
) MakeSmallVertSlider(),
138 Child
, (IPTR
) MakeBigVertSlider(),
140 Child
, (IPTR
) HVSpace
,
141 End
, /* VGroup Slider examples */
143 TAG_MORE
, (IPTR
) msg
->ops_AttrList
146 if (!obj
) return FALSE
;
148 data
= INST_DATA(cl
, obj
);
156 * MUIM_Settingsgroup_ConfigToGadgets
158 static IPTR
SlidersP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
159 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
161 struct MUI_SlidersPData
*data
= INST_DATA(cl
, obj
);
165 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
166 MUICFG_Frame_Slider
);
167 set(data
->container_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
169 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
171 set(data
->knob_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
174 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
175 MUICFG_Background_Slider
);
176 set(data
->container_background_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
177 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
178 MUICFG_Background_SliderKnob
);
179 set(data
->knob_background_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
182 setstring(data
->knob_font_string
, (IPTR
)FindFont(MUICFG_Font_Knob
));
189 * MUIM_Settingsgroup_ConfigToGadgets
191 static IPTR
SlidersP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
192 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
194 struct MUI_SlidersPData
*data
= INST_DATA(cl
, obj
);
198 str
= getstring(data
->knob_font_string
);
199 DoMethod(msg
->configdata
, MUIM_Configdata_SetFont
, MUICFG_Font_Knob
, (IPTR
)str
);
202 str
= (STRPTR
)XGET(data
->container_background_popimage
,MUIA_Imagedisplay_Spec
);
203 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_Slider
,
206 str
= (STRPTR
)XGET(data
->knob_background_popimage
,MUIA_Imagedisplay_Spec
);
207 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_SliderKnob
,
211 str
= (STRPTR
)XGET(data
->container_popframe
, MUIA_Framedisplay_Spec
);
212 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_Slider
,
214 str
= (STRPTR
)XGET(data
->knob_popframe
, MUIA_Framedisplay_Spec
);
215 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_Knob
,
221 BOOPSI_DISPATCHER(IPTR
, SlidersP_Dispatcher
, cl
, obj
, msg
)
223 switch (msg
->MethodID
)
225 case OM_NEW
: return SlidersP_New(cl
, obj
, (struct opSet
*)msg
);
226 case MUIM_Settingsgroup_ConfigToGadgets
: return SlidersP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
227 case MUIM_Settingsgroup_GadgetsToConfig
: return SlidersP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
230 return DoSuperMethodA(cl
, obj
, msg
);
232 BOOPSI_DISPATCHER_END
237 const struct __MUIBuiltinClass _MUIP_Sliders_desc
= {
240 sizeof(struct MUI_SlidersPData
),
241 (void*)SlidersP_Dispatcher
245 static const UBYTE icon32
[] =
247 0x00, 0x00, 0x00, 0x18, // width
248 0x00, 0x00, 0x00, 0x13, // height
250 0x00, 0x00, 0x00, 0x73, // number of bytes
252 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x78, 0x5d,
253 0x6a, 0xd9, 0x00, 0x03, 0x1e, 0x61, 0x12, 0xa0, 0x00, 0x02, 0x00, 0x00,
254 0x04, 0x00, 0x01, 0x42, 0x40, 0x00, 0x00, 0xb0, 0x00, 0xb9, 0x21, 0x09,
255 0x53, 0x20, 0x43, 0x02, 0x02, 0x92, 0x8a, 0x1e, 0xa7, 0x82, 0xe1, 0xcd,
256 0xb3, 0x96, 0xd4, 0xba, 0x28, 0xd3, 0xba, 0x9b, 0x28, 0xf8, 0x15, 0xf8,
257 0x21, 0xe0, 0x87, 0x4a, 0x87, 0x67, 0xd5, 0x5b, 0x4d, 0xe5, 0x64, 0x92,
258 0x81, 0x80, 0x30, 0x94, 0x35, 0x65, 0x12, 0x25, 0xc4, 0xad, 0x6d, 0x65,
259 0xc4, 0x86, 0x9a, 0x1c, 0x4b, 0xac, 0x49, 0x4a, 0x11, 0x28, 0x9a, 0x1d,
260 0x22, 0x66, 0xdb, 0x55, 0x37, 0x45, 0x9d, 0x4f, 0xe2, 0xee, 0x48, 0xa7,
261 0x0a, 0x12, 0x0f, 0x0b, 0xad, 0x5b, 0x20,
265 Object
*slidersclass_get_icon(void)
267 return RawimageObject
,
268 MUIA_Rawimage_Data
, icon32
,