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.FlowBoxChild; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gobject.Signals; 30 private import gtk.Bin; 31 private import gtk.Widget; 32 public import gtkc.gdktypes; 33 private import gtkc.gtk; 34 public import gtkc.gtktypes; 35 36 37 /** */ 38 public class FlowBoxChild : Bin 39 { 40 /** the main Gtk struct */ 41 protected GtkFlowBoxChild* gtkFlowBoxChild; 42 43 /** Get the main Gtk struct */ 44 public GtkFlowBoxChild* getFlowBoxChildStruct() 45 { 46 return gtkFlowBoxChild; 47 } 48 49 /** the main Gtk struct as a void* */ 50 protected override void* getStruct() 51 { 52 return cast(void*)gtkFlowBoxChild; 53 } 54 55 protected override void setStruct(GObject* obj) 56 { 57 gtkFlowBoxChild = cast(GtkFlowBoxChild*)obj; 58 super.setStruct(obj); 59 } 60 61 /** 62 * Sets our main struct and passes it to the parent class. 63 */ 64 public this (GtkFlowBoxChild* gtkFlowBoxChild, bool ownedRef = false) 65 { 66 this.gtkFlowBoxChild = gtkFlowBoxChild; 67 super(cast(GtkBin*)gtkFlowBoxChild, ownedRef); 68 } 69 70 71 /** */ 72 public static GType getType() 73 { 74 return gtk_flow_box_child_get_type(); 75 } 76 77 /** 78 * Creates a new #GtkFlowBoxChild, to be used as a child 79 * of a #GtkFlowBox. 80 * 81 * Return: a new #GtkFlowBoxChild 82 * 83 * Since: 3.12 84 * 85 * Throws: ConstructionException GTK+ fails to create the object. 86 */ 87 public this() 88 { 89 auto p = gtk_flow_box_child_new(); 90 91 if(p is null) 92 { 93 throw new ConstructionException("null returned by new"); 94 } 95 96 this(cast(GtkFlowBoxChild*) p); 97 } 98 99 /** 100 * Marks @child as changed, causing any state that depends on this 101 * to be updated. This affects sorting and filtering. 102 * 103 * Note that calls to this method must be in sync with the data 104 * used for the sorting and filtering functions. For instance, if 105 * the list is mirroring some external data set, and *two* children 106 * changed in the external data set when you call 107 * gtk_flow_box_child_changed() on the first child, the sort function 108 * must only read the new data for the first of the two changed 109 * children, otherwise the resorting of the children will be wrong. 110 * 111 * This generally means that if you don’t fully control the data 112 * model, you have to duplicate the data that affects the sorting 113 * and filtering functions into the widgets themselves. Another 114 * alternative is to call gtk_flow_box_invalidate_sort() on any 115 * model change, but that is more expensive. 116 * 117 * Since: 3.12 118 */ 119 public void changed() 120 { 121 gtk_flow_box_child_changed(gtkFlowBoxChild); 122 } 123 124 /** 125 * Gets the current index of the @child in its #GtkFlowBox container. 126 * 127 * Return: the index of the @child, or -1 if the @child is not 128 * in a flow box. 129 * 130 * Since: 3.12 131 */ 132 public int getIndex() 133 { 134 return gtk_flow_box_child_get_index(gtkFlowBoxChild); 135 } 136 137 /** 138 * Returns whether the @child is currently selected in its 139 * #GtkFlowBox container. 140 * 141 * Return: %TRUE if @child is selected 142 * 143 * Since: 3.12 144 */ 145 public bool isSelected() 146 { 147 return gtk_flow_box_child_is_selected(gtkFlowBoxChild) != 0; 148 } 149 150 int[string] connectedSignals; 151 152 void delegate(FlowBoxChild)[] onActivateListeners; 153 /** 154 * The ::activate signal is emitted when the user activates 155 * a child widget in a #GtkFlowBox, either by clicking or 156 * double-clicking, or by using the Space or Enter key. 157 * 158 * While this signal is used as a 159 * [keybinding signal][GtkBindingSignal], 160 * it can be used by applications for their own purposes. 161 */ 162 void addOnActivate(void delegate(FlowBoxChild) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 163 { 164 if ( "activate" !in connectedSignals ) 165 { 166 Signals.connectData( 167 this, 168 "activate", 169 cast(GCallback)&callBackActivate, 170 cast(void*)this, 171 null, 172 connectFlags); 173 connectedSignals["activate"] = 1; 174 } 175 onActivateListeners ~= dlg; 176 } 177 extern(C) static void callBackActivate(GtkFlowBoxChild* flowboxchildStruct, FlowBoxChild _flowboxchild) 178 { 179 foreach ( void delegate(FlowBoxChild) dlg; _flowboxchild.onActivateListeners ) 180 { 181 dlg(_flowboxchild); 182 } 183 } 184 }