Debian Codegraph @

gtk/src/frame.hg

raw
1 /* Copyright (C) 1998-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
18 #include <gtkmm/bin.h>
19 _DEFS(gtkmm,gtk)
20 _PINCLUDE(gtkmm/private/bin_p.h)
21
22 namespace Gtk
23 {
24
25 /** A Gtk::Bin with a decorative frame and optional label.
26 *
27 * The Frame widget surrounds its single child with a decorative frame and
28 * an optional label. If present, the label is drawn in a gap in the top
29 * side of the frame. The position of the label can be controlled with
30 * set_label_align().
31 *
32 * A Frame widget looks like this:
33 * @image html frame1.png
34 *
35 * @ingroup Widgets
36 * @ingroup Containers
37 */
38 class GTKMM_API Frame : public Bin
39 {
40 _CLASS_GTKOBJECT(Frame,GtkFrame,GTK_FRAME,Gtk::Bin,GtkBin,,,GTKMM_API)
41 public:
42
43 _CTOR_DEFAULT()
44 _WRAP_CTOR(Frame(const Glib::ustring& label), gtk_frame_new)
45
46 //TODO: Add a bool use_markup arg to set_label() as a convenience - it would have to use set_label_widget().
47
48 /** Set the label to appear in the top edge of the frame.
49 * Label alignment defaults to the upper left corner of the frame.
50 */
51 _WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_frame_set_label)
52 void unset_label();
53 _WRAP_METHOD(Glib::ustring get_label() const, gtk_frame_get_label)
54
55 _WRAP_METHOD(void set_label_widget(Widget& label_widget), gtk_frame_set_label_widget)
56 _WRAP_METHOD(Widget* get_label_widget(), gtk_frame_get_label_widget)
57 _WRAP_METHOD(const Widget* get_label_widget() const, gtk_frame_get_label_widget, constversion)
58
59 _WRAP_METHOD(void set_label_align(float xalign = 0.0, float yalign = 0.5), gtk_frame_set_label_align)
60 /** Sets the alignment of the frame widget’s label. The
61 * default values for a newly created frame are Gtk::ALIGN_START and Gtk::ALIGN_CENTER.
62 *
63 * @param xalign The position of the label along the top edge
64 * of the widget. A value of Gtk::ALIGN_START represents left alignment;
65 * Gtk::ALIGN_END represents right alignment.
66 * @param yalign The y alignment of the label. A value of Gtk::ALIGN_START aligns under
67 * the frame; Gtk::ALIGN_END aligns above the frame. If the values are
68 * Gtk::ALIGN_START or Gtk::ALIGN_END the gap in the frame won’t be painted because the label
69 * will be completely above or below the frame.
70 */
71 _WRAP_METHOD(void set_label_align(Align xalign, Align yalign = Gtk::ALIGN_CENTER), gtk_frame_set_label_align)
72
73 _WRAP_METHOD(void get_label_align(float& xalign, float& yalign) const, gtk_frame_get_label_align)
74
75 /** Sets shadow type of the frame.
76 */
77 _WRAP_METHOD(void set_shadow_type(ShadowType type), gtk_frame_set_shadow_type)
78 _WRAP_METHOD(ShadowType get_shadow_type() const, gtk_frame_get_shadow_type)
79
80 _WRAP_PROPERTY("label", Glib::ustring)
81 _WRAP_PROPERTY("label-xalign", double)
82 _WRAP_PROPERTY("label-yalign", double)
83 _WRAP_PROPERTY("shadow-type", ShadowType)
84 _WRAP_PROPERTY("label-widget", Widget*)
85
86 protected:
87 #m4 _CONVERSION(`GtkAllocation*',`Allocation&',`($2)(Glib::wrap($3))')
88 _WRAP_VFUNC(void compute_child_allocation(Allocation& allocation), compute_child_allocation)
89
90 };
91
92 } // namespace Gtk