2 #include <proto/exec.h>
4 #include <proto/muimaster.h>
5 #include <proto/intuition.h>
6 #include <clib/alib_protos.h>
7 #include <mui/TheBar_mcc.h>
11 #include "SDI_compiler.h"
13 /***********************************************************************/
16 #if defined(__amigaos4__)
17 struct Library
*IntuitionBase
;
18 struct Library
*MUIMasterBase
;
19 struct IntuitionIFace
*IIntuition
;
20 struct MUIMasterIFace
*IMUIMaster
;
22 struct IntuitionBase
*IntuitionBase
;
23 struct Library
*MUIMasterBase
;
26 /***********************************************************************/
29 #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
32 /***********************************************************************/
34 #if defined(__amigaos4__)
35 #define CLOSELIB(lib, iface) { if((iface) && (lib)) { DropInterface((APTR)(iface)); iface = NULL; CloseLibrary((struct Library *)lib); lib = NULL; } }
36 #define GETINTERFACE(iname, iface, base) ((iface) = (APTR)GetInterface((struct Library *)(base), (iname), 1L, NULL))
37 #define DROPINTERFACE(iface) { DropInterface((APTR)(iface)); iface = NULL; }
39 #define CLOSELIB(lib, iface) { if((lib)) { CloseLibrary((struct Library *)lib); lib = NULL; } }
40 #define GETINTERFACE(iname, iface, base) TRUE
41 #define DROPINTERFACE(iface) ((void)0)
44 /***********************************************************************/
58 const char * spics
[] =
70 const char * dpics
[] =
82 struct MUIS_TheBar_Button buttons
[] =
84 {0, 0, "_Get", "Get the disc.", 0, 0, NULL
, NULL
},
85 {1, 1, "Sa_ve", "Save the disc.", 0, 0, NULL
, NULL
},
86 {2, 2, "_Stop", "Stop the connection.", 0, 0, NULL
, NULL
},
87 {MUIV_TheBar_BarSpacer
,-1, NULL
, NULL
, 0, 0, NULL
, NULL
},
88 {3, 3, "_Disc", "Disc page.", 0, 0, NULL
, NULL
},
89 {MUIV_TheBar_ButtonSpacer
,-1, NULL
, NULL
, 0, 0, NULL
, NULL
},
90 {0, 4, "_Stop2", "Stop2 the connection.", 0, 0, NULL
, NULL
},
91 {4, 5, "_Matches", "Matches page.", MUIV_TheBar_ButtonFlag_Immediate
|MUIV_TheBar_ButtonFlag_Selected
, 1<<6, NULL
, NULL
},
92 {MUIV_TheBar_ImageSpacer
,-1, NULL
, NULL
, 0, 0, NULL
, NULL
},
93 {5, 6, "_Edit", "Edit page.", MUIV_TheBar_ButtonFlag_Immediate
, 1<<5, NULL
, NULL
},
94 {MUIV_TheBar_End
, 0, NULL
, NULL
, 0, 0, NULL
, NULL
},
97 const char *rowss
[] = {"0","1","2","3","6",NULL
};
98 const char *colss
[] = {"0","1","2","3","4","5","6",NULL
};
99 const char *viewModes
[] = {"Images and text","Images","Text",NULL
};
100 const char *buttonsPoss
[] = {"Left","Center","Right",NULL
};
101 const char *labelPoss
[] = {"Bottom","Top","Right","Left",NULL
};
103 const char *usedClasses
[] = {"TheBar.mcc",NULL
};
106 main(UNUSED
int argc
,char **argv
)
110 if ((IntuitionBase
= (APTR
)OpenLibrary("intuition.library",39)) != NULL
&&
111 GETINTERFACE("main", IIntuition
, IntuitionBase
))
113 if ((MUIMasterBase
= OpenLibrary("muimaster.library",19)) != NULL
&&
114 GETINTERFACE("main", IMUIMaster
, MUIMasterBase
))
116 Object
*app
, *win
, *mg
, *sb
, *viewMode
, *buttonsPos
, *labelPos
, *borderless
, *sunny
,
117 *raised
, *scaled
, *keys
, *bspacer
, *fixed
, *free
, *update
, *rows
, *cols
, *s4
, *h0
,
120 if ((app
= ApplicationObject
,
121 MUIA_Application_Title
, "TheBar Demo3",
122 MUIA_Application_Version
, "$VER: TheBarDemo3 1.0 (24.6.2003)",
123 MUIA_Application_Copyright
, "Copyright 2003 by Alfonso Ranieri",
124 MUIA_Application_Author
, "Alfonso Ranieri <alforan@tin.it>",
125 MUIA_Application_Description
, "TheBar example",
126 MUIA_Application_Base
, "THEBAREXAMPLE",
127 MUIA_Application_UsedClasses
, usedClasses
,
129 SubWindow
, win
= WindowObject
,
130 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
131 MUIA_Window_Title
, "TheBar Demo3",
133 WindowContents
, mg
= VGroup
,
135 Child
, sb
= TheBarObject
,
136 MUIA_Group_Horiz
, TRUE
,
137 MUIA_TheBar_IgnoreAppearance
, TRUE
,
138 MUIA_TheBar_ViewMode
, MUIV_TheBar_ViewMode_Gfx
,
139 MUIA_TheBar_Buttons
, buttons
,
140 MUIA_TheBar_PicsDrawer
, "PROGDIR:Pics",
141 MUIA_TheBar_Pics
, pics
,
142 MUIA_TheBar_SelPics
, spics
,
143 MUIA_TheBar_DisPics
, dpics
,
147 GroupFrameT("Appearance"),
149 Child
, Label2("Rows"),
151 Child
, rows
= MUI_MakeObject(MUIO_Radio
,NULL
,rowss
),
154 Child
, Label2("Columns"),
156 Child
, cols
= MUI_MakeObject(MUIO_Radio
,NULL
,colss
),
159 Child
, Label2("ViewMode"),
160 Child
, viewMode
= MUI_MakeObject(MUIO_Cycle
,NULL
,viewModes
),
161 Child
, Label2("Buttons position"),
162 Child
, buttonsPos
= MUI_MakeObject(MUIO_Cycle
,NULL
,buttonsPoss
),
163 Child
, Label2("Label position"),
164 Child
, labelPos
= MUI_MakeObject(MUIO_Cycle
,NULL
,labelPoss
),
166 Child
, ScrollgroupObject
,
167 MUIA_Scrollgroup_FreeHoriz
, FALSE
,
168 MUIA_Scrollgroup_Contents
, VirtgroupObject
,
169 MUIA_Frame
, MUIV_Frame_Virtual
,
172 Child
, borderless
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
173 Child
, LLabel1("Borderless"),
174 Child
, sunny
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
175 Child
, LLabel1("Sunny"),
176 Child
, raised
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
177 Child
, LLabel1("Raised"),
178 Child
, scaled
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
179 Child
, LLabel1("Scaled"),
180 Child
, keys
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
181 Child
, LLabel1("Enable keys"),
182 Child
, bspacer
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
183 Child
, LLabel1("Bar spacer"),
184 Child
, fixed
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
185 Child
, LLabel("Fixed"),
186 Child
, free
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
187 Child
, LLabel("Disable 0"),
188 Child
, h0
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
189 Child
, LLabel("Hide 0"),
190 Child
, s4
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
191 Child
, LLabel("Sleep 4"),
192 Child
, RectangleObject
, MUIA_FixHeightTxt
,"a",End
,
193 Child
, RectangleObject
, MUIA_FixHeightTxt
,"a",End
,
194 Child
, rb
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
195 Child
, LLabel("Remove Bars"),
196 Child
, rs
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
197 Child
, LLabel("Remove Spaces"),
198 Child
, ri
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
199 Child
, LLabel("Remove Images"),
206 Child
, update
= MUI_MakeObject(MUIO_Button
,"_Update"),
215 set(rows
,MUIA_Group_Horiz
,TRUE
);
216 set(cols
,MUIA_Group_Horiz
,TRUE
);
217 set(viewMode
,MUIA_Cycle_Active
,1);
218 set(s4
,MUIA_Selected
,TRUE
);
219 DoMethod(sb
,MUIM_TheBar_SetAttr
,4,MUIA_TheBar_Attr_Sleep
,TRUE
);
221 DoMethod(win
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,MUIV_Notify_Application
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
222 DoMethod(update
,MUIM_Notify
,MUIA_Pressed
,FALSE
,app
,2,MUIM_Application_ReturnID
,TAG_USER
);
224 set(win
,MUIA_Window_Open
,TRUE
);
226 while ((id
= DoMethod(app
,MUIM_Application_NewInput
,&sigs
))!=MUIV_Application_ReturnID_Quit
)
228 if (id
==(LONG
)TAG_USER
)
250 get(rows
,MUIA_Radio_Active
,&r
);
252 get(cols
,MUIA_Radio_Active
,&c
);
254 get(viewMode
,MUIA_Cycle_Active
,&vm
);
255 get(buttonsPos
,MUIA_Cycle_Active
,&bp
);
256 get(labelPos
,MUIA_Cycle_Active
,&lp
);
258 get(borderless
,MUIA_Selected
,&br
);
259 get(sunny
,MUIA_Selected
,&su
);
260 get(raised
,MUIA_Selected
,&ra
);
261 get(scaled
,MUIA_Selected
,&sc
);
262 get(keys
,MUIA_Selected
,&k
);
263 get(bspacer
,MUIA_Selected
,&bs
);
264 get(fixed
,MUIA_Selected
,&fi
);
265 get(free
,MUIA_Selected
,&fr
);
267 get(h0
,MUIA_Selected
,&hl0
);
268 get(s4
,MUIA_Selected
,&sl4
);
270 get(rb
,MUIA_Selected
,&rbl
);
271 get(rs
,MUIA_Selected
,&rsl
);
272 get(ri
,MUIA_Selected
,&ril
);
274 if (rbl
) rem
|= MUIV_TheBar_RemoveSpacers_Bar
;
275 if (rsl
) rem
|= MUIV_TheBar_RemoveSpacers_Button
;
276 if (ril
) rem
|= MUIV_TheBar_RemoveSpacers_Image
;
278 DoMethod(mg
,MUIM_Group_InitChange
);
279 DoMethod(sb
,MUIM_Group_InitChange
);
281 SetAttrs(sb
,MUIA_TheBar_Columns
, c
,
283 MUIA_TheBar_ViewMode
, vm
,
284 MUIA_TheBar_Borderless
, br
,
285 MUIA_TheBar_Sunny
, su
,
286 MUIA_TheBar_Raised
, ra
,
287 MUIA_TheBar_Scaled
, sc
,
288 MUIA_TheBar_EnableKeys
, k
,
289 MUIA_TheBar_BarSpacer
, bs
,
290 MUIA_TheBar_RemoveSpacers
,rem
,
291 MUIA_TheBar_LabelPos
, lp
,
294 DoMethod(sb
,MUIM_TheBar_SetAttr
,0,MUIA_TheBar_Attr_Hide
,hl0
);
295 DoMethod(sb
,MUIM_TheBar_SetAttr
,4,MUIA_TheBar_Attr_Sleep
,sl4
);
297 DoMethod(sb
,MUIM_TheBar_SetAttr
,6,MUIA_TheBar_Attr_Disabled
,fr
);
299 DoMethod(sb
,MUIM_Group_ExitChange
);
300 DoMethod(mg
,MUIM_Group_ExitChange
);
305 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
306 if (sigs
& SIGBREAKF_CTRL_C
) break;
310 MUI_DisposeObject(app
);
316 printf("%s: can't create application\n",argv
[0]);
320 CLOSELIB(MUIMasterBase
, IMUIMaster
);
324 printf("%s: Can't open muimaster.library ver 19 or higher\n",argv
[0]);
328 CLOSELIB(IntuitionBase
, IIntuition
);
332 printf("%s: Can't open intuition.library ver 39 or higher\n",argv
[0]);
339 /***********************************************************************/