2 Copyright © 2002-2006, The AROS Development Team. All rights reserved.
7 #include <graphics/gfx.h>
8 #include <graphics/view.h>
9 #include <clib/alib_protos.h>
10 #include <libraries/asl.h>
11 #include <libraries/mui.h>
12 #include <mui/Rawimage_mcc.h>
13 #include <proto/exec.h>
14 #include <proto/graphics.h>
15 #include <proto/utility.h>
16 #include <proto/intuition.h>
17 #include <proto/muimaster.h>
20 #include <proto/alib.h>
23 #include "zunestuff.h"
25 extern struct Library
*MUIMasterBase
;
27 struct MUI_ButtonsPData
29 Object
*text_font_string
;
30 Object
*text_background_popimage
;
31 Object
*text_selbackground_popimage
;
32 Object
*spacing_vert_slider
;
33 Object
*spacing_horiz_slider
;
34 Object
*radio_look_popimage
;
35 Object
*checkmark_look_popimage
;
36 Object
*button_popframe
;
37 Object
*imagebutton_popframe
;
40 static IPTR
ButtonsP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
42 struct MUI_ButtonsPData
*data
;
43 struct MUI_ButtonsPData d
;
45 obj
= (Object
*) DoSuperNewTags
50 Child
, (IPTR
) VGroup
, /* Text Buttons */
52 Child
, (IPTR
) ColGroup(2),
53 GroupFrameT(_(MSG_GENERAL
)),
54 MUIA_Group_SameHeight
, TRUE
,
55 MUIA_Group_VertSpacing
, 1,
56 Child
, (IPTR
) FreeLabel(_(MSG_BACKGROUND_COLON
)),
57 Child
, (IPTR
) (d
.text_background_popimage
= MakeBackgroundPopimage()),
58 Child
, RectangleObject
, MUIA_MaxHeight
, 0, End
,
60 Child
, RectangleObject
, MUIA_MaxHeight
, 0, MUIA_FixWidth
, 28, End
,
61 Child
, RectangleObject
, MUIA_MaxHeight
, 0, End
,
63 Child
, (IPTR
) FreeLabel(_(MSG_BACKGROUND_PRESSED
)),
64 Child
, (IPTR
) (d
.text_selbackground_popimage
= MakeBackgroundPopimage()),
66 Child
, (IPTR
) ColGroup(2),
67 GroupFrameT(_(MSG_TEXT_BUTTONS
)),
68 MUIA_Group_VertSpacing
, 2,
69 Child
, (IPTR
) FreeLabel(_(MSG_FRAME_COLON
)),
70 Child
, (IPTR
) (d
.button_popframe
= MakePopframe()),
71 Child
, (IPTR
) Label(_(MSG_FONT
)),
72 Child
, (IPTR
) (d
.text_font_string
= MakePopfont(FALSE
)),
74 End
, /* Text Buttons */
75 Child
, (IPTR
) VGroup
, /* other buttons */
76 Child
, (IPTR
) HGroup
, /* Image Buttons */
77 GroupFrameT(_(MSG_IMAGE_BUTTONS
)),
79 Child
, (IPTR
) HSpace(0),
80 Child
, (IPTR
) FreeLabel(_(MSG_FRAME_COLON
)),
81 Child
, (IPTR
) (d
.imagebutton_popframe
= MUI_NewObject
86 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_FRAME
),
89 Child
, (IPTR
) HSpace(0),
90 End
, /* Image Buttons */
91 Child
, (IPTR
) HGroup
, /* Checkmarks */
92 GroupFrameT(_(MSG_CHECKMARKS
)),
93 Child
, (IPTR
) HSpace(0),
94 Child
, (IPTR
) FreeLabel(_(MSG_LOOK_COLON
)),
95 Child
, (IPTR
) (d
.checkmark_look_popimage
= MUI_NewObject
98 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
102 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
103 MUIA_Imagedisplay_FreeVert
, FALSE
,
104 MUIA_Window_Title
, (IPTR
) _(MSG_CHECKMARK
),
107 Child
, (IPTR
) HSpace(0),
108 End
, /* Checkmarks */
109 Child
, (IPTR
) HGroup
, /* Radio Buttons */
110 GroupFrameT(_(MSG_RADIO_BUTTONS
)),
111 /* MUIA_Group_SameHeight, TRUE, */
113 Child
, (IPTR
) HSpace(0),
114 Child
, (IPTR
) VGroup
,
115 MUIA_Group_VertSpacing
, 1,
116 Child
, (IPTR
) (d
.radio_look_popimage
= MUI_NewObject
119 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
124 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
125 MUIA_Imagedisplay_FreeVert
, FALSE
,
126 MUIA_Window_Title
, (IPTR
) _(MSG_RADIOBUTTON
),
129 Child
, (IPTR
) CLabel(_(MSG_LOOK
)),
131 Child
, (IPTR
) HSpace(4),
132 Child
, (IPTR
) ColGroup(2),
133 MUIA_Group_VertSpacing
, 1,
134 MUIA_Group_HorizSpacing
, 2,
135 Child
, (IPTR
) Label(_(MSG_H
)),
136 Child
, (IPTR
) (d
.spacing_horiz_slider
= MakeSpacingSlider()),
137 Child
, (IPTR
) Label(_(MSG_V
)),
138 Child
, (IPTR
) (d
.spacing_vert_slider
= MakeSpacingSlider()),
139 Child
, (IPTR
) HVSpace
,
140 Child
, (IPTR
) CLabel(_(MSG_SPACING
)),
142 Child
, (IPTR
) HSpace(0),
143 End
, /* Radio Buttons */
144 End
, /* other buttons */
146 TAG_MORE
, (IPTR
) msg
->ops_AttrList
149 if (!obj
) return FALSE
;
151 data
= INST_DATA(cl
, obj
);
158 static IPTR
ButtonsP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
159 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
161 struct MUI_ButtonsPData
*data
= INST_DATA(cl
, obj
);
165 setstring(data
->text_font_string
, (IPTR
)FindFont(MUICFG_Font_Button
));
168 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
169 MUICFG_Background_Button
);
170 set(data
->text_background_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
172 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
173 MUICFG_Background_Selected
);
174 set(data
->text_selbackground_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
177 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
178 MUICFG_Frame_Button
);
179 set(data
->button_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
180 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
181 MUICFG_Frame_ImageButton
);
182 set(data
->imagebutton_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
185 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
186 MUICFG_Image_RadioButton
);
187 set(data
->radio_look_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
189 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
190 MUICFG_Image_CheckMark
);
191 set(data
->checkmark_look_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
194 setslider(data
->spacing_horiz_slider
,
195 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
196 MUICFG_Radio_HSpacing
));
197 setslider(data
->spacing_vert_slider
,
198 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
199 MUICFG_Radio_VSpacing
));
204 static IPTR
ButtonsP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
205 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
207 struct MUI_ButtonsPData
*data
= INST_DATA(cl
, obj
);
211 str
= getstring(data
->text_font_string
);
212 DoMethod(msg
->configdata
, MUIM_Configdata_SetFont
, MUICFG_Font_Button
, (IPTR
)str
);
215 str
= (STRPTR
)XGET(data
->text_background_popimage
, MUIA_Imagedisplay_Spec
);
216 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_Button
,
219 str
= (STRPTR
)XGET(data
->text_selbackground_popimage
, MUIA_Imagedisplay_Spec
);
220 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_Selected
,
224 str
= (STRPTR
)XGET(data
->button_popframe
, MUIA_Framedisplay_Spec
);
225 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_Button
,
227 str
= (STRPTR
)XGET(data
->imagebutton_popframe
, MUIA_Framedisplay_Spec
);
228 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_ImageButton
,
232 str
= (STRPTR
)XGET(data
->radio_look_popimage
, MUIA_Imagedisplay_Spec
);
233 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_RadioButton
,
236 str
= (STRPTR
)XGET(data
->checkmark_look_popimage
, MUIA_Imagedisplay_Spec
);
237 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_CheckMark
,
241 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Radio_HSpacing
,
242 XGET(data
->spacing_horiz_slider
, MUIA_Numeric_Value
));
243 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Radio_VSpacing
,
244 XGET(data
->spacing_vert_slider
, MUIA_Numeric_Value
));
250 BOOPSI_DISPATCHER(IPTR
, ButtonsP_Dispatcher
, cl
, obj
, msg
)
252 switch (msg
->MethodID
)
254 case OM_NEW
: return ButtonsP_New(cl
, obj
, (struct opSet
*)msg
);
255 case MUIM_Settingsgroup_ConfigToGadgets
: return ButtonsP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
256 case MUIM_Settingsgroup_GadgetsToConfig
: return ButtonsP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
259 return DoSuperMethodA(cl
, obj
, msg
);
261 BOOPSI_DISPATCHER_END
266 const struct __MUIBuiltinClass _MUIP_Buttons_desc
= {
269 sizeof(struct MUI_ButtonsPData
),
270 (void*)ButtonsP_Dispatcher
274 static unsigned char default_icon
[] =
276 0x00, 0x00, 0x00, 0x18, // width
277 0x00, 0x00, 0x00, 0x14, // height
279 0x00, 0x00, 0x00, 0x8d, // number of bytes
281 0x42, 0x5a, 0x68, 0x39, 0x31, 0x41, 0x59, 0x26, 0x53, 0x59, 0x1c, 0x54,
282 0x2a, 0x61, 0x00, 0x01, 0xa3, 0xfc, 0x07, 0xa2, 0x23, 0x22, 0x22, 0x62,
283 0x22, 0x22, 0x02, 0x22, 0x50, 0x00, 0x10, 0x20, 0x08, 0x00, 0x00, 0x80,
284 0x00, 0xa0, 0x00, 0x91, 0x0c, 0xd4, 0x93, 0x41, 0xa3, 0x40, 0x00, 0x11,
285 0x29, 0x4c, 0x8d, 0x34, 0x68, 0xda, 0x86, 0x8f, 0x6a, 0x94, 0x3c, 0x00,
286 0x84, 0x13, 0xe8, 0x0a, 0x44, 0x30, 0xa8, 0x91, 0xdc, 0xf3, 0xa7, 0x4d,
287 0x33, 0x38, 0xf7, 0x6f, 0x90, 0xbd, 0xef, 0x7c, 0x85, 0x03, 0x00, 0x21,
288 0x80, 0x14, 0xcf, 0x92, 0xa0, 0x52, 0xa2, 0x40, 0x2a, 0x56, 0x58, 0xd6,
289 0xda, 0xeb, 0xe3, 0x6a, 0xeb, 0xa4, 0x1f, 0xd7, 0xb2, 0x22, 0x6e, 0x52,
290 0xa4, 0x88, 0x0d, 0x2a, 0x05, 0x81, 0xb4, 0x64, 0x46, 0x09, 0xa6, 0xa4,
291 0x92, 0x6c, 0x80, 0x00, 0x01, 0x4a, 0x20, 0x04, 0x20, 0x00, 0x3f, 0x17,
292 0x72, 0x45, 0x38, 0x50, 0x90, 0x1c, 0x54, 0x2a, 0x61,
296 Object
*buttonsclass_get_icon(void)
298 return RawimageObject
,
299 MUIA_Rawimage_Data
, default_icon
,