Cleanup iconlist class in preperation of splitting to iconlist+icon classes, and...
[AROS.git] / workbench / system / Wanderer / iconwindow_drawerlist.c
bloba2a8a20c239fde3d739f96608f5ccf58f9601a43
1 /*
2 Copyright 2004-2009, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define ZCC_QUIET
8 #include "portable_macros.h"
10 #ifdef __AROS__
11 #define MUIMASTER_YES_INLINE_STDARG
12 #endif
14 #define TXTBUFF_LEN 1024
16 #ifdef __AROS__
17 #define DEBUG 0
18 #include <aros/debug.h>
19 #endif
21 #include <exec/types.h>
22 #include <libraries/mui.h>
24 #ifdef __AROS__
25 #include <zune/customclasses.h>
26 #else
27 #include <zune_AROS/customclasses.h>
28 #endif
31 #include <proto/utility.h>
33 #include <proto/graphics.h>
34 #include <proto/exec.h>
35 #include <proto/datatypes.h>
36 #include <proto/icon.h>
38 #include <dos/dos.h>
39 #include <proto/dos.h>
41 #include <stdio.h>
42 #include <string.h>
44 #include <intuition/screens.h>
45 #include <datatypes/pictureclass.h>
46 #include <clib/macros.h>
48 #if defined(__AMIGA__) && !defined(__PPC__)
49 #define NO_INLINE_STDARG
50 #endif
51 #ifndef _PROTO_INTUITION_H
52 #include <proto/intuition.h>
53 #endif
54 #include <proto/muimaster.h>
56 #include "Classes/iconlist.h"
57 #include "Classes/iconlist_attributes.h"
58 #include "Classes/icon_attributes.h"
60 #include "wanderer.h"
61 #include "wandererprefs.h"
62 #include "iconwindow.h"
63 #include "iconwindow_iconlist.h"
66 #ifndef __AROS__
67 #define DEBUG 1
69 #ifdef DEBUG
70 #define D(x) if (DEBUG) x
71 #ifdef __amigaos4__
72 #define bug DebugPrintF
73 #else
74 #define bug kprintf
75 #endif
76 #else
77 #define D(...)
78 #endif
79 #endif
81 extern struct IconWindow_BackFill_Descriptor *iconwindow_BackFill_Active;
83 #define WIWDLVERS 1
84 #define WIWDLREV 0
86 #define BG_DRAWFLAG 0xf00dd00f
88 /*** Instance Data **********************************************************/
90 struct IconWindowDrawerList_DATA
92 Object *iwidld_IconWindow;
93 struct RastPort *iwidld_RastPort;
94 struct MUI_EventHandlerNode iwidld_EventHandlerNode;
95 #ifdef __AROS__
96 struct Hook iwidld_ProcessIconListPrefs_hook;
97 #else
98 struct Hook *iwidld_ProcessIconListPrefs_hook;
99 #endif
101 IPTR iwidld_ViewPrefs_ID;
102 Object *iwidld_ViewPrefs_NotificationObject;
103 struct NotifyRequest iwidld_DrawerNotifyRequest;
106 static char __icwc_intern_TxtBuff[TXTBUFF_LEN];
108 /*** Macros *****************************************************************/
109 #define SETUP_INST_DATA struct IconWindowDrawerList_DATA *data = INST_DATA(CLASS, self)
111 /*** Hook functions *********************************************************/
112 ///IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc()
113 #ifdef __AROS__
114 AROS_UFH3(
115 void, IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc,
116 AROS_UFHA(struct Hook *, hook, A0),
117 AROS_UFHA(APTR *, obj, A2),
118 AROS_UFHA(IPTR *, param, A1)
121 #else
122 HOOKPROTO(IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc, void, APTR *obj, IPTR *param)
124 #endif
125 AROS_USERFUNC_INIT
127 /* Get our private data */
128 Object *self = ( Object *)obj;
129 IPTR CHANGED_ATTRIB = *param;
130 Class *CLASS = OCLASS(self);
132 SETUP_INST_DATA;
134 Object *prefs = NULL;
136 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__));
138 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
140 if (prefs)
142 IPTR attrib_Current, attrib_Prefs, prefs_Processing = 0;
143 BOOL options_changed = FALSE;
145 D(bug("[Wanderer:DrawerList] %s: Setting IconList options ..\n", __PRETTY_FUNCTION__));
147 GET(prefs, MUIA_WandererPrefs_Processing, &prefs_Processing);
149 switch (CHANGED_ATTRIB)
151 case MUIA_IconList_IconListMode:
152 GET(self, MUIA_IconList_IconListMode, &attrib_Current);
154 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_IconListMode)) != -1) &&
155 (attrib_Current != attrib_Prefs))
157 D(bug("[Wanderer:DrawerList] %s: IconList ListMode changed - updating ..\n", __PRETTY_FUNCTION__));
158 options_changed = TRUE;
159 if (prefs_Processing)
161 NNSET(self, MUIA_IconList_IconListMode, attrib_Prefs);
163 else
165 SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
168 break;
170 case MUIA_IconList_LabelText_Mode:
171 GET(self, MUIA_IconList_LabelText_Mode, &attrib_Current);
173 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_Mode)) != -1) &&
174 (attrib_Current != attrib_Prefs))
176 D(bug("[Wanderer:DrawerList] %s: IconList TextRenderMode changed - updating ..\n", __PRETTY_FUNCTION__));
177 options_changed = TRUE;
178 if (prefs_Processing)
180 NNSET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
182 else
184 SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
187 break;
189 case MUIA_IconList_LabelText_MaxLineLen:
190 GET(self, MUIA_IconList_LabelText_MaxLineLen, &attrib_Current);
192 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen)) != -1) &&
193 (attrib_Current != attrib_Prefs))
195 D(bug("[Wanderer:DrawerList] %s: IconList Max Text Length changed - updating ..\n", __PRETTY_FUNCTION__));
196 options_changed = TRUE;
197 if (prefs_Processing)
199 NNSET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
201 else
203 SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
206 break;
208 case MUIA_IconList_LabelText_MultiLine:
209 GET(self, MUIA_IconList_LabelText_MultiLine, &attrib_Current);
211 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine)) != -1) &&
212 (attrib_Current != attrib_Prefs))
214 D(bug("[Wanderer:DrawerList] %s: IconList Multi-Line changed - updating ..\n", __PRETTY_FUNCTION__));
215 options_changed = TRUE;
216 if (prefs_Processing)
218 NNSET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
220 else
222 SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
225 break;
227 case MUIA_IconList_LabelText_MultiLineOnFocus:
228 GET(self, MUIA_IconList_LabelText_MultiLineOnFocus, &attrib_Current);
230 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus)) != -1) &&
231 (attrib_Current != attrib_Prefs))
233 D(bug("[Wanderer:DrawerList] %s: Multi-Line on Focus changed - updating ..\n", __PRETTY_FUNCTION__));
234 options_changed = TRUE;
235 if (prefs_Processing)
237 NNSET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
239 else
241 SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
244 break;
246 case MUIA_IconList_Icon_HorizontalSpacing:
247 GET(self, MUIA_IconList_Icon_HorizontalSpacing, &attrib_Current);
249 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing)) != -1) &&
250 (attrib_Current != attrib_Prefs))
252 D(bug("[Wanderer:DrawerList] %s: Icon Horizontal Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
253 options_changed = TRUE;
254 if (prefs_Processing)
256 NNSET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
258 else
260 SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
263 break;
265 case MUIA_IconList_Icon_VerticalSpacing:
266 GET(self, MUIA_IconList_Icon_VerticalSpacing, &attrib_Current);
268 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing)) != -1) &&
269 (attrib_Current != attrib_Prefs))
271 D(bug("[Wanderer:DrawerList] %s: Icon Vertical Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
272 options_changed = TRUE;
273 if (prefs_Processing)
275 NNSET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
277 else
279 SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
282 break;
284 case MUIA_IconList_Icon_ImageSpacing:
285 GET(self, MUIA_IconList_Icon_ImageSpacing, &attrib_Current);
287 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing)) != -1) &&
288 (attrib_Current != attrib_Prefs))
290 D(bug("[Wanderer:DrawerList] %s: Icon Label Image Spacing changed - updating ..\n", __PRETTY_FUNCTION__));
291 options_changed = TRUE;
292 if (prefs_Processing)
294 NNSET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
296 else
298 SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
301 break;
303 case MUIA_IconList_LabelText_HorizontalPadding:
304 GET(self, MUIA_IconList_LabelText_HorizontalPadding, &attrib_Current);
306 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding)) != -1) &&
307 (attrib_Current != attrib_Prefs))
309 D(bug("[Wanderer:DrawerList] %s: Icon Label Horizontal Padding changed - updating ..\n", __PRETTY_FUNCTION__));
310 options_changed = TRUE;
311 if (prefs_Processing)
313 NNSET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
315 else
317 SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
320 break;
322 case MUIA_IconList_LabelText_VerticalPadding:
323 GET(self, MUIA_IconList_LabelText_VerticalPadding, &attrib_Current);
325 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding)) != -1) &&
326 (attrib_Current != attrib_Prefs))
328 D(bug("[Wanderer:DrawerList] %s: Icon Label Vertical Padding changed - updating ..\n", __PRETTY_FUNCTION__));
329 options_changed = TRUE;
330 if (prefs_Processing)
332 NNSET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
334 else
336 SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
339 break;
341 case MUIA_IconList_LabelText_BorderWidth:
342 GET(self, MUIA_IconList_LabelText_BorderWidth, &attrib_Current);
344 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth)) != -1) &&
345 (attrib_Current != attrib_Prefs))
347 D(bug("[Wanderer:DrawerList] %s: Icon Label Border Width changed - updating ..\n", __PRETTY_FUNCTION__));
348 options_changed = TRUE;
349 if (prefs_Processing)
351 NNSET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
353 else
355 SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
358 break;
360 case MUIA_IconList_LabelText_BorderHeight:
361 GET(self, MUIA_IconList_LabelText_BorderHeight, &attrib_Current);
363 if (((attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight)) != -1) &&
364 (attrib_Current != attrib_Prefs))
366 D(bug("[Wanderer:DrawerList] %s: Icon Label Border Height changed - updating ..\n", __PRETTY_FUNCTION__));
367 options_changed = TRUE;
368 if (prefs_Processing)
370 NNSET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
372 else
374 SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
377 break;
379 default:
380 D(bug("[Wanderer:DrawerList] %s: Unhandled change\n", __PRETTY_FUNCTION__));
381 break;
384 if (options_changed)
386 if (!(prefs_Processing))
388 D(bug("[Wanderer:DrawerList] %s: IconList Options have changed, causing an update ..\n", __PRETTY_FUNCTION__));
389 DoMethod(self, MUIM_IconList_Update);
391 else if (data->iwidld_IconWindow)
393 SET(data->iwidld_IconWindow, MUIA_IconWindow_Changed, TRUE);
397 AROS_USERFUNC_EXIT
399 #ifndef __AROS__
400 MakeStaticHook(Hook_ProcessIconListPrefsFunc, IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc);
401 #endif
405 /*** Methods ****************************************************************/
406 ///OM_NEW()
407 Object *IconWindowDrawerList__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
409 IPTR _newIconList__FSNotifyPort = 0;
411 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__));
413 _newIconList__FSNotifyPort = GetTagData(MUIA_Wanderer_FileSysNotifyPort, (IPTR) NULL, message->ops_AttrList);
415 self = (Object *) DoSuperNewTags
417 CLASS, self, NULL,
418 MUIA_CycleChain, 1,
419 TAG_MORE, (IPTR) message->ops_AttrList
422 if (self != NULL)
424 SETUP_INST_DATA;
425 D(bug("[Wanderer:DrawerList] %s: SELF @ 0x%p\n", __PRETTY_FUNCTION__, self));
427 #ifdef __AROS__
428 data->iwidld_ProcessIconListPrefs_hook.h_Entry = ( HOOKFUNC )IconWindowDrawerList__HookFunc_ProcessIconListPrefsFunc;
429 #else
430 data->iwidld_ProcessIconListPrefs_hook = &Hook_ProcessIconListPrefsFunc;
431 #endif
433 if (_newIconList__FSNotifyPort != 0)
435 struct IconWindowDrawerList_DATA *drawerlist_data = (struct IconWindowDrawerList_DATA *)data;
436 drawerlist_data->iwidld_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port = _newIconList__FSNotifyPort;
437 D(bug("[Wanderer:DrawerList] %s: FS Notify Port @ 0x%p\n", __PRETTY_FUNCTION__, _newIconList__FSNotifyPort));
441 return self;
445 ///OM_SET()
446 IPTR IconWindowDrawerList__OM_SET(Class *CLASS, Object *self, struct opSet *message)
448 SETUP_INST_DATA;
450 struct TagItem *tstate = message->ops_AttrList, *tag;
452 while ((tag = NextTagItem((const struct TagItem**)&tstate)) != NULL)
454 switch (tag->ti_Tag)
456 case MUIA_Background:
458 D(bug("[Wanderer:DrawerList] %s: MUIA_Background\n", __PRETTY_FUNCTION__));
459 break;
461 case MUIA_IconWindow_Window:
463 D(bug("[Wanderer:DrawerList] %s: MUIA_IconWindow_Window @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
464 data->iwidld_IconWindow = (Object *)tag->ti_Data;
465 break;
467 case MUIA_IconList_BufferRastport:
469 D(bug("[Wanderer:DrawerList] %s: MUIA_IconList_BufferRastport @ %p\n", __PRETTY_FUNCTION__, tag->ti_Data));
470 data->iwidld_RastPort = (struct RastPort *)tag->ti_Data;
471 break;
475 return DoSuperMethodA(CLASS, self, (Msg) message);
479 ///OM_GET()
480 IPTR IconWindowDrawerList__OM_GET(Class *CLASS, Object *self, struct opGet *message)
482 //SETUP_INST_DATA;
483 IPTR *store = message->opg_Storage;
484 IPTR rv = TRUE;
486 switch (message->opg_AttrID)
488 case MUIA_Version:
489 *store = (IPTR)WIWDLVERS;
490 break;
492 case MUIA_Revision:
493 *store = (IPTR)WIWDLREV;
494 break;
496 default:
497 rv = DoSuperMethodA(CLASS, self, (Msg) message);
500 return rv;
504 ///IconWindowDrawerList__MUIM_Setup()
505 IPTR IconWindowDrawerList__MUIM_Setup
507 Class *CLASS, Object *self, Msg message
510 SETUP_INST_DATA;
512 Object *prefs = NULL;
514 if (!DoSuperMethodA(CLASS, self, message)) return FALSE;
516 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
518 if (prefs)
520 /* Set our initial options */
521 IPTR attrib_Prefs;
523 GET(_win(self), MUIA_IconWindow_BackgroundAttrib, &data->iwidld_ViewPrefs_ID);
524 D(bug("[Wanderer:DrawerList] %s: Window Background = '%s'\n", __PRETTY_FUNCTION__, data->iwidld_ViewPrefs_ID));
525 data->iwidld_ViewPrefs_NotificationObject = (Object *)DoMethod(prefs,
526 MUIM_WandererPrefs_ViewSettings_GetNotifyObject,
527 data->iwidld_ViewPrefs_ID);
529 D(bug("[Wanderer:DrawerList] %s: Background Notification Obj @ 0x%p\n", __PRETTY_FUNCTION__, data->iwidld_ViewPrefs_NotificationObject));
531 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_IconListMode);
532 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_IconListMode))) SET(self, MUIA_IconList_IconListMode, attrib_Prefs);
534 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_Mode);
535 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_Mode))) SET(self, MUIA_IconList_LabelText_Mode, attrib_Prefs);
537 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_MaxLineLen);
538 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MaxLineLen))) SET(self, MUIA_IconList_LabelText_MaxLineLen, attrib_Prefs);
540 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLine);
541 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLine))) SET(self, MUIA_IconList_LabelText_MultiLine, attrib_Prefs);
543 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_MultiLineOnFocus);
544 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_MultiLineOnFocus))) SET(self, MUIA_IconList_LabelText_MultiLineOnFocus, attrib_Prefs);
546 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_Icon_HorizontalSpacing);
547 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_HorizontalSpacing))) SET(self, MUIA_IconList_Icon_HorizontalSpacing, attrib_Prefs);
549 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_Icon_VerticalSpacing);
550 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_VerticalSpacing))) SET(self, MUIA_IconList_Icon_VerticalSpacing, attrib_Prefs);
552 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_Icon_ImageSpacing);
553 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_Icon_ImageSpacing))) SET(self, MUIA_IconList_Icon_ImageSpacing, attrib_Prefs);
555 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_HorizontalPadding);
556 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_HorizontalPadding))) SET(self, MUIA_IconList_LabelText_HorizontalPadding, attrib_Prefs);
558 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_VerticalPadding);
559 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_VerticalPadding))) SET(self, MUIA_IconList_LabelText_VerticalPadding, attrib_Prefs);
561 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_BorderWidth);
562 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderWidth))) SET(self, MUIA_IconList_LabelText_BorderWidth, attrib_Prefs);
564 attrib_Prefs = DoMethod(prefs, MUIM_WandererPrefs_ViewSettings_GetAttribute, data->iwidld_ViewPrefs_ID, MUIA_IconList_LabelText_BorderHeight);
565 if ((attrib_Prefs != (IPTR)-1) && (attrib_Prefs != XGET(self, MUIA_IconList_LabelText_BorderHeight))) SET(self, MUIA_IconList_LabelText_BorderHeight, attrib_Prefs);
567 /* Configure notifications incase they get updated =) */
568 DoMethod
570 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_IconListMode, MUIV_EveryTime,
571 (IPTR) self, 3,
572 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_IconListMode
575 DoMethod
577 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_Mode, MUIV_EveryTime,
578 (IPTR) self, 3,
579 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_Mode
582 DoMethod
584 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MaxLineLen, MUIV_EveryTime,
585 (IPTR) self, 3,
586 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MaxLineLen
589 DoMethod
591 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLine, MUIV_EveryTime,
592 (IPTR) self, 3,
593 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLine
596 DoMethod
598 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_MultiLineOnFocus, MUIV_EveryTime,
599 (IPTR) self, 3,
600 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_MultiLineOnFocus
603 DoMethod
605 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_HorizontalSpacing, MUIV_EveryTime,
606 (IPTR) self, 3,
607 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_HorizontalSpacing
610 DoMethod
612 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_VerticalSpacing, MUIV_EveryTime,
613 (IPTR) self, 3,
614 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_VerticalSpacing
617 DoMethod
619 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_Icon_ImageSpacing, MUIV_EveryTime,
620 (IPTR) self, 3,
621 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_Icon_ImageSpacing
624 DoMethod
626 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_HorizontalPadding, MUIV_EveryTime,
627 (IPTR) self, 3,
628 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_HorizontalPadding
631 DoMethod
633 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_VerticalPadding, MUIV_EveryTime,
634 (IPTR) self, 3,
635 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_VerticalPadding
638 DoMethod
640 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderWidth, MUIV_EveryTime,
641 (IPTR) self, 3,
642 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderWidth
645 DoMethod
647 data->iwidld_ViewPrefs_NotificationObject, MUIM_Notify, MUIA_IconList_LabelText_BorderHeight, MUIV_EveryTime,
648 (IPTR) self, 3,
649 MUIM_CallHook, &data->iwidld_ProcessIconListPrefs_hook, (IPTR)MUIA_IconList_LabelText_BorderHeight
653 /* Setup notification on the directory -------------------------------- */
654 STRPTR directory_path = NULL;
655 GET(self, MUIA_IconDrawerList_Drawer, &directory_path);
657 if (directory_path != NULL)
659 struct IconWindowDrawerList_DATA *drawerlist_data = (struct IconWindowDrawerList_DATA *)data;
661 if (drawerlist_data->iwidld_DrawerNotifyRequest.nr_stuff.nr_Msg.nr_Port != NULL)
663 drawerlist_data->iwidld_DrawerNotifyRequest.nr_Name = directory_path;
664 drawerlist_data->iwidld_DrawerNotifyRequest.nr_Flags = NRF_SEND_MESSAGE;
665 drawerlist_data->iwidld_DrawerNotifyRequest.nr_UserData = self;
667 if (StartNotify(&drawerlist_data->iwidld_DrawerNotifyRequest))
669 D(bug("[Wanderer:DrawerList] %s: Drawer-notification setup on '%s'\n", __PRETTY_FUNCTION__, drawerlist_data->iwidld_DrawerNotifyRequest.nr_Name));
671 else
673 D(bug("[Wanderer:DrawerList] %s: FAILED to setup Drawer-notification!\n", __PRETTY_FUNCTION__));
674 drawerlist_data->iwidld_DrawerNotifyRequest.nr_Name = NULL;
679 D(bug("[Wanderer:DrawerList] %s: Setup complete!\n", __PRETTY_FUNCTION__));
681 return TRUE;
685 ///IconWindowDrawerList__MUIM_Cleanup()
686 IPTR IconWindowDrawerList__MUIM_Cleanup
688 Class *CLASS, Object *self, Msg message
691 SETUP_INST_DATA;
693 Object *prefs = NULL;
695 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__));
697 GET(_app(self), MUIA_Wanderer_Prefs, &prefs);
699 if (prefs)
701 DoMethod
703 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_IconListMode, (IPTR)self
706 DoMethod
708 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_Mode, (IPTR)self
711 DoMethod
713 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MaxLineLen, (IPTR)self
716 DoMethod
718 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLine, (IPTR)self
721 DoMethod
723 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_MultiLineOnFocus, (IPTR)self
726 DoMethod
728 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_HorizontalSpacing, (IPTR)self
731 DoMethod
733 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_VerticalSpacing, (IPTR)self
736 DoMethod
738 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_Icon_ImageSpacing, (IPTR)self
741 DoMethod
743 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_HorizontalPadding, (IPTR)self
746 DoMethod
748 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_VerticalPadding, (IPTR)self
751 DoMethod
753 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderWidth, (IPTR)self
756 DoMethod
758 data->iwidld_ViewPrefs_NotificationObject, MUIM_KillNotifyObj, MUIA_IconList_LabelText_BorderHeight, (IPTR)self
762 struct IconWindowDrawerList_DATA *drawerlist_data = (struct IconWindowDrawerList_DATA *)data;
763 if (drawerlist_data->iwidld_DrawerNotifyRequest.nr_Name != NULL)
765 D(bug("[Wanderer:DrawerList] %s: Removing Drawer FS Notification Request\n", __PRETTY_FUNCTION__));
766 EndNotify(&drawerlist_data->iwidld_DrawerNotifyRequest);
769 return DoSuperMethodA(CLASS, self, message);
773 ///IconWindowDrawerList__MUIM_DrawBackground()
774 IPTR IconWindowDrawerList__MUIM_DrawBackground
776 Class *CLASS, Object *self, struct MUIP_DrawBackground *message
779 SETUP_INST_DATA;
781 IPTR retVal = (IPTR)TRUE;
782 IPTR clip = 0;
783 struct RastPort *DrawBackGround_RastPort;
784 struct IconWindowBackFillMsg DrawBackGround_BackFillMsg;
786 D(bug("[Wanderer:DrawerList]: %s()\n", __PRETTY_FUNCTION__));
788 if ((iconwindow_BackFill_Active == NULL) ||
789 (data->iwidld_IconWindow == NULL))
791 D(bug("[Wanderer:DrawerList] %s: No Backfill support/Window not set .. causing parent class to render\n", __PRETTY_FUNCTION__));
792 goto iwc_ParentBackground;
795 DrawBackGround_RastPort = _rp(self);
797 if ((data->iwidld_RastPort != NULL) && (DrawBackGround_RastPort != data->iwidld_RastPort))
799 DrawBackGround_RastPort = data->iwidld_RastPort;
801 DrawBackGround_BackFillMsg.AreaBounds.MinX = 0;
802 DrawBackGround_BackFillMsg.AreaBounds.MinY = 0;
803 DrawBackGround_BackFillMsg.AreaBounds.MaxX = _mwidth(self);
804 DrawBackGround_BackFillMsg.AreaBounds.MaxY = _mheight(self);
806 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left - _mleft(self);
807 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top - _mtop(self);
808 DrawBackGround_BackFillMsg.DrawBounds.MaxX = message->width;
809 DrawBackGround_BackFillMsg.DrawBounds.MaxY = message->height;
811 else
813 DrawBackGround_BackFillMsg.AreaBounds.MinX = _mleft(self);
814 DrawBackGround_BackFillMsg.AreaBounds.MinY = _mtop(self);
815 DrawBackGround_BackFillMsg.AreaBounds.MaxX = (_mleft(self) + _mwidth(self));
816 DrawBackGround_BackFillMsg.AreaBounds.MaxY = (_mtop(self) + _mheight(self));
818 DrawBackGround_BackFillMsg.DrawBounds.MinX = message->left;
819 DrawBackGround_BackFillMsg.DrawBounds.MinY = message->top;
820 DrawBackGround_BackFillMsg.DrawBounds.MaxX = (message->left + message->width);
821 DrawBackGround_BackFillMsg.DrawBounds.MaxY = (message->top + message->height);
824 DrawBackGround_BackFillMsg.Layer = DrawBackGround_RastPort->Layer;
826 /* Offset into source image (ala scroll bar position) */
827 DrawBackGround_BackFillMsg.OffsetX = message->xoffset;
828 DrawBackGround_BackFillMsg.OffsetY = message->yoffset;
830 D(bug("[Wanderer:DrawerList] %s: RastPort @ 0x%p\n", __PRETTY_FUNCTION__, DrawBackGround_RastPort));
832 if ((retVal = DoMethod(data->iwidld_IconWindow, MUIM_IconWindow_BackFill_DrawBackground, XGET(data->iwidld_IconWindow, MUIA_IconWindow_BackFillData), &DrawBackGround_BackFillMsg, DrawBackGround_RastPort)) == (IPTR)TRUE)
834 D(bug("[Wanderer:DrawerList] %s: Backfill module rendered background ..\n", __PRETTY_FUNCTION__));
835 return retVal;
837 D(bug("[Wanderer:DrawerList] %s: Backfill module failed to render background ..\n", __PRETTY_FUNCTION__));
839 iwc_ParentBackground:
841 clip = (IPTR)MUI_AddClipping(muiRenderInfo(self), message->left, message->top, message->width, message->height);
843 message->width = _mwidth(self);
844 message->height = _mheight(self);
845 message->left = _mleft(self);
846 message->top = _mtop(self);
848 retVal = DoSuperMethodA(CLASS, self, (Msg) message);
850 MUI_RemoveClipping(muiRenderInfo(self), (APTR)clip);
852 return retVal;
856 ///IconWindowDrawerList__MUIM_IconList_Update()
857 IPTR IconWindowDrawerList__MUIM_IconList_Update
859 Class *CLASS, Object *self, struct MUIP_IconList_Update *message
862 SETUP_INST_DATA;
864 IPTR retVal = (IPTR)TRUE;
866 // DoMethod(self, MUIM_IconList_Clear);
868 return retVal;
871 /*** Setup ******************************************************************/
872 #ifdef __AROS__
873 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
875 IconWindowDrawerList, NULL, MUIC_IconDrawerList, NULL,
876 OM_NEW, struct opSet *,
877 OM_SET, struct opSet *,
878 OM_GET, struct opGet *,
879 MUIM_Setup, Msg,
880 MUIM_Cleanup, Msg,
881 MUIM_DrawBackground, Msg
883 #else
884 ICONWINDOWICONDRAWERLIST_CUSTOMCLASS
886 IconWindowDrawerList, NULL, NULL, IconDrawerList_Class,
887 OM_NEW, struct opSet *,
888 OM_SET, struct opSet *,
889 OM_GET, struct opGet *,
890 MUIM_Setup, Msg,
891 MUIM_Cleanup, Msg,
892 MUIM_DrawBackground, Msg
894 #endif