2 #include <proto/intuition.h>
3 #include <proto/muimaster.h>
4 #include <proto/utility.h>
6 #include <libraries/mui.h>
7 #include <libraries/gadtools.h>
9 #include "muimiamipanel_intern.h"
10 #include "muimiamipanel_locale.h"
12 #include <mui/Lamp_mcc.h>
14 /***********************************************************************/
16 static UBYTE
*ons
, *offs
, *btFixWidthTxt
;
18 /***********************************************************************/
20 struct MiamiPanelLButtonClass_DATA
26 /***********************************************************************/
28 static struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
;
31 MUIPC_LButton__OM_NEW(struct IClass
*CLASS
,Object
*self
,struct opSet
*message
)
33 struct MiamiPanelLButtonClass_DATA temp
;
34 struct TagItem
*attrs
= message
->ops_AttrList
;
36 temp
.lamp
= LampObject
, End
;
38 if (self
= (Object
*)DoSuperNewTags
42 MUIA_Frame
, MUIV_Frame_Button
,
43 MUIA_Background
, MUII_ButtonBack
,
44 MUIA_Font
, MUIV_Font_Button
,
45 MUIA_InputMode
, MUIV_InputMode_RelVerify
,
46 MUIA_CycleChain
, TRUE
,
47 MUIA_Group_Horiz
, TRUE
,
48 MUIA_Group_HorizSpacing
, 0,
50 temp
.lamp
? Child
: TAG_IGNORE
, temp
.lamp
,
51 temp
.lamp
? Child
: TAG_IGNORE
, temp
.lamp
? (RectangleObject
, MUIA_FixWidthTxt
, ".", End
) : NULL
,
53 Child
, temp
.text
= TextObject
,
54 MUIA_FixWidthTxt
, btFixWidthTxt
,
55 MUIA_Text_PreParse
, MUIX_C
,
56 MUIA_Text_Contents
, ons
,
61 struct MiamiPanelLButtonClass_DATA
*data
= INST_DATA(CLASS
,self
);
63 CopyMem(&temp
, data
, sizeof(struct MiamiPanelLButtonClass_DATA
));
69 /***********************************************************************/
72 MUIPC_LButton__OM_SET(struct IClass
*CLASS
,Object
*self
,struct opSet
*message
)
74 struct MiamiPanelLButtonClass_DATA
*data
= INST_DATA(CLASS
,self
);
77 if (tag
= FindTagItem(MPA_LButton_State
,message
->ops_AttrList
))
84 case MIAMIPANELV_AddInterface_State_GoingOnline
:
85 color
= MUIV_Lamp_Color_Error
;
90 case MIAMIPANELV_AddInterface_State_GoingOffline
:
91 color
= MUIV_Lamp_Color_Warning
;
96 case MIAMIPANELV_AddInterface_State_Suspending
:
97 color
= MUIV_Lamp_Color_FatalError
;
102 case MIAMIPANELV_AddInterface_State_Online
:
103 color
= MUIV_Lamp_Color_Ok
;
108 case MIAMIPANELV_AddInterface_State_Suspended
:
109 color
= MUIV_Lamp_Color_Processing
;
115 color
= MUIV_Lamp_Color_Off
;
121 if (data
->lamp
) set(data
->lamp
,MUIA_Lamp_Color
,color
);
122 if (text
) set(data
->text
,MUIA_Text_Contents
,text
);
123 SetSuperAttrs(CLASS
,self
,MUIA_Disabled
,dis
,TAG_DONE
);
126 return DoSuperMethodA(CLASS
,self
,(Msg
)message
);
129 /***********************************************************************/
131 BOOPSI_DISPATCHER(IPTR
, MUIPC_LButton_Dispatcher
, CLASS
, self
, message
)
133 switch (message
->MethodID
)
135 case OM_SET
: return MUIPC_LButton__OM_SET(CLASS
,self
,(APTR
)message
);
136 case OM_NEW
: return MUIPC_LButton__OM_NEW(CLASS
,self
,(APTR
)message
);
137 default: return DoSuperMethodA(CLASS
,self
,message
);
141 BOOPSI_DISPATCHER_END
143 /***********************************************************************/
146 MUIPC_LButton_ClassInit(struct MiamiPanelBase_intern
*MiamiPanelBase
)
148 MiamiPanelBaseIntern
= MiamiPanelBase
;
149 if (MiamiPanelBaseIntern
->mpb_lbuttonClass
= MUI_CreateCustomClass(NULL
, MUIC_Group
, NULL
, sizeof(struct MiamiPanelLButtonClass_DATA
), MUIPC_LButton_Dispatcher
))
151 ons
= __(MSG_IF_Button_Online
);
152 offs
= __(MSG_IF_Button_Offline
);
154 if (strlen(ons
)>strlen(offs
)) btFixWidthTxt
= ons
;
155 else btFixWidthTxt
= offs
;
163 /***********************************************************************/