| 1 |
/* Copyright (C) 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 <vector> |
| 18 |
|
| 19 |
#include <glibmm/object.h> |
| 20 |
#include <gtkmm/widget.h> |
| 21 |
_DEFS(gtkmm,gtk) |
| 22 |
_PINCLUDE(glibmm/private/object_p.h) |
| 23 |
|
| 24 |
|
| 25 |
namespace Gtk |
| 26 |
{ |
| 27 |
|
| 28 |
_CC_INCLUDE(gtk/gtk.h) |
| 29 |
_WRAP_ENUM(SizeGroupMode, GtkSizeGroupMode, decl_prefix GTKMM_API) |
| 30 |
|
| 31 |
/** Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. |
| 32 |
* This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk::Grid widget. |
| 33 |
* |
| 34 |
* In detail, the size requested for each widget in a Gtk::SizeGroup is the maximum of the sizes that would have been |
| 35 |
* requested for each widget in the size group if they were not in the size group. The mode of the size group (see |
| 36 |
* set_mode()) determines whether this applies to the horizontal size, the vertical size, or both sizes. |
| 37 |
* |
| 38 |
* Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If |
| 39 |
* you want the widgets in a GtkSizeGroup to actually be the same size, you need to pack them in such a way that they |
| 40 |
* get the size they request and not more. For example, if you are packing your widgets into a table, you would not |
| 41 |
* include the Gtk::FILL flag. |
| 42 |
* |
| 43 |
* Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal |
| 44 |
* requisition of all widgets that can be reached from the widget by a chain of size groups of type |
| 45 |
* Gtk::SIZE_GROUP_HORIZONTAL or Gtk::SIZE_GROUP_BOTH, and the vertical size from the vertical requisition of all widgets |
| 46 |
* that can be reached from the widget by a chain of size groups of type Gtk::SIZE_GROUP_VERTICAL or Gtk::SIZE_GROUP_BOTH. |
| 47 |
*/ |
| 48 |
class GTKMM_API SizeGroup |
| 49 |
: public Glib::Object, |
| 50 |
public Buildable |
| 51 |
{ |
| 52 |
_CLASS_GOBJECT(SizeGroup,GtkSizeGroup,GTK_SIZE_GROUP,Glib::Object,GObject,,,GTKMM_API) |
| 53 |
_IMPLEMENTS_INTERFACE(Buildable) |
| 54 |
protected: |
| 55 |
explicit SizeGroup(SizeGroupMode mode); |
| 56 |
|
| 57 |
public: |
| 58 |
|
| 59 |
_WRAP_CREATE(SizeGroupMode mode) |
| 60 |
|
| 61 |
_WRAP_METHOD(void set_mode(SizeGroupMode mode), gtk_size_group_set_mode) |
| 62 |
_WRAP_METHOD(SizeGroupMode get_mode() const, gtk_size_group_get_mode) |
| 63 |
|
| 64 |
_WRAP_METHOD(void set_ignore_hidden(bool ignore_hidden = true), gtk_size_group_set_ignore_hidden, |
| 65 |
deprecated "Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.") |
| 66 |
_WRAP_METHOD(bool get_ignore_hidden() const, gtk_size_group_get_ignore_hidden, |
| 67 |
deprecated "Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.") |
| 68 |
|
| 69 |
_WRAP_METHOD(void add_widget(Widget& widget), gtk_size_group_add_widget) |
| 70 |
_WRAP_METHOD(void remove_widget(Widget& widget), gtk_size_group_remove_widget) |
| 71 |
|
| 72 |
#m4 _CONVERSION(`GSList*',`std::vector<Widget*>',`Glib::SListHandler<Widget*>::slist_to_vector($3, Glib::OWNERSHIP_NONE)') |
| 73 |
_WRAP_METHOD(std::vector<Widget*> get_widgets(), gtk_size_group_get_widgets) |
| 74 |
#m4 _CONVERSION(`GSList*',`std::vector<const Widget*>',`Glib::SListHandler<const Widget*>::slist_to_vector($3, Glib::OWNERSHIP_NONE)') |
| 75 |
_WRAP_METHOD(std::vector<const Widget*> get_widgets() const, gtk_size_group_get_widgets) |
| 76 |
|
| 77 |
_WRAP_PROPERTY("mode", SizeGroupMode) |
| 78 |
_WRAP_PROPERTY("ignore_hidden", bool, |
| 79 |
deprecated "Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.") |
| 80 |
}; |
| 81 |
|
| 82 |
} //namespace Gtk |