libyui
YTree.h
1 /*
2  Copyright (C) 2000-2012 Novell, Inc
3  This library is free software; you can redistribute it and/or modify
4  it under the terms of the GNU Lesser General Public License as
5  published by the Free Software Foundation; either version 2.1 of the
6  License, or (at your option) version 3.0 of the License. This library
7  is distributed in the hope that it will be useful, but WITHOUT ANY
8  WARRANTY; without even the implied warranty of MERCHANTABILITY or
9  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10  License for more details. You should have received a copy of the GNU
11  Lesser General Public License along with this library; if not, write
12  to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13  Floor, Boston, MA 02110-1301 USA
14 */
15 
16 
17 /*-/
18 
19  File: YTree.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YTree_h
26 #define YTree_h
27 
28 #include "YSelectionWidget.h"
29 
30 class YTreeItem;
31 class YTreePrivate;
32 
33 
57 class YTree : public YSelectionWidget
58 {
59 protected:
60 
64  YTree( YWidget * parent,
65  const std::string & label,
66  bool multiSelection,
67  bool recursiveSelection);
68 
69 public:
70 
74  virtual ~YTree();
75 
80  virtual const char * widgetClass() const { return "YTree"; }
81 
90  virtual void rebuildTree() = 0;
91 
102  virtual void addItems( const YItemCollection & itemCollection );
103 
122  bool immediateMode() const;
123 
127  void setImmediateMode( bool on = true );
128 
139  virtual bool setProperty( const std::string & propertyName,
140  const YPropertyValue & val );
141 
148  virtual YPropertyValue getProperty( const std::string & propertyName );
149 
156  virtual const YPropertySet & propertySet();
157 
162  const char * userInputProperty() { return YUIProperty_CurrentItem; }
163 
164 
168  bool hasMultiSelection() const;
169 
179  virtual YTreeItem * currentItem() = 0;
180 
187  virtual void activate() = 0;
188 
195  YTreeItem * findItem( const std::vector<std::string> & path ) const;
196 
197 
198 protected:
199 
207  YTreeItem * findItem( std::vector<std::string>::const_iterator path_begin,
208  std::vector<std::string>::const_iterator path_end,
210  YItemConstIterator end ) const;
211 
212 private:
213 
215 };
216 
217 
218 #endif // YTree_h
bool immediateMode() const
Definition: YTree.cc:71
Definition: YProperty.h:104
YWidgetListIterator end()
Definition: YWidget.h:245
std::vector< YItem * > YItemCollection
Collection of pointers to YItem.
Definition: YItem.h:39
void setImmediateMode(bool on=true)
Definition: YTree.cc:78
Definition: YSelectionWidget.h:45
virtual YPropertyValue getProperty(const std::string &propertyName)
Definition: YTree.cc:155
Definition: YProperty.h:197
YWidget * parent() const
Definition: YWidget.cc:271
Definition: YTree.cc:38
YTree(YWidget *parent, const std::string &label, bool multiSelection, bool recursiveSelection)
Definition: YTree.cc:48
virtual YTreeItem * currentItem()=0
virtual const char * widgetClass() const
Definition: YTree.h:80
YTreeItem * findItem(const std::vector< std::string > &path) const
std::string label() const
Definition: YSelectionWidget.cc:99
virtual void addItems(const YItemCollection &itemCollection)
Definition: YTree.cc:88
virtual void activate()=0
YItemCollection::const_iterator YItemConstIterator
Const iterator over YItemCollection.
Definition: YItem.h:45
virtual ~YTree()
Definition: YTree.cc:64
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Definition: YTree.cc:133
Definition: YTree.h:57
virtual void rebuildTree()=0
YWidgetListIterator begin()
Definition: YWidget.h:238
virtual const YPropertySet & propertySet()
Definition: YTree.cc:96
bool hasMultiSelection() const
Definition: YTree.cc:175
bool recursiveSelection() const
Definition: YSelectionWidget.cc:130
Definition: YWidget.h:54
const char * userInputProperty()
Definition: YTree.h:162
Definition: YTreeItem.h:35