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 = GtkSourceCompletionInfo.html 27 * outPack = gsv 28 * outFile = SourceCompletionInfo 29 * strct = GtkSourceCompletionInfo 30 * realStrct= 31 * ctorStrct= 32 * clss = SourceCompletionInfo 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_source_completion_info_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gtk.TextIter 47 * - gtk.TextView 48 * - gtk.Widget 49 * structWrap: 50 * - GtkTextIter* -> TextIter 51 * - GtkTextView* -> TextView 52 * - GtkWidget* -> Widget 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gsv.SourceCompletionInfo; 59 60 public import gsvc.gsvtypes; 61 62 private import gsvc.gsv; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 private import gobject.Signals; 67 public import gtkc.gdktypes; 68 69 private import gtk.TextIter; 70 private import gtk.TextView; 71 private import gtk.Widget; 72 73 74 75 private import gtk.Window; 76 77 /** 78 * Description 79 * This object can be used to show a calltip or help for the 80 * .* current completion proposal. 81 */ 82 public class SourceCompletionInfo : Window 83 { 84 85 /** the main Gtk struct */ 86 protected GtkSourceCompletionInfo* gtkSourceCompletionInfo; 87 88 89 public GtkSourceCompletionInfo* getSourceCompletionInfoStruct() 90 { 91 return gtkSourceCompletionInfo; 92 } 93 94 95 /** the main Gtk struct as a void* */ 96 protected override void* getStruct() 97 { 98 return cast(void*)gtkSourceCompletionInfo; 99 } 100 101 /** 102 * Sets our main struct and passes it to the parent class 103 */ 104 public this (GtkSourceCompletionInfo* gtkSourceCompletionInfo) 105 { 106 super(cast(GtkWindow*)gtkSourceCompletionInfo); 107 this.gtkSourceCompletionInfo = gtkSourceCompletionInfo; 108 } 109 110 protected override void setStruct(GObject* obj) 111 { 112 super.setStruct(obj); 113 gtkSourceCompletionInfo = cast(GtkSourceCompletionInfo*)obj; 114 } 115 116 /** 117 */ 118 int[string] connectedSignals; 119 120 void delegate(SourceCompletionInfo)[] onBeforeShowListeners; 121 /** 122 */ 123 void addOnBeforeShow(void delegate(SourceCompletionInfo) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 124 { 125 if ( !("before-show" in connectedSignals) ) 126 { 127 Signals.connectData( 128 getStruct(), 129 "before-show", 130 cast(GCallback)&callBackBeforeShow, 131 cast(void*)this, 132 null, 133 connectFlags); 134 connectedSignals["before-show"] = 1; 135 } 136 onBeforeShowListeners ~= dlg; 137 } 138 extern(C) static void callBackBeforeShow(GtkSourceCompletionInfo* sourcecompletioninfoStruct, SourceCompletionInfo _sourceCompletionInfo) 139 { 140 foreach ( void delegate(SourceCompletionInfo) dlg ; _sourceCompletionInfo.onBeforeShowListeners ) 141 { 142 dlg(_sourceCompletionInfo); 143 } 144 } 145 146 147 /** 148 * Throws: ConstructionException GTK+ fails to create the object. 149 */ 150 public this () 151 { 152 // GtkSourceCompletionInfo * gtk_source_completion_info_new (void); 153 auto p = gtk_source_completion_info_new(); 154 if(p is null) 155 { 156 throw new ConstructionException("null returned by gtk_source_completion_info_new()"); 157 } 158 this(cast(GtkSourceCompletionInfo*) p); 159 } 160 161 /** 162 * Moves the GtkSourceCompletionInfo to iter. If iter is NULL info is 163 * moved to the cursor position. Moving will respect the GdkGravity setting 164 * of the info window and will ensure the line at iter is not occluded by 165 * the window. 166 * Params: 167 * view = A GtkTextView on which the info window should be positioned 168 * iter = A GtkTextIter 169 */ 170 public void moveToIter(TextView view, TextIter iter) 171 { 172 // void gtk_source_completion_info_move_to_iter (GtkSourceCompletionInfo *info, GtkTextView *view, GtkTextIter *iter); 173 gtk_source_completion_info_move_to_iter(gtkSourceCompletionInfo, (view is null) ? null : view.getTextViewStruct(), (iter is null) ? null : iter.getTextIterStruct()); 174 } 175 176 /** 177 * Set sizing information for the info window. If shrink_width or 178 * shrink_height is TRUE, the info window will try to resize to fit the 179 * window contents, with a maximum size given by width and height. Setting 180 * width or height to -1 removes the maximum size of respectively the width 181 * and height of the window. 182 * Params: 183 * width = The maximum/requested width of the window (-1 to default) 184 * height = The maximum/requested height of the window (-1 to default) 185 * shrinkWidth = Whether to shrink the width of the window to fit its contents 186 * shrinkHeight = Whether to shrink the height of the window to fit its 187 * contents 188 */ 189 public void setSizing(int width, int height, int shrinkWidth, int shrinkHeight) 190 { 191 // void gtk_source_completion_info_set_sizing (GtkSourceCompletionInfo *info, gint width, gint height, gboolean shrink_width, gboolean shrink_height); 192 gtk_source_completion_info_set_sizing(gtkSourceCompletionInfo, width, height, shrinkWidth, shrinkHeight); 193 } 194 195 /** 196 * Sets the content widget of the info window. If widget does not fit within 197 * the size requirements of the window, a GtkScrolledWindow will automatically 198 * be created and added to the window. 199 * Params: 200 * widget = A GtkWidget 201 */ 202 public void setWidget(Widget widget) 203 { 204 // void gtk_source_completion_info_set_widget (GtkSourceCompletionInfo *info, GtkWidget *widget); 205 gtk_source_completion_info_set_widget(gtkSourceCompletionInfo, (widget is null) ? null : widget.getWidgetStruct()); 206 } 207 208 /** 209 * Get the current content widget. 210 * Returns: The current content widget. 211 */ 212 public Widget getWidget() 213 { 214 // GtkWidget * gtk_source_completion_info_get_widget (GtkSourceCompletionInfo *info); 215 auto p = gtk_source_completion_info_get_widget(gtkSourceCompletionInfo); 216 217 if(p is null) 218 { 219 return null; 220 } 221 222 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 223 } 224 225 /** 226 */ 227 public void processResize() 228 { 229 // void gtk_source_completion_info_process_resize (GtkSourceCompletionInfo *info); 230 gtk_source_completion_info_process_resize(gtkSourceCompletionInfo); 231 } 232 }