Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / libs / muimaster / classes / listview.c
blob5cca0fa526085ec5568da561144d49af619d4e31
1 /*
2 Copyright © 2002-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <aros/debug.h>
8 #include <clib/alib_protos.h>
9 #include <proto/utility.h>
10 #include <proto/intuition.h>
11 #include <proto/muimaster.h>
13 #include "mui.h"
15 extern struct Library *MUIMasterBase;
17 struct MUI_ListviewData
19 Object *list;
22 /****** Listview.mui/MUIA_Listview_DefClickColumn ****************************
24 * NAME
25 * MUIA_Listview_DefClickColumn -- (V7) [ISG], LONG
27 * FUNCTION
28 * The default value to be returned for MUIA_Listview_ClickColumn when a
29 * list entry is "double clicked" by pressing the "press" key (usually
30 * return/enter). The default default is zero.
32 * SEE ALSO
33 * MUIA_Listview_ClickColumn
35 ******************************************************************************
39 /****** Listview.mui/MUIA_Listview_DoubleClick *******************************
41 * NAME
42 * MUIA_Listview_DoubleClick -- (V4) [I.G], BOOL
44 * FUNCTION
45 * Set to TRUE when a list entry is double-clicked or the "press" key
46 * (usually return/enter) is received.
48 * SEE ALSO
49 * MUIA_Listview_ClickColumn, MUIA_Listview_DefClickColumn,
50 * MUIA_Listview_SelectChange
52 ******************************************************************************
56 /**************************************************************************
57 OM_NEW
58 **************************************************************************/
59 IPTR Listview__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg)
61 struct MUI_ListviewData *data;
62 struct TagItem *tag, *tags;
63 Object *list =
64 (Object *) GetTagData(MUIA_Listview_List, (IPTR) NULL,
65 msg->ops_AttrList);
67 if (!list)
68 return (IPTR) NULL;
70 obj = (Object *) DoSuperNewTags(cl, obj, NULL,
71 MUIA_Group_Horiz, TRUE,
72 MUIA_InnerLeft, 0,
73 MUIA_InnerRight, 0,
74 MUIA_Group_Spacing, 0,
75 Child, list,
76 TAG_MORE, msg->ops_AttrList);
78 if (!obj)
79 return (IPTR) NULL;
81 data = INST_DATA(cl, obj);
82 data->list = list;
84 /* parse initial taglist, forward to list */
85 for (tags = msg->ops_AttrList; (tag = NextTagItem(&tags));)
87 switch (tag->ti_Tag)
89 case MUIA_Listview_DoubleClick:
90 case MUIA_Listview_Input:
91 case MUIA_Listview_MultiSelect:
92 case MUIA_Listview_ScrollerPos:
93 set(list, tag->ti_Tag, tag->ti_Data);
94 break;
98 return (IPTR) obj;
101 /**************************************************************************
102 OM_GET
103 **************************************************************************/
104 IPTR Listview__OM_GET(struct IClass *cl, Object *obj, struct opGet *msg)
106 /* small macro to simplify return value storage */
107 #define STORE *(msg->opg_Storage)
108 struct MUI_ListviewData *data = INST_DATA(cl, obj);
110 switch (msg->opg_AttrID)
112 case MUIA_List_CompareHook:
113 case MUIA_List_ConstructHook:
114 case MUIA_List_DestructHook:
115 case MUIA_List_DisplayHook:
116 case MUIA_List_VertProp_First:
117 case MUIA_List_Format:
118 case MUIA_List_VertProp_Entries:
119 case MUIA_List_VertProp_Visible:
120 case MUIA_List_Active:
121 case MUIA_List_First:
122 case MUIA_List_Visible:
123 case MUIA_List_Entries:
124 case MUIA_List_Quiet:
125 case MUIA_Listview_ClickColumn:
126 case MUIA_Listview_DoubleClick:
127 case MUIA_Listview_SelectChange:
128 return GetAttr(msg->opg_AttrID, data->list, msg->opg_Storage);
130 case MUIA_Listview_List:
131 STORE = (IPTR) data->list;
132 return 1;
135 return DoSuperMethodA(cl, obj, (Msg) msg);
136 #undef STORE
139 static IPTR RedirectNotify(struct IClass *cl, Object *obj, Msg msg,
140 ULONG attr)
142 struct MUI_ListviewData *data = INST_DATA(cl, obj);
144 switch (attr)
146 case MUIA_List_Active:
147 case MUIA_List_AutoVisible:
148 case MUIA_List_CompareHook:
149 case MUIA_List_ConstructHook:
150 case MUIA_List_DestructHook:
151 case MUIA_List_DisplayHook:
152 case MUIA_List_DragSortable:
153 case MUIA_List_DropMark:
154 case MUIA_List_Entries:
155 case MUIA_List_First:
156 case MUIA_List_Format:
157 case MUIA_List_InsertPosition:
158 case MUIA_List_MultiTestHook:
159 case MUIA_List_Quiet:
160 case MUIA_List_ShowDropMarks:
161 case MUIA_List_Title:
162 case MUIA_List_VertProp_Entries:
163 case MUIA_List_VertProp_First:
164 case MUIA_List_VertProp_Visible:
165 case MUIA_List_Visible:
166 case MUIA_Listview_ClickColumn:
167 case MUIA_Listview_DoubleClick:
168 case MUIA_Listview_SelectChange:
169 return DoMethodA(data->list, msg);
172 return DoSuperMethodA(cl, obj, msg);
175 /**************************************************************************
176 MUIM_Notify
177 **************************************************************************/
178 IPTR Listview__MUIM_Notify(struct IClass *cl, Object *obj,
179 struct MUIP_Notify *msg)
181 if ((IPTR)msg->DestObj == MUIV_Notify_Self)
182 msg->DestObj = obj;
184 return RedirectNotify(cl, obj, (Msg) msg, msg->TrigAttr);
187 /**************************************************************************
188 MUIM_KillNotify
189 **************************************************************************/
190 IPTR Listview__MUIM_KillNotify(struct IClass *cl, Object *obj,
191 struct MUIP_KillNotify *msg)
193 return RedirectNotify(cl, obj, (Msg) msg, msg->TrigAttr);
196 /**************************************************************************
197 MUIM_KillNotifyObj
198 **************************************************************************/
199 IPTR Listview__MUIM_KillNotifyObj(struct IClass *cl, Object *obj,
200 struct MUIP_KillNotifyObj *msg)
202 if ((IPTR)msg->dest == MUIV_Notify_Self)
203 msg->dest = obj;
205 return RedirectNotify(cl, obj, (Msg) msg, msg->TrigAttr);
208 BOOPSI_DISPATCHER(IPTR, Listview_Dispatcher, cl, obj, msg)
210 switch (msg->MethodID)
212 case OM_GET:
213 return Listview__OM_GET(cl, obj, (struct opGet *)msg);
214 case OM_NEW:
215 return Listview__OM_NEW(cl, obj, (struct opSet *)msg);
216 case MUIM_Notify:
217 return Listview__MUIM_Notify(cl, obj, (struct MUIP_Notify *)msg);
218 case MUIM_KillNotify:
219 return Listview__MUIM_KillNotify(cl, obj,
220 (struct MUIP_KillNotify *)msg);
221 case MUIM_KillNotifyObj:
222 return Listview__MUIM_KillNotifyObj(cl, obj,
223 (struct MUIP_KillNotifyObj *)msg);
224 case MUIM_List_Clear:
225 case MUIM_List_CreateImage:
226 case MUIM_List_DeleteImage:
227 case MUIM_List_Exchange:
228 case MUIM_List_GetEntry:
229 case MUIM_List_Insert:
230 case MUIM_List_InsertSingle:
231 case MUIM_List_Jump:
232 case MUIM_List_NextSelected:
233 case MUIM_List_Redraw:
234 case MUIM_List_Remove:
235 case MUIM_List_Select:
236 case MUIM_List_Sort:
237 case MUIM_List_TestPos:
239 struct MUI_ListviewData *data = INST_DATA(cl, obj);
241 return DoMethodA(data->list, msg);
246 return DoSuperMethodA(cl, obj, msg);
248 BOOPSI_DISPATCHER_END
251 * Class descriptor.
253 const struct __MUIBuiltinClass _MUI_Listview_desc =
255 MUIC_Listview,
256 MUIC_Group,
257 sizeof(struct MUI_ListviewData),
258 (void *) Listview_Dispatcher