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"
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 /***********************************************************************/
48 #define PIC(x,y) (x)*PIC_WIDTH, (y)*PIC_HEIGHT, PIC_WIDTH, PIC_HEIGHT
50 struct MUIS_TheBar_Brush brush0
= {Symbols_Data
, SYMBOLS_WIDTH
, SYMBOLS_HEIGHT
, SYMBOLS_TOTALWIDTH
, PIC( 7,0), Symbols_Colors
, SYMBOLS_NUMCOLORS
, SYMBOLS_TRCOLOR
, SYMBOLS_CSIZE
, SYMBOLS_FLAGS
, {0, 0, 0, 0}};
51 struct MUIS_TheBar_Brush brush1
= {Symbols_Data
, SYMBOLS_WIDTH
, SYMBOLS_HEIGHT
, SYMBOLS_TOTALWIDTH
, PIC(14,0), Symbols_Colors
, SYMBOLS_NUMCOLORS
, SYMBOLS_TRCOLOR
, SYMBOLS_CSIZE
, SYMBOLS_FLAGS
, {0, 0, 0, 0}};
52 struct MUIS_TheBar_Brush brush2
= {Symbols_Data
, SYMBOLS_WIDTH
, SYMBOLS_HEIGHT
, SYMBOLS_TOTALWIDTH
, PIC( 1,1), Symbols_Colors
, SYMBOLS_NUMCOLORS
, SYMBOLS_TRCOLOR
, SYMBOLS_CSIZE
, SYMBOLS_FLAGS
, {0, 0, 0, 0}};
53 struct MUIS_TheBar_Brush brush3
= {Symbols_Data
, SYMBOLS_WIDTH
, SYMBOLS_HEIGHT
, SYMBOLS_TOTALWIDTH
, PIC(10,1), Symbols_Colors
, SYMBOLS_NUMCOLORS
, SYMBOLS_TRCOLOR
, SYMBOLS_CSIZE
, SYMBOLS_FLAGS
, {0, 0, 0, 0}};
54 struct MUIS_TheBar_Brush brush4
= {Symbols_Data
, SYMBOLS_WIDTH
, SYMBOLS_HEIGHT
, SYMBOLS_TOTALWIDTH
, PIC( 2,2), Symbols_Colors
, SYMBOLS_NUMCOLORS
, SYMBOLS_TRCOLOR
, SYMBOLS_CSIZE
, SYMBOLS_FLAGS
, {0, 0, 0, 0}};
55 struct MUIS_TheBar_Brush brush5
= {Symbols_Data
, SYMBOLS_WIDTH
, SYMBOLS_HEIGHT
, SYMBOLS_TOTALWIDTH
, PIC( 1,0), Symbols_Colors
, SYMBOLS_NUMCOLORS
, SYMBOLS_TRCOLOR
, SYMBOLS_CSIZE
, SYMBOLS_FLAGS
, {0, 0, 0, 0}};
57 struct MUIS_TheBar_Brush
*brushes
[] = {&brush0
,&brush1
,&brush2
,&brush3
,&brush4
,&brush5
,(APTR
)-1};
59 struct MUIS_TheBar_Button buttons
[] =
61 {0, 0, "_Face", "Just a face." , 0, 0, NULL
, NULL
},
62 {1, 1, "_Mouse", "Your mouse." , 0, 0, NULL
, NULL
},
63 {2, 2, "_Tree", "Mind takes place.", 0, 0, NULL
, NULL
},
64 {MUIV_TheBar_BarSpacer
, -1, NULL
, NULL
, 0, 0, NULL
, NULL
},
65 {3, 3, "_Help", "Read this!." , 0, 0, NULL
, NULL
},
66 {4, 4, "_ARexx", "ARexx for ever!." , 0, 0, NULL
, NULL
},
67 {5, 5, "_Host", "Your computer." , 0, 0, NULL
, NULL
},
68 {MUIV_TheBar_End
, 0, NULL
, NULL
, 0, 0, NULL
, NULL
},
71 /***********************************************************************/
73 const char *appearances
[] = {"Images and text","Images","Text",NULL
};
74 const char *labelPoss
[] = {"Bottom","Top","Right","Left",NULL
};
76 const char *usedClasses
[] = {"TheBar.mcc",NULL
};
79 main(UNUSED
int argc
,char **argv
)
83 if ((IntuitionBase
= (APTR
)OpenLibrary("intuition.library",39)) != NULL
&&
84 GETINTERFACE("main", IIntuition
, IntuitionBase
))
86 if ((MUIMasterBase
= OpenLibrary("muimaster.library",19)) != NULL
&&
87 GETINTERFACE("main", IMUIMaster
, MUIMasterBase
))
89 Object
*app
, *win
, *sb
, *appearance
, *labelPos
, *borderless
, *sunny
, *raised
, *scaled
, *update
;
91 if ((app
= ApplicationObject
,
92 MUIA_Application_Title
, "TheBar Demo8",
93 MUIA_Application_Version
, "$VER: TheBarDemo8 1.0 (24.6.2003)",
94 MUIA_Application_Copyright
, "Copyright 2003 by Alfonso Ranieri",
95 MUIA_Application_Author
, "Alfonso Ranieri <alforan@tin.it>",
96 MUIA_Application_Description
, "TheBar example",
97 MUIA_Application_Base
, "THEBAREXAMPLE",
98 MUIA_Application_UsedClasses
, usedClasses
,
100 SubWindow
, win
= WindowObject
,
101 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
102 MUIA_Window_Title
, "TheBar Demo8",
103 WindowContents
, VGroup
,
104 Child
, sb
= TheBarObject
,
105 MUIA_Group_Horiz
, TRUE
,
106 MUIA_TheBar_IgnoreAppearance
, TRUE
,
107 MUIA_TheBar_EnableKeys
, TRUE
,
108 MUIA_TheBar_Buttons
, buttons
,
109 MUIA_TheBar_Images
, brushes
,
112 GroupFrameT("Settings"),
114 Child
, Label2("Appearance"),
115 Child
, appearance
= MUI_MakeObject(MUIO_Cycle
,NULL
,appearances
),
116 Child
, Label2("Label pos"),
117 Child
, labelPos
= MUI_MakeObject(MUIO_Cycle
,NULL
,labelPoss
),
121 Child
, Label1("Borderless"),
122 Child
, borderless
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
124 Child
, Label1("Sunny"),
125 Child
, sunny
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
127 Child
, Label1("Raised"),
128 Child
, raised
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
130 Child
, Label1("Scaled"),
131 Child
, scaled
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
135 Child
, update
= MUI_MakeObject(MUIO_Button
,"_Update"),
143 DoMethod(win
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,MUIV_Notify_Application
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
144 DoMethod(update
,MUIM_Notify
,MUIA_Pressed
,FALSE
,app
,2,MUIM_Application_ReturnID
,TAG_USER
);
146 set(win
,MUIA_Window_Open
,TRUE
);
148 while ((id
= DoMethod(app
,MUIM_Application_NewInput
,&sigs
))!=MUIV_Application_ReturnID_Quit
)
150 if (id
==(LONG
)TAG_USER
)
152 IPTR appearanceV
= 0,
159 get(appearance
,MUIA_Cycle_Active
,&appearanceV
);
160 get(labelPos
,MUIA_Cycle_Active
,&labelPosV
);
161 get(borderless
,MUIA_Selected
,&borderlessV
);
162 get(sunny
,MUIA_Selected
,&sunnyV
);
163 get(raised
,MUIA_Selected
,&raisedV
);
164 get(scaled
,MUIA_Selected
,&scaledV
);
166 SetAttrs(sb
,MUIA_TheBar_ViewMode
, appearanceV
,
167 MUIA_TheBar_LabelPos
, labelPosV
,
168 MUIA_TheBar_Borderless
, borderlessV
,
169 MUIA_TheBar_Sunny
, sunnyV
,
170 MUIA_TheBar_Raised
, raisedV
,
171 MUIA_TheBar_Scaled
, scaledV
,
177 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
178 if (sigs
& SIGBREAKF_CTRL_C
) break;
182 MUI_DisposeObject(app
);
188 printf("%s: can't create application\n",argv
[0]);
192 CLOSELIB(MUIMasterBase
, IMUIMaster
);
196 printf("%s: Can't open muimaster.library ver 19 or higher\n",argv
[0]);
200 CLOSELIB(IntuitionBase
, IIntuition
);
204 printf("%s: Can't open intuition.library ver 37 or higher\n",argv
[0]);
211 /***********************************************************************/