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