2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkIMContext.html
28 * strct = GtkIMContext
49 * - GdkRectangle* -> Rectangle
50 * - GdkWindow* -> Window
56 private import gtk
.gtktypes
;
58 private import lib
.gtk
;
60 private import glib
.Str
;
61 private import gdk
.Window
;
62 private import gdk
.Rectangle
;
67 private import gobject
.ObjectG
;
68 public class IMContext
: ObjectG
71 /** the main Gtk struct */
72 protected GtkIMContext
* gtkIMContext
;
75 public GtkIMContext
* getIMContextStruct()
81 /** the main Gtk struct as a void* */
82 protected void* getStruct()
84 return cast(void*)gtkIMContext
;
88 * Sets our main struct and passes it to the parent class
90 public this (GtkIMContext
* gtkIMContext
)
92 super(cast(GObject
*)gtkIMContext
);
93 this.gtkIMContext
= gtkIMContext
;
99 // imports for the signal processing
100 private import gobject
.Signals
;
101 private import gdk
.gdktypes
;
102 int[char[]] connectedSignals
;
104 void delegate(char[], IMContext
)[] onCommitListeners
;
105 void addOnCommit(void delegate(char[], IMContext
) dlg
)
107 if ( !("commit" in connectedSignals
) )
112 cast(GCallback
)&callBackCommit
,
115 cast(ConnectFlags
)0);
116 connectedSignals
["commit"] = 1;
118 onCommitListeners
~= dlg
;
120 extern(C
) static void callBackCommit(GtkIMContext
* imcontextStruct
, gchar
* arg1
, IMContext iMContext
)
122 bit consumed
= false;
124 foreach ( void delegate(char[], IMContext
) dlg
; iMContext
.onCommitListeners
)
126 dlg(Str
.toString(arg1
), iMContext
);
132 gboolean
delegate(gint
, gint
, IMContext
)[] onDeleteSurroundingListeners
;
133 void addOnDeleteSurrounding(gboolean
delegate(gint
, gint
, IMContext
) dlg
)
135 if ( !("delete-surrounding" in connectedSignals
) )
139 "delete-surrounding",
140 cast(GCallback
)&callBackDeleteSurrounding
,
143 cast(ConnectFlags
)0);
144 connectedSignals
["delete-surrounding"] = 1;
146 onDeleteSurroundingListeners
~= dlg
;
148 extern(C
) static void callBackDeleteSurrounding(GtkIMContext
* imcontextStruct
, gint arg1
, gint arg2
, IMContext iMContext
)
150 bit consumed
= false;
152 foreach ( gboolean
delegate(gint
, gint
, IMContext
) dlg
; iMContext
.onDeleteSurroundingListeners
)
154 dlg(arg1
, arg2
, iMContext
);
160 void delegate(IMContext
)[] onPreeditChangedListeners
;
161 void addOnPreeditChanged(void delegate(IMContext
) dlg
)
163 if ( !("preedit-changed" in connectedSignals
) )
168 cast(GCallback
)&callBackPreeditChanged
,
171 cast(ConnectFlags
)0);
172 connectedSignals
["preedit-changed"] = 1;
174 onPreeditChangedListeners
~= dlg
;
176 extern(C
) static void callBackPreeditChanged(GtkIMContext
* imcontextStruct
, IMContext iMContext
)
178 bit consumed
= false;
180 foreach ( void delegate(IMContext
) dlg
; iMContext
.onPreeditChangedListeners
)
188 void delegate(IMContext
)[] onPreeditEndListeners
;
189 void addOnPreeditEnd(void delegate(IMContext
) dlg
)
191 if ( !("preedit-end" in connectedSignals
) )
196 cast(GCallback
)&callBackPreeditEnd
,
199 cast(ConnectFlags
)0);
200 connectedSignals
["preedit-end"] = 1;
202 onPreeditEndListeners
~= dlg
;
204 extern(C
) static void callBackPreeditEnd(GtkIMContext
* imcontextStruct
, IMContext iMContext
)
206 bit consumed
= false;
208 foreach ( void delegate(IMContext
) dlg
; iMContext
.onPreeditEndListeners
)
216 void delegate(IMContext
)[] onPreeditStartListeners
;
217 void addOnPreeditStart(void delegate(IMContext
) dlg
)
219 if ( !("preedit-start" in connectedSignals
) )
224 cast(GCallback
)&callBackPreeditStart
,
227 cast(ConnectFlags
)0);
228 connectedSignals
["preedit-start"] = 1;
230 onPreeditStartListeners
~= dlg
;
232 extern(C
) static void callBackPreeditStart(GtkIMContext
* imcontextStruct
, IMContext iMContext
)
234 bit consumed
= false;
236 foreach ( void delegate(IMContext
) dlg
; iMContext
.onPreeditStartListeners
)
244 gboolean
delegate(IMContext
)[] onRetrieveSurroundingListeners
;
245 void addOnRetrieveSurrounding(gboolean
delegate(IMContext
) dlg
)
247 if ( !("retrieve-surrounding" in connectedSignals
) )
251 "retrieve-surrounding",
252 cast(GCallback
)&callBackRetrieveSurrounding
,
255 cast(ConnectFlags
)0);
256 connectedSignals
["retrieve-surrounding"] = 1;
258 onRetrieveSurroundingListeners
~= dlg
;
260 extern(C
) static void callBackRetrieveSurrounding(GtkIMContext
* imcontextStruct
, IMContext iMContext
)
262 bit consumed
= false;
264 foreach ( gboolean
delegate(IMContext
) dlg
; iMContext
.onRetrieveSurroundingListeners
)
275 * Set the client window for the input context; this is the
276 * GdkWindow in which the input appears. This window is
277 * used in order to correctly position status windows, and may
278 * also be used for purposes internal to the input method.
282 * the client window. This may be NULL to indicate
283 * that the previous client window no longer exists.
285 public void setClientWindow(Window window
)
287 // void gtk_im_context_set_client_window (GtkIMContext *context, GdkWindow *window);
288 gtk_im_context_set_client_window(gtkIMContext
, (window
is null) ?
null : window
.getWindowStruct());
292 * Retrieve the current preedit string for the input context,
293 * and a list of attributes to apply to the string.
294 * This string should be displayed inserted at the insertion
299 * location to store the retrieved string. The
300 * string retrieved must be freed with g_free().
302 * location to store the retrieved attribute list.
303 * When you are done with this list, you must
304 * unreference it with pango_attr_list_unref().
306 * location to store position of cursor (in characters)
307 * within the preedit string.
309 public void getPreeditString(char** str, PangoAttrList
** attrs
, int* cursorPos
)
311 // void gtk_im_context_get_preedit_string (GtkIMContext *context, gchar **str, PangoAttrList **attrs, gint *cursor_pos);
312 gtk_im_context_get_preedit_string(gtkIMContext
, str, attrs
, cursorPos
);
316 * Allow an input method to internally handle key press and release
317 * events. If this function returns TRUE, then no further processing
318 * should be done for this key event.
324 * TRUE if the input method handled the key event.
326 public int filterKeypress(GdkEventKey
* event
)
328 // gboolean gtk_im_context_filter_keypress (GtkIMContext *context, GdkEventKey *event);
329 return gtk_im_context_filter_keypress(gtkIMContext
, event
);
333 * Notify the input method that the widget to which this
334 * input context corresponds has gained focus. The input method
335 * may, for example, change the displayed feedback to reflect
340 public void focusIn()
342 // void gtk_im_context_focus_in (GtkIMContext *context);
343 gtk_im_context_focus_in(gtkIMContext
);
347 * Notify the input method that the widget to which this
348 * input context corresponds has lost focus. The input method
349 * may, for example, change the displayed feedback or reset the contexts
350 * state to reflect this change.
354 public void focusOut()
356 // void gtk_im_context_focus_out (GtkIMContext *context);
357 gtk_im_context_focus_out(gtkIMContext
);
361 * Notify the input method that a change such as a change in cursor
362 * position has been made. This will typically cause the input
363 * method to clear the preedit state.
369 // void gtk_im_context_reset (GtkIMContext *context);
370 gtk_im_context_reset(gtkIMContext
);
374 * Notify the input method that a change in cursor
375 * position has been made. The location is relative to the client
382 public void setCursorLocation(Rectangle area
)
384 // void gtk_im_context_set_cursor_location (GtkIMContext *context, GdkRectangle *area);
385 gtk_im_context_set_cursor_location(gtkIMContext
, (area
is null) ?
null : area
.getRectangleStruct());
389 * Sets whether the IM context should use the preedit string
390 * to display feedback. If use_preedit is FALSE (default
391 * is TRUE), then the IM context may use some other method to display
392 * feedback, such as displaying it in a child of the root window.
396 * whether the IM context should use the preedit string.
398 public void setUsePreedit(int usePreedit
)
400 // void gtk_im_context_set_use_preedit (GtkIMContext *context, gboolean use_preedit);
401 gtk_im_context_set_use_preedit(gtkIMContext
, usePreedit
);
405 * Sets surrounding context around the insertion point and preedit
406 * string. This function is expected to be called in response to the
407 * GtkIMContext::retrieve_surrounding signal, and will likely have no
408 * effect if called at other times.
412 * text surrounding the insertion point, as UTF-8.
413 * the preedit string should not be included within
416 * the length of text, or -1 if text is nul-terminated
418 * the byte index of the insertion cursor within text.
420 public void setSurrounding(char[] text
, int len
, int cursorIndex
)
422 // void gtk_im_context_set_surrounding (GtkIMContext *context, const gchar *text, gint len, gint cursor_index);
423 gtk_im_context_set_surrounding(gtkIMContext
, Str
.toStringz(text
), len
, cursorIndex
);
427 * Retrieves context around the insertion point. Input methods
428 * typically want context in order to constrain input text based on
429 * existing text; this is important for languages such as Thai where
430 * only some sequences of characters are allowed.
431 * This function is implemented by emitting the
432 * GtkIMContext::retrieve_surrounding signal on the input method; in
433 * response to this signal, a widget should provide as much context as
434 * is available, up to an entire paragraph, by calling
435 * gtk_im_context_set_surrounding(). Note that there is no obligation
436 * for a widget to respond to the ::retrieve_surrounding signal, so input
437 * methods must be prepared to function without context.
441 * location to store a UTF-8 encoded string of text
442 * holding context around the insertion point.
443 * If the function returns TRUE, then you must free
444 * the result stored in this location with g_free().
446 * location to store byte index of the insertion cursor
449 * TRUE if surrounding text was provided; in this case
450 * you must free the result stored in *text.
452 public int getSurrounding(char** text
, int* cursorIndex
)
454 // gboolean gtk_im_context_get_surrounding (GtkIMContext *context, gchar **text, gint *cursor_index);
455 return gtk_im_context_get_surrounding(gtkIMContext
, text
, cursorIndex
);
459 * Asks the widget that the input context is attached to to delete
460 * characters around the cursor position by emitting the
461 * GtkIMContext::delete_surrounding signal. Note that offset and n_chars
462 * are in characters not in bytes which differs from the usage other
463 * places in GtkIMContext.
464 * In order to use this function, you should first call
465 * gtk_im_context_get_surrounding() to get the current context, and
466 * call this function immediately afterwards to make sure that you
467 * know what you are deleting. You should also account for the fact
468 * that even if the signal was handled, the input context might not
469 * have deleted all the characters that were requested to be deleted.
470 * This function is used by an input method that wants to make
471 * subsitutions in the existing text in response to new input. It is
472 * not useful for applications.
476 * offset from cursor position in chars;
477 * a negative value means start before the cursor.
479 * number of characters to delete.
481 * TRUE if the signal was handled.
483 * The "commit" signal
484 * void user_function (GtkIMContext *imcontext,
486 * gpointer user_data) : Run last
488 * the object which received the signal.
491 * user data set when the signal handler was connected.
493 public int deleteSurrounding(int offset
, int nChars
)
495 // gboolean gtk_im_context_delete_surrounding (GtkIMContext *context, gint offset, gint n_chars);
496 return gtk_im_context_delete_surrounding(gtkIMContext
, offset
, nChars
);