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 = GtkFrame.html 27 * outPack = gtk 28 * outFile = Frame 29 * strct = GtkFrame 30 * realStrct= 31 * ctorStrct= 32 * clss = Frame 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_frame_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gtk.Widget 48 * structWrap: 49 * - GtkWidget* -> Widget 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gtk.Frame; 56 57 public import gtkc.gtktypes; 58 59 private import gtkc.gtk; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 64 private import glib.Str; 65 private import gtk.Widget; 66 67 68 69 private import gtk.Bin; 70 71 /** 72 * The frame widget is a Bin that surrounds its child 73 * with a decorative frame and an optional label. 74 * If present, the label is drawn in a gap in the 75 * top side of the frame. The position of the 76 * label can be controlled with gtk_frame_set_label_align(). 77 * 78 * GtkFrame as GtkBuildable 79 * 80 * The GtkFrame implementation of the GtkBuildable interface 81 * supports placing a child in the label position by specifying 82 * "label" as the "type" attribute of a <child> element. 83 * A normal content child can be specified without specifying 84 * a <child> type attribute. 85 * 86 * $(DDOC_COMMENT example) 87 */ 88 public class Frame : Bin 89 { 90 91 /** the main Gtk struct */ 92 protected GtkFrame* gtkFrame; 93 94 95 public GtkFrame* getFrameStruct() 96 { 97 return gtkFrame; 98 } 99 100 101 /** the main Gtk struct as a void* */ 102 protected override void* getStruct() 103 { 104 return cast(void*)gtkFrame; 105 } 106 107 /** 108 * Sets our main struct and passes it to the parent class 109 */ 110 public this (GtkFrame* gtkFrame) 111 { 112 super(cast(GtkBin*)gtkFrame); 113 this.gtkFrame = gtkFrame; 114 } 115 116 protected override void setStruct(GObject* obj) 117 { 118 super.setStruct(obj); 119 gtkFrame = cast(GtkFrame*)obj; 120 } 121 122 /** 123 * Creates frame with label and set it's child widget 124 */ 125 public this(Widget widget, string label) 126 { 127 this(label); 128 add(widget); 129 } 130 131 /** 132 */ 133 134 /** 135 * Creates a new GtkFrame, with optional label label. 136 * If label is NULL, the label is omitted. 137 * Params: 138 * label = the text to use as the label of the frame. [allow-none] 139 * Throws: ConstructionException GTK+ fails to create the object. 140 */ 141 public this (string label) 142 { 143 // GtkWidget * gtk_frame_new (const gchar *label); 144 auto p = gtk_frame_new(Str.toStringz(label)); 145 if(p is null) 146 { 147 throw new ConstructionException("null returned by gtk_frame_new(Str.toStringz(label))"); 148 } 149 this(cast(GtkFrame*) p); 150 } 151 152 /** 153 * Sets the text of the label. If label is NULL, 154 * the current label is removed. 155 * Params: 156 * label = the text to use as the label of the frame. [allow-none] 157 */ 158 public void setLabel(string label) 159 { 160 // void gtk_frame_set_label (GtkFrame *frame, const gchar *label); 161 gtk_frame_set_label(gtkFrame, Str.toStringz(label)); 162 } 163 164 /** 165 * Sets the label widget for the frame. This is the widget that 166 * will appear embedded in the top edge of the frame as a 167 * title. 168 * Params: 169 * labelWidget = the new label widget 170 */ 171 public void setLabelWidget(Widget labelWidget) 172 { 173 // void gtk_frame_set_label_widget (GtkFrame *frame, GtkWidget *label_widget); 174 gtk_frame_set_label_widget(gtkFrame, (labelWidget is null) ? null : labelWidget.getWidgetStruct()); 175 } 176 177 /** 178 * Sets the alignment of the frame widget's label. The 179 * default values for a newly created frame are 0.0 and 0.5. 180 * Params: 181 * xalign = The position of the label along the top edge 182 * of the widget. A value of 0.0 represents left alignment; 183 * 1.0 represents right alignment. 184 * yalign = The y alignment of the label. A value of 0.0 aligns under 185 * the frame; 1.0 aligns above the frame. If the values are exactly 186 * 0.0 or 1.0 the gap in the frame won't be painted because the label 187 * will be completely above or below the frame. 188 */ 189 public void setLabelAlign(float xalign, float yalign) 190 { 191 // void gtk_frame_set_label_align (GtkFrame *frame, gfloat xalign, gfloat yalign); 192 gtk_frame_set_label_align(gtkFrame, xalign, yalign); 193 } 194 195 /** 196 * Sets the shadow type for frame. 197 * Params: 198 * type = the new GtkShadowType 199 */ 200 public void setShadowType(GtkShadowType type) 201 { 202 // void gtk_frame_set_shadow_type (GtkFrame *frame, GtkShadowType type); 203 gtk_frame_set_shadow_type(gtkFrame, type); 204 } 205 206 /** 207 * If the frame's label widget is a GtkLabel, returns the 208 * text in the label widget. (The frame will have a GtkLabel 209 * for the label widget if a non-NULL argument was passed 210 * to gtk_frame_new().) 211 * Returns: the text in the label, or NULL if there was no label widget or the lable widget was not a GtkLabel. This string is owned by GTK+ and must not be modified or freed. 212 */ 213 public string getLabel() 214 { 215 // const gchar * gtk_frame_get_label (GtkFrame *frame); 216 return Str.toString(gtk_frame_get_label(gtkFrame)); 217 } 218 219 /** 220 * Retrieves the X and Y alignment of the frame's label. See 221 * gtk_frame_set_label_align(). 222 * Params: 223 * xalign = location to store X alignment of 224 * frame's label, or NULL. [out][allow-none] 225 * yalign = location to store X alignment of 226 * frame's label, or NULL. [out][allow-none] 227 */ 228 public void getLabelAlign(out float xalign, out float yalign) 229 { 230 // void gtk_frame_get_label_align (GtkFrame *frame, gfloat *xalign, gfloat *yalign); 231 gtk_frame_get_label_align(gtkFrame, &xalign, &yalign); 232 } 233 234 /** 235 * Retrieves the label widget for the frame. See 236 * gtk_frame_set_label_widget(). 237 * Returns: the label widget, or NULL if there is none. [transfer none] 238 */ 239 public Widget getLabelWidget() 240 { 241 // GtkWidget * gtk_frame_get_label_widget (GtkFrame *frame); 242 auto p = gtk_frame_get_label_widget(gtkFrame); 243 244 if(p is null) 245 { 246 return null; 247 } 248 249 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 250 } 251 252 /** 253 * Retrieves the shadow type of the frame. See 254 * gtk_frame_set_shadow_type(). 255 * Returns: the current shadow type of the frame. 256 */ 257 public GtkShadowType getShadowType() 258 { 259 // GtkShadowType gtk_frame_get_shadow_type (GtkFrame *frame); 260 return gtk_frame_get_shadow_type(gtkFrame); 261 } 262 }