add casts to zune macros to silence some warnings
[tangerine.git] / workbench / utilities / Presenter / presentation.c
blob859f96b91bf6b57239ad9ea13a746415847e48ec
1 /*
2 Copyright © 2003-2004, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define MUIMASTER_YES_INLINE_STDARG
8 #include <proto/intuition.h>
9 #include <proto/muimaster.h>
10 #include <proto/diskfont.h>
11 #include <proto/utility.h>
12 #include <graphics/text.h>
13 #include <libraries/mui.h>
14 #include <zune/customclasses.h>
16 #include "presentation.h"
18 /*** Instance data **********************************************************/
19 struct Presentation_DATA
21 ULONG ssd_ChildCount;
22 struct MUI_EventHandlerNode ssd_EHN;
25 /*** Macros *****************************************************************/
26 #define SETUP_INST_DATA struct Presentation_DATA *data = INST_DATA(CLASS, self)
28 /*** Methods ****************************************************************/
29 Object *Presentation__OM_NEW
31 Class *CLASS, Object *self, struct opSet *message
34 self = (Object *) DoSuperNewTags
36 CLASS, self, NULL,
38 InnerSpacing(4, 4),
40 /* Add content here ... */
42 TAG_MORE, (IPTR) message->ops_AttrList
45 return self;
48 IPTR Presentation__OM_ADDMEMBER
50 Class *CLASS, Object *self, struct opMember *message
53 IPTR success = DoSuperMethodA(CLASS, self, (Msg) message);
55 if (success)
57 SETUP_INST_DATA;
58 data->ssd_ChildCount++;
61 return success;
64 IPTR Presentation__OM_REMMEMBER
66 Class *CLASS, Object *self, struct opMember *message
69 IPTR success = DoSuperMethodA(CLASS, self, (Msg) message);
71 if (success)
73 SETUP_INST_DATA;
74 data->ssd_ChildCount--;
77 return success;
80 IPTR Presentation__OM_SET
82 Class *CLASS, Object *self, struct opSet *message
85 SETUP_INST_DATA;
86 const struct TagItem *tstate = message->ops_AttrList;
87 struct TagItem *tag;
89 while ((tag = NextTagItem(&tstate)) != NULL)
91 switch (tag->ti_Tag)
93 case MUIA_Group_ActivePage:
94 switch (tag->ti_Data)
96 case MUIV_Group_ActivePage_Next:
99 XGET(self, MUIA_Group_ActivePage)
100 >= data->ssd_ChildCount - 1
103 tag->ti_Tag = TAG_IGNORE;
105 break;
107 case MUIV_Group_ActivePage_Prev:
108 if (XGET(self, MUIA_Group_ActivePage) <= 0)
110 tag->ti_Tag = TAG_IGNORE;
112 break;
114 break;
118 return DoSuperMethodA(CLASS, self, (Msg) message);
121 IPTR Presentation__MUIM_Setup
123 Class *CLASS, Object *self, struct MUIP_Setup *message
126 if (DoSuperMethodA(CLASS, self, (Msg) message))
128 SETUP_INST_DATA;
130 data->ssd_EHN.ehn_Events = IDCMP_RAWKEY;
131 data->ssd_EHN.ehn_Priority = 0;
132 data->ssd_EHN.ehn_Flags = 0;
133 data->ssd_EHN.ehn_Object = self;
134 data->ssd_EHN.ehn_Class = CLASS;
136 DoMethod
138 _win(self), MUIM_Window_AddEventHandler, (IPTR) &data->ssd_EHN
141 return TRUE;
144 return FALSE;
147 IPTR Presentation__MUIM_Cleanup
149 Class *CLASS, Object *self, struct MUIP_Cleanup *message
152 SETUP_INST_DATA;
154 DoMethod
156 _win(self), MUIM_Window_RemEventHandler, (IPTR) &data->ssd_EHN
159 return DoSuperMethodA(CLASS, self, (Msg) message);
162 IPTR Presentation__MUIM_HandleEvent
164 Class *CLASS, Object *self, struct MUIP_HandleEvent *message
167 if (message->imsg != NULL)
169 switch (message->imsg->Class)
171 case IDCMP_RAWKEY:
172 switch (message->imsg->Code)
174 case CURSORRIGHT:
175 /* Next slide --------------------------------------*/
178 self, MUIA_Group_ActivePage,
179 MUIV_Group_ActivePage_Next
181 break;
183 case CURSORLEFT:
184 /* Previous slide ----------------------------------*/
187 self, MUIA_Group_ActivePage,
188 MUIV_Group_ActivePage_Prev
190 break;
192 break;
196 return MUI_EventHandlerRC_Eat;
199 /*** Setup ******************************************************************/
200 ZUNE_CUSTOMCLASS_7
202 Presentation, NULL, MUIC_Group, NULL,
203 OM_NEW, struct opSet *,
204 OM_ADDMEMBER, struct opMember *,
205 OM_REMMEMBER, struct opMember *,
206 OM_SET, struct opSet *,
207 MUIM_Setup, struct MUIP_Setup *,
208 MUIM_Cleanup, struct MUIP_Cleanup *,
209 MUIM_HandleEvent, struct MUIP_HandleEvent *