Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# menuitem.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002 The Inti Development Team.
    00003  *  Copyright (C) 2000 Red Hat, Inc.
    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 Library General Public License for more details.
    00014  *
    00015  *  You should have received a copy of the GNU Library General Public License
    00016  *  along with this program; if not, write to the Free Software
    00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    00018  */
    00019
    00024
    00025 #ifndef INTI_GTK_MENU_ITEM_H
    00026 #define INTI_GTK_MENU_ITEM_H
    00027
    00028 #ifndef INTI_GTK_ITEM_H
    00029 #include <inti/gtk/item.h>
    00030 #endif
    00031
    00032 #ifndef __GTK_MENU_ITEM_H__
    00033 #include <gtk/gtkmenuitem.h>
    00034 #endif
    00035
    00036 namespace Inti {
    00037
    00038 namespace Gtk {
    00039
    00040 class Menu;
    00041 class MenuItemClass;
    00042
    00049
    00050 class MenuItem : public Item
    00051 {
    00052         friend class G::Object;
    00053         friend class MenuItemClass;
    00054
    00055         MenuItem(const MenuItem&);
    00056         MenuItem& operator=(const MenuItem&);
    00057
    00058 protected:
    00061
    00062         explicit MenuItem(GtkMenuItem *menu_item, bool reference = false);
    00069
    00073
    00074         void add_label(const String& label, bool use_underline);
    00081
    00085
    00086         virtual void on_activate();
    00088
    00089         virtual void on_activate_item();
    00092
    00093         virtual void on_toggle_size_request(int *requisition);
    00099
    00100         virtual void on_toggle_size_allocate(int allocate);
    00106
    00108 //  Signals
    00109
    00110         typedef G::Signal0<void> ActivateSignalType;
    00111         typedef G::SignalProxy<TypeInstance, ActivateSignalType> ActivateSignalProxy;
    00112         static const ActivateSignalType activate_signal;
    00113
    00114         typedef G::Signal0<void> ActivateItemSignalType;
    00115         typedef G::SignalProxy<TypeInstance, ActivateItemSignalType> ActivateItemSignalProxy;
    00116         static const ActivateItemSignalType activate_item_signal;
    00117
    00118         typedef G::Signal1<void, int*> ToggleSizeRequestSignalType;
    00119         typedef G::SignalProxy<TypeInstance, ToggleSizeRequestSignalType> ToggleSizeRequestSignalProxy;
    00120         static const ToggleSizeRequestSignalType toggle_size_request_signal;
    00121
    00122         typedef G::Signal1<void, int> ToggleSizeAllocateSignalType;
    00123         typedef G::SignalProxy<TypeInstance, ToggleSizeAllocateSignalType> ToggleSizeAllocateSignalProxy;
    00124         static const ToggleSizeAllocateSignalType toggle_size_allocate_signal;
    00125
    00126 public:
    00129
    00130         MenuItem();
    00132
    00133         explicit MenuItem(const String& label, bool use_underline = false);
    00137
    00138         MenuItem(const String& label, Menu& submenu, bool use_underline = false);
    00143
    00144         virtual ~MenuItem();
    00146
    00150
    00151         GtkMenuItem* gtk_menu_item() const { return (GtkMenuItem*)instance; }
    00153
    00154         GtkMenuItemClass* gtk_menu_item_class() const;
    00156
    00157         operator GtkMenuItem* () const;
    00159
    00160         bool has_submenu() const;
    00162
    00163         bool get_right_justified() const;
    00166
    00167         Menu* get_submenu() const;
    00170
    00174
    00175         void set_label(const String& label, bool use_underline = false);
    00182
    00183         void set_submenu(Menu& submenu);
    00186
    00187         void remove_submenu();
    00189
    00190         void activate();
    00192
    00193         void toggle_size_request(int *requisition);
    00195
    00196         void toggle_size_allocate(int allocation);
    00198
    00199         void set_right_justified(bool right_justified);
    00206
    00207         void set_accel_path(const char *accel_path);
    00223
    00227
    00228         const ActivateSignalProxy sig_activate()
    00229         {
    00230                 return ActivateSignalProxy(this, &activate_signal);
    00231         }
    00233
    00234         const ActivateItemSignalProxy sig_activate_item()
    00235         {
    00236                 return ActivateItemSignalProxy(this, &activate_item_signal);
    00237         }
    00241
    00242         const ToggleSizeRequestSignalProxy sig_toggle_size_request()
    00243         {
    00244                 return ToggleSizeRequestSignalProxy(this, &toggle_size_request_signal);
    00245         }
    00248
    00249         const ToggleSizeAllocateSignalProxy sig_toggle_size_allocate()
    00250         {
    00251                 return ToggleSizeAllocateSignalProxy(this, &toggle_size_allocate_signal);
    00252         }
    00255
    00257 };
    00258
    00259 } // namespace Gtk
    00260
    00261 } // namespace Inti
    00262
    00263 #endif // INTI_GTK_MENU_ITEM_H
    00264

Main Page - Footer