IconTextMenuToggle.h
Go to the documentation of this file.00001 #ifndef ICONTEXTMENUTOGGLE_H_
00002 #define ICONTEXTMENUTOGGLE_H_
00003
00004 #include "gtkutil/image.h"
00005
00006 #include <gtk/gtklabel.h>
00007 #include <gtk/gtkmenuitem.h>
00008 #include <gtk/gtkhbox.h>
00009 #include <gtk/gtkimage.h>
00010 #include <string>
00011
00012 namespace gtkutil
00013 {
00014
00019 class IconTextMenuToggle
00020 {
00021 private:
00022
00023 GdkPixbuf* _icon;
00024 GtkWidget* _label;
00025
00026 public:
00027
00028
00029 IconTextMenuToggle (const std::string& icon, const std::string& text) :
00030 _icon(gtkutil::getLocalPixbuf(icon)), _label(gtk_label_new(text.c_str()))
00031 {
00032 }
00033
00034
00035
00036 operator GtkWidget* ()
00037 {
00038 GtkWidget* hbx = gtk_hbox_new(FALSE, 4);
00039 gtk_box_pack_start(GTK_BOX(hbx), gtk_image_new_from_pixbuf(_icon), FALSE, FALSE, 0);
00040 gtk_box_pack_start(GTK_BOX(hbx), _label, FALSE, FALSE, 0);
00041
00042 GtkWidget* menuItem = gtk_check_menu_item_new();
00043 gtk_container_add(GTK_CONTAINER(menuItem), hbx);
00044 return menuItem;
00045 }
00046
00047 };
00048
00049 }
00050
00051 #endif