Debian Codegraph @

gtk/src/bin.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 #include <gtkmm/container.h>
18 _DEFS(gtkmm,gtk)
19 _PINCLUDE(gtkmm/private/container_p.h)
20
21 namespace Gtk
22 {
23
24 //TODO: Add an add_pixbuf() method?
25 /** A container with just one child.
26 *
27 * This is an abstract base class from which all classes holding
28 * up to 1 widget inside of them derive. It provides access to methods
29 * relevent to a single object, such as add_label, etc.
30 *
31 * @ingroup Widgets
32 */
33 class GTKMM_API Bin : public Container
34 {
35 _CLASS_GTKOBJECT(Bin,GtkBin,GTK_BIN,Gtk::Container,GtkContainer,,,GTKMM_API)
36 protected:
37
38 /** This constructor is protected because only derived
39 * classes should be instantiated.
40 */
41 _CTOR_DEFAULT
42 public:
43
44 _WRAP_METHOD(Gtk::Widget* get_child(), gtk_bin_get_child)
45 _WRAP_METHOD(const Gtk::Widget* get_child() const, gtk_bin_get_child)
46
47 /** Remove the contained widget.
48 * Since this can only hold one widget it is not necessary to
49 * specify which widget to remove like other containers.
50 *
51 * Sometimes when a widget is added to a Gtk::ScrolledWindow, a Gtk::Viewport
52 * is created and inserted between the ScrolledWindow and the added widget.
53 * If the child is such an automatically created Viewport, remove() removes
54 * the Viewport's child from the Viewport, and removes the Viewport from the
55 * ScrolledWindow. The Viewport is destroyed.
56 */
57 void remove();
58
59 //Convenience methods that don't correspond to GTK+ functions:
60
61 _DEPRECATE_IFDEF_START
62 /** Add a Label object.
63 * This does not correspond to any GTK+ function and is provided purely for
64 * convenience.
65 * @param label The text for the label.
66 * @param mnemonic If <tt>true</tt>, characters preceded by an underscore
67 * (_) will be underlined and used as a keyboard accelerator (shortcut).
68 * @param x_align The horizontal alignment of the text. This ranges from
69 * 0.0 (left aligned) to 1.0 (right aligned).
70 * @param y_align The vertical alignment of the text. This ranges from
71 * 0.0 (top aligned) to 1.0 (bottom aligned).
72 *
73 * @deprecated Use the other add_label().
74 */
75 void add_label(const Glib::ustring& label, bool mnemonic = false,
76 double x_align = 0.5, double y_align = 0.5);
77 _DEPRECATE_IFDEF_END
78
79 /** Add a Label object.
80 * This does not correspond to any GTK+ function and is provided purely for
81 * convenience.
82 * @param label The label text.
83 * @param mnemonic If <tt>true</tt>, characters preceded by an underscore
84 * (_) will be underlined and used as a keyboard accelerator (shortcut).
85 * @param x_align The horizontal alignment of the text. For possible
86 * values, see Gtk::Align.
87 * @param y_align The vertical alignment of the text. For possible
88 * values, see Gtk::Align.
89 */
90 _DEPRECATE_IFDEF_START
91 void add_label(const Glib::ustring& label, bool mnemonic,
92 Align x_align, Align y_align = ALIGN_CENTER);
93 #else
94 void add_label(const Glib::ustring& label, bool mnemonic = false,
95 Align x_align = ALIGN_CENTER, Align y_align = ALIGN_CENTER);
96 _DEPRECATE_IFDEF_END
97
98 //TODO: Change this to Pixbuf?
99 /* Add Image and Label objects.
100 * This does not correspond to any GTK+ function and is provided purely for
101 * convenience.
102 * This will create, manage, add, and show a new Image and Label (within a
103 * horizontal Box) to this Bin.
104 * @param pixmap A Glib::RefPtr to a Gdk::Pixmap.
105 * @param mask A Glib::RefPtr to a Gdk::Bitmap.
106 * @param label The text for the label.
107 * @param x_align The horizontal alignment of the text in the label.
108 * @param y_align The vertical alignment of the text in the label.
109 */
110 /*
111 void add_pixlabel(const Glib::RefPtr<Gdk::Pixmap>& pixmap,
112 const Glib::RefPtr<Gdk::Bitmap>& mask,
113 const Glib::ustring& label,
114 Align x_align = ALIGN_CENTER, Align y_align = ALIGN_CENTER);
115 */
116
117 _DEPRECATE_IFDEF_START
118 /** Add Image and Label objects.
119 * This does not correspond to any GTK+ function and is provided purely for
120 * convenience.
121 * This will create, manage, add, and show a new Image and Label (within a
122 * horizontal Box) to this Bin.
123 * @param pixfile The path to a file to be displayed.
124 * @param label The text for the label.
125 * @param x_align The horizontal alignment of the text in the label.
126 * @param y_align The vertical alignment of the text in the label.
127 *
128 * @deprecated Use the other add_pixlabel().
129 */
130 void add_pixlabel(const std::string& pixfile,
131 const Glib::ustring& label,
132 double x_align = 0.5, double y_align = 0.5);
133 _DEPRECATE_IFDEF_END
134
135 /** Add Image and Label objects.
136 * This does not correspond to any GTK+ function and is provided purely for
137 * convenience.
138 * This will create, manage, add, and show a new Image and Label (within a
139 * horizontal Box) to this Bin.
140 * @param pixfile The path to a file to be displayed.
141 * @param label The text for the label.
142 * @param x_align The horizontal alignment of the text in the label.
143 * @param y_align The vertical alignment of the text in the label.
144 *
145 * @newin{3,14}
146 */
147 _DEPRECATE_IFDEF_START
148 void add_pixlabel(const std::string& pixfile,
149 const Glib::ustring& label,
150 Align x_align, Align y_align = ALIGN_CENTER);
151 #else
152 void add_pixlabel(const std::string& pixfile,
153 const Glib::ustring& label,
154 Align x_align = ALIGN_CENTER, Align y_align = ALIGN_CENTER);
155 _DEPRECATE_IFDEF_END
156 };
157
158 } //namespace Gtk