Debian Codegraph @

gtk/src/offscreenwindow.hg

raw
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 _CONFIGINCLUDE(gtkmmconfig.h)
18
19 #include <gtkmm/window.h>
20
21 _DEFS(gtkmm,gtk)
22 _PINCLUDE(gtkmm/private/window_p.h)
23
24 namespace Gtk
25 {
26
27 /** A top-level container widget used to manage offscreen rendering of child widgets.
28 * OffscreenWindow is strictly intended to be used for obtaining
29 * snapshots of widgets that are not part of a normal widget hierarchy.
30 * It differs from Gtk::Widget::get_snapshot() in that the widget you
31 * want to get a snapshot of need not be displayed on the user's screen
32 * as a part of a widget hierarchy. However, since OffscreenWindow
33 * is a top-level widget you cannot obtain snapshots of a full window
34 * with it since you cannot pack a toplevel widget in another toplevel.
35 *
36 * The idea is to take a widget and manually set the state of it,
37 * add it to an OffscreenWindow and then retrieve the snapshot
38 * as a Gdk::Pixbuf.
39 *
40 * OffscreenWindow derives from Window only as an implementation
41 * detail. Applications should not use any API specific to #GtkWindow
42 * to operate on this object. It should be treated as a Bin that
43 * has no parent widget.
44 *
45 * When contained offscreen widgets are redrawn, OffscreenWindow
46 * will emit a "damage-event" signal.
47 *
48 * @newin{2,20}
49 * @ingroup Containers
50 * @ingroup Widgets
51 */
52 class GTKMM_API OffscreenWindow : public Window
53 {
54 _CLASS_GTKOBJECT(OffscreenWindow, GtkOffscreenWindow, GTK_OFFSCREEN_WINDOW, Gtk::Window, GtkWindow, , , GTKMM_API)
55 _UNMANAGEABLE
56 public:
57 _CTOR_DEFAULT()
58
59 //TODO: Should this always be const?
60 #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new Cairo::Surface($3, true /* take reference */))')
61 #m4 _CONVERSION(`cairo_surface_t*',`Cairo::RefPtr<const Cairo::Surface>',`Cairo::RefPtr<Cairo::Surface>(new Cairo::Surface($3, true /* take reference */))')
62 _WRAP_METHOD(Cairo::RefPtr<Cairo::Surface> get_surface(), gtk_offscreen_window_get_surface)
63 _WRAP_METHOD(Cairo::RefPtr<const Cairo::Surface> get_surface() const, gtk_offscreen_window_get_surface)
64
65
66 _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_pixbuf(), gtk_offscreen_window_get_pixbuf)
67 _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_pixbuf() const, gtk_offscreen_window_get_pixbuf)
68 };
69
70 } // namespace Gtk