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>
10 #include "SDI_compiler.h"
12 /***********************************************************************/
15 #if defined(__amigaos4__)
16 struct Library
*IntuitionBase
;
17 struct Library
*MUIMasterBase
;
18 struct IntuitionIFace
*IIntuition
;
19 struct MUIMasterIFace
*IMUIMaster
;
21 struct IntuitionBase
*IntuitionBase
;
22 struct Library
*MUIMasterBase
;
25 /***********************************************************************/
28 #define MAKE_ID(a,b,c,d) ((ULONG)(a)<<24|(ULONG)(b)<<16|(ULONG)(c)<<8|(ULONG)(d))
31 /***********************************************************************/
33 #if defined(__amigaos4__)
34 #define CLOSELIB(lib, iface) { if((iface) && (lib)) { DropInterface((APTR)(iface)); iface = NULL; CloseLibrary((struct Library *)lib); lib = NULL; } }
35 #define GETINTERFACE(iname, iface, base) ((iface) = (APTR)GetInterface((struct Library *)(base), (iname), 1L, NULL))
36 #define DROPINTERFACE(iface) { DropInterface((APTR)(iface)); iface = NULL; }
38 #define CLOSELIB(lib, iface) { if((lib)) { CloseLibrary((struct Library *)lib); lib = NULL; } }
39 #define GETINTERFACE(iname, iface, base) TRUE
40 #define DROPINTERFACE(iface) ((void)0)
43 /***********************************************************************/
49 #define PIC(x,y) (x+y*COLS)
51 #define BAR {MUIV_TheBar_BarSpacer, -1, NULL, NULL, 0, 0, NULL, NULL}
53 struct MUIS_TheBar_Button buttons
[] =
55 {PIC(7,0), 1, "_Face", "Just a face.", 0, 0, NULL
, NULL
},
56 {PIC(14,0), 2, "_Mouse", "Your mouse.", 0, 0, NULL
, NULL
},
57 {PIC(1,1), 3, "_Tree", "Mind takes place.", 0, 0, NULL
, NULL
},
61 {PIC(10,1), 4, "_Help", "Read this!.", 0, 0, NULL
, NULL
},
62 {PIC(2,2), 5, "_ARexx", "ARexx for ever!.", 0, 0, NULL
, NULL
},
63 {PIC(1,0), 6, "_Host", "Your computer.", 0, 0, NULL
, NULL
},
65 {MUIV_TheBar_End
, 0, NULL
, NULL
, 0, 0, NULL
, NULL
}
68 /***********************************************************************/
70 const char *appearances
[] = {"Images and text","Images","Text",NULL
};
71 const char *labelPoss
[] = {"Bottom","Top","Right","Left",NULL
};
73 const char *usedClasses
[] = {"TheBar.mcc",NULL
};
76 main(UNUSED
int argc
,char **argv
)
80 if ((IntuitionBase
= (APTR
)OpenLibrary("intuition.library",39)) != NULL
&&
81 GETINTERFACE("main", IIntuition
, IntuitionBase
))
83 if ((MUIMasterBase
= OpenLibrary("muimaster.library",19)) != NULL
&&
84 GETINTERFACE("main", IMUIMaster
, MUIMasterBase
))
86 Object
*app
, *win
, *sb
, *appearance
, *labelPos
, *borderless
, *sunny
, *raised
, *scaled
, *update
;
88 if ((app
= ApplicationObject
,
89 MUIA_Application_Title
, "TheBar Demo6",
90 MUIA_Application_Version
, "$VER: TheBarDemo6 1.0 (24.6.2003)",
91 MUIA_Application_Copyright
, "Copyright 2003 by Alfonso Ranieri",
92 MUIA_Application_Author
, "Alfonso Ranieri <alforan@tin.it>",
93 MUIA_Application_Description
, "TheBar example",
94 MUIA_Application_Base
, "THEBAREXAMPLE",
95 MUIA_Application_UsedClasses
, usedClasses
,
97 SubWindow
, win
= WindowObject
,
98 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
99 MUIA_Window_Title
, "TheBar Demo6",
100 WindowContents
, VGroup
,
101 Child
, sb
= TheBarObject
,
102 MUIA_Group_Horiz
, TRUE
,
103 MUIA_TheBar_IgnoreAppearance
, TRUE
,
104 MUIA_TheBar_EnableKeys
, TRUE
,
105 MUIA_TheBar_Buttons
, buttons
,
106 MUIA_TheBar_PicsDrawer
, "PROGDIR:Pics",
107 MUIA_TheBar_Strip
, "symbols",
108 MUIA_TheBar_StripCols
, COLS
,
109 MUIA_TheBar_StripRows
, ROWS
,
110 MUIA_TheBar_StripHSpace
, HSPACE
,
111 MUIA_TheBar_StripVSpace
, VSPACE
,
114 GroupFrameT("Settings"),
116 Child
, Label2("Appearance"),
117 Child
, appearance
= MUI_MakeObject(MUIO_Cycle
,NULL
,appearances
),
118 Child
, Label2("Label pos"),
119 Child
, labelPos
= MUI_MakeObject(MUIO_Cycle
,NULL
,labelPoss
),
123 Child
, Label1("Borderless"),
124 Child
, borderless
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
126 Child
, Label1("Sunny"),
127 Child
, sunny
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
129 Child
, Label1("Raised"),
130 Child
, raised
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
132 Child
, Label1("Scaled"),
133 Child
, scaled
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
137 Child
, update
= MUI_MakeObject(MUIO_Button
,"_Update"),
145 DoMethod(win
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,MUIV_Notify_Application
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
146 DoMethod(update
,MUIM_Notify
,MUIA_Pressed
,FALSE
,app
,2,MUIM_Application_ReturnID
,TAG_USER
);
148 set(win
,MUIA_Window_Open
,TRUE
);
150 while ((id
= DoMethod(app
,MUIM_Application_NewInput
,&sigs
))!=MUIV_Application_ReturnID_Quit
)
152 if (id
==(LONG
)TAG_USER
)
154 IPTR appearanceV
= 0,
161 get(appearance
,MUIA_Cycle_Active
,&appearanceV
);
162 get(labelPos
,MUIA_Cycle_Active
,&labelPosV
);
163 get(borderless
,MUIA_Selected
,&borderlessV
);
164 get(sunny
,MUIA_Selected
,&sunnyV
);
165 get(raised
,MUIA_Selected
,&raisedV
);
166 get(scaled
,MUIA_Selected
,&scaledV
);
168 SetAttrs(sb
,MUIA_TheBar_ViewMode
, appearanceV
,
169 MUIA_TheBar_LabelPos
, labelPosV
,
170 MUIA_TheBar_Borderless
, borderlessV
,
171 MUIA_TheBar_Sunny
, sunnyV
,
172 MUIA_TheBar_Raised
, raisedV
,
173 MUIA_TheBar_Scaled
, scaledV
,
179 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
180 if (sigs
& SIGBREAKF_CTRL_C
) break;
184 MUI_DisposeObject(app
);
190 printf("%s: can't create application\n",argv
[0]);
194 CLOSELIB(MUIMasterBase
, IMUIMaster
);
198 printf("%s: Can't open muimaster.library ver 19 or higher\n",argv
[0]);
202 CLOSELIB(IntuitionBase
, IIntuition
);
206 printf("%s: Can't open intuition.library ver 39 or higher\n",argv
[0]);
213 /***********************************************************************/