2 Copyright (C) 2012, The AROS Development Team.
7 #include <aros/debug.h>
9 #include <proto/intuition.h>
10 #include <proto/utility.h>
11 #include <proto/muimaster.h>
12 #include <libraries/mui.h>
13 #include <devices/rawkeycodes.h>
14 #include <zune/customclasses.h>
17 #include <proto/alib.h>
20 #include "zunestuff.h"
22 IPTR
ClassListview__OM_NEW(struct IClass
*CLASS
, Object
*obj
, struct opSet
*message
)
24 struct ClassListview_DATA
*data
= NULL
;
26 obj
= (Object
*)DoSuperNewTags(CLASS
, obj
, NULL
,
27 TAG_MORE
, (IPTR
) message
->ops_AttrList
);
29 if (!obj
) return FALSE
;
31 data
= INST_DATA(CLASS
, obj
);
33 data
->list
= (Object
*)GetTagData(MUIA_Listview_List
, (IPTR
)NULL
, message
->ops_AttrList
);
35 data
->ehn
.ehn_Events
= IDCMP_RAWKEY
;
36 data
->ehn
.ehn_Priority
= 0;
37 data
->ehn
.ehn_Flags
= 0;
38 data
->ehn
.ehn_Object
= obj
;
39 data
->ehn
.ehn_Class
= CLASS
;
44 IPTR
ClassListview__MUIM_Setup(struct IClass
*CLASS
, Object
*obj
, struct MUIP_Setup
*message
)
46 struct ClassListview_DATA
*data
= INST_DATA(CLASS
, obj
);
48 if (!DoSuperMethodA(CLASS
, obj
, (Msg
) message
)) return (IPTR
)NULL
;
50 DoMethod(_win(obj
), MUIM_Window_AddEventHandler
, (IPTR
)&data
->ehn
);
55 IPTR
ClassListview__MUIM_Cleanup(struct IClass
*CLASS
, Object
*obj
, struct MUIP_Cleanup
*message
)
57 struct ClassListview_DATA
*data
= INST_DATA(CLASS
, obj
);
59 DoMethod(_win(obj
), MUIM_Window_RemEventHandler
, (IPTR
)&data
->ehn
);
61 return DoSuperMethodA(CLASS
, obj
, (Msg
)message
);
64 IPTR
ClassListview__MUIM_HandleEvent(struct IClass
*CLASS
, Object
*obj
, struct MUIP_HandleEvent
*message
)
66 struct ClassListview_DATA
*data
= INST_DATA(CLASS
, obj
);
67 IPTR retval
= MUI_EventHandlerRC_Eat
;
69 if ((message
->imsg
) && (message
->imsg
->Class
== IDCMP_RAWKEY
) && ((IPTR
)obj
== XGET(_win(obj
), MUIA_Window_ActiveObject
)))
71 switch(message
->imsg
->Code
)
74 SET(data
->list
, MUIA_List_Active
, MUIV_List_Active_Top
);
77 SET(data
->list
, MUIA_List_Active
, MUIV_List_Active_Bottom
);
80 SET(data
->list
, MUIA_List_Active
, MUIV_List_Active_PageUp
);
83 SET(data
->list
, MUIA_List_Active
, MUIV_List_Active_PageDown
);
86 SET(data
->list
, MUIA_List_Active
, MUIV_List_Active_Up
);
89 SET(data
->list
, MUIA_List_Active
, MUIV_List_Active_Down
);
102 BOOPSI_DISPATCHER(IPTR
, ClassListview_Dispatcher
, CLASS
, self
, message
)
104 switch (message
->MethodID
)
107 return ClassListview__OM_NEW(CLASS
, self
, (struct opSet
*)message
);
110 return ClassListview__MUIM_Setup(CLASS
, self
, (struct MUIP_Setup
*)message
);
113 return ClassListview__MUIM_Cleanup(CLASS
, self
, (struct MUIP_Cleanup
*)message
);
115 case MUIM_HandleEvent
:
116 return ClassListview__MUIM_HandleEvent(CLASS
, self
, (struct MUIP_HandleEvent
*)message
);
119 return DoSuperMethodA(CLASS
, self
, message
);
124 BOOPSI_DISPATCHER_END