I've no idea here...
[gtkD.git] / src / gtk / ButtonBox.d
blobca1658c8c8a74d5bfeba6e70893f50cbd3655c94
1 /*
2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkButtonBox.html
26 * outPack = gtk
27 * outFile = ButtonBox
28 * strct = GtkButtonBox
29 * realStrct=
30 * ctorStrct=
31 * clss = ButtonBox
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_button_box_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.Widget
46 * - gtk.Button
47 * - gtk.HButtonBox
48 * - gtk.VButtonBox
49 * structWrap:
50 * - GtkWidget* -> Widget
51 * local aliases:
54 module gtk.ButtonBox;
56 private import gtk.gtktypes;
58 private import lib.gtk;
60 private import gtk.Widget;
61 private import gtk.Button;
62 private import gtk.HButtonBox;
63 private import gtk.VButtonBox;
65 /**
66 * Description
67 * The primary purpose of this class is to keep track of the various properties
68 * of GtkHButtonBox and GtkVButtonBox widgets.
69 * gtk_button_box_get_child_size() retrieves the minimum width and height
70 * for widgets in a given button box. gtk_button_box_set_child_size()
71 * allows those properties to be changed.
72 * The internal padding of buttons can be retrieved and changed per button box using
73 * gtk_button_box_get_child_ipadding() and gtk_button_box_set_child_ipadding()
74 * respectively.
75 * gtk_button_box_get_spacing() and gtk_button_box_set_spacing() retrieve and
76 * change default number of pixels between buttons, respectively.
77 * gtk_button_box_get_layout() and gtk_button_box_set_layout() retrieve and alter the method
78 * used to spread the buttons in a button box across the container, respectively.
79 * The main purpose of GtkButtonBox is to make sure the children have all the same size.
80 * Therefore it ignores the homogeneous property which it inherited from GtkBox, and always
81 * behaves as if homogeneous was TRUE.
83 private import gtk.Box;
84 public class ButtonBox : Box
87 /** the main Gtk struct */
88 protected GtkButtonBox* gtkButtonBox;
91 public GtkButtonBox* getButtonBoxStruct()
93 return gtkButtonBox;
97 /** the main Gtk struct as a void* */
98 protected void* getStruct()
100 return cast(void*)gtkButtonBox;
104 * Sets our main struct and passes it to the parent class
106 public this (GtkButtonBox* gtkButtonBox)
108 super(cast(GtkBox*)gtkButtonBox);
109 this.gtkButtonBox = gtkButtonBox;
112 static ButtonBox createActionBox(
113 void delegate(Button) onClicked,
114 StockID[] stocks,
115 char[][] actions,
116 bool vertical=false
119 ButtonBox bBox;
120 if ( vertical )
122 bBox = VButtonBox.createActionBox();
124 else
126 bBox = HButtonBox.createActionBox();
129 Button button;
130 for( int i=0 ; i<stocks.length && i<actions.length ; i++)
132 button = new Button(stocks[i]);
133 bBox.packEnd(button, false, false, 7);
134 button.setActionName(actions[i]);
135 button.addOnClicked(onClicked);
137 return bBox;
140 static ButtonBox createOkBox(void delegate(Button) onClicked)
142 static StockID[] stocks = [StockID.OK];
143 char[][] actions;
144 actions ~= "action.ok";
145 return createActionBox(onClicked, stocks, actions);
148 static ButtonBox createOkCancelBox(void delegate(Button) onClicked)
150 static StockID[] stocks = [StockID.OK, StockID.CANCEL];
151 char[][] actions;
152 actions ~= "action.ok";
153 actions ~= "action.cancel";
154 return createActionBox(onClicked, stocks, actions);
164 * Retrieves the method being used to arrange the buttons in a button box.
165 * widget:
166 * a GtkButtonBox.
167 * Returns:
168 * the method used to layout buttons in widget.
170 public GtkButtonBoxStyle getLayout()
172 // GtkButtonBoxStyle gtk_button_box_get_layout (GtkButtonBox *widget);
173 return gtk_button_box_get_layout(gtkButtonBox);
177 * Warning
178 * gtk_button_box_get_child_size is deprecated and should not be used in newly-written code. Use the style properties
179 * "child-min-width/-height" instead.
180 * Retrieves the current width and height of all child widgets in a button box.
181 * min_width and min_height are filled with those values, respectively.
182 * widget:
183 * a GtkButtonBox.
184 * min_width:
185 * the width of the buttons contained by widget.
186 * min_height:
187 * the height of the buttons contained by widget.
189 public void getChildSize(int* minWidth, int* minHeight)
191 // void gtk_button_box_get_child_size (GtkButtonBox *widget, gint *min_width, gint *min_height);
192 gtk_button_box_get_child_size(gtkButtonBox, minWidth, minHeight);
196 * Warning
197 * gtk_button_box_get_child_ipadding is deprecated and should not be used in newly-written code. Use the style properties
198 * "child-internal-pad-x/-y" instead.
199 * Gets the default number of pixels that pad the buttons in a given button box.
200 * widget:
201 * a GtkButtonBox.
202 * ipad_x:
203 * the horizontal padding used by buttons in widget.
204 * ipad_y:
205 * the vertical padding used by buttons in widget.
207 public void getChildIpadding(int* ipadX, int* ipadY)
209 // void gtk_button_box_get_child_ipadding (GtkButtonBox *widget, gint *ipad_x, gint *ipad_y);
210 gtk_button_box_get_child_ipadding(gtkButtonBox, ipadX, ipadY);
214 * Returns whether child should appear in a secondary group of children.
215 * widget:
216 * a GtkButtonBox
217 * child:
218 * a child of widget
219 * Returns:
220 * whether child should appear in a secondary group of children.
221 * Since 2.4
223 public int getChildSecondary(Widget child)
225 // gboolean gtk_button_box_get_child_secondary (GtkButtonBox *widget, GtkWidget *child);
226 return gtk_button_box_get_child_secondary(gtkButtonBox, (child is null) ? null : child.getWidgetStruct());
231 * Changes the way buttons are arranged in their container.
232 * widget:
233 * a GtkButtonBox.
234 * layout_style:
235 * the new layout style.
237 public void setLayout(GtkButtonBoxStyle layoutStyle)
239 // void gtk_button_box_set_layout (GtkButtonBox *widget, GtkButtonBoxStyle layout_style);
240 gtk_button_box_set_layout(gtkButtonBox, layoutStyle);
244 * Warning
245 * gtk_button_box_set_child_size is deprecated and should not be used in newly-written code. Use the style properties
246 * "child-min-width/-height" instead.
247 * Sets a new default size for the children of a given button box.
248 * widget:
249 * a GtkButtonBox.
250 * min_width:
251 * a default width for buttons in widget.
252 * min_height:
253 * a default height for buttons in widget.
255 public void setChildSize(int minWidth, int minHeight)
257 // void gtk_button_box_set_child_size (GtkButtonBox *widget, gint min_width, gint min_height);
258 gtk_button_box_set_child_size(gtkButtonBox, minWidth, minHeight);
262 * Warning
263 * gtk_button_box_set_child_ipadding is deprecated and should not be used in newly-written code. Use the style properties
264 * "child-internal-pad-x/-y" instead.
265 * Changes the amount of internal padding used by all buttons in a given button
266 * box.
267 * widget:
268 * a GtkButtonBox.
269 * ipad_x:
270 * the horizontal padding that should be used by each button in widget.
271 * ipad_y:
272 * the vertical padding that should be used by each button in widget.
274 public void setChildIpadding(int ipadX, int ipadY)
276 // void gtk_button_box_set_child_ipadding (GtkButtonBox *widget, gint ipad_x, gint ipad_y);
277 gtk_button_box_set_child_ipadding(gtkButtonBox, ipadX, ipadY);
281 * Sets whether child should appear in a secondary group of children.
282 * A typical use of a secondary child is the help button in a dialog.
283 * This group appears after the other children if the style
284 * is GTK_BUTTONBOX_START, GTK_BUTTONBOX_SPREAD or
285 * GTK_BUTTONBOX_EDGE, and before the other children if the style
286 * is GTK_BUTTONBOX_END. For horizontal button boxes, the definition
287 * of before/after depends on direction of the widget (see
288 * gtk_widget_set_direction()). If the style is GTK_BUTTONBOX_START
289 * or GTK_BUTTONBOX_END, then the secondary children are aligned at
290 * the other end of the button box from the main children. For the
291 * other styles, they appear immediately next to the main children.
292 * widget:
293 * a GtkButtonBox
294 * child:
295 * a child of widget
296 * is_secondary:
297 * if TRUE, the child appears in a secondary group of the
298 * button box.
299 * Property Details
300 * The "layout-style" property
301 * "layout-style" GtkButtonBoxStyle : Read / Write
302 * How to layout the buttons in the box. Possible values are default, spread, edge, start and end.
303 * Default value: GTK_BUTTONBOX_DEFAULT_STYLE
304 * Child Property Details
305 * The "secondary" child property
306 * "secondary" gboolean : Read / Write
307 * If TRUE, the child appears in a secondary group of children, suitable for, e.g., help buttons.
308 * Default value: FALSE
309 * Style Property Details
310 * The "child-internal-pad-x" style property
311 * "child-internal-pad-x" gint : Read
312 * Amount to increase child's size on either side.
313 * Allowed values: >= 0
314 * Default value: 4
316 public void setChildSecondary(Widget child, int isSecondary)
318 // void gtk_button_box_set_child_secondary (GtkButtonBox *widget, GtkWidget *child, gboolean is_secondary);
319 gtk_button_box_set_child_secondary(gtkButtonBox, (child is null) ? null : child.getWidgetStruct(), isSecondary);