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 private import gtk.TextIter;
69 private import gtk.TextView;
70 private import gtk.Widget;
71 
72 
73 private import gtk.Window;
74 
75 /**
76  * This object can be used to show a calltip or help for the
77  * current completion proposal.
78  *
79  * The info window has always the same size as the natural size of its child
80  * widget, added with gtk_container_add(). If you want a fixed size instead, a
81  * possibility is to use a scrolled window, as the following example
82  * demonstrates.
83  *
84  * $(DDOC_COMMENT example)
85  *
86  * If the calltip is displayed on top of a certain widget, say a GtkTextView,
87  * you should attach the calltip window to the GtkTextView with
88  * gtk_window_set_attached_to(). By doing this, the calltip will be hidden when
89  * the "focus-out-event" signal is emitted by the GtkTextView. You
90  * may also be interested by the "cursor-position" property (when
91  * its value is modified). If you use the GtkSourceCompletionInfo through the
92  * GtkSourceCompletion machinery, you don't need to worry about this.
93  */
94 public class SourceCompletionInfo : Window
95 {
96 	
97 	/** the main Gtk struct */
98 	protected GtkSourceCompletionInfo* gtkSourceCompletionInfo;
99 	
100 	
101 	/** Get the main Gtk struct */
102 	public GtkSourceCompletionInfo* getSourceCompletionInfoStruct()
103 	{
104 		return gtkSourceCompletionInfo;
105 	}
106 	
107 	
108 	/** the main Gtk struct as a void* */
109 	protected override void* getStruct()
110 	{
111 		return cast(void*)gtkSourceCompletionInfo;
112 	}
113 	
114 	/**
115 	 * Sets our main struct and passes it to the parent class
116 	 */
117 	public this (GtkSourceCompletionInfo* gtkSourceCompletionInfo)
118 	{
119 		super(cast(GtkWindow*)gtkSourceCompletionInfo);
120 		this.gtkSourceCompletionInfo = gtkSourceCompletionInfo;
121 	}
122 	
123 	protected override void setStruct(GObject* obj)
124 	{
125 		super.setStruct(obj);
126 		gtkSourceCompletionInfo = cast(GtkSourceCompletionInfo*)obj;
127 	}
128 	
129 	/**
130 	 */
131 	int[string] connectedSignals;
132 	
133 	void delegate(SourceCompletionInfo)[] onBeforeShowListeners;
134 	/**
135 	 * Warning
136 	 * GtkSourceCompletionInfo::before-show has been deprecated since version 3.10 and should not be used in newly-written code. This signal should not be used.
137 	 * This signal is emitted before any "show" management. You can connect
138 	 * to this signal if you want to change some properties or position
139 	 * before the real "show".
140 	 */
141 	void addOnBeforeShow(void delegate(SourceCompletionInfo) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
142 	{
143 		if ( !("before-show" in connectedSignals) )
144 		{
145 			Signals.connectData(
146 			getStruct(),
147 			"before-show",
148 			cast(GCallback)&callBackBeforeShow,
149 			cast(void*)this,
150 			null,
151 			connectFlags);
152 			connectedSignals["before-show"] = 1;
153 		}
154 		onBeforeShowListeners ~= dlg;
155 	}
156 	extern(C) static void callBackBeforeShow(GtkSourceCompletionInfo* infoStruct, SourceCompletionInfo _sourceCompletionInfo)
157 	{
158 		foreach ( void delegate(SourceCompletionInfo) dlg ; _sourceCompletionInfo.onBeforeShowListeners )
159 		{
160 			dlg(_sourceCompletionInfo);
161 		}
162 	}
163 	
164 	
165 	/**
166 	 * Throws: ConstructionException GTK+ fails to create the object.
167 	 */
168 	public this ()
169 	{
170 		// GtkSourceCompletionInfo * gtk_source_completion_info_new  (void);
171 		auto p = gtk_source_completion_info_new();
172 		if(p is null)
173 		{
174 			throw new ConstructionException("null returned by gtk_source_completion_info_new()");
175 		}
176 		this(cast(GtkSourceCompletionInfo*) p);
177 	}
178 	
179 	/**
180 	 * Moves the GtkSourceCompletionInfo to iter. If iter is NULL info is
181 	 * moved to the cursor position. Moving will respect the GdkGravity setting
182 	 * of the info window and will ensure the line at iter is not occluded by
183 	 * the window.
184 	 * Params:
185 	 * view = a GtkTextView on which the info window should be positioned.
186 	 * iter = a GtkTextIter. [allow-none]
187 	 */
188 	public void moveToIter(TextView view, TextIter iter)
189 	{
190 		// void gtk_source_completion_info_move_to_iter  (GtkSourceCompletionInfo *info,  GtkTextView *view,  GtkTextIter *iter);
191 		gtk_source_completion_info_move_to_iter(gtkSourceCompletionInfo, (view is null) ? null : view.getTextViewStruct(), (iter is null) ? null : iter.getTextIterStruct());
192 	}
193 	
194 	/**
195 	 * Warning
196 	 * gtk_source_completion_info_set_widget has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_container_add() instead. If there is already a child
197 	 * widget, remove it with gtk_container_remove().
198 	 * Sets the content widget of the info window. See that the previous widget will
199 	 * lose a reference and it can be destroyed, so if you do not want this to
200 	 * happen you must use g_object_ref() before calling this method.
201 	 * Params:
202 	 * widget = a GtkWidget. [allow-none]
203 	 */
204 	public void setWidget(Widget widget)
205 	{
206 		// void gtk_source_completion_info_set_widget  (GtkSourceCompletionInfo *info,  GtkWidget *widget);
207 		gtk_source_completion_info_set_widget(gtkSourceCompletionInfo, (widget is null) ? null : widget.getWidgetStruct());
208 	}
209 	
210 	/**
211 	 * Warning
212 	 * gtk_source_completion_info_get_widget has been deprecated since version 3.8 and should not be used in newly-written code. Use gtk_bin_get_child() instead.
213 	 * Get the current content widget.
214 	 * Returns: The current content widget. [transfer none] Signal Details The "before-show" signal void user_function (GtkSourceCompletionInfo *info, gpointer user_data) : Action Warning GtkSourceCompletionInfo::before-show has been deprecated since version 3.10 and should not be used in newly-written code. This signal should not be used. This signal is emitted before any "show" management. You can connect to this signal if you want to change some properties or position before the real "show".
215 	 */
216 	public Widget getWidget()
217 	{
218 		// GtkWidget * gtk_source_completion_info_get_widget  (GtkSourceCompletionInfo *info);
219 		auto p = gtk_source_completion_info_get_widget(gtkSourceCompletionInfo);
220 		
221 		if(p is null)
222 		{
223 			return null;
224 		}
225 		
226 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
227 	}
228 }