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