Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / network / stacks / AROSTCP / MUI.MiamiPanel / muimiamipanel.h
blobe8b39551cbf905bb322cfec1ce6ec380b5c6b208
2 #include <libraries/mui.h>
4 /* Some internal macros */
6 #undef BOOLSAME
7 #define BOOLSAME(a,b) (((a) ? TRUE : FALSE)==((b) ? TRUE : FALSE))
9 /***********************************************************************/
12 ** bigint
15 typedef struct
17 ULONG hi;
18 ULONG lo;
19 } bigint;
21 /***********************************************************************/
23 ** Messages
26 /* Message used to wake-up the proc */
27 struct MPS_AppMsg
29 struct Message link;
30 void *synccb;
31 void *asynccb;
32 long flags;
33 UBYTE *font;
34 UBYTE *screen;
35 long xo;
36 long yo;
37 ULONG *sigbit;
38 ULONG res;
41 /* Message prototype */
42 struct MPS_Msg
44 struct Message link;
45 ULONG type;
46 ULONG size;
47 ULONG flags;
50 enum
52 MPV_Msg_Flags_Reply = 1<<0, /* The message must be replied */
55 /* Messages types */
56 enum
58 MPV_Msg_Type_Cleanup = 0,
59 MPV_Msg_Type_AddInterface,
60 MPV_Msg_Type_DelInterface,
61 MPV_Msg_Type_SetInterfaceState,
62 MPV_Msg_Type_SetInterfaceSpeed,
63 MPV_Msg_Type_InterfaceReport,
64 MPV_Msg_Type_ToFront,
65 MPV_Msg_Type_InhibitRefresh,
66 MPV_Msg_Type_GetCoord,
67 MPV_Msg_Type_Event,
68 MPV_Msg_Type_RefreshName,
70 MPV_Msg_Type_Last
73 /* Message used to add an inteerface */
74 struct MPS_Msg_AddInterface
76 struct MPS_Msg link;
77 long unit;
78 UBYTE *name;
79 long state;
80 long ontime;
81 UBYTE *speed;
84 /* Message used to delete an interface */
85 struct MPS_Msg_DelInterface
87 struct MPS_Msg link;
88 long unit;
91 /* Message used to change state/ontime */
92 struct MPS_Msg_SetInterfaceState
94 struct MPS_Msg link;
95 long unit;
96 long state;
97 long ontime;
100 /* Message used to change the speed */
101 struct MPS_Msg_SetInterfaceSpeed
103 struct MPS_Msg link;
104 long unit;
105 UBYTE *speed;
108 /* Message used to change rate/ontime/traffic */
109 struct MPS_Msg_InterfaceReport
111 struct MPS_Msg link;
112 long unit;
113 long rate;
114 long now;
115 bigint total;
118 /* Message used to start/stop an interface add/delete phase */
119 struct MPS_Msg_InhibitRefresh
121 struct MPS_Msg link;
122 long val;
125 /* Message used to get the window x/y - Unused */
126 struct MPS_Msg_GetCoord
128 struct MPS_Msg link;
129 long *xp;
130 long *yp;
133 /* Message used to report a sinal bit event - Unused */
134 struct MPS_Msg_Event
136 struct MPS_Msg link;
137 ULONG sigs;
140 /* Message used to change an interface name */
141 struct MPS_Msg_RefreshName
143 struct MPS_Msg link;
144 long unit;
145 UBYTE *name;
148 /***********************************************************************/
150 ** MCCs tag base
153 #define MUIMPANEL_TAG(n) ((int)(0xfec90000+(n)))
155 /***********************************************************************/
157 ** Preferences
160 /* The actual preferences version */
161 enum
163 MPV_Prefs_Version = 1,
166 struct MPS_Prefs
168 ULONG layout;
169 ULONG flags;
171 ULONG barLayout;
172 ULONG viewMode;
173 ULONG labelPos;
174 ULONG btflags;
176 struct MinList iflist;
179 struct MPS_TinyPrefs
181 ULONG layout;
182 ULONG flags;
184 ULONG barLayout;
185 ULONG viewMode;
186 ULONG labelPos;
187 ULONG btflags;
190 /* Layout */
191 enum
193 MPV_Layout_Horiz = 1<<0,
194 MPV_Layout_Left = 1<<1,
195 MPV_Layout_Right = 1<<2,
196 MPV_Layout_PureTop = 1<<3,
197 MPV_Layout_PureBottom = 1<<4,
198 MPV_Layout_Top = MPV_Layout_PureTop|MPV_Layout_Horiz,
199 MPV_Layout_Bottom = MPV_Layout_PureBottom|MPV_Layout_Horiz,
202 /* flags */
203 enum
205 MPV_Flags_TrafficShort = 1<<0,
206 MPV_Flags_TrafficNoGrouping = 1<<1,
207 MPV_Flags_RateShort = 1<<2,
208 MPV_Flags_RateNoGrouping = 1<<3,
209 MPV_Flags_UseBusyBar = 1<<4,
210 MPV_Flags_Iconify = 1<<5,
211 MPV_Flags_BWin = 1<<6,
212 MPV_Flags_BWinBorders = 1<<7,
213 MPV_Flags_UseTransparency = 1<<8,
216 /* btflags */
217 enum
219 MPV_BTFlags_Borderless = 1<<0,
220 MPV_BTFlags_Sunny = 1<<1,
221 MPV_BTFlags_Raised = 1<<2,
222 MPV_BTFlags_Scaled = 1<<3,
223 MPV_BTFlags_Underscore = 1<<4,
224 MPV_BTFlags_Frame = 1<<5,
225 MPV_BTFlags_DragBar = 1<<6,
228 #define PREFS(p) ((struct MPS_Prefs *)(p))
230 /* An interface in iflist */
231 struct ifnode
233 struct MinNode link;
234 UBYTE name[16];
235 ULONG scale;
239 /* To use with loadIFFPrefs() */
240 enum
242 MPV_LoadPrefs_Env = 1<<0,
243 MPV_LoadPrefs_EnvArc = 1<<1,
244 MPV_LoadPrefs_FallBack = 1<<2,
247 /***********************************************************************/
249 ** App - Application.mui subclass
250 ** The core.
253 /* Methods */
254 enum
256 MPM_Rebuild = MUIMPANEL_TAG(0),
257 MPM_Quit = MUIMPANEL_TAG(1),
258 MPM_DisposeWin = MUIMPANEL_TAG(2),
259 MPM_Save = MUIMPANEL_TAG(3),
260 MPM_Load = MUIMPANEL_TAG(4),
261 MPM_About = MUIMPANEL_TAG(5),
262 MPM_Miami = MUIMPANEL_TAG(6),
263 MPM_Prefs = MUIMPANEL_TAG(7),
266 struct MPP_DisposeWin
268 ULONG MethodID;
269 Object *win;
272 struct MPP_Save
274 ULONG MethodID;
275 ULONG save;
278 struct MPP_Load
280 ULONG MethodID;
281 ULONG envarc;
284 struct MPP_Miami
286 ULONG MethodID;
287 ULONG cmd;
290 enum
292 MPV_Miami_Show,
293 MPV_Miami_Hide,
294 MPV_Miami_Quit,
297 /* Attributes */
298 enum
300 MPA_Application = MUIMPANEL_TAG(0),
301 MPA_Show = MUIMPANEL_TAG(1),
302 MPA_Prefs = MUIMPANEL_TAG(2),
303 MPA_OneWay = MUIMPANEL_TAG(3),
304 MPA_Bar = MUIMPANEL_TAG(4),
305 MPA_Value = MUIMPANEL_TAG(5),
306 MPA_NoIfList = MUIMPANEL_TAG(6),
307 MPA_SkipBar = MUIMPANEL_TAG(7),
310 /***********************************************************************/
312 ** Prefs - Window.mui subclass
313 ** Edit preferences.
316 /* Methods */
317 enum
319 MPM_Prefs_UsePrefs = MUIMPANEL_TAG(15),
322 struct MPP_Prefs_UsePrefs
324 ULONG MethodID;
325 ULONG mode;
328 enum
330 MPV_Prefs_UsePrefs_Save,
331 MPV_Prefs_UsePrefs_Use,
332 MPV_Prefs_UsePrefs_Apply,
333 MPV_Prefs_UsePrefs_Test,
334 MPV_Prefs_UsePrefs_Cancel,
337 /* No attribute defined */
339 /***********************************************************************/
341 ** MGroup - Group.mui subclass
342 ** Made of IFGroup & CGroup.
343 ** May change layout on the fly.
346 /* Methods */
347 enum
349 MPM_MGroup_GrabIFList = MUIMPANEL_TAG(16),
350 MPM_MGroup_UpdateTransparency = MUIMPANEL_TAG(17),
353 /* No attribute defined */
355 /***********************************************************************/
357 ** IfGroup - Virtgroup.mui subclass
358 ** Interfaces list.
361 /* Methods */
362 enum
364 MPM_IfGroup_HandleEvent = MUIMPANEL_TAG(20),
365 MPM_IfGroup_GrabIFList,
368 /* No attribute defined */
370 enum
372 TAG_SCALE = MUIMPANEL_TAG(30),
374 TAG_SCALE_1,
375 TAG_SCALE_2,
376 TAG_SCALE_3,
377 TAG_SCALE_4,
378 TAG_SCALE_5,
379 TAG_SCALE_6,
380 TAG_SCALE_7,
381 TAG_SCALE_8,
383 TAG_SCALE_LAST
386 /***********************************************************************/
388 ** If - Group.mui subclass
389 ** Rappresents an interface.
392 /* Methods */
393 enum
395 MPM_If_Switch = MUIMPANEL_TAG(50),
398 /* Attributes */
399 enum
401 MPA_If_Unit = MUIMPANEL_TAG(50),
402 MPA_If_Name = MUIMPANEL_TAG(51),
403 MPA_If_State = MUIMPANEL_TAG(52),
404 MPA_If_Ontime = MUIMPANEL_TAG(53),
405 MPA_If_Traffic = MUIMPANEL_TAG(54),
406 MPA_If_Rate = MUIMPANEL_TAG(55),
407 MPA_If_Now = MUIMPANEL_TAG(56),
408 MPA_If_Speed = MUIMPANEL_TAG(57),
409 MPA_If_PMExLlst = MUIMPANEL_TAG(58),
410 MPA_If_Scale = MUIMPANEL_TAG(59),
413 /***********************************************************************/
415 ** LButton - Group.mui subclass
416 ** Made of a Lamp and a Text.
419 /* No method defined */
421 /* Attributes */
422 enum
424 MPA_LButton_State = MUIMPANEL_TAG(70),
427 /***********************************************************************/
429 ** MUI Macros
432 /* Menus */
433 #define MTITLE(t) {NM_TITLE,NULL,0,0,0,(APTR)(t)}
434 #define MITEM(t) {NM_ITEM,NULL,0,0,0,(APTR)(t)}
435 #define MBAR {NM_ITEM,(UBYTE *)NM_BARLABEL,0,0,0,NULL}
436 #define MXSUB(t,m) {NM_SUB,NULL,0,CHECKIT,(LONG)(m),(APTR)(t)}
437 #define MEND {NM_END,NULL,0,0,0,NULL}
439 /* PopupMenu */
440 #define PMMenuIDNoTitle(id) PM_MakeMenu(\
441 PM_Item, PM_MakeItem(PM_Hidden,TRUE,TAG_DONE),\
442 PM_Item, PM_MakeItem(PM_Title,"",PM_NoSelect,TRUE,PM_ShinePen,TRUE,PM_Shadowed,TRUE,PM_Center,TRUE,PM_ID,id,TAG_DONE),\
443 PM_Item, PM_MakeItem(PM_WideTitleBar,TRUE,TAG_DONE)
444 #define _pmenu(pm) ((struct PopupMenu *)(pm))
445 #define pmset(pm,attr,value) PM_SetItemAttrs(_pmenu(pm),attr,value,TAG_DONE)
447 /* MCCs */
448 #if !defined(__AROS__)
449 #define appObject NewObject(MiamiPanelBaseIntern->mpb_appClass->mcc_Class,NULL
450 #define aboutObject NewObject(MiamiPanelBaseIntern->mpb_aboutClass->mcc_Class,NULL
451 #define prefsObject NewObject(MiamiPanelBaseIntern->mpb_prefsClass->mcc_Class,NULL
452 #define mgroupObject NewObject(MiamiPanelBaseIntern->mpb_mgroupClass->mcc_Class,NULL
453 #define ifGroupObject NewObject(MiamiPanelBaseIntern->mpb_ifGroupClass->mcc_Class,NULL
454 #define ifObject NewObject(MiamiPanelBaseIntern->mpb_ifClass->mcc_Class,NULL
455 #define lbuttonObject NewObject(MiamiPanelBaseIntern->mpb_lbuttonClass->mcc_Class,NULL
456 #define rateObject NewObject(MiamiPanelBaseIntern->mpb_rateClass->mcc_Class,NULL
457 #define trafficObject NewObject(MiamiPanelBaseIntern->mpb_trafficClass->mcc_Class,NULL
458 #define timeTextObject NewObject(MiamiPanelBaseIntern->mpb_timeTextClass->mcc_Class,NULL
459 #endif
461 /* Various */
462 #define IDS(s) ((ULONG *)(s+sizeof(s)/sizeof(UBYTE *)/2))
464 /***********************************************************************/
466 ** Default preferecences
468 #define DEF_Layout MPV_Layout_Top
469 #define DEF_Flags (MPV_Flags_TrafficShort|MPV_Flags_RateShort|MPV_Flags_UseBusyBar|MPV_Flags_BWin|MPV_Flags_BWinBorders)
470 #define DEF_TBLayout MUIV_TheBar_BarPos_Left
471 #define DEF_TBVMode MUIV_TheBar_ViewMode_TextGfx
472 #define DEF_TBLPos MUIV_TheBar_LabelPos_Right
473 #define DEF_TBFlags (MPV_BTFlags_Underscore|MPV_BTFlags_Frame|MPV_BTFlags_DragBar)
474 #define DEF_Scale (scales[0].ti_Data)
476 /***********************************************************************/
478 ** Global definitions
481 #define DEF_Author "Alfonso Ranieri"
482 #define DEF_EMail "alforan@tin.it"
483 #define DEF_HomePage "http://alfie.altervista.org"
484 #define DEF_Base "MUI.MiamiPanel"
485 #define DEF_Guide "MIAMI:"DEF_Base".guide"
486 #define DEF_Icon "ENVARC:Sys/MiamiPanel"
487 #define DEF_Catalog DEF_Base".catalog"
488 #define DEF_ENVFILE "ENV:MUI/"DEF_Base
489 #define DEF_ENVARCFILE "ENVARC:MUI/"DEF_Base
491 /*****************************************************************************/
493 ** Callback types definitions
496 typedef long (MiamiPanelCallBackType)(APTR code,LONG count,UBYTE *args);
498 /*****************************************************************************/
500 ** Commands codes
503 enum
505 MIAMIPANELV_CallBack_Code_UnitOnline = 112,
506 MIAMIPANELV_CallBack_Code_UnitOffline = 113,
508 MIAMIPANELV_CallBack_Code_ShowMainGUI = 56,
509 MIAMIPANELV_CallBack_Code_HideMainGUI = 19,
510 MIAMIPANELV_CallBack_Code_ClosePanel = 110,
511 MIAMIPANELV_CallBack_Code_QuitMiami = 123,
513 MIAMIPANELV_CallBack_Code_Localize = 27,
516 /*****************************************************************************/
518 ** Interface states
521 enum
523 MIAMIPANELV_AddInterface_State_GoingOnline = 1<<8,
524 MIAMIPANELV_AddInterface_State_GoingOffline = 1<<9,
525 MIAMIPANELV_AddInterface_State_Suspending = 1<<10,
526 MIAMIPANELV_AddInterface_State_Offline = 1<<0,
527 MIAMIPANELV_AddInterface_State_Online = 1<<1,
528 MIAMIPANELV_AddInterface_State_Suspended = 1<<2,
531 /*****************************************************************************/
533 ** Flags defining the appearance of the control panel
536 enum
538 MIAMIPANELV_Init_Flags_ShowSpeed = 1<<0,
539 MIAMIPANELV_Init_Flags_ShowDataTransferRate = 1<<1,
540 MIAMIPANELV_Init_Flags_ShowUpTime = 1<<2,
541 MIAMIPANELV_Init_Flags_ShowTotal = 1<<3,
542 MIAMIPANELV_Init_Flags_ShowStatusButton = 1<<4,
543 MIAMIPANELV_Init_Flags_Control = 1<<5,
546 /*****************************************************************************/
548 ** String codes
551 enum
553 MIAMIPANELV_String_Status_GoingOnline = 5000, /* ">On" */
554 MIAMIPANELV_String_Status_GoingOffline = 5001, /* ">Of" */
555 MIAMIPANELV_String_Status_Suspending = 5002, /* ">Su" */
556 MIAMIPANELV_String_Status_Online = 5003, /* "Onl" */
557 MIAMIPANELV_String_Status_Offline = 5004, /* "Off" */
558 MIAMIPANELV_String_Status_Suspended = 5005, /* "Sus" */
560 MIAMIPANELV_String_Button_Show = 5006, /* "Show" */
561 MIAMIPANELV_String_Button_Hide = 5007, /* "Hide" */
562 MIAMIPANELV_String_Button_Quit = 5008, /* "Quit" */
563 MIAMIPANELV_String_Button_Online = 5009, /* "Onl" */
564 MIAMIPANELV_String_Button_Offline = 5010, /* "Off" */
567 /*****************************************************************************/