| 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/menuitem.h> |
| 18 |
_DEFS(gtkmm,gtk) |
| 19 |
_PINCLUDE(gtkmm/private/menuitem_p.h) |
| 20 |
|
| 21 |
|
| 22 |
namespace Gtk |
| 23 |
{ |
| 24 |
|
| 25 |
/** A menu item that maintains the state of a boolean value in addition to a Gtk::MenuItem's usual role in activating application code. |
| 26 |
* A check box indicating the state of the boolean value is displayed at the left side of the Gtk::MenuItem. |
| 27 |
* Activating the Gtk::MenuItem toggles the value. |
| 28 |
* @ingroup Widgets |
| 29 |
* @ingroup Menus |
| 30 |
*/ |
| 31 |
class GTKMM_API CheckMenuItem : public MenuItem |
| 32 |
{ |
| 33 |
_CLASS_GTKOBJECT(CheckMenuItem,GtkCheckMenuItem,GTK_CHECK_MENU_ITEM,Gtk::MenuItem,GtkMenuItem,,,GTKMM_API) |
| 34 |
public: |
| 35 |
|
| 36 |
_CTOR_DEFAULT |
| 37 |
explicit CheckMenuItem(const Glib::ustring& label, bool mnemonic = false); |
| 38 |
|
| 39 |
|
| 40 |
_WRAP_METHOD(void set_active(bool is_active = true), gtk_check_menu_item_set_active) |
| 41 |
_WRAP_METHOD(bool get_active() const, gtk_check_menu_item_get_active) |
| 42 |
|
| 43 |
_WRAP_METHOD(void toggled(), gtk_check_menu_item_toggled) |
| 44 |
|
| 45 |
_WRAP_METHOD(void set_inconsistent(bool setting = true), gtk_check_menu_item_set_inconsistent) |
| 46 |
_WRAP_METHOD(bool get_inconsistent() const, gtk_check_menu_item_get_inconsistent) |
| 47 |
|
| 48 |
_WRAP_METHOD(void set_draw_as_radio(bool draw_as_radio = true), gtk_check_menu_item_set_draw_as_radio) |
| 49 |
_WRAP_METHOD(bool get_draw_as_radio() const, gtk_check_menu_item_get_draw_as_radio) |
| 50 |
|
| 51 |
_WRAP_SIGNAL(void toggled(), "toggled") |
| 52 |
|
| 53 |
_WRAP_PROPERTY("active", bool) |
| 54 |
_WRAP_PROPERTY("inconsistent", bool) |
| 55 |
_WRAP_PROPERTY("draw-as-radio", bool) |
| 56 |
|
| 57 |
protected: |
| 58 |
|
| 59 |
#m4begin |
| 60 |
dnl This extra conversion does the extra reference, often needed by code for vfuncs and signal. |
| 61 |
_CONVERSION(`cairo_t*',`const ::Cairo::RefPtr< ::Cairo::Context>&',`::Cairo::RefPtr< ::Cairo::Context>(new ::Cairo::Context($3, false /* has_reference */))') |
| 62 |
#m4end |
| 63 |
|
| 64 |
/** Triggered when the item is redrawn (e.g.after being toggled) |
| 65 |
* Overload this signal if you want to implement your own check item |
| 66 |
* look. Otherwise, you most likely don't care about it. |
| 67 |
* The GdkRectangle specifies the area of the widget which will get |
| 68 |
* redrawn. |
| 69 |
*/ |
| 70 |
_WRAP_VFUNC(void draw_indicator(const ::Cairo::RefPtr< ::Cairo::Context>& cr), draw_indicator) |
| 71 |
}; |
| 72 |
|
| 73 |
} //namespace Gtk |