build git 2.17.1
[AROS-Contrib.git] / bgui / gadgets / TreeView / TVGetEntry.c
blob76d1dfc652ec199403351556b0e1a01ecca9965b
1 /*
2 * @(#) $Header$
4 * BGUI Tree List View class
6 * (C) Copyright 1999 Manuel Lemos.
7 * (C) Copyright 1996-1999 Nick Christie.
8 * All Rights Reserved.
10 * $Log$
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:38 mlemos
18 * Bumped to revision 42.0 before handing BGUI to AROS team
20 * Revision 41.11 2000/05/09 20:35:23 mlemos
21 * Bumped to revision 41.11
23 * Revision 1.2 2000/05/09 20:00:23 mlemos
24 * Merged with the branch Manuel_Lemos_fixes.
26 * Revision 1.1.2.2 1999/05/31 01:12:45 mlemos
27 * Made the method functions take the arguments in the apropriate registers.
29 * Revision 1.1.2.1 1999/02/21 04:07:36 mlemos
30 * Nick Christie sources.
36 /************************************************************************
37 ********************** TREEVIEW CLASS: GETENTRY ***********************
38 ************************************************************************/
40 /************************************************************************
41 ****************************** INCLUDES *******************************
42 ************************************************************************/
44 #include "TreeViewPrivate.h"
45 #include "TVUtil.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_GETENTRY() ****************************
72 *************************************************************************
73 * Return an entry in the treeview. In the message structure for this
74 * method, the user supplies a reference to an entry and a code to
75 * indicate which entries to consider. This method returns the matching
76 * entry if successful, NULL on failure.
78 * Special values allowed for the reference entry are:
79 * TV_ROOT to represent the root of the tree (a dummy entry).
80 * TV_SELECTED for the (first) currently selected entry.
82 * If the relation entry is TV_SELECTED, but no entry is currently
83 * selected, nothing is done and zero is returned.
85 * Permitted values for the relationship code are as follows:
86 * TVW_ENTRY specified entry only (not useful)
87 * TVW_PARENT parent of entry
88 * TVW_CHILD_FIRST first child of entry
89 * TVW_CHILD_LAST last child of entry
90 * TVW_SIBLING_FIRST first sibling of entry
91 * TVW_SIBLING_LAST last sibling of entry
92 * TVW_SIBLING_NEXT next sibling of entry
93 * TVW_SIBLING_PREV prev. sibling of entry
94 * TVW_TREE_NEXT next in tree from entry
95 * TVW_TREE_PREV prev. in tree from entry
96 * TVW_TREE_PAGE_UP page up in tree from entry
97 * TVW_TREE_PAGE_DOWN page down in tree from entry
99 * If the relation entry is TV_ROOT, only the TVW_CHILD_??? codes are
100 * permitted. To obtain all entries in the treeview via consecutive
101 * calls, pass TV_ROOT as the initial reference entry with TVW_TREE_NEXT
102 * as the code. Then make the return value from this method the next
103 * reference entry, until the return is NULL.
105 * Permitted bits for the flags parameter are:
106 * TVF_SELECTED affect only selected entries
107 * TVF_VISIBLE affect only visible entries
109 *************************************************************************/
111 METHOD(TV_GetEntry, struct tvGet *, tvg)
113 struct tvAnchor tva;
114 TVData *tv;
115 TNPTR tn;
116 ULONG rc;
118 TV_DebugDumpMethod((Msg) tvg);
120 tv = (TVData *) INST_DATA(cl,obj);
121 tn = NULL;
122 rc = 0;
123 memset(&tva,0,sizeof(tva));
126 * Find the treenode corresponding to this tvGet.
129 if ((tn = TV_MatchNextEntry(tv,tvg->tvg_Entry,tvg->tvg_Which,tvg->tvg_Flags,&tva)))
130 rc = (IPTR) tn->tn_Entry;
132 return(rc);
134 METHOD_END