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.CellRendererCombo; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import gobject.ObjectG; 30 private import gobject.Signals; 31 private import gtk.CellRenderer; 32 private import gtk.CellRendererText; 33 private import gtk.TreeIter; 34 private import gtk.c.functions; 35 public import gtk.c.types; 36 private import std.algorithm; 37 38 39 /** 40 * Renders a combobox in a cell 41 * 42 * #GtkCellRendererCombo renders text in a cell like #GtkCellRendererText from 43 * which it is derived. But while #GtkCellRendererText offers a simple entry to 44 * edit the text, #GtkCellRendererCombo offers a #GtkComboBox 45 * widget to edit the text. The values to display in the combo box are taken from 46 * the tree model specified in the #GtkCellRendererCombo:model property. 47 * 48 * The combo cell renderer takes care of adding a text cell renderer to the combo 49 * box and sets it to display the column specified by its 50 * #GtkCellRendererCombo:text-column property. Further properties of the combo box 51 * can be set in a handler for the #GtkCellRenderer::editing-started signal. 52 */ 53 public class CellRendererCombo : CellRendererText 54 { 55 /** the main Gtk struct */ 56 protected GtkCellRendererCombo* gtkCellRendererCombo; 57 58 /** Get the main Gtk struct */ 59 public GtkCellRendererCombo* getCellRendererComboStruct(bool transferOwnership = false) 60 { 61 if (transferOwnership) 62 ownedRef = false; 63 return gtkCellRendererCombo; 64 } 65 66 /** the main Gtk struct as a void* */ 67 protected override void* getStruct() 68 { 69 return cast(void*)gtkCellRendererCombo; 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GtkCellRendererCombo* gtkCellRendererCombo, bool ownedRef = false) 76 { 77 this.gtkCellRendererCombo = gtkCellRendererCombo; 78 super(cast(GtkCellRendererText*)gtkCellRendererCombo, ownedRef); 79 } 80 81 82 /** */ 83 public static GType getType() 84 { 85 return gtk_cell_renderer_combo_get_type(); 86 } 87 88 /** 89 * Creates a new #GtkCellRendererCombo. 90 * Adjust how text is drawn using object properties. 91 * Object properties can be set globally (with g_object_set()). 92 * Also, with #GtkTreeViewColumn, you can bind a property to a value 93 * in a #GtkTreeModel. For example, you can bind the “text” property 94 * on the cell renderer to a string value in the model, thus rendering 95 * a different string in each row of the #GtkTreeView. 96 * 97 * Returns: the new cell renderer 98 * 99 * Throws: ConstructionException GTK+ fails to create the object. 100 */ 101 public this() 102 { 103 auto __p = gtk_cell_renderer_combo_new(); 104 105 if(__p is null) 106 { 107 throw new ConstructionException("null returned by new"); 108 } 109 110 this(cast(GtkCellRendererCombo*) __p); 111 } 112 113 /** 114 * This signal is emitted each time after the user selected an item in 115 * the combo box, either by using the mouse or the arrow keys. Contrary 116 * to GtkComboBox, GtkCellRendererCombo::changed is not emitted for 117 * changes made to a selected item in the entry. The argument @new_iter 118 * corresponds to the newly selected item in the combo box and it is relative 119 * to the GtkTreeModel set via the model property on GtkCellRendererCombo. 120 * 121 * Note that as soon as you change the model displayed in the tree view, 122 * the tree view will immediately cease the editing operating. This 123 * means that you most probably want to refrain from changing the model 124 * until the combo cell renderer emits the edited or editing_canceled signal. 125 * 126 * Params: 127 * pathString = a string of the path identifying the edited cell 128 * (relative to the tree view model) 129 * newIter = the new iter selected in the combo box 130 * (relative to the combo box model) 131 */ 132 gulong addOnChanged(void delegate(string, TreeIter, CellRendererCombo) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 133 { 134 return Signals.connect(this, "changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 135 } 136 }