| 1 |
/* Copyright (C) 2010 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/widget.h> |
| 18 |
#include <gtkmm/activatable.h> |
| 19 |
_DEFS(gtkmm,gtk) |
| 20 |
_PINCLUDE(gtkmm/private/widget_p.h) |
| 21 |
|
| 22 |
namespace Gtk |
| 23 |
{ |
| 24 |
|
| 25 |
//TODO: Derive from (and implement) Actionable when we can break ABI. |
| 26 |
|
| 27 |
/** A "light switch"-style toggle. |
| 28 |
* |
| 29 |
* The Switch widget has two states: on or off. The user can control |
| 30 |
* which state should be active by clicking the empty area, or by dragging the |
| 31 |
* handle. |
| 32 |
* |
| 33 |
* @ingroup Widgets |
| 34 |
* @newin{3,0} |
| 35 |
*/ |
| 36 |
class GTKMM_API Switch |
| 37 |
: public Widget, |
| 38 |
public Activatable |
| 39 |
{ |
| 40 |
_CLASS_GTKOBJECT(Switch, GtkSwitch, GTK_SWITCH, Gtk::Widget, GtkWidget, , , GTKMM_API) |
| 41 |
_IMPLEMENTS_INTERFACE(Activatable) |
| 42 |
public: |
| 43 |
|
| 44 |
_CTOR_DEFAULT |
| 45 |
|
| 46 |
_WRAP_METHOD(void set_active(bool is_active = true), gtk_switch_set_active) |
| 47 |
_WRAP_METHOD(bool get_active() const, gtk_switch_get_active) |
| 48 |
|
| 49 |
_WRAP_METHOD(void set_state(bool state = true), gtk_switch_set_state) |
| 50 |
_WRAP_METHOD(bool get_state() const, gtk_switch_get_state) |
| 51 |
|
| 52 |
_WRAP_PROPERTY("active", bool) |
| 53 |
_WRAP_PROPERTY("state", bool) |
| 54 |
|
| 55 |
//activate is an action signal that's documented as not for use by applications. |
| 56 |
_IGNORE_SIGNAL("activate") |
| 57 |
|
| 58 |
_WRAP_SIGNAL(bool state_set(bool state), "state-set") |
| 59 |
}; |
| 60 |
|
| 61 |
} // namespace Gtk |