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 gobject.Flags; 26 27 private import glib.Str; 28 private import gobject.c.functions; 29 public import gobject.c.types; 30 public import gtkc.gobjecttypes; 31 32 33 /** */ 34 public struct Flags 35 { 36 37 /** 38 * This function is meant to be called from the complete_type_info() 39 * function of a #GTypePlugin implementation, see the example for 40 * g_enum_complete_type_info() above. 41 * 42 * Params: 43 * gFlagsType = the type identifier of the type being completed 44 * info = the #GTypeInfo struct to be filled in 45 * constValues = An array of #GFlagsValue structs for the possible 46 * enumeration values. The array is terminated by a struct with all 47 * members being 0. 48 */ 49 public static void completeTypeInfo(GType gFlagsType, out GTypeInfo info, GFlagsValue* constValues) 50 { 51 g_flags_complete_type_info(gFlagsType, &info, constValues); 52 } 53 54 /** 55 * Returns the first #GFlagsValue which is set in @value. 56 * 57 * Params: 58 * flagsClass = a #GFlagsClass 59 * value = the value 60 * 61 * Returns: the first #GFlagsValue which is set in 62 * @value, or %NULL if none is set 63 */ 64 public static GFlagsValue* getFirstValue(GFlagsClass* flagsClass, uint value) 65 { 66 return g_flags_get_first_value(flagsClass, value); 67 } 68 69 /** 70 * Looks up a #GFlagsValue by name. 71 * 72 * Params: 73 * flagsClass = a #GFlagsClass 74 * name = the name to look up 75 * 76 * Returns: the #GFlagsValue with name @name, 77 * or %NULL if there is no flag with that name 78 */ 79 public static GFlagsValue* getValueByName(GFlagsClass* flagsClass, string name) 80 { 81 return g_flags_get_value_by_name(flagsClass, Str.toStringz(name)); 82 } 83 84 /** 85 * Looks up a #GFlagsValue by nickname. 86 * 87 * Params: 88 * flagsClass = a #GFlagsClass 89 * nick = the nickname to look up 90 * 91 * Returns: the #GFlagsValue with nickname @nick, 92 * or %NULL if there is no flag with that nickname 93 */ 94 public static GFlagsValue* getValueByNick(GFlagsClass* flagsClass, string nick) 95 { 96 return g_flags_get_value_by_nick(flagsClass, Str.toStringz(nick)); 97 } 98 99 /** 100 * Registers a new static flags type with the name @name. 101 * 102 * It is normally more convenient to let [glib-mkenums][glib-mkenums] 103 * generate a my_flags_get_type() function from a usual C enumeration 104 * definition than to write one yourself using g_flags_register_static(). 105 * 106 * Params: 107 * name = A nul-terminated string used as the name of the new type. 108 * constStaticValues = An array of #GFlagsValue structs for the possible 109 * flags values. The array is terminated by a struct with all members being 0. 110 * GObject keeps a reference to the data, so it cannot be stack-allocated. 111 * 112 * Returns: The new type identifier. 113 */ 114 public static GType registerStatic(string name, GFlagsValue* constStaticValues) 115 { 116 return g_flags_register_static(Str.toStringz(name), constStaticValues); 117 } 118 }