Reference Manual

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

# menushell.h

Go to the documentation of this file.

    00001 /*  Inti: Integrated Foundation Classes
    00002  *  Copyright (C) 2002-2003 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_SHELL_H
    00026 #define INTI_GTK_MENU_SHELL_H
    00027
    00028 #ifndef INTI_GTK_CONTAINER_H
    00029 #include <inti/gtk/container.h>
    00030 #endif
    00031
    00032 #ifndef __GTK_MENU_SHELL_H__
    00033 #include <gtk/gtkmenushell.h>
    00034 #endif
    00035
    00036 #ifndef INTI_GTK_MENU_ITEM_H
    00037 #include <inti/gtk/menuitem.h>
    00038 #endif
    00039
    00040 namespace Inti {
    00041
    00042 namespace Gtk {
    00043
    00044 class MenuShellClass;
    00045
    00048
    00049 enum MenuDirectionType
    00050 {
    00051         MENU_DIR_PARENT = GTK_MENU_DIR_PARENT,
    00052         MENU_DIR_CHILD = GTK_MENU_DIR_CHILD,
    00053         MENU_DIR_NEXT = GTK_MENU_DIR_NEXT,
    00054         MENU_DIR_PREV = GTK_MENU_DIR_PREV
    00055 };
    00056
    00064
    00065 class MenuShell : public Container
    00066 {
    00067         friend class G::Object;
    00068         friend class MenuShellClass;
    00069
    00070         MenuShell(const MenuShell&);
    00071         MenuShell& operator=(const MenuShell&);
    00072
    00073 protected:
    00076
    00077         MenuShell();
    00079
    00080         explicit MenuShell(GtkMenuShell *menu_shell, bool reference = false);
    00087
    00089 //  Override these do_ methods when you want to change the default behaviour of the GtkMenuShell.
    00090
    00091         virtual void do_select_item(GtkWidget *menu_item);
    00092
    00093         virtual void do_insert(GtkWidget *child, int position);
    00094
    00095         virtual int do_get_popup_delay();
    00096
    00099
    00100         virtual void on_deactivate();
    00102
    00103         virtual void on_selection_done();
    00105
    00107 //  Signals
    00108
    00109         typedef G::Signal0<void> DeactivateSignalType;
    00110         typedef G::SignalProxy<TypeInstance, DeactivateSignalType> DeactivateSignalProxy;
    00111         static const DeactivateSignalType deactivate_signal;
    00112
    00113         typedef G::Signal0<void> SelectionDoneSignalType;
    00114         typedef G::SignalProxy<TypeInstance, SelectionDoneSignalType> SelectionDoneSignalProxy;
    00115         static const SelectionDoneSignalType selection_done_signal;
    00116
    00117 public:
    00120
    00121         virtual ~MenuShell();
    00123
    00127
    00128         GtkMenuShell* gtk_menu_shell() const { return (GtkMenuShell*)instance; }
    00130
    00131         GtkMenuShellClass* gtk_menu_shell_class() const;
    00133
    00134         operator GtkMenuShell* () const;
    00136
    00137         bool children(std::vector<MenuItem*>& child_list) const;
    00141
    00145
    00146         void append(MenuItem& item, const Slot0<void> *callback = 0);
    00150
    00151         void append(MenuItem& item, const AccelKey& accel_key, const Slot0<void> *callback = 0);
    00159
    00160         void append(MenuItem& item, const AccelKey& accel_key, AccelGroup& accel_group, const Slot0<void> *callback = 0);
    00166
    00167         void append(const char *stock_id, const Slot0<void> *callback);
    00171
    00172         void prepend(MenuItem& item, const Slot0<void> *callback = 0);
    00176
    00177         void prepend(MenuItem& item, const AccelKey& accel_key, const Slot0<void> *callback = 0);
    00185
    00186         void prepend(MenuItem& item, const AccelKey& accel_key, AccelGroup& accel_group, const Slot0<void> *callback = 0);
    00192
    00193         void prepend(const char *stock_id, const Slot0<void> *callback);
    00197
    00198         void insert(MenuItem& item, int position, const Slot0<void> *callback = 0);
    00203
    00204         void insert(MenuItem& item, int position, const AccelKey& accel_key, const Slot0<void> *callback = 0);
    00213
    00214         void insert(MenuItem& item, int position, const AccelKey& accel_key, AccelGroup& accel_group, const Slot0<void> *callback = 0);
    00221
    00222         void insert(const char *stock_id, int position, const Slot0<void> *callback);
    00227
    00228         void select_item(MenuItem& item);
    00231
    00232         void deselect();
    00234
    00235         void activate_item(MenuItem& item, bool force_deactivate);
    00240
    00241         void deactivate();
    00244
    00245         void select_first(bool search_sensitive);
    00252
    00256
    00257         const DeactivateSignalProxy sig_deactivate()
    00258         {
    00259                 return DeactivateSignalProxy(this, &deactivate_signal);
    00260         }
    00262
    00263         const SelectionDoneSignalProxy sig_selection_done()
    00264         {
    00265                 return SelectionDoneSignalProxy(this, &selection_done_signal);
    00266         }
    00269
    00271 };
    00272
    00273 } // namespace Gtk
    00274
    00275 } // namespace Inti
    00276
    00277 #endif // INTI_GTK_MENU_SHELL_H
    00278

Main Page - Footer