libyui
3.0.10
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: YMenuItem.h 00020 00021 Author: Stefan Hundhammer <sh@suse.de> 00022 00023 /-*/ 00024 00025 #ifndef YMenuItem_h 00026 #define YMenuItem_h 00027 00028 #include "YTreeItem.h" 00029 00030 00031 00032 /** 00033 * Item class for menu items. 00034 **/ 00035 class YMenuItem: public YTreeItem 00036 { 00037 public: 00038 /** 00039 * Constructors for toplevel items. 00040 **/ 00041 YMenuItem( const std::string & label ) 00042 : YTreeItem( label ) 00043 {} 00044 00045 YMenuItem( const std::string & label, 00046 const std::string & iconName ) 00047 : YTreeItem( label, iconName ) 00048 {} 00049 00050 /** 00051 * Constructors for items that have a parent item. 00052 * 00053 * They will automatically register this item with the parent item. The 00054 * parent assumes ownership of this item and will delete it in its (the 00055 * parent's) destructor. 00056 **/ 00057 YMenuItem( YMenuItem * parent, 00058 const std::string & label ) 00059 : YTreeItem( parent, label ) 00060 {} 00061 00062 YMenuItem( YMenuItem * parent, 00063 const std::string & label, 00064 const std::string & iconName ) 00065 : YTreeItem( parent, label, iconName ) 00066 {} 00067 00068 /** 00069 * Destructor. 00070 * 00071 * This will delete all children. 00072 **/ 00073 virtual ~YMenuItem() {} 00074 00075 00076 /** 00077 * Returns this item's parent item or 0 if it is a toplevel item. 00078 **/ 00079 YMenuItem * parent() const 00080 { return dynamic_cast<YMenuItem *> ( YTreeItem::parent() ); } 00081 00082 00083 private: 00084 00085 // Disable unwanted base class methods 00086 00087 bool isOpen() const { return false; } 00088 void setOpen( bool ) {} 00089 }; 00090 00091 00092 #endif // YMenuItem_h