libyui

/data/gitorious.org/libyui/libyui-master/src/YContextMenu.h

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:         YContextMenu.h
00035 
00036   Author:       Stefan Hundhammer <sh@suse.de>
00037 
00038 /-*/
00039 
00040 #ifndef YContextMenu_h
00041 #define YContextMenu_h
00042 
00043 #include "YSelectionWidget.h"
00044 #include "YMenuItem.h"
00045 
00046 class YMenuItem;
00047 class YContextMenuPrivate;
00048 
00049 
00063 class YContextMenu : public YSelectionWidget
00064 {
00065 protected:
00072     YContextMenu();
00073 
00074 public:
00078     virtual ~YContextMenu();
00079      
00084     virtual const char * widgetClass() const { return "YContextMenu"; }
00085 
00094     virtual void rebuildMenuTree() = 0;
00095 
00106     virtual void addItems( const YItemCollection & itemCollection );
00107 
00118     virtual void addItem( YItem * item_disown );
00119 
00125     virtual void deleteAllItems();
00126 
00134     void resolveShortcutConflicts();
00135 
00146     virtual bool setProperty( const string & propertyName,
00147                               const YPropertyValue & val );
00148 
00155     virtual YPropertyValue getProperty( const string & propertyName );
00156 
00163     virtual const YPropertySet & propertySet();
00164 
00165 protected:
00166 
00171     YMenuItem * findMenuItem( int index );
00172     
00179     YMenuItem * findMenuItem( int index, YItemConstIterator begin, YItemConstIterator end );
00180 
00185     YMenuItem * itemAt( int index )
00186         { return findMenuItem( index ); }
00187 
00188 private:
00189 
00193     void assignUniqueIndex( YItemIterator begin, YItemIterator end );
00194 
00195 
00196     ImplPtr<YContextMenuPrivate> priv;
00197 };
00198 
00199 
00200 #endif // YContextMenu_h
 All Classes Functions Variables Enumerations Friends