2 Copyright © 2002-2016, The AROS Development Team. All rights reserved.
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>
15 extern struct Library
*MUIMasterBase
;
17 struct MUI_ListviewData
22 /****** Listview.mui/MUIA_Listview_DefClickColumn ****************************
25 * MUIA_Listview_DefClickColumn -- (V7) [ISG], LONG
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.
33 * MUIA_Listview_ClickColumn
35 ******************************************************************************
39 /****** Listview.mui/MUIA_Listview_DoubleClick *******************************
42 * MUIA_Listview_DoubleClick -- (V4) [..G], BOOL
45 * Set to TRUE when a list entry is double-clicked or the "press" key
46 * (usually return/enter) is received.
49 * MUIA_Listview_ClickColumn, MUIA_Listview_DefClickColumn,
50 * MUIA_Listview_SelectChange
52 ******************************************************************************
56 /****** Listview.mui/MUIA_Listview_DragType **********************************
59 * MUIA_Listview_DragType -- (V11) [ISG], LONG
62 * Specifies whether list entries can be dragged as part of a
63 * drag-and-drop operation. Two values can be used:
64 * MUIV_Listview_DragType_None: entries cannot be dragged
65 * MUIV_Listview_DragType_Immediate: entries can be dragged
68 * MUIA_Listview_DragSortable, MUIA_Draggable
70 ******************************************************************************
74 /**************************************************************************
76 **************************************************************************/
77 IPTR
Listview__OM_NEW(struct IClass
*cl
, Object
*obj
, struct opSet
*msg
)
79 struct MUI_ListviewData
*data
;
80 struct TagItem
*tag
, *tags
;
82 (Object
*) GetTagData(MUIA_Listview_List
, (IPTR
) NULL
,
88 obj
= (Object
*) DoSuperNewTags(cl
, obj
, NULL
,
89 MUIA_Group_Horiz
, TRUE
,
92 MUIA_Group_Spacing
, 0,
94 TAG_MORE
, msg
->ops_AttrList
);
99 data
= INST_DATA(cl
, obj
);
102 /* parse initial taglist, forward to list */
103 for (tags
= msg
->ops_AttrList
; (tag
= NextTagItem(&tags
));)
107 case MUIA_Listview_DefClickColumn
:
108 case MUIA_Listview_DragType
:
109 case MUIA_Listview_Input
:
110 case MUIA_Listview_MultiSelect
:
111 case MUIA_Listview_ScrollerPos
:
112 set(list
, tag
->ti_Tag
, tag
->ti_Data
);
120 /**************************************************************************
122 **************************************************************************/
123 IPTR
Listview__OM_GET(struct IClass
*cl
, Object
*obj
, struct opGet
*msg
)
125 /* small macro to simplify return value storage */
126 #define STORE *(msg->opg_Storage)
127 struct MUI_ListviewData
*data
= INST_DATA(cl
, obj
);
129 switch (msg
->opg_AttrID
)
131 case MUIA_List_CompareHook
:
132 case MUIA_List_ConstructHook
:
133 case MUIA_List_DestructHook
:
134 case MUIA_List_DisplayHook
:
135 case MUIA_List_VertProp_First
:
136 case MUIA_List_Format
:
137 case MUIA_List_VertProp_Entries
:
138 case MUIA_List_VertProp_Visible
:
139 case MUIA_List_Active
:
140 case MUIA_List_First
:
141 case MUIA_List_Visible
:
142 case MUIA_List_Entries
:
143 case MUIA_List_Quiet
:
144 case MUIA_Listview_ClickColumn
:
145 case MUIA_Listview_DefClickColumn
:
146 case MUIA_Listview_DoubleClick
:
147 case MUIA_Listview_DragType
:
148 case MUIA_Listview_SelectChange
:
149 return GetAttr(msg
->opg_AttrID
, data
->list
, msg
->opg_Storage
);
151 case MUIA_Listview_List
:
152 STORE
= (IPTR
) data
->list
;
156 return DoSuperMethodA(cl
, obj
, (Msg
) msg
);
160 static IPTR
RedirectNotify(struct IClass
*cl
, Object
*obj
, Msg msg
,
163 struct MUI_ListviewData
*data
= INST_DATA(cl
, obj
);
167 case MUIA_List_Active
:
168 case MUIA_List_AutoVisible
:
169 case MUIA_List_CompareHook
:
170 case MUIA_List_ConstructHook
:
171 case MUIA_List_DestructHook
:
172 case MUIA_List_DisplayHook
:
173 case MUIA_List_DragSortable
:
174 case MUIA_List_DropMark
:
175 case MUIA_List_Entries
:
176 case MUIA_List_First
:
177 case MUIA_List_Format
:
178 case MUIA_List_InsertPosition
:
179 case MUIA_List_MultiTestHook
:
180 case MUIA_List_Quiet
:
181 case MUIA_List_ShowDropMarks
:
182 case MUIA_List_Title
:
183 case MUIA_List_VertProp_Entries
:
184 case MUIA_List_VertProp_First
:
185 case MUIA_List_VertProp_Visible
:
186 case MUIA_List_Visible
:
187 case MUIA_Listview_ClickColumn
:
188 case MUIA_Listview_DoubleClick
:
189 case MUIA_Listview_SelectChange
:
190 return DoMethodA(data
->list
, msg
);
193 return DoSuperMethodA(cl
, obj
, msg
);
196 /**************************************************************************
198 **************************************************************************/
199 IPTR
Listview__MUIM_Notify(struct IClass
*cl
, Object
*obj
,
200 struct MUIP_Notify
*msg
)
202 if ((IPTR
)msg
->DestObj
== MUIV_Notify_Self
)
205 return RedirectNotify(cl
, obj
, (Msg
) msg
, msg
->TrigAttr
);
208 /**************************************************************************
210 **************************************************************************/
211 IPTR
Listview__MUIM_KillNotify(struct IClass
*cl
, Object
*obj
,
212 struct MUIP_KillNotify
*msg
)
214 return RedirectNotify(cl
, obj
, (Msg
) msg
, msg
->TrigAttr
);
217 /**************************************************************************
219 **************************************************************************/
220 IPTR
Listview__MUIM_KillNotifyObj(struct IClass
*cl
, Object
*obj
,
221 struct MUIP_KillNotifyObj
*msg
)
223 if ((IPTR
)msg
->dest
== MUIV_Notify_Self
)
226 return RedirectNotify(cl
, obj
, (Msg
) msg
, msg
->TrigAttr
);
229 /* Note that there is no OM_SET method here because this method will be
230 propagated to the list by the Group class (superclass of both List and
232 BOOPSI_DISPATCHER(IPTR
, Listview_Dispatcher
, cl
, obj
, msg
)
234 switch (msg
->MethodID
)
237 return Listview__OM_GET(cl
, obj
, (struct opGet
*)msg
);
239 return Listview__OM_NEW(cl
, obj
, (struct opSet
*)msg
);
241 return Listview__MUIM_Notify(cl
, obj
, (struct MUIP_Notify
*)msg
);
242 case MUIM_KillNotify
:
243 return Listview__MUIM_KillNotify(cl
, obj
,
244 (struct MUIP_KillNotify
*)msg
);
245 case MUIM_KillNotifyObj
:
246 return Listview__MUIM_KillNotifyObj(cl
, obj
,
247 (struct MUIP_KillNotifyObj
*)msg
);
248 case MUIM_List_Clear
:
249 case MUIM_List_CreateImage
:
250 case MUIM_List_DeleteImage
:
251 case MUIM_List_Exchange
:
252 case MUIM_List_GetEntry
:
253 case MUIM_List_Insert
:
254 case MUIM_List_InsertSingle
:
256 case MUIM_List_NextSelected
:
257 case MUIM_List_Redraw
:
258 case MUIM_List_Remove
:
259 case MUIM_List_Select
:
261 case MUIM_List_TestPos
:
263 struct MUI_ListviewData
*data
= INST_DATA(cl
, obj
);
265 return DoMethodA(data
->list
, msg
);
270 return DoSuperMethodA(cl
, obj
, msg
);
272 BOOPSI_DISPATCHER_END
277 const struct __MUIBuiltinClass _MUI_Listview_desc
=
281 sizeof(struct MUI_ListviewData
),
282 (void *) Listview_Dispatcher