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 /***********************************************************************/
45 struct MUIS_TheBar_Button buttons
[] =
47 {0, 0, "_Pred", "Pread mail.", 0, 0, NULL
, NULL
},
48 {1, 1, "_Next", "Next mail.", 0, 0, NULL
, NULL
},
49 {2, 2, "_Move", "Move somewhere.", 0, 0, NULL
, NULL
},
50 {MUIV_TheBar_BarSpacer
, 3, NULL
, NULL
, 0, 0, NULL
, NULL
},
51 {3, 4, "_Forw", "Forward somewhere.", 0, 0, NULL
, NULL
},
52 {4, 5, "F_ind", "Find something.", 0, 0, NULL
, NULL
},
53 {5, 6, "_Save", "Save mail.", 0, 0, NULL
, NULL
},
54 {MUIV_TheBar_End
, 0, NULL
, NULL
, 0, 0, NULL
, NULL
},
57 /***********************************************************************/
59 const char *usedClasses
[] = {"TheBar.mcc",NULL
};
61 const char *appearances
[] = {"Images and text","Images","Text",NULL
};
62 const char *labelPoss
[] = {"Bottom","Top","Right","Left",NULL
};
65 main(UNUSED
int argc
,char **argv
)
69 if ((IntuitionBase
= (APTR
)OpenLibrary("intuition.library",39)) != NULL
&&
70 GETINTERFACE("main", IIntuition
, IntuitionBase
))
72 if ((MUIMasterBase
= OpenLibrary("muimaster.library",19)) != NULL
&&
73 GETINTERFACE("main", IMUIMaster
, MUIMasterBase
))
75 Object
*app
, *win
, *sb
, *appearance
, *labelPos
, *borderless
, *sunny
, *raised
, *scaled
, *update
;
77 if ((app
= ApplicationObject
,
78 MUIA_Application_Title
, "TheBar Demo1",
79 MUIA_Application_Version
, "$VER: TheBarDemo1 1.0 (24.6.2003)",
80 MUIA_Application_Copyright
, "Copyright 2003 by Alfonso Ranieri",
81 MUIA_Application_Author
, "Alfonso Ranieri <alforan@tin.it>",
82 MUIA_Application_Description
, "TheBar example",
83 MUIA_Application_Base
, "THEBAREXAMPLE",
84 MUIA_Application_UsedClasses
, usedClasses
,
86 SubWindow
, win
= WindowObject
,
87 MUIA_Window_ID
, MAKE_ID('M','A','I','N'),
88 MUIA_Window_Title
, "TheBar Demo1",
89 WindowContents
, VGroup
,
90 Child
, sb
= TheBarObject
,
91 MUIA_Group_Horiz
, TRUE
,
92 MUIA_TheBar_IgnoreAppearance
, TRUE
,
93 MUIA_TheBar_EnableKeys
, TRUE
,
94 MUIA_TheBar_Buttons
, buttons
,
95 MUIA_TheBar_PicsDrawer
, "PROGDIR:Pics",
96 MUIA_TheBar_Strip
, "Read.toolbar",
97 MUIA_TheBar_SelStrip
, "Read_S.toolbar",
98 MUIA_TheBar_DisStrip
, "Read_G.toolbar",
99 MUIA_TheBar_StripCols
, 11,
102 GroupFrameT("Settings"),
104 Child
, Label2("Appearance"),
105 Child
, appearance
= MUI_MakeObject(MUIO_Cycle
,NULL
,appearances
),
106 Child
, Label2("Label pos"),
107 Child
, labelPos
= MUI_MakeObject(MUIO_Cycle
,NULL
,labelPoss
),
111 Child
, Label1("Borderless"),
112 Child
, borderless
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
114 Child
, Label1("Sunny"),
115 Child
, sunny
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
117 Child
, Label1("Raised"),
118 Child
, raised
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
120 Child
, Label1("Scaled"),
121 Child
, scaled
= MUI_MakeObject(MUIO_Checkmark
,NULL
),
125 Child
, update
= MUI_MakeObject(MUIO_Button
,"_Update"),
133 DoMethod(win
,MUIM_Notify
,MUIA_Window_CloseRequest
,TRUE
,MUIV_Notify_Application
,2,MUIM_Application_ReturnID
,MUIV_Application_ReturnID_Quit
);
134 DoMethod(update
,MUIM_Notify
,MUIA_Pressed
,FALSE
,app
,2,MUIM_Application_ReturnID
,TAG_USER
);
136 set(win
,MUIA_Window_Open
,TRUE
);
138 while ((id
= DoMethod(app
,MUIM_Application_NewInput
,&sigs
))!=MUIV_Application_ReturnID_Quit
)
140 if (id
==(LONG
)TAG_USER
)
142 IPTR appearanceV
= 0,
149 get(appearance
,MUIA_Cycle_Active
,&appearanceV
);
150 get(labelPos
,MUIA_Cycle_Active
,&labelPosV
);
151 get(borderless
,MUIA_Selected
,&borderlessV
);
152 get(sunny
,MUIA_Selected
,&sunnyV
);
153 get(raised
,MUIA_Selected
,&raisedV
);
154 get(scaled
,MUIA_Selected
,&scaledV
);
156 SetAttrs(sb
,MUIA_TheBar_ViewMode
, appearanceV
,
157 MUIA_TheBar_LabelPos
, labelPosV
,
158 MUIA_TheBar_Borderless
, borderlessV
,
159 MUIA_TheBar_Sunny
, sunnyV
,
160 MUIA_TheBar_Raised
, raisedV
,
161 MUIA_TheBar_Scaled
, scaledV
,
167 sigs
= Wait(sigs
| SIGBREAKF_CTRL_C
);
168 if (sigs
& SIGBREAKF_CTRL_C
) break;
172 MUI_DisposeObject(app
);
178 printf("%s: can't create application\n",argv
[0]);
182 CLOSELIB(MUIMasterBase
, IMUIMaster
);
186 printf("%s: Can't open muimaster.library ver 19 or higher\n",argv
[0]);
190 CLOSELIB(IntuitionBase
, IIntuition
);
194 printf("%s: Can't open intuition.library ver 39 or higher\n",argv
[0]);
201 /***********************************************************************/