MenuItemAccelerator.h

Go to the documentation of this file.
00001 #ifndef MENUITEMACCELERATOR_H_
00002 #define MENUITEMACCELERATOR_H_
00003 
00004 #include <string>
00005 #include <gtk/gtkwidget.h>
00006 
00007 namespace gtkutil
00008 {
00009 
00010     /* greebo: Encapsulation for a menu item with a right-aligned accelerator label
00011      */
00012     class TextMenuItemAccelerator
00013     {
00014             // Label to display
00015             std::string _labelText;
00016             // The corresponding widget
00017             GtkWidget* _label;
00018 
00019             // Label of the accelerator
00020             std::string _accelLabelText;
00021             // The corresponding widget
00022             GtkWidget* _accel;
00023 
00024             // The icon pixbuf
00025             GdkPixbuf* _icon;
00026             // The corresponding image widget
00027             GtkWidget* _iconImage;
00028 
00029             // Flag to indicate this is a toggle menu item
00030             bool _isToggle;
00031 
00032         public:
00033 
00038             TextMenuItemAccelerator (const std::string& label, const std::string& accelLabel, GdkPixbuf* icon,
00039                     bool isToggle);
00040 
00041             // destructor
00042             virtual ~TextMenuItemAccelerator() {}
00043 
00044             // Operator cast to GtkWidget* for packing into a menu
00045             virtual operator GtkWidget* ();
00046 
00047             // Changes teh label text of the given menu item
00048             // (This works AFTER the class has been cast onto a GtkWidget*)
00049             void setLabel (const std::string& newLabel);
00050 
00051             // Changes the accelerator text of this menutem
00052             // (This works AFTER the class has been cast onto a GtkWidget*)
00053             void setAccelerator (const std::string& newAccel);
00054 
00055             // Change the icon
00056             // (This works AFTER the class has been cast onto a GtkWidget*)
00057             void setIcon (GdkPixbuf* icon);
00058 
00059             // Change the icon
00060             // (This works BEFORE the class has been cast onto a GtkWidget*)
00061             void setIsToggle (bool isToggle);
00062     };
00063 
00064 }
00065 
00066 #endif /*MENUITEMACCELERATOR_H_*/

Generated by  doxygen 1.6.2