2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <exec/types.h>
9 #include <utility/date.h>
11 #include <aros/debug.h>
12 #include <aros/asmcall.h>
14 #include <proto/muimaster.h>
15 #include <proto/graphics.h>
16 #include <proto/intuition.h>
17 #include <proto/utility.h>
18 #include <proto/timer.h>
24 #include "busy_private.h"
26 /*** Methods ****************************************************************/
27 IPTR
Busy__OM_NEW(Class
*cl
, Object
*obj
, struct opSet
*msg
)
29 struct Busy_DATA
*data
;
31 obj
= (Object
*) DoSuperMethodA(cl
, obj
, (Msg
)msg
);
34 data
= INST_DATA(cl
, obj
);
35 if (GetTagData(MUIA_Busy_ShowHideIH
, FALSE
, msg
->ops_AttrList
))
37 data
->flags
|= FLG_SHOWHIDEIH
;
41 data
->ihn
.ihn_Flags
= MUIIHNF_TIMER
;
42 data
->ihn
.ihn_Method
= MUIM_Busy_Move
;
43 data
->ihn
.ihn_Object
= obj
;
44 data
->ihn
.ihn_Millis
= 0;
49 IPTR
Busy__OM_SET(Class
*cl
, Object
*obj
, struct opSet
*msg
)
51 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
52 struct TagItem
*tags
= msg
->ops_AttrList
;
56 while ((tag
= NextTagItem((const struct TagItem
**)&tags
)) != NULL
)
61 if ((LONG
)tag
->ti_Data
== MUIV_Busy_Speed_User
)
67 data
->speed
= tag
->ti_Data
;
70 if ((data
->flags
& FLG_SHOWN
) ||
71 ((data
->flags
& FLG_SETUP
) && !(data
->flags
& FLG_SHOWHIDEIH
)))
73 if (data
->ihn
.ihn_Millis
)
75 DoMethod(_app(obj
), MUIM_Application_RemInputHandler
, (IPTR
) &data
->ihn
);
78 data
->ihn
.ihn_Millis
= data
->speed
;
80 if (data
->ihn
.ihn_Millis
)
82 DoMethod(_app(obj
), MUIM_Application_AddInputHandler
, (IPTR
) &data
->ihn
);
87 } /* switch(tag->ti_Tag) */
89 } /* while ((tag = NextTagItem(&tags)) != NULL) */
93 MUI_Redraw(obj
, MADF_DRAWUPDATE
);
96 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
100 IPTR
Busy__OM_GET(Class
*cl
, Object
*obj
, struct opGet
*msg
)
102 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
105 switch(msg
->opg_AttrID
)
107 case MUIA_Busy_Speed
:
108 *msg
->opg_Storage
= data
->speed
;
112 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
120 IPTR
Busy__MUIM_Setup(Class
*cl
, Object
*obj
, struct MUIP_Setup
*msg
)
122 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
124 if (!DoSuperMethodA(cl
, obj
, (Msg
)msg
)) return FALSE
;
126 if (data
->speed
&& !(data
->flags
& FLG_SHOWHIDEIH
))
128 data
->ihn
.ihn_Millis
= data
->speed
;
129 DoMethod(_app(obj
), MUIM_Application_AddInputHandler
, (IPTR
) &data
->ihn
);
132 data
->flags
|= FLG_SETUP
;
138 IPTR
Busy__MUIM_Cleanup(Class
*cl
, Object
*obj
, struct MUIP_Cleanup
*msg
)
140 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
142 if (data
->ihn
.ihn_Millis
&& !(data
->flags
& FLG_SHOWHIDEIH
))
144 DoMethod(_app(obj
), MUIM_Application_RemInputHandler
, (IPTR
) &data
->ihn
);
145 data
->ihn
.ihn_Millis
= 0;
148 data
->flags
&= ~FLG_SETUP
;
150 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
153 IPTR
Busy__MUIM_Show(Class
*cl
, Object
*obj
, struct MUIP_Show
*msg
)
155 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
158 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
160 if (data
->speed
&& (data
->flags
& FLG_SHOWHIDEIH
))
162 data
->ihn
.ihn_Millis
= data
->speed
;
163 DoMethod(_app(obj
), MUIM_Application_AddInputHandler
, (IPTR
) &data
->ihn
);
166 data
->flags
|= FLG_SHOWN
;
172 IPTR
Busy__MUIM_Hide(Class
*cl
, Object
*obj
, struct MUIP_Hide
*msg
)
174 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
176 if (data
->ihn
.ihn_Millis
&& (data
->flags
& FLG_SHOWHIDEIH
))
178 DoMethod(_app(obj
), MUIM_Application_RemInputHandler
, (IPTR
) &data
->ihn
);
179 data
->ihn
.ihn_Millis
= 0;
182 data
->flags
&= ~FLG_SHOWN
;
184 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
187 IPTR
Busy__MUIM_AskMinMax(Class
*cl
, Object
*obj
, struct MUIP_AskMinMax
*msg
)
189 DoSuperMethodA(cl
, obj
, (Msg
)msg
);
191 msg
->MinMaxInfo
->MinWidth
+= 50;
192 msg
->MinMaxInfo
->MinHeight
+= 4;
193 msg
->MinMaxInfo
->DefWidth
+= 50;
194 msg
->MinMaxInfo
->DefHeight
+= 4;
195 msg
->MinMaxInfo
->MaxWidth
= MUI_MAXMAX
;
196 msg
->MinMaxInfo
->MaxHeight
= MUI_MAXMAX
;
202 IPTR
Busy__MUIM_Draw(Class
*cl
, Object
*obj
, struct MUIP_Draw
*msg
)
204 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
208 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
210 if (!(msg
->flags
& (MADF_DRAWOBJECT
| MADF_DRAWUPDATE
))) return 0;
212 for(x
= 0; x
< _mwidth(obj
); x
++)
216 col
= ((x
+ data
->pos
) / 8) % 2;
217 SetAPen(_rp(obj
), _pens(obj
)[col
? MPEN_SHADOW
: MPEN_SHINE
]);
218 RectFill(_rp(obj
), _mleft(obj
) + x
, _mtop(obj
), _mleft(obj
) + x
, _mbottom(obj
));
225 IPTR
Busy__MUIM_Busy_Move(Class
*cl
, Object
*obj
, Msg msg
)
227 struct Busy_DATA
*data
;
229 data
= INST_DATA(cl
, obj
);
232 MUI_Redraw(obj
, MADF_DRAWUPDATE
);