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  = GtkTreeSortable.html
27  * outPack = gtk
28  * outFile = TreeSortableT
29  * strct   = GtkTreeSortable
30  * realStrct=
31  * ctorStrct=
32  * clss    = TreeSortableT
33  * interf  = TreeSortableIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * 	- TStruct
38  * extend  = 
39  * implements:
40  * prefixes:
41  * 	- gtk_tree_sortable_
42  * 	- gtk_
43  * omit structs:
44  * omit prefixes:
45  * omit code:
46  * omit signals:
47  * imports:
48  * structWrap:
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gtk.TreeSortableT;
55 
56 public  import gtkc.gtktypes;
57 
58 public import gtkc.gtk;
59 public import glib.ConstructionException;
60 public import gobject.ObjectG;
61 
62 public import gobject.Signals;
63 public  import gtkc.gdktypes;
64 
65 
66 
67 
68 
69 /**
70  * Description
71  * GtkTreeSortable is an interface to be implemented by tree models which
72  * support sorting. The GtkTreeView uses the methods provided by this interface
73  * to sort the model.
74  */
75 public template TreeSortableT(TStruct)
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GtkTreeSortable* gtkTreeSortable;
80 	
81 	
82 	public GtkTreeSortable* getTreeSortableTStruct()
83 	{
84 		return cast(GtkTreeSortable*)getStruct();
85 	}
86 	
87 	
88 	/**
89 	 */
90 	int[string] connectedSignals;
91 	
92 	void delegate(TreeSortableIF)[] _onSortColumnChangedListeners;
93 	void delegate(TreeSortableIF)[] onSortColumnChangedListeners()
94 	{
95 		return  _onSortColumnChangedListeners;
96 	}
97 	/**
98 	 * The ::sort-column-changed signal is emitted when the sort column
99 	 * or sort order of sortable is changed. The signal is emitted before
100 	 * the contents of sortable are resorted.
101 	 * See Also
102 	 * GtkTreeModel, GtkTreeView
103 	 */
104 	void addOnSortColumnChanged(void delegate(TreeSortableIF) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
105 	{
106 		if ( !("sort-column-changed" in connectedSignals) )
107 		{
108 			Signals.connectData(
109 			getStruct(),
110 			"sort-column-changed",
111 			cast(GCallback)&callBackSortColumnChanged,
112 			cast(void*)cast(TreeSortableIF)this,
113 			null,
114 			connectFlags);
115 			connectedSignals["sort-column-changed"] = 1;
116 		}
117 		_onSortColumnChangedListeners ~= dlg;
118 	}
119 	extern(C) static void callBackSortColumnChanged(GtkTreeSortable* sortableStruct, TreeSortableIF _treeSortableIF)
120 	{
121 		foreach ( void delegate(TreeSortableIF) dlg ; _treeSortableIF.onSortColumnChangedListeners )
122 		{
123 			dlg(_treeSortableIF);
124 		}
125 	}
126 	
127 	
128 	/**
129 	 * Emits a "sort-column-changed" signal on sortable.
130 	 */
131 	public void sortColumnChanged()
132 	{
133 		// void gtk_tree_sortable_sort_column_changed  (GtkTreeSortable *sortable);
134 		gtk_tree_sortable_sort_column_changed(getTreeSortableTStruct());
135 	}
136 	
137 	/**
138 	 * Fills in sort_column_id and order with the current sort column and the
139 	 * order. It returns TRUE unless the sort_column_id is
140 	 * GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or
141 	 * GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.
142 	 * Params:
143 	 * sortColumnId = The sort column id to be filled in
144 	 * order = The GtkSortType to be filled in
145 	 * Returns: TRUE if the sort column is not one of the special sort column ids.
146 	 */
147 	public int getSortColumnId(out int sortColumnId, out GtkSortType order)
148 	{
149 		// gboolean gtk_tree_sortable_get_sort_column_id  (GtkTreeSortable *sortable,  gint *sort_column_id,  GtkSortType *order);
150 		return gtk_tree_sortable_get_sort_column_id(getTreeSortableTStruct(), &sortColumnId, &order);
151 	}
152 	
153 	/**
154 	 * Sets the current sort column to be sort_column_id. The sortable will
155 	 * resort itself to reflect this change, after emitting a
156 	 * "sort-column-changed" signal. sort_column_id may either be
157 	 * Params:
158 	 * sortColumnId = the sort column id to set
159 	 * order = The sort order of the column
160 	 */
161 	public void setSortColumnId(int sortColumnId, GtkSortType order)
162 	{
163 		// void gtk_tree_sortable_set_sort_column_id  (GtkTreeSortable *sortable,  gint sort_column_id,  GtkSortType order);
164 		gtk_tree_sortable_set_sort_column_id(getTreeSortableTStruct(), sortColumnId, order);
165 	}
166 	
167 	/**
168 	 * Sets the comparison function used when sorting to be sort_func. If the
169 	 * current sort column id of sortable is the same as sort_column_id, then
170 	 * the model will sort using this function.
171 	 * Params:
172 	 * sortColumnId = the sort column id to set the function for
173 	 * sortFunc = The comparison function
174 	 * userData = User data to pass to sort_func, or NULL. [allow-none]
175 	 * destroy = Destroy notifier of user_data, or NULL. [allow-none]
176 	 */
177 	public void setSortFunc(int sortColumnId, GtkTreeIterCompareFunc sortFunc, void* userData, GDestroyNotify destroy)
178 	{
179 		// void gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,  gint sort_column_id,  GtkTreeIterCompareFunc sort_func,  gpointer user_data,  GDestroyNotify destroy);
180 		gtk_tree_sortable_set_sort_func(getTreeSortableTStruct(), sortColumnId, sortFunc, userData, destroy);
181 	}
182 	
183 	/**
184 	 * Sets the default comparison function used when sorting to be sort_func.
185 	 * If the current sort column id of sortable is
186 	 * GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using
187 	 * this function.
188 	 * If sort_func is NULL, then there will be no default comparison function.
189 	 * This means that once the model has been sorted, it can't go back to the
190 	 * default state. In this case, when the current sort column id of sortable
191 	 * is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.
192 	 * Params:
193 	 * sortFunc = The comparison function
194 	 * userData = User data to pass to sort_func, or NULL. [allow-none]
195 	 * destroy = Destroy notifier of user_data, or NULL. [allow-none]
196 	 */
197 	public void setDefaultSortFunc(GtkTreeIterCompareFunc sortFunc, void* userData, GDestroyNotify destroy)
198 	{
199 		// void gtk_tree_sortable_set_default_sort_func  (GtkTreeSortable *sortable,  GtkTreeIterCompareFunc sort_func,  gpointer user_data,  GDestroyNotify destroy);
200 		gtk_tree_sortable_set_default_sort_func(getTreeSortableTStruct(), sortFunc, userData, destroy);
201 	}
202 	
203 	/**
204 	 * Returns TRUE if the model has a default sort function. This is used
205 	 * primarily by GtkTreeViewColumns in order to determine if a model can
206 	 * go back to the default state, or not.
207 	 * Returns: TRUE, if the model has a default sort function Signal Details The "sort-column-changed" signal void user_function (GtkTreeSortable *sortable, gpointer user_data) : Run Last The ::sort-column-changed signal is emitted when the sort column or sort order of sortable is changed. The signal is emitted before the contents of sortable are resorted.
208 	 */
209 	public int hasDefaultSortFunc()
210 	{
211 		// gboolean gtk_tree_sortable_has_default_sort_func  (GtkTreeSortable *sortable);
212 		return gtk_tree_sortable_has_default_sort_func(getTreeSortableTStruct());
213 	}
214 }