libyui
YContextMenu.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: YContextMenu.h
20 
21  Author: Stefan Hundhammer <shundhammer@suse.de>
22 
23 /-*/
24 
25 #ifndef YContextMenu_h
26 #define YContextMenu_h
27 
28 #include "YSelectionWidget.h"
29 #include "YMenuItem.h"
30 
31 class YMenuItem;
33 
34 
52 {
53 protected:
60  YContextMenu();
61 
62 public:
66  virtual ~YContextMenu();
67 
72  virtual const char * widgetClass() const { return "YContextMenu"; }
73 
82  virtual void rebuildMenuTree() = 0;
83 
94  virtual void addItems( const YItemCollection & itemCollection );
95 
106  virtual void addItem( YItem * item_disown );
107 
113  virtual void deleteAllItems();
114 
123 
134  virtual bool setProperty( const std::string & propertyName,
135  const YPropertyValue & val );
136 
143  virtual YPropertyValue getProperty( const std::string & propertyName );
144 
151  virtual const YPropertySet & propertySet();
152 
153 protected:
154 
159  YMenuItem * findMenuItem( int index );
160 
168 
173  YMenuItem * itemAt( int index )
174  { return findMenuItem( index ); }
175 
176 private:
177 
181  void assignUniqueIndex( YItemIterator begin, YItemIterator end );
182 
183 
185 };
186 
187 
188 #endif // YContextMenu_h
YItemCollection::iterator YItemIterator
Mutable iterator over YItemCollection.
Definition: YItem.h:42
Definition: YProperty.h:104
YWidgetListIterator end()
Definition: YWidget.h:245
std::vector< YItem * > YItemCollection
Collection of pointers to YItem.
Definition: YItem.h:39
Definition: YSelectionWidget.h:45
Definition: YContextMenu.cc:36
Definition: YProperty.h:197
virtual void addItems(const YItemCollection &itemCollection)
Definition: YContextMenu.cc:64
void resolveShortcutConflicts()
Definition: YContextMenu.cc:140
virtual ~YContextMenu()
Definition: YContextMenu.cc:57
virtual YPropertyValue getProperty(const std::string &propertyName)
Definition: YContextMenu.cc:194
YMenuItem * itemAt(int index)
Definition: YContextMenu.h:173
virtual const char * widgetClass() const
Definition: YContextMenu.h:72
virtual const YPropertySet & propertySet()
Definition: YContextMenu.cc:155
YMenuItem * findMenuItem(int index)
Definition: YContextMenu.cc:107
Definition: YItem.h:55
YItemCollection::const_iterator YItemConstIterator
Const iterator over YItemCollection.
Definition: YItem.h:45
Definition: YMenuItem.h:43
virtual void deleteAllItems()
Definition: YContextMenu.cc:99
YWidgetListIterator begin()
Definition: YWidget.h:238
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Definition: YContextMenu.cc:177
virtual void rebuildMenuTree()=0
Definition: YContextMenu.h:51
virtual void addItem(YItem *item_disown)
Definition: YContextMenu.cc:73
YContextMenu()
Definition: YContextMenu.cc:48