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 <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"
24 extern struct Library
*MUIMasterBase
;
26 struct MUI_ButtonsPData
28 Object
*text_font_string
;
29 Object
*text_background_popimage
;
30 Object
*text_selbackground_popimage
;
31 Object
*spacing_vert_slider
;
32 Object
*spacing_horiz_slider
;
33 Object
*radio_look_popimage
;
34 Object
*checkmark_look_popimage
;
35 Object
*button_popframe
;
36 Object
*imagebutton_popframe
;
39 static IPTR
ButtonsP_New(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
41 struct MUI_ButtonsPData
*data
;
42 struct MUI_ButtonsPData d
;
44 obj
= (Object
*) DoSuperNewTags
49 Child
, (IPTR
) VGroup
, /* Text Buttons */
51 Child
, (IPTR
) ColGroup(2),
52 GroupFrameT(_(MSG_GENERAL
)),
53 MUIA_Group_SameHeight
, TRUE
,
54 MUIA_Group_VertSpacing
, 1,
55 Child
, (IPTR
) FreeLabel(_(MSG_BACKGROUND_COLON
)),
56 Child
, (IPTR
) (d
.text_background_popimage
= MakeBackgroundPopimage()),
57 Child
, RectangleObject
, MUIA_MaxHeight
, 0, End
,
59 Child
, RectangleObject
, MUIA_MaxHeight
, 0, MUIA_FixWidth
, 28, End
,
60 Child
, RectangleObject
, MUIA_MaxHeight
, 0, End
,
62 Child
, (IPTR
) FreeLabel(_(MSG_BACKGROUND_PRESSED
)),
63 Child
, (IPTR
) (d
.text_selbackground_popimage
= MakeBackgroundPopimage()),
65 Child
, (IPTR
) ColGroup(2),
66 GroupFrameT(_(MSG_TEXT_BUTTONS
)),
67 MUIA_Group_VertSpacing
, 2,
68 Child
, (IPTR
) FreeLabel(_(MSG_FRAME_COLON
)),
69 Child
, (IPTR
) (d
.button_popframe
= MakePopframe()),
70 Child
, (IPTR
) Label(_(MSG_FONT
)),
71 Child
, (IPTR
) (d
.text_font_string
= MakePopfont(FALSE
)),
73 End
, /* Text Buttons */
74 Child
, (IPTR
) VGroup
, /* other buttons */
75 Child
, (IPTR
) HGroup
, /* Image Buttons */
76 GroupFrameT(_(MSG_IMAGE_BUTTONS
)),
78 Child
, (IPTR
) HSpace(0),
79 Child
, (IPTR
) FreeLabel(_(MSG_FRAME_COLON
)),
80 Child
, (IPTR
) (d
.imagebutton_popframe
= MUI_NewObject
85 MUIA_Window_Title
, (IPTR
) _(MSG_ADJUST_FRAME
),
88 Child
, (IPTR
) HSpace(0),
89 End
, /* Image Buttons */
90 Child
, (IPTR
) HGroup
, /* Checkmarks */
91 GroupFrameT(_(MSG_CHECKMARKS
)),
92 Child
, (IPTR
) HSpace(0),
93 Child
, (IPTR
) FreeLabel(_(MSG_LOOK_COLON
)),
94 Child
, (IPTR
) (d
.checkmark_look_popimage
= MUI_NewObject
97 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
101 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
102 MUIA_Imagedisplay_FreeVert
, FALSE
,
103 MUIA_Window_Title
, (IPTR
) _(MSG_CHECKMARK
),
106 Child
, (IPTR
) HSpace(0),
107 End
, /* Checkmarks */
108 Child
, (IPTR
) HGroup
, /* Radio Buttons */
109 GroupFrameT(_(MSG_RADIO_BUTTONS
)),
110 /* MUIA_Group_SameHeight, TRUE, */
112 Child
, (IPTR
) HSpace(0),
113 Child
, (IPTR
) VGroup
,
114 MUIA_Group_VertSpacing
, 1,
115 Child
, (IPTR
) (d
.radio_look_popimage
= MUI_NewObject
118 MUIA_Imageadjust_Type
, MUIV_Imageadjust_Type_Image
,
123 MUIA_Imagedisplay_FreeHoriz
, FALSE
,
124 MUIA_Imagedisplay_FreeVert
, FALSE
,
125 MUIA_Window_Title
, (IPTR
) _(MSG_RADIOBUTTON
),
128 Child
, (IPTR
) CLabel(_(MSG_LOOK
)),
130 Child
, (IPTR
) HSpace(4),
131 Child
, (IPTR
) ColGroup(2),
132 MUIA_Group_VertSpacing
, 1,
133 MUIA_Group_HorizSpacing
, 2,
134 Child
, (IPTR
) Label(_(MSG_H
)),
135 Child
, (IPTR
) (d
.spacing_horiz_slider
= MakeSpacingSlider()),
136 Child
, (IPTR
) Label(_(MSG_V
)),
137 Child
, (IPTR
) (d
.spacing_vert_slider
= MakeSpacingSlider()),
138 Child
, (IPTR
) HVSpace
,
139 Child
, (IPTR
) CLabel(_(MSG_SPACING
)),
141 Child
, (IPTR
) HSpace(0),
142 End
, /* Radio Buttons */
143 End
, /* other buttons */
145 TAG_MORE
, (IPTR
) msg
->ops_AttrList
148 if (!obj
) return FALSE
;
150 data
= INST_DATA(cl
, obj
);
157 static IPTR
ButtonsP_ConfigToGadgets(struct IClass
*cl
, Object
*obj
,
158 struct MUIP_Settingsgroup_ConfigToGadgets
*msg
)
160 struct MUI_ButtonsPData
*data
= INST_DATA(cl
, obj
);
164 setstring(data
->text_font_string
, (IPTR
)FindFont(MUICFG_Font_Button
));
167 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
168 MUICFG_Background_Button
);
169 set(data
->text_background_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
171 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
172 MUICFG_Background_Selected
);
173 set(data
->text_selbackground_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
176 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
177 MUICFG_Frame_Button
);
178 set(data
->button_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
179 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
180 MUICFG_Frame_ImageButton
);
181 set(data
->imagebutton_popframe
, MUIA_Framedisplay_Spec
, (IPTR
)spec
);
184 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
185 MUICFG_Image_RadioButton
);
186 set(data
->radio_look_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
188 spec
= (STRPTR
)DoMethod(msg
->configdata
, MUIM_Configdata_GetString
,
189 MUICFG_Image_CheckMark
);
190 set(data
->checkmark_look_popimage
, MUIA_Imagedisplay_Spec
, (IPTR
)spec
);
193 setslider(data
->spacing_horiz_slider
,
194 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
195 MUICFG_Radio_HSpacing
));
196 setslider(data
->spacing_vert_slider
,
197 DoMethod(msg
->configdata
, MUIM_Configdata_GetULong
,
198 MUICFG_Radio_VSpacing
));
203 static IPTR
ButtonsP_GadgetsToConfig(struct IClass
*cl
, Object
*obj
,
204 struct MUIP_Settingsgroup_GadgetsToConfig
*msg
)
206 struct MUI_ButtonsPData
*data
= INST_DATA(cl
, obj
);
210 str
= getstring(data
->text_font_string
);
211 DoMethod(msg
->configdata
, MUIM_Configdata_SetFont
, MUICFG_Font_Button
, (IPTR
)str
);
214 str
= (STRPTR
)XGET(data
->text_background_popimage
, MUIA_Imagedisplay_Spec
);
215 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_Button
,
218 str
= (STRPTR
)XGET(data
->text_selbackground_popimage
, MUIA_Imagedisplay_Spec
);
219 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Background_Selected
,
223 str
= (STRPTR
)XGET(data
->button_popframe
, MUIA_Framedisplay_Spec
);
224 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_Button
,
226 str
= (STRPTR
)XGET(data
->imagebutton_popframe
, MUIA_Framedisplay_Spec
);
227 DoMethod(msg
->configdata
, MUIM_Configdata_SetFramespec
, MUICFG_Frame_ImageButton
,
231 str
= (STRPTR
)XGET(data
->radio_look_popimage
, MUIA_Imagedisplay_Spec
);
232 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_RadioButton
,
235 str
= (STRPTR
)XGET(data
->checkmark_look_popimage
, MUIA_Imagedisplay_Spec
);
236 DoMethod(msg
->configdata
, MUIM_Configdata_SetImspec
, MUICFG_Image_CheckMark
,
240 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Radio_HSpacing
,
241 XGET(data
->spacing_horiz_slider
, MUIA_Numeric_Value
));
242 DoMethod(msg
->configdata
, MUIM_Configdata_SetULong
, MUICFG_Radio_VSpacing
,
243 XGET(data
->spacing_vert_slider
, MUIA_Numeric_Value
));
249 BOOPSI_DISPATCHER(IPTR
, ButtonsP_Dispatcher
, cl
, obj
, msg
)
251 switch (msg
->MethodID
)
253 case OM_NEW
: return ButtonsP_New(cl
, obj
, (struct opSet
*)msg
);
254 case MUIM_Settingsgroup_ConfigToGadgets
: return ButtonsP_ConfigToGadgets(cl
,obj
,(APTR
)msg
);break;
255 case MUIM_Settingsgroup_GadgetsToConfig
: return ButtonsP_GadgetsToConfig(cl
,obj
,(APTR
)msg
);break;
258 return DoSuperMethodA(cl
, obj
, msg
);
260 BOOPSI_DISPATCHER_END
265 const struct __MUIBuiltinClass _MUIP_Buttons_desc
= {
268 sizeof(struct MUI_ButtonsPData
),
269 (void*)ButtonsP_Dispatcher