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.BoolFilter;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Expression;
30 private import gtk.Filter;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
33 
34 
35 /**
36  * `GtkBoolFilter` evaluates a boolean `GtkExpression`
37  * to determine whether to include items.
38  */
39 public class BoolFilter : Filter
40 {
41 	/** the main Gtk struct */
42 	protected GtkBoolFilter* gtkBoolFilter;
43 
44 	/** Get the main Gtk struct */
45 	public GtkBoolFilter* getBoolFilterStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return gtkBoolFilter;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected override void* getStruct()
54 	{
55 		return cast(void*)gtkBoolFilter;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GtkBoolFilter* gtkBoolFilter, bool ownedRef = false)
62 	{
63 		this.gtkBoolFilter = gtkBoolFilter;
64 		super(cast(GtkFilter*)gtkBoolFilter, ownedRef);
65 	}
66 
67 
68 	/** */
69 	public static GType getType()
70 	{
71 		return gtk_bool_filter_get_type();
72 	}
73 
74 	/**
75 	 * Creates a new bool filter.
76 	 *
77 	 * Params:
78 	 *     expression = The expression to evaluate
79 	 *         or %NULL for none
80 	 *
81 	 * Returns: a new `GtkBoolFilter`
82 	 *
83 	 * Throws: ConstructionException GTK+ fails to create the object.
84 	 */
85 	public this(Expression expression)
86 	{
87 		auto __p = gtk_bool_filter_new((expression is null) ? null : expression.getExpressionStruct(true));
88 
89 		if(__p is null)
90 		{
91 			throw new ConstructionException("null returned by new");
92 		}
93 
94 		this(cast(GtkBoolFilter*) __p, true);
95 	}
96 
97 	/**
98 	 * Gets the expression that the filter uses to evaluate if
99 	 * an item should be filtered.
100 	 *
101 	 * Returns: a `GtkExpression`
102 	 */
103 	public Expression getExpression()
104 	{
105 		auto __p = gtk_bool_filter_get_expression(gtkBoolFilter);
106 
107 		if(__p is null)
108 		{
109 			return null;
110 		}
111 
112 		return ObjectG.getDObject!(Expression)(cast(GtkExpression*) __p);
113 	}
114 
115 	/**
116 	 * Returns whether the filter inverts the expression.
117 	 *
118 	 * Returns: %TRUE if the filter inverts
119 	 */
120 	public bool getInvert()
121 	{
122 		return gtk_bool_filter_get_invert(gtkBoolFilter) != 0;
123 	}
124 
125 	/**
126 	 * Sets the expression that the filter uses to check if items
127 	 * should be filtered.
128 	 *
129 	 * The expression must have a value type of %G_TYPE_BOOLEAN.
130 	 *
131 	 * Params:
132 	 *     expression = a `GtkExpression`
133 	 */
134 	public void setExpression(Expression expression)
135 	{
136 		gtk_bool_filter_set_expression(gtkBoolFilter, (expression is null) ? null : expression.getExpressionStruct());
137 	}
138 
139 	/**
140 	 * Sets whether the filter should invert the expression.
141 	 *
142 	 * Params:
143 	 *     invert = %TRUE to invert
144 	 */
145 	public void setInvert(bool invert)
146 	{
147 		gtk_bool_filter_set_invert(gtkBoolFilter, invert);
148 	}
149 }