/* $Id: menuitem.gen_h,v 1.49 2001/07/15 13:33:38 murrayc Exp $ */ /* menuitem.h * * Copyright (C) 1998-1999 The Gtk-- Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <gtk--/item.h> #include <gtk/gtkmenuitem.h> namespace Gtk { class Menu; //: The widget used for item in menus. //- The {\class Gtk::MenuItem} widget and the derived widgets are the only valid //- childs for menus. Their function is to correctly handle highlighting, //- alignment, events and submenus. //- //- As it derives from {\class Gtk::Bin} it can hold any valid child widget, //- altough only a few are really useful. class MenuItem : public Item { public: typedef MenuItem CppObjectType; typedef GtkMenuItem BaseObjectType; public: //: Returns the underlaying gtk+ object. GtkMenuItem* gtkobj(); const GtkMenuItem* gtkobj() const; //: Returns true if object is this type. static bool isA(Gtk::Object *object); virtual ~MenuItem(); private: public: //: create an empty menu item MenuItem(); //: create a menu item with label MenuItem(const string &label,gfloat x=0.0,gfloat y=0.5); Gtk::Menu* get_submenu() const; bool has_submenu() { return (gtkobj()->submenu)!=0; } //: Make this item a cascading menu void set_submenu(Gtk::Menu& submenu); //: Remove the item's attached submenu void remove_submenu(); void set_placement(GtkSubmenuPlacement placement); void configure(gint show_toggle_indicator,gint show_submenu_indicator); void right_justify(); // gtk_menu_item_(de)select are just a wrapper for gtk_item_(de)select // and defined in Gtk_Item, so they do not be redefined here emitable signal void activate(); signal void activate_item(); /* these are internal and will become private */ guint accel_key; guint nav_key; Label* accel_label_; void show_accel_label(); void hide_accel_label(); void accelerate(); // this is a hack to insert accelerators in realized widgets // without breaking binary compatiblity. Move to realize_impl protected: // impl functions virtual void activate_impl(); virtual void activate_item_impl(); }; //+ PROPERTIES(gtkmenuitem) //. name: submenu //. type: Gtk_Menu* //. get: {get_submenu()} //. set: {set_submenu()} //. desc: The submenu (e.g. cascading menu) this item may hold //. name: show_toggle_indicator //. type: bool //. get: none //. set: {configure()} //. desc: Unused. //. name: show_submenu_indicator //. type: bool //. get: none //. set: {configure()} //. desc: If the item holds a submenu and this flag is set, //. an arrow next to the item's label will be drawn //. name: submenu_placement //. type: guint:1 //. get: none //. set: {set_placement()} //. desc: Can be set to {\enum GTK_TOP_BOTTOM, GTK_LEFT_RIGHT} //. name: right_justify //. type: bool //. get: none //. set: {right_justify()} //. desc: {right_justify()} forces this flag to true }