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>
11 #include "muimiamipanel_intern.h"
12 #include "muimiamipanel_locale.h"
14 /***********************************************************************/
16 struct MiamiPanelTimeTextClass_DATA
21 /***********************************************************************/
23 static struct MiamiPanelBase_intern
*MiamiPanelBaseIntern
;
26 MUIPC_TimeText__OM_NEW(struct IClass
*CLASS
,Object
*self
,struct opSet
*message
)
28 register struct TagItem
*attrs
= message
->ops_AttrList
;
30 if (self
= (Object
*)DoSuperNewTags
34 MUIA_Text_Contents
, "00:00:00",
37 register struct MiamiPanelTimeTextClass_DATA
*data
= INST_DATA(CLASS
,self
);
39 data
->secs
= GetTagData(MPA_Value
,0,attrs
);
45 /***********************************************************************/
48 MUIPC_TimeText__OM_SET(struct IClass
*CLASS
,Object
*self
,struct opSet
*message
)
50 register struct MiamiPanelTimeTextClass_DATA
*data
= INST_DATA(CLASS
,self
);
51 register struct TagItem
*tag
;
52 struct TagItem
*tstate
;
54 for (tstate
= message
->ops_AttrList
; tag
= NextTagItem(&tstate
); )
56 register ULONG tidata
= tag
->ti_Data
;
61 if (tidata
!=data
->secs
)
67 register ULONG d
, h
, m
;
77 if (d
>0) sprintf(buf
,"%lu %02lu:%02lu:%02lu",d
,h
,m
,s
);
78 else sprintf(buf
,"%02lu:%02lu:%02lu",h
,m
,s
);
80 else strcpy(buf
,"00:00:00");
83 SetSuperAttrs(CLASS
, self
, MUIA_Text_Contents
, buf
, TAG_DONE
);
89 return DoSuperMethodA(CLASS
,self
,(APTR
)message
);
92 /***********************************************************************/
94 BOOPSI_DISPATCHER(IPTR
, MUIPC_TimeText_Dispatcher
, CLASS
, self
, message
)
96 switch (message
->MethodID
)
98 case OM_SET
: return MUIPC_TimeText__OM_SET(CLASS
,self
,(APTR
)message
);
99 case OM_NEW
: return MUIPC_TimeText__OM_NEW(CLASS
,self
,(APTR
)message
);
100 default: return DoSuperMethodA(CLASS
,self
,message
);
104 BOOPSI_DISPATCHER_END
106 /***********************************************************************/
109 MUIPC_TimeText_ClassInit(struct MiamiPanelBase_intern
*MiamiPanelBase
)
111 MiamiPanelBaseIntern
= MiamiPanelBase
;
112 return (ULONG
)(MiamiPanelBaseIntern
->mpb_timeTextClass
= MUI_CreateCustomClass(NULL
, MUIC_Text
, NULL
, sizeof(struct MiamiPanelTimeTextClass_DATA
), MUIPC_TimeText_Dispatcher
));
115 /***********************************************************************/