1 /*
2  * This file is part of EvinceD.
3  * EvinceD is based on GtkD.
4  *
5  * EvinceD is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License
7  * as published by the Free Software Foundation; either version 3
8  * of the License, or (at your option) any later version, with
9  * some exceptions, please read the COPYING file.
10  *
11  * EvinceD is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with EvinceD; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
19  */
20 
21 // generated automatically - do not change
22 // find conversion definition on APILookup.txt
23 
24 
25 module evince.document.Rectangle;
26 
27 private import evince.document.c.functions;
28 public  import evince.document.c.types;
29 private import glib.ConstructionException;
30 private import glib.MemorySlice;
31 private import gobject.ObjectG;
32 private import gtkd.Loader;
33 
34 
35 /** */
36 public final class Rectangle
37 {
38 	/** the main Gtk struct */
39 	protected EvRectangle* evRectangle;
40 	protected bool ownedRef;
41 
42 	/** Get the main Gtk struct */
43 	public EvRectangle* getRectangleStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return evRectangle;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected void* getStruct()
52 	{
53 		return cast(void*)evRectangle;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (EvRectangle* evRectangle, bool ownedRef = false)
60 	{
61 		this.evRectangle = evRectangle;
62 		this.ownedRef = ownedRef;
63 	}
64 
65 	~this ()
66 	{
67 		if ( Linker.isLoaded(LIBRARY_EVINCEDOCUMENT) && ownedRef )
68 			ev_rectangle_free(evRectangle);
69 	}
70 
71 
72 	/** */
73 	public @property double x1()
74 	{
75 		return evRectangle.x1;
76 	}
77 
78 	/** Ditto */
79 	public @property void x1(double value)
80 	{
81 		evRectangle.x1 = value;
82 	}
83 
84 	/** */
85 	public @property double y1()
86 	{
87 		return evRectangle.y1;
88 	}
89 
90 	/** Ditto */
91 	public @property void y1(double value)
92 	{
93 		evRectangle.y1 = value;
94 	}
95 
96 	/** */
97 	public @property double x2()
98 	{
99 		return evRectangle.x2;
100 	}
101 
102 	/** Ditto */
103 	public @property void x2(double value)
104 	{
105 		evRectangle.x2 = value;
106 	}
107 
108 	/** */
109 	public @property double y2()
110 	{
111 		return evRectangle.y2;
112 	}
113 
114 	/** Ditto */
115 	public @property void y2(double value)
116 	{
117 		evRectangle.y2 = value;
118 	}
119 
120 	/** */
121 	public static GType getType()
122 	{
123 		return ev_rectangle_get_type();
124 	}
125 
126 	/** */
127 	public this()
128 	{
129 		auto __p = ev_rectangle_new();
130 
131 		if(__p is null)
132 		{
133 			throw new ConstructionException("null returned by new");
134 		}
135 
136 		this(cast(EvRectangle*) __p);
137 	}
138 
139 	/** */
140 	public Rectangle copy()
141 	{
142 		auto __p = ev_rectangle_copy(evRectangle);
143 
144 		if(__p is null)
145 		{
146 			return null;
147 		}
148 
149 		return ObjectG.getDObject!(Rectangle)(cast(EvRectangle*) __p, true);
150 	}
151 
152 	/** */
153 	public void free()
154 	{
155 		ev_rectangle_free(evRectangle);
156 		ownedRef = false;
157 	}
158 }