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.Requisition;
26 
27 private import glib.ConstructionException;
28 private import glib.MemorySlice;
29 private import gobject.ObjectG;
30 private import gtk.c.functions;
31 public  import gtk.c.types;
32 private import gtkd.Loader;
33 
34 
35 /**
36  * A #GtkRequisition-struct represents the desired size of a widget. See
37  * [GtkWidget’s geometry management section][geometry-management] for
38  * more information.
39  */
40 public final class Requisition
41 {
42 	/** the main Gtk struct */
43 	protected GtkRequisition* gtkRequisition;
44 	protected bool ownedRef;
45 
46 	/** Get the main Gtk struct */
47 	public GtkRequisition* getRequisitionStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gtkRequisition;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct()
56 	{
57 		return cast(void*)gtkRequisition;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GtkRequisition* gtkRequisition, bool ownedRef = false)
64 	{
65 		this.gtkRequisition = gtkRequisition;
66 		this.ownedRef = ownedRef;
67 	}
68 
69 	~this ()
70 	{
71 		if ( Linker.isLoaded(LIBRARY_GTK) && ownedRef )
72 			gtk_requisition_free(gtkRequisition);
73 	}
74 
75 
76 	/**
77 	 * the widget’s desired width
78 	 */
79 	public @property int width()
80 	{
81 		return gtkRequisition.width;
82 	}
83 
84 	/** Ditto */
85 	public @property void width(int value)
86 	{
87 		gtkRequisition.width = value;
88 	}
89 
90 	/**
91 	 * the widget’s desired height
92 	 */
93 	public @property int height()
94 	{
95 		return gtkRequisition.height;
96 	}
97 
98 	/** Ditto */
99 	public @property void height(int value)
100 	{
101 		gtkRequisition.height = value;
102 	}
103 
104 	/** */
105 	public static GType getType()
106 	{
107 		return gtk_requisition_get_type();
108 	}
109 
110 	/**
111 	 * Allocates a new `GtkRequisition`.
112 	 *
113 	 * The struct is initialized to zero.
114 	 *
115 	 * Returns: a new empty `GtkRequisition`. The newly
116 	 *     allocated `GtkRequisition` should be freed with
117 	 *     [method@Gtk.Requisition.free]
118 	 *
119 	 * Throws: ConstructionException GTK+ fails to create the object.
120 	 */
121 	public this()
122 	{
123 		auto __p = gtk_requisition_new();
124 
125 		if(__p is null)
126 		{
127 			throw new ConstructionException("null returned by new");
128 		}
129 
130 		this(cast(GtkRequisition*) __p);
131 	}
132 
133 	/**
134 	 * Copies a `GtkRequisition`.
135 	 *
136 	 * Returns: a copy of @requisition
137 	 */
138 	public Requisition copy()
139 	{
140 		auto __p = gtk_requisition_copy(gtkRequisition);
141 
142 		if(__p is null)
143 		{
144 			return null;
145 		}
146 
147 		return ObjectG.getDObject!(Requisition)(cast(GtkRequisition*) __p, true);
148 	}
149 
150 	/**
151 	 * Frees a `GtkRequisition`.
152 	 */
153 	public void free()
154 	{
155 		gtk_requisition_free(gtkRequisition);
156 		ownedRef = false;
157 	}
158 }