4 * BGUI Tree List View class
6 * (C) Copyright 1999 Manuel Lemos.
7 * (C) Copyright 1996-1999 Nick Christie.
11 * Revision 42.2 2004/06/16 20:16:49 verhaegs
12 * Use METHODPROTO, METHOD_END and REGFUNCPROTOn where needed.
14 * Revision 42.1 2000/05/15 19:29:08 stegerg
15 * replacements for REG macro
17 * Revision 42.0 2000/05/09 22:21:41 mlemos
18 * Bumped to revision 42.0 before handing BGUI to AROS team
20 * Revision 41.11 2000/05/09 20:35:25 mlemos
21 * Bumped to revision 41.11
23 * Revision 1.2 2000/05/09 20:00:25 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 1.1.2.2 1999/05/31 01:12:47 mlemos
27 * Made the method functions take the arguments in the apropriate registers.
29 * Revision 1.1.2.1 1999/02/21 04:07:39 mlemos
30 * Nick Christie sources.
36 /************************************************************************
37 *********************** TREEVIEW CLASS: GET/SET ***********************
38 ************************************************************************/
41 /************************************************************************
42 ****************************** INCLUDES *******************************
43 ************************************************************************/
45 #include "TreeViewPrivate.h"
48 /************************************************************************
49 ************************** LOCAL DEFINITIONS **************************
50 ************************************************************************/
53 /************************************************************************
54 ************************* EXTERNAL REFERENCES *************************
55 ************************************************************************/
58 * Functions from TVUtil are listed in TVUtil.h
61 /************************************************************************
62 ***************************** PROTOTYPES ******************************
63 ************************************************************************/
66 /************************************************************************
67 ***************************** LOCAL DATA ******************************
68 ************************************************************************/
71 /************************************************************************
72 ***************************** TV_GET() ********************************
73 *************************************************************************
74 * Handle OM_GET: return an object attribute. Supply our class ptr,
75 * object ptr and an opGet message. Returns TRUE if attribute was
76 * recognized, FALSE otherwise.
78 *************************************************************************/
80 METHOD(TV_Get
, struct opGet
*, opg
)
85 tv
= (TVData
*) INST_DATA(cl
,obj
);
88 switch (opg
->opg_AttrID
)
91 *(opg
->opg_Storage
) = tv
->tv_Indentation
;
98 GetAttr(LISTV_NumEntries
,tv
->tv_Listview
,&top
);
102 GetAttr(LISTV_Top
,tv
->tv_Listview
,&top
);
103 *(opg
->opg_Storage
) = (IPTR
) TV_IndexToTreeNode(tv
,top
);
106 *(opg
->opg_Storage
) = (IPTR
)NULL
;
111 *(opg
->opg_Storage
) = tv
->tv_NumEntries
;
114 case TVA_LastClicked
:
115 *(opg
->opg_Storage
) = (IPTR
) tv
->tv_LastClicked
;
119 GetAttr(LISTV_ViewBounds
,tv
->tv_Listview
,opg
->opg_Storage
);
123 rc
= DoSuperMethodA(cl
,obj
,(Msg
) opg
);
131 /************************************************************************
132 ***************************** TV_SET() ********************************
133 *************************************************************************
134 * Handle OM_SET: set an object attribute. Supply our class ptr,
135 * object ptr and an opGet message. Returns TRUE if new attribute(s)
136 * caused a visual update.
138 *************************************************************************/
140 METHOD(TV_Set
, struct opSet
*, ops
)
147 tv
= (TVData
*) INST_DATA(cl
,obj
);
151 * Let our superclass react to OM_SET first
154 rc
= DoSuperMethodA(cl
,obj
,(Msg
) ops
);
157 * Now we look at the taglist
160 if ((tag
= FindTagItem(TVA_Indentation
,ops
->ops_AttrList
)))
162 tv
->tv_Indentation
= max(tag
->ti_Data
,8);
168 DoMethod(obj
,TVM_REFRESH
,ops
->ops_GInfo
);
170 if ((tag
= FindTagItem(TVA_Top
,ops
->ops_AttrList
)))
172 struct TagItem tags
[2];
176 if ((tn
= TV_FindTreeNode(RootList(tv
),(APTR
) tag
->ti_Data
)))
178 if ((pos
= TV_TreeNodeToIndex(tv
,tn
)) != ~0)
181 KPrintF("OM_SET: tn=%08lx pos=%lu\n",tn,pos);
184 tags
[0].ti_Tag
= LISTV_Top
;
185 tags
[0].ti_Data
= pos
;
186 tags
[1].ti_Tag
= TAG_DONE
;
187 DoMethod(tv
->tv_Listview
,OM_SET
,tags
,ops
->ops_GInfo
);