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 atk.Range;
26 
27 private import atk.c.functions;
28 public  import atk.c.types;
29 private import glib.ConstructionException;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 public  import gtkc.atktypes;
33 private import gtkd.Loader;
34 
35 
36 /**
37  * #AtkRange are used on #AtkValue, in order to represent the full
38  * range of a given component (for example an slider or a range
39  * control), or to define each individual subrange this full range is
40  * splitted if available. See #AtkValue documentation for further
41  * details.
42  */
43 public class Range
44 {
45 	/** the main Gtk struct */
46 	protected AtkRange* atkRange;
47 	protected bool ownedRef;
48 
49 	/** Get the main Gtk struct */
50 	public AtkRange* getRangeStruct(bool transferOwnership = false)
51 	{
52 		if (transferOwnership)
53 			ownedRef = false;
54 		return atkRange;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected void* getStruct()
59 	{
60 		return cast(void*)atkRange;
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (AtkRange* atkRange, bool ownedRef = false)
67 	{
68 		this.atkRange = atkRange;
69 		this.ownedRef = ownedRef;
70 	}
71 
72 	~this ()
73 	{
74 		if ( Linker.isLoaded(LIBRARY_ATK) && ownedRef )
75 			atk_range_free(atkRange);
76 	}
77 
78 
79 	/** */
80 	public static GType getType()
81 	{
82 		return atk_range_get_type();
83 	}
84 
85 	/**
86 	 * Creates a new #AtkRange.
87 	 *
88 	 * Params:
89 	 *     lowerLimit = inferior limit for this range
90 	 *     upperLimit = superior limit for this range
91 	 *     description = human readable description of this range.
92 	 *
93 	 * Returns: a new #AtkRange
94 	 *
95 	 * Since: 2.12
96 	 *
97 	 * Throws: ConstructionException GTK+ fails to create the object.
98 	 */
99 	public this(double lowerLimit, double upperLimit, string description)
100 	{
101 		auto __p = atk_range_new(lowerLimit, upperLimit, Str.toStringz(description));
102 
103 		if(__p is null)
104 		{
105 			throw new ConstructionException("null returned by new");
106 		}
107 
108 		this(cast(AtkRange*) __p);
109 	}
110 
111 	/**
112 	 * Returns a new #AtkRange that is a exact copy of @src
113 	 *
114 	 * Returns: a new #AtkRange copy of @src
115 	 *
116 	 * Since: 2.12
117 	 */
118 	public Range copy()
119 	{
120 		auto __p = atk_range_copy(atkRange);
121 
122 		if(__p is null)
123 		{
124 			return null;
125 		}
126 
127 		return ObjectG.getDObject!(Range)(cast(AtkRange*) __p, true);
128 	}
129 
130 	/**
131 	 * Free @range
132 	 *
133 	 * Since: 2.12
134 	 */
135 	public void free()
136 	{
137 		atk_range_free(atkRange);
138 		ownedRef = false;
139 	}
140 
141 	/**
142 	 * Returns the human readable description of @range
143 	 *
144 	 * Returns: the human-readable description of @range
145 	 *
146 	 * Since: 2.12
147 	 */
148 	public string getDescription()
149 	{
150 		return Str.toString(atk_range_get_description(atkRange));
151 	}
152 
153 	/**
154 	 * Returns the lower limit of @range
155 	 *
156 	 * Returns: the lower limit of @range
157 	 *
158 	 * Since: 2.12
159 	 */
160 	public double getLowerLimit()
161 	{
162 		return atk_range_get_lower_limit(atkRange);
163 	}
164 
165 	/**
166 	 * Returns the upper limit of @range
167 	 *
168 	 * Returns: the upper limit of @range
169 	 *
170 	 * Since: 2.12
171 	 */
172 	public double getUpperLimit()
173 	{
174 		return atk_range_get_upper_limit(atkRange);
175 	}
176 }