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.Border;
26 
27 private import glib.ConstructionException;
28 private import glib.c.functions;
29 private import gobject.ObjectG;
30 private import gtk.c.functions;
31 public  import gtk.c.types;
32 public  import gtkc.gtktypes;
33 private import gtkd.Loader;
34 
35 
36 /**
37  * A struct that specifies a border around a rectangular area
38  * that can be of different width on each side.
39  */
40 public final class Border
41 {
42 	/** the main Gtk struct */
43 	protected GtkBorder* gtkBorder;
44 	protected bool ownedRef;
45 
46 	/** Get the main Gtk struct */
47 	public GtkBorder* getBorderStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gtkBorder;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct()
56 	{
57 		return cast(void*)gtkBorder;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GtkBorder* gtkBorder, bool ownedRef = false)
64 	{
65 		this.gtkBorder = gtkBorder;
66 		this.ownedRef = ownedRef;
67 	}
68 
69 	~this ()
70 	{
71 		if ( Linker.isLoaded(LIBRARY_GTK) && ownedRef )
72 			gtk_border_free(gtkBorder);
73 	}
74 
75 
76 	/**
77 	 * The width of the left border
78 	 */
79 	public @property short left()
80 	{
81 		return gtkBorder.left;
82 	}
83 
84 	/** Ditto */
85 	public @property void left(short value)
86 	{
87 		gtkBorder.left = value;
88 	}
89 
90 	/**
91 	 * The width of the right border
92 	 */
93 	public @property short right()
94 	{
95 		return gtkBorder.right;
96 	}
97 
98 	/** Ditto */
99 	public @property void right(short value)
100 	{
101 		gtkBorder.right = value;
102 	}
103 
104 	/**
105 	 * The width of the top border
106 	 */
107 	public @property short top()
108 	{
109 		return gtkBorder.top;
110 	}
111 
112 	/** Ditto */
113 	public @property void top(short value)
114 	{
115 		gtkBorder.top = value;
116 	}
117 
118 	/**
119 	 * The width of the bottom border
120 	 */
121 	public @property short bottom()
122 	{
123 		return gtkBorder.bottom;
124 	}
125 
126 	/** Ditto */
127 	public @property void bottom(short value)
128 	{
129 		gtkBorder.bottom = value;
130 	}
131 
132 	/** */
133 	public static GType getType()
134 	{
135 		return gtk_border_get_type();
136 	}
137 
138 	/**
139 	 * Allocates a new #GtkBorder-struct and initializes its elements to zero.
140 	 *
141 	 * Returns: a newly allocated #GtkBorder-struct.
142 	 *     Free with gtk_border_free()
143 	 *
144 	 * Since: 2.14
145 	 *
146 	 * Throws: ConstructionException GTK+ fails to create the object.
147 	 */
148 	public this()
149 	{
150 		auto p = gtk_border_new();
151 
152 		if(p is null)
153 		{
154 			throw new ConstructionException("null returned by new");
155 		}
156 
157 		this(cast(GtkBorder*) p);
158 	}
159 
160 	/**
161 	 * Copies a #GtkBorder-struct.
162 	 *
163 	 * Returns: a copy of @border_.
164 	 */
165 	public Border copy()
166 	{
167 		auto p = gtk_border_copy(gtkBorder);
168 
169 		if(p is null)
170 		{
171 			return null;
172 		}
173 
174 		return ObjectG.getDObject!(Border)(cast(GtkBorder*) p, true);
175 	}
176 
177 	/**
178 	 * Frees a #GtkBorder-struct.
179 	 */
180 	public void free()
181 	{
182 		gtk_border_free(gtkBorder);
183 		ownedRef = false;
184 	}
185 }