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 gsv.SourceCompletionInfo; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gobject.Signals; 30 private import gsvc.gsv; 31 public import gsvc.gsvtypes; 32 private import gtk.BuildableIF; 33 private import gtk.BuildableT; 34 private import gtk.TextIter; 35 private import gtk.TextView; 36 private import gtk.Widget; 37 private import gtk.Window; 38 private import std.algorithm; 39 40 41 /** */ 42 public class SourceCompletionInfo : Window 43 { 44 /** the main Gtk struct */ 45 protected GtkSourceCompletionInfo* gtkSourceCompletionInfo; 46 47 /** Get the main Gtk struct */ 48 public GtkSourceCompletionInfo* getSourceCompletionInfoStruct() 49 { 50 return gtkSourceCompletionInfo; 51 } 52 53 /** the main Gtk struct as a void* */ 54 protected override void* getStruct() 55 { 56 return cast(void*)gtkSourceCompletionInfo; 57 } 58 59 protected override void setStruct(GObject* obj) 60 { 61 gtkSourceCompletionInfo = cast(GtkSourceCompletionInfo*)obj; 62 super.setStruct(obj); 63 } 64 65 /** 66 * Sets our main struct and passes it to the parent class. 67 */ 68 public this (GtkSourceCompletionInfo* gtkSourceCompletionInfo, bool ownedRef = false) 69 { 70 this.gtkSourceCompletionInfo = gtkSourceCompletionInfo; 71 super(cast(GtkWindow*)gtkSourceCompletionInfo, ownedRef); 72 } 73 74 75 /** */ 76 public static GType getType() 77 { 78 return gtk_source_completion_info_get_type(); 79 } 80 81 /** 82 * Returns: a new GtkSourceCompletionInfo. 83 * 84 * Throws: ConstructionException GTK+ fails to create the object. 85 */ 86 public this() 87 { 88 auto p = gtk_source_completion_info_new(); 89 90 if(p is null) 91 { 92 throw new ConstructionException("null returned by new"); 93 } 94 95 this(cast(GtkSourceCompletionInfo*) p); 96 } 97 98 /** 99 * Get the current content widget. 100 * 101 * Deprecated: Use gtk_bin_get_child() instead. 102 * 103 * Returns: The current content widget. 104 */ 105 public Widget getWidget() 106 { 107 auto p = gtk_source_completion_info_get_widget(gtkSourceCompletionInfo); 108 109 if(p is null) 110 { 111 return null; 112 } 113 114 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 115 } 116 117 /** 118 * Moves the #GtkSourceCompletionInfo to @iter. If @iter is %NULL @info is 119 * moved to the cursor position. Moving will respect the #GdkGravity setting 120 * of the info window and will ensure the line at @iter is not occluded by 121 * the window. 122 * 123 * Params: 124 * view = a #GtkTextView on which the info window should be positioned. 125 * iter = a #GtkTextIter. 126 */ 127 public void moveToIter(TextView view, TextIter iter) 128 { 129 gtk_source_completion_info_move_to_iter(gtkSourceCompletionInfo, (view is null) ? null : view.getTextViewStruct(), (iter is null) ? null : iter.getTextIterStruct()); 130 } 131 132 /** 133 * Sets the content widget of the info window. See that the previous widget will 134 * lose a reference and it can be destroyed, so if you do not want this to 135 * happen you must use g_object_ref() before calling this method. 136 * 137 * Deprecated: Use gtk_container_add() instead. If there is already a child 138 * widget, remove it with gtk_container_remove(). 139 * 140 * Params: 141 * widget = a #GtkWidget. 142 */ 143 public void setWidget(Widget widget) 144 { 145 gtk_source_completion_info_set_widget(gtkSourceCompletionInfo, (widget is null) ? null : widget.getWidgetStruct()); 146 } 147 148 protected class OnBeforeShowDelegateWrapper 149 { 150 static OnBeforeShowDelegateWrapper[] listeners; 151 void delegate(SourceCompletionInfo) dlg; 152 gulong handlerId; 153 154 this(void delegate(SourceCompletionInfo) dlg) 155 { 156 this.dlg = dlg; 157 this.listeners ~= this; 158 } 159 160 void remove(OnBeforeShowDelegateWrapper source) 161 { 162 foreach(index, wrapper; listeners) 163 { 164 if (wrapper.handlerId == source.handlerId) 165 { 166 listeners[index] = null; 167 listeners = std.algorithm.remove(listeners, index); 168 break; 169 } 170 } 171 } 172 } 173 174 /** 175 * This signal is emitted before any "show" management. You can connect 176 * to this signal if you want to change some properties or position 177 * before the real "show". 178 * 179 * Deprecated: This signal should not be used. 180 */ 181 gulong addOnBeforeShow(void delegate(SourceCompletionInfo) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 182 { 183 auto wrapper = new OnBeforeShowDelegateWrapper(dlg); 184 wrapper.handlerId = Signals.connectData( 185 this, 186 "before-show", 187 cast(GCallback)&callBackBeforeShow, 188 cast(void*)wrapper, 189 cast(GClosureNotify)&callBackBeforeShowDestroy, 190 connectFlags); 191 return wrapper.handlerId; 192 } 193 194 extern(C) static void callBackBeforeShow(GtkSourceCompletionInfo* sourcecompletioninfoStruct, OnBeforeShowDelegateWrapper wrapper) 195 { 196 wrapper.dlg(wrapper.outer); 197 } 198 199 extern(C) static void callBackBeforeShowDestroy(OnBeforeShowDelegateWrapper wrapper, GClosure* closure) 200 { 201 wrapper.remove(wrapper); 202 } 203 }