| 1 |
/* Copyright (C) 1998-2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/menushell.h> |
| 18 |
#include <gtkmm/menuitem.h> |
| 19 |
_DEFS(gtkmm,gtk) |
| 20 |
_PINCLUDE(gtkmm/private/menushell_p.h) |
| 21 |
|
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
|
| 26 |
_WRAP_ENUM(PackDirection, GtkPackDirection, decl_prefix GTKMM_API) |
| 27 |
|
| 28 |
/** A standard menu bar which usually holds Gtk::Menu submenu items. |
| 29 |
* The useful methods are in the base class - Gtk::MenuShell. |
| 30 |
* |
| 31 |
* The MenuBar widget looks like this: |
| 32 |
* @image html menubar1.png |
| 33 |
* |
| 34 |
* @ingroup Widgets |
| 35 |
* @ingroup Menus |
| 36 |
*/ |
| 37 |
class GTKMM_API MenuBar : public MenuShell |
| 38 |
{ |
| 39 |
_CLASS_GTKOBJECT(MenuBar,GtkMenuBar,GTK_MENU_BAR,Gtk::MenuShell,GtkMenuShell,,,GTKMM_API) |
| 40 |
|
| 41 |
public: |
| 42 |
MenuBar(); |
| 43 |
|
| 44 |
//This is custom-implemented because the gtk_menu_new_from_model() does more |
| 45 |
//than just call g_object_new. See https://bugzilla.gnome.org/show_bug.cgi?id=704671 |
| 46 |
//This might be nearly-useless. See https://bugzilla.gnome.org/show_bug.cgi?id=708905 |
| 47 |
/** Creates a new MenuBar and populates it with menu items |
| 48 |
* and submenus according to the @a model. |
| 49 |
* |
| 50 |
* The created menu items are connected to actions found in the |
| 51 |
* ApplicationWindow to which the menu bar belongs - typically |
| 52 |
* by means of being contained within the ApplicationWindow's |
| 53 |
* widget hierarchy. |
| 54 |
* |
| 55 |
* @param model |
| 56 |
* |
| 57 |
* @newin{3,10} |
| 58 |
*/ |
| 59 |
explicit MenuBar(const Glib::RefPtr<Gio::MenuModel>& model); |
| 60 |
_IGNORE(gtk_menu_bar_new_from_model) |
| 61 |
|
| 62 |
_WRAP_METHOD(PackDirection get_pack_direction () const, gtk_menu_bar_get_pack_direction) |
| 63 |
_WRAP_METHOD(void set_pack_direction(PackDirection pack_dir), gtk_menu_bar_set_pack_direction) |
| 64 |
_WRAP_METHOD(PackDirection get_child_pack_direction() const, gtk_menu_bar_get_child_pack_direction) |
| 65 |
_WRAP_METHOD(void set_child_pack_direction(PackDirection child_pack_dir), gtk_menu_bar_set_child_pack_direction) |
| 66 |
|
| 67 |
// append, prepend and insert are defined in menushell |
| 68 |
|
| 69 |
_WRAP_PROPERTY("pack-direction", PackDirection) |
| 70 |
_WRAP_PROPERTY("child-pack-direction", PackDirection) |
| 71 |
|
| 72 |
private: |
| 73 |
void init_accels_handler_(void); |
| 74 |
}; |
| 75 |
|
| 76 |
} // namespace Gtk |