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  * Conversion parameters:
26  * inFile  = 
27  * outPack = gobject
28  * outFile = Flags
29  * strct   = GFlagsValue
30  * realStrct=
31  * ctorStrct=
32  * clss    = Flags
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_flags_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * structWrap:
48  * 	- GFlagsValue* -> Flags
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gobject.Flags;
55 
56 public  import gtkc.gobjecttypes;
57 
58 private import gtkc.gobject;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 private import glib.Str;
63 
64 
65 
66 /**
67  * The GLib type system provides fundamental types for enumeration and
68  * flags types. (Flags types are like enumerations, but allow their
69  * values to be combined by bitwise or). A registered enumeration or
70  * flags type associates a name and a nickname with each allowed
71  * value, and the methods g_enum_get_value_by_name(),
72  * g_enum_get_value_by_nick(), g_flags_get_value_by_name() and
73  * g_flags_get_value_by_nick() can look up values by their name or
74  * nickname. When an enumeration or flags type is registered with the
75  * GLib type system, it can be used as value type for object
76  * properties, using g_param_spec_enum() or g_param_spec_flags().
77  *
78  * GObject ships with a utility called glib-mkenums that can construct
79  * suitable type registration functions from C enumeration
80  * definitions.
81  */
82 public class Flags
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GFlagsValue* gFlagsValue;
87 	
88 	
89 	/** Get the main Gtk struct */
90 	public GFlagsValue* getFlagsStruct()
91 	{
92 		return gFlagsValue;
93 	}
94 	
95 	
96 	/** the main Gtk struct as a void* */
97 	protected void* getStruct()
98 	{
99 		return cast(void*)gFlagsValue;
100 	}
101 	
102 	/**
103 	 * Sets our main struct and passes it to the parent class
104 	 */
105 	public this (GFlagsValue* gFlagsValue)
106 	{
107 		this.gFlagsValue = gFlagsValue;
108 	}
109 	
110 	/**
111 	 */
112 	
113 	/**
114 	 * Returns the first GFlagsValue which is set in value.
115 	 * Params:
116 	 * flagsClass = a GFlagsClass
117 	 * value = the value
118 	 * Returns: the first GFlagsValue which is set in value, or NULL if none is set
119 	 */
120 	public static Flags getFirstValue(GFlagsClass* flagsClass, uint value)
121 	{
122 		// GFlagsValue * g_flags_get_first_value (GFlagsClass *flags_class,  guint value);
123 		auto p = g_flags_get_first_value(flagsClass, value);
124 		
125 		if(p is null)
126 		{
127 			return null;
128 		}
129 		
130 		return ObjectG.getDObject!(Flags)(cast(GFlagsValue*) p);
131 	}
132 	
133 	/**
134 	 * Looks up a GFlagsValue by name.
135 	 * Params:
136 	 * flagsClass = a GFlagsClass
137 	 * name = the name to look up
138 	 * Returns: the GFlagsValue with name name, or NULL if there is no flag with that name
139 	 */
140 	public static Flags getValueByName(GFlagsClass* flagsClass, string name)
141 	{
142 		// GFlagsValue * g_flags_get_value_by_name (GFlagsClass *flags_class,  const gchar *name);
143 		auto p = g_flags_get_value_by_name(flagsClass, Str.toStringz(name));
144 		
145 		if(p is null)
146 		{
147 			return null;
148 		}
149 		
150 		return ObjectG.getDObject!(Flags)(cast(GFlagsValue*) p);
151 	}
152 	
153 	/**
154 	 * Looks up a GFlagsValue by nickname.
155 	 * Params:
156 	 * flagsClass = a GFlagsClass
157 	 * nick = the nickname to look up
158 	 * Returns: the GFlagsValue with nickname nick, or NULL if there is no flag with that nickname
159 	 */
160 	public static Flags getValueByNick(GFlagsClass* flagsClass, string nick)
161 	{
162 		// GFlagsValue * g_flags_get_value_by_nick (GFlagsClass *flags_class,  const gchar *nick);
163 		auto p = g_flags_get_value_by_nick(flagsClass, Str.toStringz(nick));
164 		
165 		if(p is null)
166 		{
167 			return null;
168 		}
169 		
170 		return ObjectG.getDObject!(Flags)(cast(GFlagsValue*) p);
171 	}
172 	
173 	/**
174 	 * Registers a new static flags type with the name name.
175 	 * It is normally more convenient to let glib-mkenums generate a
176 	 * my_flags_get_type() function from a usual C enumeration definition
177 	 * than to write one yourself using g_flags_register_static().
178 	 * Params:
179 	 * name = A nul-terminated string used as the name of the new type.
180 	 * Returns: The new type identifier.
181 	 */
182 	public static GType registerStatic(string name, Flags _StaticValues)
183 	{
184 		// GType g_flags_register_static (const gchar *name,  const GFlagsValue *const_static_values);
185 		return g_flags_register_static(Str.toStringz(name), (_StaticValues is null) ? null : _StaticValues.getFlagsStruct());
186 	}
187 	
188 	/**
189 	 * This function is meant to be called from the complete_type_info()
190 	 * function of a GTypePlugin implementation, see the example for
191 	 * g_enum_complete_type_info() above.
192 	 * Params:
193 	 * type = the type identifier of the type being completed
194 	 * info = the GTypeInfo struct to be filled in
195 	 */
196 	public static void completeTypeInfo(GType type, GTypeInfo* info, Flags _Values)
197 	{
198 		// void g_flags_complete_type_info (GType g_flags_type,  GTypeInfo *info,  const GFlagsValue *const_values);
199 		g_flags_complete_type_info(type, info, (_Values is null) ? null : _Values.getFlagsStruct());
200 	}
201 }