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:22:09 mlemos
18 * Bumped to revision 42.0 before handing BGUI to AROS team
20 * Revision 41.11 2000/05/09 20:35:56 mlemos
21 * Bumped to revision 41.11
23 * Revision 1.2 2000/05/09 20:00:52 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 1.1.2.2 1999/05/31 01:12:59 mlemos
27 * Made the method functions take the arguments in the apropriate registers.
29 * Revision 1.1.2.1 1999/02/21 04:08:10 mlemos
30 * Nick Christie sources.
36 /************************************************************************
37 *********************** TREEVIEW CLASS: VISIBLE ***********************
38 ************************************************************************/
40 /************************************************************************
41 ****************************** INCLUDES *******************************
42 ************************************************************************/
44 #include "TreeViewPrivate.h"
47 /************************************************************************
48 ************************** LOCAL DEFINITIONS **************************
49 ************************************************************************/
52 /************************************************************************
53 ************************* EXTERNAL REFERENCES *************************
54 ************************************************************************/
57 * Functions from TVUtil are listed in TVUtil.h
60 /************************************************************************
61 ***************************** PROTOTYPES ******************************
62 ************************************************************************/
65 /************************************************************************
66 ***************************** LOCAL DATA ******************************
67 ************************************************************************/
70 /************************************************************************
71 **************************** TV_VISIBLE() *****************************
72 *************************************************************************
73 * Make an entry visible in the treeview, by a combination of scrolling
74 * the view area, and expanding parent entries. In the message structure
75 * for this method, the user supplies a reference to an entry, a code to
76 * indicate which entries to affect and some flags that allow further
77 * operations, eg. selecting the entry. This method returns non-zero if
78 * successful, zero on failure.
80 * Special values allowed for the reference entry are:
81 * TV_ROOT to represent the root of the tree (a dummy entry).
82 * TV_SELECTED for the (first) currently selected entry.
84 * If the relation entry is TV_SELECTED, but no entry is currently
85 * selected, nothing is done and zero is returned.
87 * Permitted values for the relationship code are as follows:
88 * TVW_ENTRY specified entry only
89 * TVW_PARENT parent of entry
90 * TVW_CHILD_FIRST first child of entry
91 * TVW_CHILD_LAST last child of entry
92 * TVW_SIBLING_FIRST first sibling of entry
93 * TVW_SIBLING_LAST last sibling of entry
94 * TVW_SIBLING_NEXT next sibling of entry
95 * TVW_SIBLING_PREV prev. sibling of entry
96 * TVW_TREE_NEXT next in tree from entry
97 * TVW_TREE_PREV prev. in tree from entry
98 * TVW_TREE_PAGE_UP page up in tree from entry
99 * TVW_TREE_PAGE_DOWN page down in tree from entry
101 * If the relation entry is TV_ROOT, only the TVW_CHILD_??? codes are
104 * Permitted bits for the flags parameter are:
105 * TVF_SELECTED affect only selected entries
106 * TVF_SELECT select entry
107 * TVF_DESELECT deselect entry
108 * TVF_MULTISELECT multi-select entry (with TVF_SELECT)
109 * TVF_EXPAND expand entry
110 * TVF_CONTRACT contract entry
112 *************************************************************************/
114 METHOD(TV_Visible
, struct tvEntry
*, tve
)
117 struct TagItem tags
[2];
122 TV_DebugDumpMethod((Msg
) tve
);
124 tv
= (TVData
*) INST_DATA(cl
,obj
);
126 flags
= tve
->tve_Flags
& ~TVF_VISIBLE
;
127 memset(&tva
,0,sizeof(tva
));
130 * Find the treenode corresponding to this tvEntry.
133 if ((tn
= TV_MatchNextEntry(tv
,tve
->tve_Entry
,tve
->tve_Which
,flags
,&tva
)))
136 * Expand all unexpanded parents of this entry
141 while((pn
= ParentOf(pn
)))
144 DoMethod(obj
,TVM_EXPAND
,NULL
,pn
,TVW_ENTRY
,TVF_INTERNAL
);
148 * Find this entry's position in the listview
149 * and tell the listview to make it visible.
152 pos
= TV_TreeNodeToIndex(tv
,tn
);
154 tags
[0].ti_Tag
= LISTV_MakeVisible
;
155 tags
[0].ti_Data
= pos
;
156 tags
[1].ti_Tag
= TAG_DONE
;
157 DoMethod(tv
->tv_Listview
,OM_SET
,tags
,tve
->tve_GInfo
);
162 * User wants us to select the entry as well?
165 if (tve
->tve_Flags
& (TVF_SELECT
| TVF_DESELECT
))
166 DoMethod(obj
,TVM_SELECT
,tve
->tve_GInfo
,tn
,TVW_ENTRY
,TVF_INTERNAL
|
167 (tve
->tve_Flags
& (TVF_MULTISELECT
| TVF_DESELECT
)));
170 * User wants us to expand the entry as well?
173 if (tve
->tve_Flags
& (TVF_EXPAND
| TVF_CONTRACT
))
174 DoMethod(obj
,TVM_EXPAND
,tve
->tve_GInfo
,tn
,TVW_ENTRY
,TVF_INTERNAL
|
175 (tve
->tve_Flags
& TVF_CONTRACT
));
177 } /* endif matched entry */