1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = GtkButtonBox.html 27 * outPack = gtk 28 * outFile = ButtonBox 29 * strct = GtkButtonBox 30 * realStrct= 31 * ctorStrct= 32 * clss = ButtonBox 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_button_box_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - gtk.Widget 48 * - gtk.Button 49 * - gtk.HButtonBox 50 * - gtk.VButtonBox 51 * structWrap: 52 * - GtkWidget* -> Widget 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gtk.ButtonBox; 59 60 public import gtkc.gtktypes; 61 62 private import gtkc.gtk; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 67 private import gtk.Widget; 68 private import gtk.Button; 69 private import gtk.HButtonBox; 70 private import gtk.VButtonBox; 71 72 73 74 private import gtk.Box; 75 76 /** 77 * Description 78 * The primary purpose of this class is to keep track of the various properties 79 * of GtkHButtonBox and GtkVButtonBox widgets. 80 * gtk_button_box_get_child_size() retrieves the minimum width and height 81 * for widgets in a given button box. 82 * The internal padding of buttons can be retrieved and changed per button box using 83 * gtk_button_box_get_child_ipadding() and gtk_button_box_set_child_ipadding() 84 * respectively. 85 * gtk_button_box_get_spacing() and gtk_button_box_set_spacing() retrieve and 86 * change default number of pixels between buttons, respectively. 87 * gtk_button_box_get_layout() and gtk_button_box_set_layout() retrieve and alter the method 88 * used to spread the buttons in a button box across the container, respectively. 89 * The main purpose of GtkButtonBox is to make sure the children have all the same size. 90 * Therefore it ignores the homogeneous property which it inherited from GtkBox, and always 91 * behaves as if homogeneous was TRUE. 92 */ 93 public class ButtonBox : Box 94 { 95 96 /** the main Gtk struct */ 97 protected GtkButtonBox* gtkButtonBox; 98 99 100 public GtkButtonBox* getButtonBoxStruct() 101 { 102 return gtkButtonBox; 103 } 104 105 106 /** the main Gtk struct as a void* */ 107 protected override void* getStruct() 108 { 109 return cast(void*)gtkButtonBox; 110 } 111 112 /** 113 * Sets our main struct and passes it to the parent class 114 */ 115 public this (GtkButtonBox* gtkButtonBox) 116 { 117 super(cast(GtkBox*)gtkButtonBox); 118 this.gtkButtonBox = gtkButtonBox; 119 } 120 121 protected override void setStruct(GObject* obj) 122 { 123 super.setStruct(obj); 124 gtkButtonBox = cast(GtkButtonBox*)obj; 125 } 126 127 /** */ 128 static ButtonBox createActionBox( 129 void delegate(Button) onClicked, 130 StockID[] stocks, 131 string[] actions, 132 bool vertical=false 133 ) 134 { 135 ButtonBox bBox; 136 if ( vertical ) 137 { 138 bBox = VButtonBox.createActionBox(); 139 } 140 else 141 { 142 bBox = HButtonBox.createActionBox(); 143 } 144 145 Button button; 146 for( int i=0 ; i<stocks.length && i<actions.length ; i++) 147 { 148 button = new Button(stocks[i]); 149 bBox.packEnd(button, false, false, 7); 150 button.setActionName(actions[i]); 151 button.addOnClicked(onClicked); 152 } 153 return bBox; 154 } 155 156 /** */ 157 static ButtonBox createOkBox(void delegate(Button) onClicked) 158 { 159 static StockID[] stocks = [StockID.OK]; 160 string[] actions; 161 actions ~= "action.ok"; 162 return createActionBox(onClicked, stocks, actions); 163 } 164 165 /** */ 166 static ButtonBox createOkCancelBox(void delegate(Button) onClicked) 167 { 168 static StockID[] stocks = [StockID.OK, StockID.CANCEL]; 169 string[] actions; 170 actions ~= "action.ok"; 171 actions ~= "action.cancel"; 172 return createActionBox(onClicked, stocks, actions); 173 } 174 175 /** 176 */ 177 178 /** 179 * Retrieves the method being used to arrange the buttons in a button box. 180 * Returns: the method used to layout buttons in widget. 181 */ 182 public GtkButtonBoxStyle getLayout() 183 { 184 // GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget); 185 return gtk_button_box_get_layout(gtkButtonBox); 186 } 187 188 /** 189 * Warning 190 * gtk_button_box_get_child_size is deprecated and should not be used in newly-written code. Use the style properties 191 * "child-min-width/-height" instead. 192 * Retrieves the current width and height of all child widgets in a button box. 193 * min_width and min_height are filled with those values, respectively. 194 * Params: 195 * minWidth = the width of the buttons contained by widget. 196 * minHeight = the height of the buttons contained by widget. 197 */ 198 public void getChildSize(out int minWidth, out int minHeight) 199 { 200 // void gtk_button_box_get_child_size (GtkButtonBox *widget, gint *min_width, gint *min_height); 201 gtk_button_box_get_child_size(gtkButtonBox, &minWidth, &minHeight); 202 } 203 204 /** 205 * Warning 206 * gtk_button_box_get_child_ipadding is deprecated and should not be used in newly-written code. Use the style properties 207 * "child-internal-pad-x" 208 * and 209 * "child-internal-pad-y" 210 * instead. 211 * Gets the default number of pixels that pad the buttons in a given button box. 212 * Params: 213 * ipadX = the horizontal padding used by buttons in widget. 214 * ipadY = the vertical padding used by buttons in widget. 215 */ 216 public void getChildIpadding(out int ipadX, out int ipadY) 217 { 218 // void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint *ipad_x, gint *ipad_y); 219 gtk_button_box_get_child_ipadding(gtkButtonBox, &ipadX, &ipadY); 220 } 221 222 /** 223 * Returns whether child should appear in a secondary group of children. 224 * Since 2.4 225 * Params: 226 * child = a child of widget 227 * Returns: whether child should appear in a secondary group of children. 228 */ 229 public int getChildSecondary(Widget child) 230 { 231 // gboolean gtk_button_box_get_child_secondary (GtkButtonBox *widget, GtkWidget *child); 232 return gtk_button_box_get_child_secondary(gtkButtonBox, (child is null) ? null : child.getWidgetStruct()); 233 } 234 235 /** 236 * Changes the way buttons are arranged in their container. 237 * Params: 238 * layoutStyle = the new layout style. 239 */ 240 public void setLayout(GtkButtonBoxStyle layoutStyle) 241 { 242 // void gtk_button_box_set_layout (GtkButtonBox *widget, GtkButtonBoxStyle layout_style); 243 gtk_button_box_set_layout(gtkButtonBox, layoutStyle); 244 } 245 246 /** 247 * Warning 248 * gtk_button_box_set_child_size is deprecated and should not be used in newly-written code. This is not supported anymore and can only be set through the theme 249 * Params: 250 * minWidth = a default width for buttons in widget 251 * minHeight = a default height for buttons in widget 252 */ 253 public void setChildSize(int minWidth, int minHeight) 254 { 255 // void gtk_button_box_set_child_size (GtkButtonBox *widget, gint min_width, gint min_height); 256 gtk_button_box_set_child_size(gtkButtonBox, minWidth, minHeight); 257 } 258 259 /** 260 * Warning 261 * gtk_button_box_set_child_ipadding is deprecated and should not be used in newly-written code. Use the style properties 262 * "child-internal-pad-x/-y" instead. 263 * Changes the amount of internal padding used by all buttons in a given button 264 * box. 265 * Params: 266 * ipadX = the horizontal padding that should be used by each button in widget. 267 * ipadY = the vertical padding that should be used by each button in widget. 268 */ 269 public void setChildIpadding(int ipadX, int ipadY) 270 { 271 // void gtk_button_box_set_child_ipadding (GtkButtonBox *widget, gint ipad_x, gint ipad_y); 272 gtk_button_box_set_child_ipadding(gtkButtonBox, ipadX, ipadY); 273 } 274 275 /** 276 * Sets whether child should appear in a secondary group of children. 277 * A typical use of a secondary child is the help button in a dialog. 278 * This group appears after the other children if the style 279 * is GTK_BUTTONBOX_START, GTK_BUTTONBOX_SPREAD or 280 * GTK_BUTTONBOX_EDGE, and before the other children if the style 281 * is GTK_BUTTONBOX_END. For horizontal button boxes, the definition 282 * of before/after depends on direction of the widget (see 283 * gtk_widget_set_direction()). If the style is GTK_BUTTONBOX_START 284 * or GTK_BUTTONBOX_END, then the secondary children are aligned at 285 * the other end of the button box from the main children. For the 286 * other styles, they appear immediately next to the main children. 287 * Params: 288 * child = a child of widget 289 * isSecondary = if TRUE, the child appears in a secondary group of the 290 * button box. 291 */ 292 public void setChildSecondary(Widget child, int isSecondary) 293 { 294 // void gtk_button_box_set_child_secondary (GtkButtonBox *widget, GtkWidget *child, gboolean is_secondary); 295 gtk_button_box_set_child_secondary(gtkButtonBox, (child is null) ? null : child.getWidgetStruct(), isSecondary); 296 } 297 }