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