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()
80 	{
81 		return gtkFixed;
82 	}
83 
84 	/** the main Gtk struct as a void* */
85 	protected override void* getStruct()
86 	{
87 		return cast(void*)gtkFixed;
88 	}
89 
90 	protected override void setStruct(GObject* obj)
91 	{
92 		gtkFixed = cast(GtkFixed*)obj;
93 		super.setStruct(obj);
94 	}
95 
96 	/**
97 	 * Sets our main struct and passes it to the parent class.
98 	 */
99 	public this (GtkFixed* gtkFixed, bool ownedRef = false)
100 	{
101 		this.gtkFixed = gtkFixed;
102 		super(cast(GtkContainer*)gtkFixed, ownedRef);
103 	}
104 
105 	/**
106 	 */
107 
108 	public static GType getType()
109 	{
110 		return gtk_fixed_get_type();
111 	}
112 
113 	/**
114 	 * Creates a new #GtkFixed.
115 	 *
116 	 * Return: a new #GtkFixed.
117 	 *
118 	 * Throws: ConstructionException GTK+ fails to create the object.
119 	 */
120 	public this()
121 	{
122 		auto p = gtk_fixed_new();
123 		
124 		if(p is null)
125 		{
126 			throw new ConstructionException("null returned by new");
127 		}
128 		
129 		this(cast(GtkFixed*) p);
130 	}
131 
132 	/**
133 	 * Moves a child of a #GtkFixed container to the given position.
134 	 *
135 	 * Params:
136 	 *     widget = the child widget.
137 	 *     x = the horizontal position to move the widget to.
138 	 *     y = the vertical position to move the widget to.
139 	 */
140 	public void move(Widget widget, int x, int y)
141 	{
142 		gtk_fixed_move(gtkFixed, (widget is null) ? null : widget.getWidgetStruct(), x, y);
143 	}
144 
145 	/**
146 	 * Adds a widget to a #GtkFixed container at the given position.
147 	 *
148 	 * Params:
149 	 *     widget = the widget to add.
150 	 *     x = the horizontal position to place the widget at.
151 	 *     y = the vertical position to place the widget at.
152 	 */
153 	public void put(Widget widget, int x, int y)
154 	{
155 		gtk_fixed_put(gtkFixed, (widget is null) ? null : widget.getWidgetStruct(), x, y);
156 	}
157 }