1 // -*- c++ -*- 2 // Generated by gmmproc 2.45.3 -- DO NOT MODIFY! 3 #ifndef _GTKMM_SIZEGROUP_H 4 #define _GTKMM_SIZEGROUP_H 5 6 7 #include <glibmm/ustring.h> 8 #include <sigc++/sigc++.h> 9 10 /* $Id: sizegroup.hg,v 1.5 2006/12/11 18:57:50 murrayc Exp $ */ 11 12 /* box.h 13 * 14 * Copyright 2002 The gtkmm Development Team 15 * 16 * This library is free software; you can redistribute it and/or 17 * modify it under the terms of the GNU Lesser General Public 18 * License as published by the Free Software Foundation; either 19 * version 2.1 of the License, or (at your option) any later version. 20 * 21 * This library is distributed in the hope that it will be useful, 22 * but WITHOUT ANY WARRANTY; without even the implied warranty of 23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 * Lesser General Public License for more details. 25 * 26 * You should have received a copy of the GNU Lesser General Public 27 * License along with this library; if not, write to the Free 28 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 29 */ 30 31 #include <glibmm/object.h> 32 #include <gtkmm/widget.h> 33 34 35 #ifndef DOXYGEN_SHOULD_SKIP_THIS 36 typedef struct _GtkSizeGroup GtkSizeGroup; 37 typedef struct _GtkSizeGroupClass GtkSizeGroupClass; 38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 39 40 41 #ifndef DOXYGEN_SHOULD_SKIP_THIS 42 namespace Gtk 43 { class SizeGroup_Class; } // namespace Gtk 44 #endif //DOXYGEN_SHOULD_SKIP_THIS 45 46 namespace Gtk 47 { 48 49 50 /** @addtogroup gtkmmEnums gtkmm Enums and Flags */ 51 52 /** 53 * 54 * @ingroup gtkmmEnums 55 */ 56 enum SizeGroupMode 57 { 58 SIZE_GROUP_NONE, 59 SIZE_GROUP_HORIZONTAL, 60 SIZE_GROUP_VERTICAL, 61 SIZE_GROUP_BOTH 62 }; 63 64 } // namespace Gtk 65 66 67 #ifndef DOXYGEN_SHOULD_SKIP_THIS 68 namespace Glib 69 { 70 71 template <> 72 class Value<Gtk::SizeGroupMode> : public Glib::Value_Enum<Gtk::SizeGroupMode> 73 { 74 public: 75 static GType value_type() G_GNUC_CONST; 76 }; 77 78 } // namespace Glib 79 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 80 81 82 namespace Gtk 83 { 84 85 86 /** Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. 87 * This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk::Table widget. 88 * 89 * In detail, the size requested for each widget in a Gtk::SizeGroup is the maximum of the sizes that would have been 90 * requested for each widget in the size group if they were not in the size group. The mode of the size group (see 91 * set_mode()) determines whether this applies to the horizontal size, the vertical size, or both sizes. 92 * 93 * Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If 94 * you want the widgets in a GtkSizeGroup to actually be the same size, you need to pack them in such a way that they 95 * get the size they request and not more. For example, if you are packing your widgets into a table, you would not 96 * include the Gtk::FILL flag. 97 * 98 * Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal 99 * requisition of all widgets that can be reached from the widget by a chain of size groups of type 100 * Gtk::SIZE_GROUP_HORIZONTAL or Gtk::SIZE_GROUP_BOTH, and the vertical size from the vertical requisition of all widgets 101 * that can be reached from the widget by a chain of size groups of type Gtk::SIZE_GROUP_VERTICAL or Gtk::SIZE_GROUP_BOTH. 102 */ 103 104 class SizeGroup : public Glib::Object 105 { 106 107 #ifndef DOXYGEN_SHOULD_SKIP_THIS 108 109 public: 110 typedef SizeGroup CppObjectType; 111 typedef SizeGroup_Class CppClassType; 112 typedef GtkSizeGroup BaseObjectType; 113 typedef GtkSizeGroupClass BaseClassType; 114 115 private: friend class SizeGroup_Class; 116 static CppClassType sizegroup_class_; 117 118 private: 119 // noncopyable 120 SizeGroup(const SizeGroup&); 121 SizeGroup& operator=(const SizeGroup&); 122 123 protected: 124 explicit SizeGroup(const Glib::ConstructParams& construct_params); 125 explicit SizeGroup(GtkSizeGroup* castitem); 126 127 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 128 129 public: 130 virtual ~SizeGroup(); 131 132 /** Get the GType for this class, for use with the underlying GObject type system. 133 */ 134 static GType get_type() G_GNUC_CONST; 135 136 #ifndef DOXYGEN_SHOULD_SKIP_THIS 137 138 139 static GType get_base_type() G_GNUC_CONST; 140 #endif 141 142 ///Provides access to the underlying C GObject. gobj()143 GtkSizeGroup* gobj() { return reinterpret_cast<GtkSizeGroup*>(gobject_); } 144 145 ///Provides access to the underlying C GObject. gobj()146 const GtkSizeGroup* gobj() const { return reinterpret_cast<GtkSizeGroup*>(gobject_); } 147 148 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. 149 GtkSizeGroup* gobj_copy(); 150 151 private: 152 153 protected: 154 explicit SizeGroup(SizeGroupMode mode); 155 156 public: 157 158 159 static Glib::RefPtr<SizeGroup> create(SizeGroupMode mode); 160 161 162 /** Sets the Gtk::SizeGroupMode of the size group. The mode of the size 163 * group determines whether the widgets in the size group should 164 * all have the same horizontal requisition (Gtk::SIZE_GROUP_MODE_HORIZONTAL) 165 * all have the same vertical requisition (Gtk::SIZE_GROUP_MODE_VERTICAL), 166 * or should all have the same requisition in both directions 167 * (Gtk::SIZE_GROUP_MODE_BOTH). 168 * 169 * @param mode The mode to set for the size group. 170 */ 171 void set_mode(SizeGroupMode mode); 172 173 /** Gets the current mode of the size group. See set_mode(). 174 * 175 * @return The current mode of the size group. 176 */ 177 SizeGroupMode get_mode() const; 178 179 180 /** Sets whether unmapped widgets should be ignored when 181 * calculating the size. 182 * 183 * @newin{2,8} 184 * 185 * @param ignore_hidden Whether unmapped widgets should be ignored 186 * when calculating the size. 187 */ 188 void set_ignore_hidden(bool ignore_hidden = true); 189 190 /** Returns if invisible widgets are ignored when calculating the size. 191 * 192 * @newin{2,8} 193 * 194 * @return <tt>true</tt> if invisible widgets are ignored. 195 */ 196 bool get_ignore_hidden() const; 197 198 199 /** Adds a widget to a Gtk::SizeGroup. In the future, the requisition 200 * of the widget will be determined as the maximum of its requisition 201 * and the requisition of the other widgets in the size group. 202 * Whether this applies horizontally, vertically, or in both directions 203 * depends on the mode of the size group. See set_mode(). 204 * 205 * When the widget is destroyed or no longer referenced elsewhere, it will 206 * be removed from the size group. 207 * 208 * @param widget The Gtk::Widget to add. 209 */ 210 void add_widget(Widget& widget); 211 212 /** Removes a widget from a Gtk::SizeGroup. 213 * 214 * @param widget The Gtk::Widget to remove. 215 */ 216 void remove_widget(Widget& widget); 217 218 219 /** Returns the list of widgets associated with @a size_group. 220 * 221 * @newin{2,10} 222 * 223 * @return A SList of 224 * widgets. The list is owned by GTK+ and should not be modified. 225 */ 226 Glib::SListHandle<Widget*> get_widgets(); 227 228 /** Returns the list of widgets associated with @a size_group. 229 * 230 * @newin{2,10} 231 * 232 * @return A SList of 233 * widgets. The list is owned by GTK+ and should not be modified. 234 */ 235 Glib::SListHandle<const Widget*> get_widgets() const; 236 237 /** The directions in which the size group affects the requested sizes of its component widgets. 238 * 239 * @return A PropertyProxy that allows you to get or set the value of the property, 240 * or receive notification when the value of the property changes. 241 */ 242 Glib::PropertyProxy< SizeGroupMode > property_mode() ; 243 244 /** The directions in which the size group affects the requested sizes of its component widgets. 245 * 246 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 247 * or receive notification when the value of the property changes. 248 */ 249 Glib::PropertyProxy_ReadOnly< SizeGroupMode > property_mode() const; 250 251 /** If TRUE, unmapped widgets are ignored when determining the size of the group. 252 * 253 * @return A PropertyProxy that allows you to get or set the value of the property, 254 * or receive notification when the value of the property changes. 255 */ 256 Glib::PropertyProxy< bool > property_ignore_hidden() ; 257 258 /** If TRUE, unmapped widgets are ignored when determining the size of the group. 259 * 260 * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, 261 * or receive notification when the value of the property changes. 262 */ 263 Glib::PropertyProxy_ReadOnly< bool > property_ignore_hidden() const; 264 265 266 public: 267 268 public: 269 //C++ methods used to invoke GTK+ virtual functions: 270 271 protected: 272 //GTK+ Virtual Functions (override these to change behaviour): 273 274 //Default Signal Handlers:: 275 276 277 }; 278 279 } /* namespace Gtk */ 280 281 282 namespace Glib 283 { 284 /** A Glib::wrap() method for this object. 285 * 286 * @param object The C instance. 287 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. 288 * @result A C++ instance that wraps this C instance. 289 * 290 * @relates Gtk::SizeGroup 291 */ 292 Glib::RefPtr<Gtk::SizeGroup> wrap(GtkSizeGroup* object, bool take_copy = false); 293 } 294 295 296 #endif /* _GTKMM_SIZEGROUP_H */ 297 298