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