libyui
|
00001 /************************************************************************** 00002 Copyright (C) 2000 - 2010 Novell, Inc. 00003 All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00019 **************************************************************************/ 00020 00021 00022 /*---------------------------------------------------------------------\ 00023 | | 00024 | __ __ ____ _____ ____ | 00025 | \ \ / /_ _/ ___|_ _|___ \ | 00026 | \ V / _` \___ \ | | __) | | 00027 | | | (_| |___) || | / __/ | 00028 | |_|\__,_|____/ |_| |_____| | 00029 | | 00030 | core system | 00031 | (C) SuSE GmbH | 00032 \----------------------------------------------------------------------/ 00033 00034 File: YTreeItem.h 00035 00036 Author: Stefan Hundhammer <sh@suse.de> 00037 00038 /-*/ 00039 00040 #ifndef YTreeItem_h 00041 #define YTreeItem_h 00042 00043 #include "YItem.h" 00044 00045 using std::string; 00046 using std::vector; 00047 00048 00054 class YTreeItem: public YItem 00055 { 00056 public: 00060 YTreeItem( const string & label, 00061 bool isOpen = false ); 00062 00063 YTreeItem( const string & label, 00064 const string & iconName, 00065 bool isOpen = false ); 00066 00074 YTreeItem( YTreeItem * parent, 00075 const string & label, 00076 bool isOpen = false ); 00077 00078 YTreeItem( YTreeItem * parent, 00079 const string & label, 00080 const string & iconName, 00081 bool isOpen = false ); 00082 00088 virtual ~YTreeItem(); 00089 00095 virtual bool hasChildren() const { return ! _children.empty(); } 00096 00102 virtual YItemIterator childrenBegin() { return _children.begin(); } 00103 virtual YItemConstIterator childrenBegin() const { return _children.begin(); } 00104 00110 virtual YItemIterator childrenEnd() { return _children.end(); } 00111 virtual YItemConstIterator childrenEnd() const { return _children.end(); } 00112 00120 virtual void addChild( YItem * item_disown ); 00121 00125 virtual void deleteChildren(); 00126 00134 bool isOpen() const; 00135 00139 void setOpen( bool open ); 00140 00146 virtual YTreeItem * parent() const { return _parent; } 00147 00148 private: 00149 00150 YTreeItem * _parent; 00151 YItemCollection _children; 00152 bool _isOpen; 00153 }; 00154 00155 00156 #endif // YTreeItem_h