| 1 |
/* Copyright (C) 2013 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/container.h> |
| 18 |
#include <gtkmm/enums.h> |
| 19 |
|
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/container_p.h) |
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
_CC_INCLUDE(gtk/gtk.h) |
| 26 |
|
| 27 |
/** A container that shows only one child at a time. |
| 28 |
* |
| 29 |
* Gtk::Stack does not provide a means for users to change the visible |
| 30 |
* child. Instead, the Gtk::StackSwitcher or Gtk::StackSidebar widget can be used with |
| 31 |
* Gtk::Stack to provide this functionality. |
| 32 |
* |
| 33 |
* @ingroup Widgets |
| 34 |
* @ingroup Containers |
| 35 |
* @newin{3,10} |
| 36 |
*/ |
| 37 |
class GTKMM_API Stack |
| 38 |
: public Container |
| 39 |
{ |
| 40 |
_CLASS_GTKOBJECT(Stack,GtkStack,GTK_STACK,Gtk::Container,GtkContainer,,,GTKMM_API) |
| 41 |
public: |
| 42 |
_CTOR_DEFAULT |
| 43 |
|
| 44 |
_WRAP_METHOD(void add(Widget& child, const Glib::ustring& name), gtk_stack_add_named) |
| 45 |
|
| 46 |
_WRAP_METHOD(void add(Widget& child, const Glib::ustring& name, const Glib::ustring& title), gtk_stack_add_titled) |
| 47 |
|
| 48 |
//TODO: Remove this method overload when we can break ABI and API, and Container::add() |
| 49 |
//has been made non-virtual. It's not very useful in Stack. It's needed only to |
| 50 |
//avoid a compilation error when compiling with -Woverloaded-virtual -Werror. |
| 51 |
//See https://bugzilla.gnome.org/show_bug.cgi?id=724732 |
| 52 |
/** Adds a child. |
| 53 |
* |
| 54 |
* @newin{3,14} |
| 55 |
* |
| 56 |
* @deprecated Use one of the other add() methods instead. This method was added only to avoid a compilation error. |
| 57 |
*/ |
| 58 |
void add(Widget& child) override; |
| 59 |
|
| 60 |
_WRAP_METHOD(void set_visible_child(Widget& child), gtk_stack_set_visible_child) |
| 61 |
|
| 62 |
_WRAP_METHOD(Widget* get_visible_child(), gtk_stack_get_visible_child) |
| 63 |
_WRAP_METHOD(const Widget* get_visible_child() const, gtk_stack_get_visible_child, constversion) |
| 64 |
|
| 65 |
_WRAP_METHOD(void set_visible_child(const Glib::ustring& name), gtk_stack_set_visible_child_name) |
| 66 |
_WRAP_METHOD(void set_visible_child(const Glib::ustring& name, StackTransitionType transition), gtk_stack_set_visible_child_full) |
| 67 |
_WRAP_METHOD(Glib::ustring get_visible_child_name() const, gtk_stack_get_visible_child_name) |
| 68 |
|
| 69 |
_WRAP_METHOD(void set_homogeneous(bool homogeneous = true), gtk_stack_set_homogeneous) |
| 70 |
_WRAP_METHOD(bool get_homogeneous() const, gtk_stack_get_homogeneous) |
| 71 |
|
| 72 |
_WRAP_METHOD(void set_hhomogeneous(bool hhomogeneous = true), gtk_stack_set_hhomogeneous) |
| 73 |
_WRAP_METHOD(bool get_hhomogeneous() const, gtk_stack_get_hhomogeneous) |
| 74 |
|
| 75 |
_WRAP_METHOD(void set_vhomogeneous(bool vhomogeneous = true), gtk_stack_set_vhomogeneous) |
| 76 |
_WRAP_METHOD(bool get_vhomogeneous() const, gtk_stack_get_vhomogeneous) |
| 77 |
|
| 78 |
_WRAP_METHOD(void set_transition_duration(guint duration), gtk_stack_set_transition_duration) |
| 79 |
_WRAP_METHOD(guint get_transition_duration() const, gtk_stack_get_transition_duration) |
| 80 |
|
| 81 |
_WRAP_METHOD(void set_transition_type(StackTransitionType transition), gtk_stack_set_transition_type) |
| 82 |
_WRAP_METHOD(StackTransitionType get_transition_type(), gtk_stack_get_transition_type, deprecated "Use the const method instead.") |
| 83 |
_WRAP_METHOD(StackTransitionType get_transition_type() const, gtk_stack_get_transition_type) |
| 84 |
|
| 85 |
_WRAP_METHOD(bool get_transition_running() const, gtk_stack_get_transition_running) |
| 86 |
|
| 87 |
_WRAP_METHOD(Widget* get_child_by_name(const Glib::ustring& name), gtk_stack_get_child_by_name) |
| 88 |
_WRAP_METHOD(const Widget* get_child_by_name(const Glib::ustring& name) const, gtk_stack_get_child_by_name, constversion) |
| 89 |
|
| 90 |
_WRAP_METHOD(void set_interpolate_size(bool interpolate_size), gtk_stack_set_interpolate_size, newin "3,20") |
| 91 |
_WRAP_METHOD(bool get_interpolate_size() const, gtk_stack_get_interpolate_size, newin "3,20") |
| 92 |
|
| 93 |
_WRAP_PROPERTY("homogeneous", bool) |
| 94 |
_WRAP_PROPERTY("hhomogeneous", bool) |
| 95 |
_WRAP_PROPERTY("transition-duration", unsigned int) |
| 96 |
_WRAP_PROPERTY("transition-running", bool) |
| 97 |
_WRAP_PROPERTY("transition-type", StackTransitionType) |
| 98 |
_WRAP_PROPERTY("vhomogeneous", bool) |
| 99 |
_WRAP_PROPERTY("visible-child", Widget*) |
| 100 |
_WRAP_PROPERTY("visible-child-name", Glib::ustring) |
| 101 |
_WRAP_PROPERTY("interpolate-size", bool, newin "3,20") |
| 102 |
|
| 103 |
_WRAP_CHILD_PROPERTY("name", Glib::ustring) |
| 104 |
_WRAP_CHILD_PROPERTY("title", Glib::ustring) |
| 105 |
_WRAP_CHILD_PROPERTY("icon-name", Glib::ustring) |
| 106 |
_WRAP_CHILD_PROPERTY("position", int) |
| 107 |
_WRAP_CHILD_PROPERTY("needs-attention", bool) |
| 108 |
|
| 109 |
// There are no signals or vfuncs. |
| 110 |
}; |
| 111 |
|
| 112 |
} //namespace Gtk |