2 Copyright © 1995-2011, 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/alib.h>
15 #include <proto/muimaster.h>
16 #include <proto/graphics.h>
17 #include <proto/intuition.h>
18 #include <proto/utility.h>
19 #include <proto/timer.h>
25 #include "busy_private.h"
27 /*** Methods ****************************************************************/
28 IPTR
Busy__OM_NEW(Class
*cl
, Object
*obj
, struct opSet
*msg
)
30 struct Busy_DATA
*data
;
32 obj
= (Object
*) DoSuperMethodA(cl
, obj
, (Msg
)msg
);
35 data
= INST_DATA(cl
, obj
);
36 if (GetTagData(MUIA_Busy_ShowHideIH
, FALSE
, msg
->ops_AttrList
))
38 data
->flags
|= FLG_SHOWHIDEIH
;
42 data
->ihn
.ihn_Flags
= MUIIHNF_TIMER
;
43 data
->ihn
.ihn_Method
= MUIM_Busy_Move
;
44 data
->ihn
.ihn_Object
= obj
;
45 data
->ihn
.ihn_Millis
= 0;
50 IPTR
Busy__OM_SET(Class
*cl
, Object
*obj
, struct opSet
*msg
)
52 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
53 struct TagItem
*tags
= msg
->ops_AttrList
;
57 while ((tag
= NextTagItem(&tags
)) != NULL
)
62 if ((LONG
)tag
->ti_Data
== MUIV_Busy_Speed_User
)
68 data
->speed
= tag
->ti_Data
;
71 if ((data
->flags
& FLG_SHOWN
) ||
72 ((data
->flags
& FLG_SETUP
) && !(data
->flags
& FLG_SHOWHIDEIH
)))
74 if (data
->ihn
.ihn_Millis
)
76 DoMethod(_app(obj
), MUIM_Application_RemInputHandler
, (IPTR
) &data
->ihn
);
79 data
->ihn
.ihn_Millis
= data
->speed
;
81 if (data
->ihn
.ihn_Millis
)
83 DoMethod(_app(obj
), MUIM_Application_AddInputHandler
, (IPTR
) &data
->ihn
);
88 } /* switch(tag->ti_Tag) */
90 } /* while ((tag = NextTagItem(&tags)) != NULL) */
94 MUI_Redraw(obj
, MADF_DRAWUPDATE
);
97 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
101 IPTR
Busy__OM_GET(Class
*cl
, Object
*obj
, struct opGet
*msg
)
103 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
106 switch(msg
->opg_AttrID
)
108 case MUIA_Busy_Speed
:
109 *msg
->opg_Storage
= data
->speed
;
113 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
121 IPTR
Busy__MUIM_Setup(Class
*cl
, Object
*obj
, struct MUIP_Setup
*msg
)
123 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
125 if (!DoSuperMethodA(cl
, obj
, (Msg
)msg
)) return FALSE
;
127 if (data
->speed
&& !(data
->flags
& FLG_SHOWHIDEIH
))
129 data
->ihn
.ihn_Millis
= data
->speed
;
130 DoMethod(_app(obj
), MUIM_Application_AddInputHandler
, (IPTR
) &data
->ihn
);
133 data
->flags
|= FLG_SETUP
;
139 IPTR
Busy__MUIM_Cleanup(Class
*cl
, Object
*obj
, struct MUIP_Cleanup
*msg
)
141 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
143 if (data
->ihn
.ihn_Millis
&& !(data
->flags
& FLG_SHOWHIDEIH
))
145 DoMethod(_app(obj
), MUIM_Application_RemInputHandler
, (IPTR
) &data
->ihn
);
146 data
->ihn
.ihn_Millis
= 0;
149 data
->flags
&= ~FLG_SETUP
;
151 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
154 IPTR
Busy__MUIM_Show(Class
*cl
, Object
*obj
, struct MUIP_Show
*msg
)
156 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
159 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
161 if (data
->speed
&& (data
->flags
& FLG_SHOWHIDEIH
))
163 data
->ihn
.ihn_Millis
= data
->speed
;
164 DoMethod(_app(obj
), MUIM_Application_AddInputHandler
, (IPTR
) &data
->ihn
);
167 data
->flags
|= FLG_SHOWN
;
173 IPTR
Busy__MUIM_Hide(Class
*cl
, Object
*obj
, struct MUIP_Hide
*msg
)
175 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
177 if (data
->ihn
.ihn_Millis
&& (data
->flags
& FLG_SHOWHIDEIH
))
179 DoMethod(_app(obj
), MUIM_Application_RemInputHandler
, (IPTR
) &data
->ihn
);
180 data
->ihn
.ihn_Millis
= 0;
183 data
->flags
&= ~FLG_SHOWN
;
185 return DoSuperMethodA(cl
, obj
, (Msg
)msg
);
188 IPTR
Busy__MUIM_AskMinMax(Class
*cl
, Object
*obj
, struct MUIP_AskMinMax
*msg
)
190 DoSuperMethodA(cl
, obj
, (Msg
)msg
);
192 msg
->MinMaxInfo
->MinWidth
+= 50;
193 msg
->MinMaxInfo
->MinHeight
+= 4;
194 msg
->MinMaxInfo
->DefWidth
+= 50;
195 msg
->MinMaxInfo
->DefHeight
+= 4;
196 msg
->MinMaxInfo
->MaxWidth
= MUI_MAXMAX
;
197 msg
->MinMaxInfo
->MaxHeight
= MUI_MAXMAX
;
203 IPTR
Busy__MUIM_Draw(Class
*cl
, Object
*obj
, struct MUIP_Draw
*msg
)
205 struct Busy_DATA
*data
= INST_DATA(cl
, obj
);
209 retval
= DoSuperMethodA(cl
, obj
, (Msg
)msg
);
211 if (!(msg
->flags
& (MADF_DRAWOBJECT
| MADF_DRAWUPDATE
))) return 0;
213 for(x
= 0; x
< _mwidth(obj
); x
++)
217 col
= ((x
+ data
->pos
) / 8) % 2;
218 SetAPen(_rp(obj
), _pens(obj
)[col
? MPEN_SHADOW
: MPEN_SHINE
]);
219 RectFill(_rp(obj
), _mleft(obj
) + x
, _mtop(obj
), _mleft(obj
) + x
, _mbottom(obj
));
226 IPTR
Busy__MUIM_Busy_Move(Class
*cl
, Object
*obj
, Msg msg
)
228 struct Busy_DATA
*data
;
230 data
= INST_DATA(cl
, obj
);
233 MUI_Redraw(obj
, MADF_DRAWUPDATE
);