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.PropertyExpression; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gobject.ParamSpec; 31 private import gtk.Expression; 32 private import gtk.c.functions; 33 public import gtk.c.types; 34 35 36 /** 37 * A `GObject` property value in a `GtkExpression`. 38 */ 39 public class PropertyExpression : Expression 40 { 41 /** the main Gtk struct */ 42 protected GtkPropertyExpression* gtkPropertyExpression; 43 44 /** Get the main Gtk struct */ 45 public GtkPropertyExpression* getPropertyExpressionStruct(bool transferOwnership = false) 46 { 47 if (transferOwnership) 48 ownedRef = false; 49 return gtkPropertyExpression; 50 } 51 52 /** the main Gtk struct as a void* */ 53 protected override void* getStruct() 54 { 55 return cast(void*)gtkPropertyExpression; 56 } 57 58 /** 59 * Sets our main struct and passes it to the parent class. 60 */ 61 public this (GtkPropertyExpression* gtkPropertyExpression, bool ownedRef = false) 62 { 63 this.gtkPropertyExpression = gtkPropertyExpression; 64 super(cast(GtkExpression*)gtkPropertyExpression, ownedRef); 65 } 66 67 68 /** */ 69 public static GType getType() 70 { 71 return gtk_property_expression_get_type(); 72 } 73 74 /** 75 * Creates an expression that looks up a property via the 76 * given `expression` or the `this` argument when `expression` 77 * is `NULL`. 78 * 79 * If the resulting object conforms to `this_type`, its property named 80 * `property_name` will be queried. Otherwise, this expression's 81 * evaluation will fail. 82 * 83 * The given `this_type` must have a property with `property_name`. 84 * 85 * Params: 86 * thisType = The type to expect for the this type 87 * expression = Expression to 88 * evaluate to get the object to query or `NULL` to 89 * query the `this` object 90 * propertyName = name of the property 91 * 92 * Returns: a new `GtkExpression` 93 * 94 * Throws: ConstructionException GTK+ fails to create the object. 95 */ 96 public this(GType thisType, Expression expression, string propertyName) 97 { 98 auto __p = gtk_property_expression_new(thisType, (expression is null) ? null : expression.getExpressionStruct(true), Str.toStringz(propertyName)); 99 100 if(__p is null) 101 { 102 throw new ConstructionException("null returned by new"); 103 } 104 105 this(cast(GtkPropertyExpression*) __p); 106 } 107 108 /** 109 * Creates an expression that looks up a property via the 110 * given `expression` or the `this` argument when `expression` 111 * is `NULL`. 112 * 113 * If the resulting object conforms to `this_type`, its 114 * property specified by `pspec` will be queried. 115 * Otherwise, this expression's evaluation will fail. 116 * 117 * Params: 118 * expression = Expression to 119 * evaluate to get the object to query or `NULL` to 120 * query the `this` object 121 * pspec = the `GParamSpec` for the property to query 122 * 123 * Returns: a new `GtkExpression` 124 * 125 * Throws: ConstructionException GTK+ fails to create the object. 126 */ 127 public this(Expression expression, ParamSpec pspec) 128 { 129 auto __p = gtk_property_expression_new_for_pspec((expression is null) ? null : expression.getExpressionStruct(true), (pspec is null) ? null : pspec.getParamSpecStruct()); 130 131 if(__p is null) 132 { 133 throw new ConstructionException("null returned by new_for_pspec"); 134 } 135 136 this(cast(GtkPropertyExpression*) __p); 137 } 138 139 /** 140 * Gets the expression specifying the object of 141 * a property expression. 142 * 143 * Returns: the object expression 144 */ 145 public Expression getExpression() 146 { 147 auto __p = gtk_property_expression_get_expression(cast(GtkExpression*)gtkPropertyExpression); 148 149 if(__p is null) 150 { 151 return null; 152 } 153 154 return ObjectG.getDObject!(Expression)(cast(GtkExpression*) __p); 155 } 156 157 /** 158 * Gets the `GParamSpec` specifying the property of 159 * a property expression. 160 * 161 * Returns: the `GParamSpec` for the property 162 */ 163 public ParamSpec getPspec() 164 { 165 auto __p = gtk_property_expression_get_pspec(cast(GtkExpression*)gtkPropertyExpression); 166 167 if(__p is null) 168 { 169 return null; 170 } 171 172 return ObjectG.getDObject!(ParamSpec)(cast(GParamSpec*) __p); 173 } 174 }