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 = GtkFixed.html 27 * outPack = gtk 28 * outFile = Fixed 29 * strct = GtkFixed 30 * realStrct= 31 * ctorStrct= 32 * clss = Fixed 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_fixed_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gtk.Widget 47 * structWrap: 48 * - GtkWidget* -> Widget 49 * module aliases: 50 * local aliases: 51 * overrides: 52 */ 53 54 module gtk.Fixed; 55 56 public import gtkc.gtktypes; 57 58 private import gtkc.gtk; 59 private import glib.ConstructionException; 60 private import gobject.ObjectG; 61 62 63 private import gtk.Widget; 64 65 66 67 private import gtk.Container; 68 69 /** 70 * The GtkFixed widget is a container which can place child widgets 71 * at fixed positions and with fixed sizes, given in pixels. GtkFixed 72 * performs no automatic layout management. 73 * 74 * For most applications, you should not use this container! It keeps 75 * you from having to learn about the other GTK+ containers, but it 76 * results in broken applications. With GtkFixed, the following 77 * things will result in truncated text, overlapping widgets, and 78 * other display bugs: 79 * 80 * Themes, which may change widget sizes. 81 * 82 * Fonts other than the one you used to write the app will of course 83 * change the size of widgets containing text; keep in mind that 84 * users may use a larger font because of difficulty reading the 85 * default, or they may be using Windows or the framebuffer port of 86 * GTK+, where different fonts are available. 87 * 88 * Translation of text into other languages changes its size. Also, 89 * display of non-English text will use a different font in many 90 * cases. 91 * 92 * In addition, the fixed widget can't properly be mirrored in 93 * right-to-left languages such as Hebrew and Arabic. i.e. normally 94 * GTK+ will flip the interface to put labels to the right of the 95 * thing they label, but it can't do that with GtkFixed. So your 96 * application will not be usable in right-to-left languages. 97 * 98 * Finally, fixed positioning makes it kind of annoying to add/remove 99 * GUI elements, since you have to reposition all the other 100 * elements. This is a long-term maintenance problem for your 101 * application. 102 * 103 * If you know none of these things are an issue for your application, 104 * and prefer the simplicity of GtkFixed, by all means use the 105 * widget. But you should be aware of the tradeoffs. 106 */ 107 public class Fixed : Container 108 { 109 110 /** the main Gtk struct */ 111 protected GtkFixed* gtkFixed; 112 113 114 public GtkFixed* getFixedStruct() 115 { 116 return gtkFixed; 117 } 118 119 120 /** the main Gtk struct as a void* */ 121 protected override void* getStruct() 122 { 123 return cast(void*)gtkFixed; 124 } 125 126 /** 127 * Sets our main struct and passes it to the parent class 128 */ 129 public this (GtkFixed* gtkFixed) 130 { 131 super(cast(GtkContainer*)gtkFixed); 132 this.gtkFixed = gtkFixed; 133 } 134 135 protected override void setStruct(GObject* obj) 136 { 137 super.setStruct(obj); 138 gtkFixed = cast(GtkFixed*)obj; 139 } 140 141 /** 142 */ 143 144 /** 145 * Creates a new GtkFixed. 146 * Throws: ConstructionException GTK+ fails to create the object. 147 */ 148 public this () 149 { 150 // GtkWidget * gtk_fixed_new (void); 151 auto p = gtk_fixed_new(); 152 if(p is null) 153 { 154 throw new ConstructionException("null returned by gtk_fixed_new()"); 155 } 156 this(cast(GtkFixed*) p); 157 } 158 159 /** 160 * Adds a widget to a GtkFixed container at the given position. 161 * Params: 162 * widget = the widget to add. 163 * x = the horizontal position to place the widget at. 164 * y = the vertical position to place the widget at. 165 */ 166 public void put(Widget widget, int x, int y) 167 { 168 // void gtk_fixed_put (GtkFixed *fixed, GtkWidget *widget, gint x, gint y); 169 gtk_fixed_put(gtkFixed, (widget is null) ? null : widget.getWidgetStruct(), x, y); 170 } 171 172 /** 173 * Moves a child of a GtkFixed container to the given position. 174 * Params: 175 * widget = the child widget. 176 * x = the horizontal position to move the widget to. 177 * y = the vertical position to move the widget to. 178 * Child Property Details 179 * The "x" child property 180 * "x" gint : Read / Write 181 * X position of child widget. 182 * Default value: 0 183 */ 184 public void move(Widget widget, int x, int y) 185 { 186 // void gtk_fixed_move (GtkFixed *fixed, GtkWidget *widget, gint x, gint y); 187 gtk_fixed_move(gtkFixed, (widget is null) ? null : widget.getWidgetStruct(), x, y); 188 } 189 }