libyui
 
Loading...
Searching...
No Matches
YTreeItem.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: YTreeItem.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25#ifndef YTreeItem_h
26#define YTreeItem_h
27
28#include "YItem.h"
29
35class YTreeItem: public YItem
36{
37public:
41 YTreeItem( const std::string & label,
42 bool isOpen = false );
43
44 YTreeItem( const std::string & label,
45 const std::string & iconName,
46 bool isOpen = false );
47
56 const std::string & label,
57 bool isOpen = false );
58
60 const std::string & label,
61 const std::string & iconName,
62 bool isOpen = false );
63
69 virtual ~YTreeItem();
70
75 virtual const char * itemClass() const { return "YTreeItem"; }
76
82 virtual bool hasChildren() const { return ! _children.empty(); }
83
89 virtual YItemIterator childrenBegin() { return _children.begin(); }
90 virtual YItemConstIterator childrenBegin() const { return _children.begin(); }
91
97 virtual YItemIterator childrenEnd() { return _children.end(); }
98 virtual YItemConstIterator childrenEnd() const { return _children.end(); }
99
107 virtual void addChild( YItem * item_disown );
108
112 virtual void deleteChildren();
113
121 bool isOpen() const;
122
126 void setOpen( bool open = true );
127 void setClosed() { setOpen( false ); }
128
134 virtual YTreeItem * parent() const { return _parent; }
135
136private:
137
138 YTreeItem * _parent;
139 YItemCollection _children;
140 bool _isOpen;
141};
142
143
144#endif // YTreeItem_h
YItemCollection::const_iterator YItemConstIterator
Const iterator over YItemCollection.
Definition YItem.h:45
YItemCollection::iterator YItemIterator
Mutable iterator over YItemCollection.
Definition YItem.h:42
std::vector< YItem * > YItemCollection
Collection of pointers to YItem.
Definition YItem.h:39
std::string label() const
Definition YItem.h:97
YItem(const std::string &label, bool selected=false)
Definition YItem.h:61
std::string iconName() const
Definition YItem.h:107
Definition YTreeItem.h:36
virtual void deleteChildren()
Definition YTreeItem.cc:86
virtual ~YTreeItem()
Definition YTreeItem.cc:74
virtual YTreeItem * parent() const
Definition YTreeItem.h:134
virtual bool hasChildren() const
Definition YTreeItem.h:82
YTreeItem(YTreeItem *parent, const std::string &label, bool isOpen=false)
virtual YItemIterator childrenBegin()
Definition YTreeItem.h:89
virtual YItemIterator childrenEnd()
Definition YTreeItem.h:97
void setOpen(bool open=true)
Definition YTreeItem.cc:107
virtual const char * itemClass() const
Definition YTreeItem.h:75
virtual void addChild(YItem *item_disown)
Definition YTreeItem.cc:80
bool isOpen() const
Definition YTreeItem.cc:101
YTreeItem(const std::string &label, bool isOpen=false)