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_SlidersPData
31 Object
*container_background_popimage
;
32 Object
*container_popframe
;
33 Object
*knob_background_popimage
;
34 Object
*knob_popframe
;
35 Object
*knob_font_string
;
39 static Object
*MakeSmallHorizSlider(void)
41 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 9);
42 set(obj
, MUIA_CycleChain
, 1);
43 set(obj
, MUIA_Numeric_Value
, 5);
47 static Object
*MakeBigHorizSlider(void)
49 Object
*obj
= MUI_MakeObject(MUIO_Slider
, (IPTR
)"", 0, 99);
50 set(obj
, MUIA_CycleChain
, 1);
51 set(obj
, MUIA_Numeric_Value
, 42);
55 static Object
*MakeSmallVertSlider(void)
58 MUIA_Slider_Horiz
, FALSE
,
62 MUIA_Numeric_Value
, 5,
66 static Object
*MakeBigVertSlider(void)
69 MUIA_Slider_Horiz
, FALSE
,
73 MUIA_Numeric_Value
, 42,
77 static IPTR
SlidersP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
79 struct MUI_SlidersPData
*data
;
80 struct MUI_SlidersPData d
;
82 obj
= (Object
*) DoSuperNewTags
86 MUIA_Group_Horiz
, FALSE
,
91 GroupFrameT(_(MSG_CONTAINER_DESIGN
)),
93 MUIA_Group_SameWidth
, TRUE
,
95 MUIA_Group_VertSpacing
, 1,
96 Child
, (IPTR
) (d
.container_background_popimage
= MakeBackgroundPopimage()),
97 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
100 MUIA_Group_VertSpacing
, 1,
101 Child
, (IPTR
) (d
.container_popframe
= MakePopframe()),
102 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
103 End
, /* VGroup Frame */
104 End
, /* HGroup Frame/BG */
105 End
, /* HGroup Container Design */
106 Child
, (IPTR
) VGroup
,
107 GroupFrameT(_(MSG_KNOB_DESIGN
)),
108 Child
, (IPTR
) HGroup
,
109 MUIA_Group_SameWidth
, TRUE
,
110 Child
, (IPTR
) VGroup
,
111 MUIA_Group_VertSpacing
, 1,
112 Child
, (IPTR
) (d
.knob_background_popimage
= MakeBackgroundPopimage()),
113 Child
, (IPTR
) CLabel(_(MSG_BACKGROUND
)),
115 Child
, (IPTR
) VGroup
,
116 MUIA_Group_VertSpacing
, 1,
117 Child
, (IPTR
) (d
.knob_popframe
= MakePopframe()),
118 Child
, (IPTR
) CLabel(_(MSG_FRAME
)),
119 End
, /* VGroup Frame */
120 End
, /* HGroup Frame/BG */
121 Child
, (IPTR
) HGroup
,
122 Child
, (IPTR
) Label2(_(MSG_FONT
)),
123 Child
, (IPTR
) (d
.knob_font_string
= MakePopfont(FALSE
)),
124 End
, /* HGroup font */
125 End
, /* VGroup Knob Design */
126 End
, /* HGroup Container/Knob design */
128 Child
, (IPTR
) VGroup
,
129 GroupFrameT(_(MSG_EXAMPLE_SLIDERS
)),
130 Child
, (IPTR
) VSpace(0),
131 Child
, (IPTR
) HGroup
,
132 Child
, (IPTR
) VGroup
,
133 Child
, (IPTR
) MakeSmallHorizSlider(),
134 Child
, (IPTR
) MakeBigHorizSlider(),
135 End
, /* VGroup horiz sliders */
136 Child
, (IPTR
) MakeSmallVertSlider(),
137 Child
, (IPTR
) MakeBigVertSlider(),
139 Child
, (IPTR
) HVSpace
,
140 End
, /* VGroup Slider examples */
142 TAG_MORE
, (IPTR
) msg
->ops_AttrList
145 if (!obj
) return FALSE
;
147 data
= INST_DATA(cl
, obj
);
155 * MUIM_Settingsgroup_ConfigToGadgets
157 static IPTR
SlidersP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
158 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
160 struct MUI_SlidersPData
*data
= INST_DATA(cl
, obj
);
164 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
165 MUICFG_Frame_Slider
);
166 set(data
->container_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
168 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
170 set(data
->knob_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
173 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
174 MUICFG_Background_Slider
);
175 set(data
->container_background_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
176 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
177 MUICFG_Background_SliderKnob
);
178 set(data
->knob_background_popimage
,MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
181 setstring(data
->knob_font_string
, (IPTR
)FindFont(MUICFG_Font_Knob
));
188 * MUIM_Settingsgroup_ConfigToGadgets
190 static IPTR
SlidersP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
191 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
193 struct MUI_SlidersPData
*data
= INST_DATA(cl
, obj
);
197 str
= getstring(data
->knob_font_string
);
198 DoMethod(msg
->configdata
, MUIM_Configdata_SetFont
, MUICFG_Font_Knob
, (IPTR
)str
);
201 str
= (STRPTR
)XGET(data
->container_background_popimage
,MUIA_Imagedisplay_Spec
);
202 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_Slider
,
205 str
= (STRPTR
)XGET(data
->knob_background_popimage
,MUIA_Imagedisplay_Spec
);
206 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_SliderKnob
,
210 str
= (STRPTR
)XGET(data
->container_popframe
, MUIA_Framedisplay_Spec
);
211 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_Slider
,
213 str
= (STRPTR
)XGET(data
->knob_popframe
, MUIA_Framedisplay_Spec
);
214 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_Knob
,
220 BOOPSI_DISPATCHER(IPTR
, SlidersP_Dispatcher
, cl
, obj
, msg
)
222 switch (msg
->MethodID
)
224 case OM_NEW
: return SlidersP_New(cl
, obj
, (struct opSet
*)msg
);
225 case MUIM_Settingsgroup_ConfigToGadgets
: return SlidersP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
226 case MUIM_Settingsgroup_GadgetsToConfig
: return SlidersP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
229 return DoSuperMethodA(cl
, obj
, msg
);
231 BOOPSI_DISPATCHER_END
236 const struct __MUIBuiltinClass _MUIP_Sliders_desc
= {
239 sizeof(struct MUI_SlidersPData
),
240 (void*)SlidersP_Dispatcher