| 1 |
/* Copyright (C) 2014 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/bin.h> |
| 18 |
_DEFS(gtkmm,gtk) |
| 19 |
_PINCLUDE(gtkmm/private/bin_p.h) |
| 20 |
|
| 21 |
namespace Gtk |
| 22 |
{ |
| 23 |
|
| 24 |
/** A container which overlays widgets on top of each other. |
| 25 |
* |
| 26 |
* Gtk::Overlay is a container which contains a single main child, on top |
| 27 |
* of which it can place “overlay” widgets. The |
| 28 |
* position of each overlay widget is determined by its Gtk::Widget:halign |
| 29 |
* and Gtk::Widget:valign properties. E.g. a widget with both alignments |
| 30 |
* set to Gtk::ALIGN_START will be placed at the top left corner of the |
| 31 |
* main widget, whereas an overlay with halign set to Gtk::ALIGN_CENTER |
| 32 |
* and valign set to Gtk::ALIGN_END will be placed a the bottom edge of |
| 33 |
* the main widget, horizontally centered. The position can be adjusted |
| 34 |
* by setting the margin properties of the child to non-zero values. |
| 35 |
* |
| 36 |
* More complicated placement of overlays is possible by connecting |
| 37 |
* to the Gtk::Overlay::get-child-position signal. |
| 38 |
* |
| 39 |
* The Gtk::Overlay implementation of the Gtk::Buildable interface |
| 40 |
* supports placing a child as an overlay by specifying “overlay” as |
| 41 |
* the “type” attribute of a `<child>` element. |
| 42 |
* |
| 43 |
* @ingroup Containers |
| 44 |
* @newin{3,14} |
| 45 |
*/ |
| 46 |
|
| 47 |
class GTKMM_API Overlay |
| 48 |
: public Bin |
| 49 |
{ |
| 50 |
_CLASS_GTKOBJECT(Overlay, GtkOverlay, GTK_OVERLAY, Gtk::Bin, GtkBin, , , GTKMM_API) |
| 51 |
public: |
| 52 |
|
| 53 |
/** Creates a new Overlay. |
| 54 |
*/ |
| 55 |
_CTOR_DEFAULT |
| 56 |
|
| 57 |
|
| 58 |
_WRAP_METHOD(void add_overlay(Gtk::Widget& widget), gtk_overlay_add_overlay) |
| 59 |
|
| 60 |
_WRAP_METHOD(void reorder_overlay(Widget& child, int position), gtk_overlay_reorder_overlay) |
| 61 |
_WRAP_METHOD(bool get_overlay_pass_through(Widget& widget) const, gtk_overlay_get_overlay_pass_through) |
| 62 |
_WRAP_METHOD(void set_overlay_pass_through(Widget& widget, bool pass_through = true), gtk_overlay_set_overlay_pass_through) |
| 63 |
|
| 64 |
#m4 _CONVERSION(`GdkRectangle*',`Gdk::Rectangle&',`Glib::wrap($3)') |
| 65 |
_WRAP_SIGNAL(bool get_child_position(Gtk::Widget* widget, Gdk::Rectangle& allocation), "get-child-position") |
| 66 |
|
| 67 |
_WRAP_CHILD_PROPERTY("pass-through", bool) |
| 68 |
_WRAP_CHILD_PROPERTY("index", int) |
| 69 |
|
| 70 |
}; |
| 71 |
|
| 72 |
} // namespace Gtk |