2 Copyright © 1995-2003, The AROS Development Team. All rights reserved.
6 #define MUIMASTER_YES_INLINE_STDARG
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <exec/memory.h>
13 #include <libraries/mui.h>
15 #include <proto/exec.h>
16 #include <proto/dos.h>
17 #include <proto/graphics.h>
18 #include <proto/intuition.h>
19 #include <proto/layers.h>
20 #include <proto/muimaster.h>
21 #include <proto/utility.h>
23 #include "desktop_intern.h"
24 #include "presentation.h"
25 #include "iconcontainerclass.h"
26 #include "iconclass.h"
28 #include "desktop_intern_protos.h"
33 static ULONG
DoSetupMethod(Object
* obj
, struct MUI_RenderInfo
*info
)
36 MUI set the correct render info *before* it calls MUIM_Setup so please
37 only use this function instead of DoMethodA()
39 muiRenderInfo(obj
) = info
;
41 return DoMethod(obj
, MUIM_Setup
, (IPTR
) info
);
44 IPTR
iconConNew(Class
* cl
, Object
* obj
, struct opSet
*ops
)
47 struct IconContainerClassData
*data
;
49 *tstate
= ops
->ops_AttrList
;
52 BYTE viewMode
= ICAVM_LARGE
;
54 while ((tag
= NextTagItem(&tstate
)) != NULL
)
58 case ICA_VertScroller
:
59 vert
= (Object
*) tag
->ti_Data
;
62 case ICA_HorizScroller
:
63 horiz
= (Object
*) tag
->ti_Data
;
67 viewMode
= tag
->ti_Data
;
71 continue; /* Don't supress non-processed tags */
74 tag
->ti_Tag
= TAG_IGNORE
;
77 retval
= DoSuperMethodA(cl
, obj
, (Msg
) ops
);
81 obj
= (Object
*) retval
;
82 data
= INST_DATA(cl
, obj
);
84 data
->perfectLayout
= TRUE
;
85 data
->thisColumnWidth
= 0;
86 data
->thisColumnHeight
= 0;
87 data
->virtualWidth
= 0;
88 data
->virtualHeight
= 0;
91 data
->visibleWidth
= 0;
92 data
->visibleHeight
= 0;
93 data
->heightAdjusted
= 0;
94 data
->widthAdjusted
= 0;
95 data
->horizScroll
= FALSE
;
96 data
->vertScroll
= FALSE
;
97 data
->horizProp
= horiz
;
98 data
->vertProp
= vert
;
100 data
->ehn
.ehn_Priority
= 0;
101 data
->ehn
.ehn_Flags
= (1 << 1);
102 data
->ehn
.ehn_Object
= obj
;
103 data
->ehn
.ehn_Class
= NULL
;
104 data
->ehn
.ehn_Events
= IDCMP_MOUSEBUTTONS
;
105 data
->viewMode
= viewMode
;
107 data
->columns
= AllocVec(sizeof(struct DetailColumn
) * 4, MEMF_ANY
);
108 data
->columns
[0].dc_Content
= IA_Label
;
109 data
->columns
[0].dc_X
= 0;
110 data
->columns
[0].dc_Width
= 120;
111 data
->columns
[1].dc_Content
= IA_Size
;
112 data
->columns
[1].dc_X
= 121;
113 data
->columns
[1].dc_Width
= 60;
114 data
->columns
[2].dc_Content
= IA_Type
;
115 data
->columns
[2].dc_X
= 182;
116 data
->columns
[2].dc_Width
= 80;
117 data
->columns
[3].dc_Content
= IA_LastModified
;
118 data
->columns
[3].dc_X
= 263;
119 data
->columns
[3].dc_Width
= 160;
121 data
->numColumns
= 4;
127 IPTR
iconConSetup(Class
* cl
, Object
* obj
, struct MUIP_Setup
* msg
)
130 //struct MemberNode *mn;
131 struct IconContainerClassData
*data
;
133 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
135 // the superclass will send the method to the memberlist
136 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
139 DoSetupMethod(data
->horizProp
, msg
->RenderInfo
);
142 DoSetupMethod(data
->vertProp
, msg
->RenderInfo
);
144 DoMethod(_win(obj
), MUIM_Window_AddEventHandler
, (IPTR
) &data
->ehn
);
149 IPTR
iconConCleanup(Class
* cl
, Object
* obj
, struct MUIP_Cleanup
* msg
)
152 struct IconContainerClassData
*data
;
154 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
156 DoMethod(obj
, MUIM_Window_RemEventHandler
, (IPTR
) &data
->ehn
);
158 // the superclass will send this method to the memberlist
159 retval
= DoSuperMethodA(cl
, obj
, msg
);
164 IPTR
iconConShow(Class
* cl
, Object
* obj
, Msg msg
)
167 //struct MemberNode *mn;
168 struct IconContainerClassData
*data
;
170 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
172 // the superclass will send this method to the memberlist
173 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
176 DoMethod(data
->horizProp
, MUIM_Show
);
179 DoMethod(data
->vertProp
, MUIM_Show
);
184 IPTR
iconConAskMinMax(Class
* cl
, Object
* obj
, struct MUIP_AskMinMax
* msg
)
187 struct MUI_MinMax minMax
;
188 struct IconContainerClassData
*data
;
190 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
192 // the superclass will send this method to the memberlist
193 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
195 msg
->MinMaxInfo
->MinWidth
+= 20;
196 msg
->MinMaxInfo
->DefWidth
+= 300;
197 msg
->MinMaxInfo
->MaxWidth
= MUI_MAXMAX
;
198 msg
->MinMaxInfo
->MinHeight
+= 20;
199 msg
->MinMaxInfo
->DefHeight
+= 300;
200 msg
->MinMaxInfo
->MaxHeight
= MUI_MAXMAX
;
207 minMax
.MinHeight
= 0;
208 minMax
.DefHeight
= 0;
209 minMax
.MaxHeight
= 0;
210 DoMethod(data
->vertProp
, MUIM_AskMinMax
, (IPTR
) &minMax
);
218 minMax
.MinHeight
= 0;
219 minMax
.DefHeight
= 0;
220 minMax
.MaxHeight
= 0;
221 DoMethod(data
->horizProp
, MUIM_AskMinMax
, (IPTR
) &minMax
);
227 BOOL
canLay(Object
* parent
, Object
* newObject
, ULONG newX
, ULONG newY
,
228 struct MinList
* memberList
, struct IconContainerClassData
* data
)
230 struct MemberNode
*mn
;
232 if (_memberCount(parent
) != 1)
234 mn
= (struct MemberNode
*) _memberList(parent
).mlh_Head
;
235 while (mn
->m_Node
.mln_Succ
)
238 ((newX
< _left(mn
->m_Object
) || newX
> _right(mn
->m_Object
))
239 && (newY
< _top(mn
->m_Object
)
240 || newY
> _bottom(mn
->m_Object
))
241 && (newX
+ _defwidth(mn
->m_Object
) < _left(mn
->m_Object
)
242 || newX
+ _defwidth(mn
->m_Object
) > _right(mn
->m_Object
))
243 && (newY
+ _defheight(mn
->m_Object
) < _top(mn
->m_Object
)
244 || newY
+ _defheight(mn
->m_Object
) >
245 _bottom(mn
->m_Object
))))
250 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
261 // lay out a newly added icon
262 ULONG
layoutObject(struct IconContainerClassData
* data
, Object
* obj
,
270 if (data
->viewMode
== ICAVM_DETAIL
)
273 if (_memberCount(obj
) == 1)
276 newY
= _bottom(data
->last
) + ICONSPACINGY
- _mtop(obj
);
277 if (newX
+ _defwidth(newObject
) + ICONSPACINGX
> data
->virtualWidth
)
278 data
->virtualWidth
= newX
+ _defwidth(newObject
) + ICONSPACINGX
;
280 if (newY
+ _defheight(newObject
) + ICONSPACINGY
> data
->virtualHeight
)
281 data
->virtualHeight
= newY
+ _defheight(newObject
) + ICONSPACINGX
;
283 MUI_Layout(newObject
, newX
, newY
, _defwidth(newObject
),
284 _defheight(newObject
), 0);
288 if (data
->perfectLayout
)
290 if (_memberCount(obj
) == 1)
295 // data->virtualWidth=_defwidth(newObject)+ICONSPACINGX;
296 data
->thisColumnWidth
= _defwidth(newObject
);
300 newX
= _left(data
->last
) - _mleft(obj
);
301 newY
= _bottom(data
->last
) + ICONSPACINGY
- _mtop(obj
);
302 if (newY
+ _defheight(newObject
) > _mheight(obj
))
305 newX
+= data
->thisColumnWidth
+ ICONSPACINGX
;
307 // data->virtualWidth+=(_defwidth(newObject)+ICONSPACINGX);
308 data
->thisColumnHeight
= 0;
309 data
->thisColumnWidth
= 0;
312 if (_defwidth(newObject
) > data
->thisColumnWidth
)
314 // data->virtualWidth+=(_defwidth(newObject)-data->thisColumnWidth);
315 data
->thisColumnWidth
= _defwidth(newObject
);
319 data
->thisColumnHeight
+= (ICONSPACINGY
+ _defheight(newObject
));
320 // if(data->thisColumnHeight+_defheight(newObject)+ICONSPACINGY >
321 // data->virtualHeight)
322 // data->virtualHeight+=data->thisColumnHeight;
326 struct MemberNode
*mn
;
333 canLay(obj
, newObject
, newX
, newY
, &(_memberList(obj
)), data
);
335 mn
= (struct MemberNode
*) _memberList(obj
).mlh_Head
;
336 while (mn
->m_Node
.mln_Succ
&& !laid
)
338 newX
= _left(mn
->m_Object
) - _mleft(obj
);
339 newY
= _bottom(mn
->m_Object
) + ICONSPACINGY
- _mtop(obj
);
341 // will the icon go off the bottom of the screen?
342 if ((newY
+ _defwidth(newObject
) > _mheight(obj
))
343 && _mheight(obj
) > _defheight(newObject
))
345 newX
+= _width(mn
->m_Object
) + ICONSPACINGX
;
350 canLay(obj
, newObject
, newX
, newY
, &(_memberList(obj
)),
353 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
359 if (newX
+ _defwidth(newObject
) + ICONSPACINGX
>
362 newX
+ _defwidth(newObject
+ ICONSPACINGX
);
364 if (newY
+ _defheight(newObject
) + ICONSPACINGY
>
366 data
->virtualHeight
=
367 newY
+ _defheight(newObject
) + ICONSPACINGX
;
369 MUI_Layout(newObject
, newX
, newY
, _defwidth(newObject
),
370 _defheight(newObject
), 0);
374 data
->last
= newObject
;
380 ULONG
iconConLayout(Class
* cl
, Object
* obj
, Msg msg
)
383 struct IconContainerClassData
*data
;
385 data
= INST_DATA(cl
, obj
);
386 retval
= DoSuperMethodA(cl
, obj
, msg
);
388 if (data
->visibleHeight
== 0)
391 SetAttrs(data
->horizProp
, MUIA_Prop_Visible
, _mwidth(obj
), TAG_END
);
392 SetAttrs(data
->vertProp
, MUIA_Prop_Visible
, _mheight(obj
), TAG_END
);
396 if (data
->visibleHeight
!= _mheight(obj
))
399 data
->heightAdjusted
= _mheight(obj
) - data
->visibleHeight
;
402 if (data
->visibleWidth
!= _mwidth(obj
))
405 data
->widthAdjusted
= _mwidth(obj
) - data
->visibleWidth
;
413 IPTR
iconConAdd(Class
* cl
, Object
* obj
, struct opMember
* msg
)
415 struct IconContainerClassData
*data
;
416 //struct MemberNode *mn;
418 struct MUI_MinMax minMax
;
424 minMax
.MinHeight
= 0;
425 minMax
.DefHeight
= 0;
426 minMax
.MaxHeight
= 0;
428 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
430 DoSuperMethodA(cl
, obj
, (Msg
)msg
);
432 DoSetupMethod(msg
->opam_Object
, muiRenderInfo(obj
));
434 DoMethod(msg
->opam_Object
, MUIM_AskMinMax
, (IPTR
) &minMax
);
436 _minwidth(msg
->opam_Object
) = minMax
.MinWidth
;
437 _minheight(msg
->opam_Object
) = minMax
.MinHeight
;
438 _maxwidth(msg
->opam_Object
) = minMax
.MaxWidth
;
439 _maxheight(msg
->opam_Object
) = minMax
.MaxHeight
;
440 _defwidth(msg
->opam_Object
) = minMax
.DefWidth
;
441 _defheight(msg
->opam_Object
) = minMax
.DefHeight
;
443 layoutObject(data
, obj
, msg
->opam_Object
);
445 DoMethod(msg
->opam_Object
, MUIM_Show
);
448 MUI_AddClipping(muiRenderInfo(obj
), _mleft(obj
), _mtop(obj
),
449 _mwidth(obj
), _mheight(obj
));
450 MUI_Redraw(msg
->opam_Object
, MADF_DRAWOBJECT
);
451 MUI_RemoveClipping(muiRenderInfo(obj
), clip
);
452 // _memberCount(obj)++;
453 // AddTail((struct List *) &(_memberList(obj)), (struct Node *) mn);
454 SetAttrs(data
->horizProp
, MUIA_Prop_Entries
, data
->virtualWidth
, TAG_END
);
455 SetAttrs(data
->vertProp
, MUIA_Prop_Entries
, data
->virtualHeight
, TAG_END
);
460 void redrawRectangle(LONG x1
, LONG y1
, LONG x2
, LONG y2
, Object
* obj
,
461 struct IconContainerClassData
*data
)
463 struct MemberNode
*mn
;
465 mn
= (struct MemberNode
*) _memberList(obj
).mlh_Head
;
466 while (mn
->m_Node
.mln_Succ
)
468 // check to see if the left or right edge is in the damaged
469 // area - also, check to see whether an object is in the area where
470 // both edges are to the left and right of the damaged area
471 if ((_mleft(mn
->m_Object
) >= x1
&& _mleft(mn
->m_Object
) <= x2
) ||
472 (_mright(mn
->m_Object
) >= x1
&& _mright(mn
->m_Object
) <= x2
) ||
473 (_mleft(mn
->m_Object
) <= x1
&& _mright(mn
->m_Object
) >= x2
))
475 // as above, except with the top and bottom edges of the member
477 if ((_mtop(mn
->m_Object
) >= y1
&& _mtop(mn
->m_Object
) <= y2
) ||
478 (_mbottom(mn
->m_Object
) >= y1
&& _mbottom(mn
->m_Object
) <= y2
)
479 || (_mtop(mn
->m_Object
) <= y1
480 && _mbottom(mn
->m_Object
) >= y2
))
482 MUI_Redraw(mn
->m_Object
, MADF_DRAWOBJECT
);
486 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
490 IPTR
drawAll(Class
* cl
, Object
* obj
, struct MUIP_Draw
*msg
,
491 struct IconContainerClassData
*data
)
494 struct MemberNode
*mn
;
498 MUI_AddClipping(muiRenderInfo(obj
), _mleft(obj
), _mtop(obj
),
499 _mwidth(obj
), _mheight(obj
));
501 if (data
->widthAdjusted
!= 0)
503 if (data
->widthAdjusted
> 0)
504 redrawRectangle(_mright(obj
) - data
->widthAdjusted
, _mtop(obj
),
505 _mright(obj
), _mbottom(obj
), obj
, data
);
506 SetAttrs(data
->horizProp
, MUIA_Prop_Visible
, _mwidth(obj
), TAG_END
);
509 if (data
->heightAdjusted
!= 0)
511 if (data
->heightAdjusted
> 0)
512 redrawRectangle(_mleft(obj
), _mbottom(obj
) - data
->heightAdjusted
,
513 _mright(obj
), _mbottom(obj
), obj
, data
);
514 SetAttrs(data
->vertProp
, MUIA_Prop_Visible
, _mheight(obj
), TAG_END
);
517 if (data
->heightAdjusted
== 0 && data
->widthAdjusted
== 0)
519 // if(!(muiRenderInfo(obj)->mri_Flags & MUIMRI_REFRESHMODE))
521 // SetAttrs(data->horizProp, MUIA_Prop_Visible, _mwidth(obj), TAG_END);
522 // SetAttrs(data->vertProp, MUIA_Prop_Visible, _mheight(obj), TAG_END);
524 EraseRect(_rp(obj
), _mleft(obj
), _mtop(obj
), _mright(obj
),
527 mn
= (struct MemberNode
*) _memberList(obj
).mlh_Head
;
528 while (mn
->m_Node
.mln_Succ
)
530 MUI_Redraw(mn
->m_Object
, MADF_DRAWOBJECT
);
531 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
535 data
->visibleWidth
= _mwidth(obj
);
536 data
->visibleHeight
= _mheight(obj
);
537 data
->widthAdjusted
= 0;
538 data
->heightAdjusted
= 0;
540 MUI_RemoveClipping(muiRenderInfo(obj
), clip
);
545 IPTR
iconConDraw(Class
* cl
, Object
* obj
, struct MUIP_Draw
* msg
)
547 struct IconContainerClassData
*data
;
548 struct MemberNode
*mn
;
552 scroll_caused_damage
;
554 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
556 SetAttrs(obj
, AICA_ApplyMethodsToMembers
, FALSE
, TAG_END
);
557 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
558 SetAttrs(obj
, AICA_ApplyMethodsToMembers
, TRUE
, TAG_END
);
560 if ((msg
->flags
& MADF_DRAWOBJECT
) || (msg
->flags
& MADF_DRAWALL
))
562 retval
= drawAll(cl
, obj
, msg
, data
);
564 else if (msg
->flags
& MADF_DRAWUPDATE
)
566 LONG scrollAmountX
= 0,
573 if (data
->vertScroll
)
576 scrollAmountY
= data
->yView
- data
->lastYView
;
578 if (scrollAmountY
> 0)
580 // scroll bottom, displays shifts up, redraw gap at bottom
581 redrawY1
= _mbottom(obj
) - abs(scrollAmountY
);
582 redrawY2
= _mbottom(obj
);
584 else if (scrollAmountY
< 0)
586 // scroll top, display shifts bottom, redraw gap at top
587 redrawY1
= _mtop(obj
);
588 redrawY2
= _mtop(obj
) + abs(scrollAmountY
);
591 redrawX1
= _mleft(obj
);
592 redrawX2
= _mright(obj
);
594 // shift the positions of the member objects
595 mn
= (struct MemberNode
*) _memberList(obj
).mlh_Head
;
596 while (mn
->m_Node
.mln_Succ
)
598 MUI_Layout(mn
->m_Object
,
599 _left(mn
->m_Object
) - scrollAmountX
- _mleft(obj
),
600 _top(mn
->m_Object
) - scrollAmountY
- _mtop(obj
),
601 _width(mn
->m_Object
), _height(mn
->m_Object
), 0);
602 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
606 MUI_AddClipping(muiRenderInfo(obj
), _mleft(obj
), _mtop(obj
),
607 _mwidth(obj
), _mheight(obj
));
610 (_rp(obj
)->Layer
->Flags
& LAYERREFRESH
) ? TRUE
: FALSE
;
612 ScrollRaster(_rp(obj
), 0, scrollAmountY
, _mleft(obj
), _mtop(obj
),
613 _mright(obj
), _mbottom(obj
));
616 redrawRectangle(redrawX1
, redrawY1
, redrawX2
, redrawY2
, obj
,
619 if ((_rp(obj
)->Layer
->Flags
& LAYERREFRESH
) && !layerrefresh
)
620 scroll_caused_damage
= TRUE
;
622 scroll_caused_damage
= FALSE
;
624 MUI_RemoveClipping(muiRenderInfo(obj
), clip
);
626 if (scroll_caused_damage
)
628 struct Region
*damageList
;
634 // get the damage area bounds in x1,x2,y1,y2
635 LockLayer(0, _window(obj
)->WLayer
);
636 damageList
= _window(obj
)->WLayer
->DamageList
;
637 x1
= damageList
->bounds
.MinX
;
638 y1
= damageList
->bounds
.MinY
;
639 x2
= damageList
->bounds
.MaxX
;
640 y2
= damageList
->bounds
.MaxY
;
641 UnlockLayer(_window(obj
)->WLayer
);
643 if (MUI_BeginRefresh(muiRenderInfo(obj
), 0))
645 EraseRect(_rp(obj
), x1
, y1
, x2
, y2
);
646 redrawRectangle(x1
, y1
, x2
, y2
, obj
, data
);
648 MUI_EndRefresh(muiRenderInfo(obj
), 0);
652 data
->vertScroll
= FALSE
;
654 else if (data
->horizScroll
)
657 scrollAmountX
= data
->xView
- data
->lastXView
;
660 if (scrollAmountX
> 0)
662 // scroll right, displays shifts left, redraw gap at right
663 redrawX1
= _mright(obj
) - abs(scrollAmountX
);
664 redrawX2
= _mright(obj
);
667 else if (scrollAmountX
< 0)
669 // scroll left, display shifts right, redraw gap at left
670 redrawX1
= _mleft(obj
);
671 redrawX2
= _mleft(obj
) + abs(scrollAmountX
);
674 redrawY1
= _mtop(obj
);
675 redrawY2
= _mbottom(obj
);
677 // shift the positions of the member objects
678 mn
= (struct MemberNode
*) _memberList(obj
).mlh_Head
;
679 while (mn
->m_Node
.mln_Succ
)
681 MUI_Layout(mn
->m_Object
,
682 _left(mn
->m_Object
) - scrollAmountX
- _mleft(obj
),
683 _top(mn
->m_Object
) - scrollAmountY
- _mtop(obj
),
684 _width(mn
->m_Object
), _height(mn
->m_Object
), 0);
686 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
690 MUI_AddClipping(muiRenderInfo(obj
), _mleft(obj
), _mtop(obj
),
691 _mwidth(obj
), _mheight(obj
));
694 (_rp(obj
)->Layer
->Flags
& LAYERREFRESH
) ? TRUE
: FALSE
;
696 ScrollRaster(_rp(obj
), scrollAmountX
, 0, _mleft(obj
), _mtop(obj
),
697 _mright(obj
), _mbottom(obj
));
699 redrawRectangle(redrawX1
, redrawY1
, redrawX2
, redrawY2
, obj
,
702 if ((_rp(obj
)->Layer
->Flags
& LAYERREFRESH
) && !layerrefresh
)
703 scroll_caused_damage
= TRUE
;
705 scroll_caused_damage
= FALSE
;
707 MUI_RemoveClipping(muiRenderInfo(obj
), clip
);
709 if (scroll_caused_damage
)
711 struct Region
*damageList
;
717 // get the damage area bounds in x1,x2,y1,y2
718 LockLayer(0, _window(obj
)->WLayer
);
719 damageList
= _window(obj
)->WLayer
->DamageList
;
720 x1
= damageList
->bounds
.MinX
;
721 y1
= damageList
->bounds
.MinY
;
722 x2
= damageList
->bounds
.MaxX
;
723 y2
= damageList
->bounds
.MaxY
;
724 UnlockLayer(_window(obj
)->WLayer
);
726 if (MUI_BeginRefresh(muiRenderInfo(obj
), 0))
728 EraseRect(_rp(obj
), x1
, y1
, x2
, y2
);
729 redrawRectangle(x1
, y1
, x2
, y2
, obj
, data
);
731 MUI_EndRefresh(muiRenderInfo(obj
), 0);
735 data
->horizScroll
= FALSE
;
741 IPTR
iconConSet(Class
* cl
, Object
* obj
, struct opSet
* msg
)
743 struct IconContainerClassData
*data
;
746 *tstate
= msg
->ops_AttrList
;
748 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
750 while ((tag
= NextTagItem(&tstate
)))
754 case ICA_ScrollToHoriz
:
756 data
->lastXView
= data
->xView
;
757 data
->xView
= tag
->ti_Data
;
758 data
->horizScroll
= TRUE
;
759 MUI_Redraw(obj
, MADF_DRAWUPDATE
);
762 case ICA_ScrollToVert
:
764 data
->lastYView
= data
->yView
;
765 data
->yView
= tag
->ti_Data
;
766 data
->vertScroll
= TRUE
;
767 MUI_Redraw(obj
, MADF_DRAWUPDATE
);
771 data
->open
= tag
->ti_Data
;
772 SetAttrs(_win(obj
), MUIA_Window_Open
, FALSE
, TAG_END
);
776 ULONG iconViewMode
= IAVM_LARGEICON
;
777 struct MemberNode
*mn
;
778 struct MUI_MinMax minMax
;
780 data
->viewMode
= tag
->ti_Data
;
781 switch (data
->viewMode
)
784 iconViewMode
= IAVM_LARGEICON
;
787 iconViewMode
= IAVM_SMALLICON
;
790 iconViewMode
= IAVM_DETAIL
;
794 _memberCount(obj
) = 0;
795 data
->thisColumnWidth
= 0;
796 data
->thisColumnHeight
= 0;
797 data
->virtualWidth
= 0;
798 data
->virtualHeight
= 0;
800 // mn = (struct MemberNode *) data->memberList.mlh_Head;
801 mn
= (struct MemberNode
*) _memberList(obj
).mlh_Head
;
802 while (mn
->m_Node
.mln_Succ
)
804 DoMethod(mn
->m_Object
, MUIM_Hide
);
805 SetAttrs(mn
->m_Object
, IA_ViewMode
, iconViewMode
,
807 muiNotifyData(mn
->m_Object
)->mnd_ParentObject
= obj
;
808 DoMethod(mn
->m_Object
, MUIM_ConnectParent
, (IPTR
) obj
);
809 DoMethod(mn
->m_Object
, MUIM_AskMinMax
, (IPTR
) &minMax
);
811 _minwidth(mn
->m_Object
) = minMax
.MinWidth
;
812 _minheight(mn
->m_Object
) = minMax
.MinHeight
;
813 _maxwidth(mn
->m_Object
) = minMax
.MaxWidth
;
814 _maxheight(mn
->m_Object
) = minMax
.MaxHeight
;
815 _defwidth(mn
->m_Object
) = minMax
.DefWidth
;
816 _defheight(mn
->m_Object
) = minMax
.DefHeight
;
820 layoutObject(data
, obj
, mn
->m_Object
);
821 DoMethod(mn
->m_Object
, MUIM_Show
);
823 SetAttrs(data
->horizProp
, MUIA_Prop_Entries
,
824 data
->virtualWidth
, TAG_END
);
825 SetAttrs(data
->vertProp
, MUIA_Prop_Entries
,
826 data
->virtualHeight
, TAG_END
);
828 mn
= (struct MemberNode
*) mn
->m_Node
.mln_Succ
;
831 MUI_Redraw(obj
, MADF_DRAWALL
);
839 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
844 IPTR
iconConGet(Class
* cl
, Object
* obj
, struct opGet
* msg
)
847 struct IconContainerClassData
*data
;
849 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
851 switch (msg
->opg_AttrID
)
854 *msg
->opg_Storage
= (ULONG
) data
->open
;
857 retval
= DoSuperMethodA(cl
, obj
, (Msg
) msg
);
864 IPTR
iconConConnectParent(Class
* cl
, Object
* obj
,
865 struct MUIP_ConnectParent
* msg
)
867 struct IconContainerClassData
*data
;
870 retval
= DoSuperMethodA(cl
, obj
, msg
);
872 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
876 muiNotifyData(data
->horizProp
)->mnd_ParentObject
= obj
;
877 DoMethod(data
->horizProp
, MUIM_ConnectParent
, (IPTR
) obj
);
881 muiNotifyData(data
->vertProp
)->mnd_ParentObject
= obj
;
882 DoMethod(data
->vertProp
, MUIM_ConnectParent
, (IPTR
) obj
);
888 IPTR
iconConHandleInput(Class
* cl
, Object
* obj
,
889 struct MUIP_HandleInput
* msg
)
893 struct IconContainerClassData
*data
;
895 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
899 switch (msg
->imsg
->Class
)
901 case IDCMP_MOUSEBUTTONS
:
903 if (msg
->imsg
->Code
== SELECTDOWN
)
905 // kprintf("ic handleinput\n");
907 if (msg
->imsg
->MouseX
>= _mleft(obj
)
908 && msg
->imsg
->MouseX
<= _mright(obj
)
909 && msg
->imsg
->MouseY
>= _mtop(obj
)
910 && msg
->imsg
->MouseY
<= _mbottom(obj
))
913 // if(!data->justSelected)
916 // DoMethod(obj, ICM_UnselectAll);
921 // data->justSelected=FALSE;
934 IPTR
iconConDispose(Class
* cl
, Object
* obj
, Msg msg
)
938 SetAttrs(obj
, ICA_DeleteMe
, TRUE
, TAG_END
);
940 retval
= DoSuperMethodA(cl
, obj
, msg
);
945 IPTR
iconConGetColumn(Class
* cl
, Object
* obj
, struct opGetColumn
* msg
)
947 struct IconContainerClassData
*data
;
950 struct DetailColumn
*dc
= NULL
;
952 data
= (struct IconContainerClassData
*) INST_DATA(cl
, obj
);
954 while (!found
&& i
< data
->numColumns
)
956 if (data
->columns
[i
].dc_Content
== msg
->colType
)
959 dc
= &data
->columns
[i
];
967 BOOPSI_DISPATCHER(IPTR
, iconContainerDispatcher
, cl
, obj
, msg
)
971 switch (msg
->MethodID
)
974 retval
= iconConNew(cl
, obj
, (struct opSet
*) msg
);
977 retval
= iconConSetup(cl
, obj
, (struct MUIP_Setup
*) msg
);
980 retval
= iconConCleanup(cl
, obj
, (struct MUIP_Cleanup
*) msg
);
983 retval
= iconConShow(cl
, obj
, msg
);
986 retval
= iconConDraw(cl
, obj
, (struct MUIP_Draw
*) msg
);
989 retval
= iconConAskMinMax(cl
, obj
, (struct MUIP_AskMinMax
*) msg
);
992 retval
= iconConLayout(cl
, obj
, msg
);
994 case MUIM_DrawBackground
:
997 retval
= iconConAdd(cl
, obj
, (struct opMember
*) msg
);
1000 retval
= iconConSet(cl
, obj
, (struct opSet
*) msg
);
1003 retval
= iconConGet(cl
, obj
, (struct opGet
*) msg
);
1005 case MUIM_ConnectParent
:
1007 iconConConnectParent(cl
, obj
,
1008 (struct MUIP_ConnectParent
*) msg
);
1010 case MUIM_HandleInput
:
1012 iconConHandleInput(cl
, obj
, (struct MUIP_HandleInput
*) msg
);
1015 retval
= iconConDispose(cl
, obj
, msg
);
1018 retval
= iconConGetColumn(cl
, obj
, (struct opGetColumn
*) msg
);
1021 retval
= DoSuperMethodA(cl
, obj
, msg
);
1027 BOOPSI_DISPATCHER_END