⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtkeditable.sgml

📁 This GTK+ version 2.12.3. GTK+ is a multi-platform toolkit for creating graphical user interfaces.
💻 SGML
字号:
<!-- ##### SECTION Title ##### -->GtkEditable<!-- ##### SECTION Short_Description ##### -->Interface for text-editing widgets<!-- ##### SECTION Long_Description ##### --><para>The #GtkEditable interface is an interface which should be implemented bytext editing widgets, such as #GtkEntry and #GtkText. It contains functions for generically manipulating an editable widget, a large number of action signals used for key bindings, and several signals that an application can connect to to modify the behavior of a widget. </para><para>As an example of the latter usage, by connectingthe following handler to "insert_text", an applicationcan convert all entry into a widget into uppercase.<example><title>Forcing entry to uppercase.</title><programlisting>#include &lt;ctype.h&gt;voidinsert_text_handler (GtkEditable *editable,                     const gchar *text,                     gint         length,                     gint        *position,                     gpointer     data){  int i;  gchar *result = g_utf8_strup (text, length);  g_signal_handlers_block_by_func (editable,				   (gpointer) insert_text_handler, data);  gtk_editable_insert_text (editable, result, length, position);  g_signal_handlers_unblock_by_func (editable,                                     (gpointer) insert_text_handler, data);  g_signal_stop_emission_by_name (editable, "insert_text");   g_free (result);}</programlisting></example></para><!-- ##### SECTION See_Also ##### --><para></para><!-- ##### SECTION Stability_Level ##### --><!-- ##### STRUCT GtkEditable ##### --><para>The #GtkEditable structure contains the following fields.(These fields should be considered read-only. They shouldnever be set by an application.)<informaltable pgwide="1" frame="none" role="struct"><tgroup cols="2"><colspec colwidth="2*"/><colspec colwidth="8*"/><tbody><row><entry>#guint selection_start;</entry><entry>the starting position of the selected characters  in the widget.</entry></row><row><entry>#guint selection_end;</entry><entry>the end position of the selected characters  in the widget.</entry></row><row><entry>#guint editable;</entry><entry>a flag indicating whether or not the widget iseditable by the user.</entry></row></tbody></tgroup></informaltable></para><!-- ##### SIGNAL GtkEditable::changed ##### --><para>Indicates that the user has changed the contentsof the widget.</para>@editable: the object which received the signal.<!-- ##### SIGNAL GtkEditable::delete-text ##### --><para>This signal is emitted when text is deleted fromthe widget by the user. The default handler forthis signal will normally be responsible for insertingthe text, so by connecting to this signal and thenstopping the signal with gtk_signal_emit_stop(), itis possible to modify the inserted text, or preventit from being inserted entirely. The @start_posand @end_pos parameters are interpreted as forgtk_editable_delete_text()</para>@editable: the object which received the signal.@start_pos: the starting position.@end_pos: the end position.<!-- ##### SIGNAL GtkEditable::insert-text ##### --><para>This signal is emitted when text is inserted intothe widget by the user. The default handler forthis signal will normally be responsible for insertingthe text, so by connecting to this signal and thenstopping the signal with gtk_signal_emit_stop(), itis possible to modify the inserted text, or preventit from being inserted entirely.</para>@editable: the object which received the signal.@new_text: the new text to insert.@new_text_length: the length of the new text, in bytes,   or -1 if new_text is nul-terminated@position: the position, in characters, at which to insert            the new text. this is an in-out parameter.            After the signal emission is finished, it should            point after the newly inserted text.<!-- ##### FUNCTION gtk_editable_select_region ##### --><para>Selects a region of text. The characters thatare selected are those characters at positions from@start_pos up to, but not including @end_pos. If @end_pos is negative, then the the characters selectedwill be those characters from @start_pos to the endof the text.</para>@editable: a #GtkEditable widget.@start: the starting position.@end: the end position.<!-- ##### FUNCTION gtk_editable_get_selection_bounds ##### --><para>Gets the current selection bounds, if there is a selection.</para>@editable: a #GtkEditable widget.@start: location to store the starting position, or %NULL.@end: location to store the end position, or %NULL.@Returns: %TRUE if there is a selection.<!-- ##### FUNCTION gtk_editable_insert_text ##### --><para>Inserts text at a given position.</para>@editable: a #GtkEditable widget.@new_text: the text to insert.@new_text_length: the length of the text to insert, in bytes@position: an inout parameter. The caller initializes it to           the position at which to insert the text. After the           call it points at the position after the newly           inserted text.<!-- ##### FUNCTION gtk_editable_delete_text ##### --><para>Deletes a sequence of characters. The characters thatare deleted are those characters at positions from@start_pos up to, but not including @end_pos. If @end_pos is negative, then the the characters deletedwill be those characters from @start_pos to the endof the text.</para>@editable: a #GtkEditable widget.@start_pos: the starting position.@end_pos: the end position.<!-- ##### FUNCTION gtk_editable_get_chars ##### --><para>Retrieves a sequence of characters. The characters thatare retrieved are those characters at positions from@start_pos up to, but not including @end_pos. If @end_pos is negative, then the the characters retrievedwill be those characters from @start_pos to the endof the text.</para>@editable: a #GtkEditable widget.@start_pos: the starting position.@end_pos: the end position.@Returns: the characters in the indicated region.          The result must be freed with g_free() when          the application is finished with it.<!-- ##### FUNCTION gtk_editable_cut_clipboard ##### --><para>Causes the characters in the current selection tobe copied to the clipboard and then deleted fromthe widget.</para>@editable: a #GtkEditable widget.<!-- ##### FUNCTION gtk_editable_copy_clipboard ##### --><para>Causes the characters in the current selection tobe copied to the clipboard.</para>@editable: a #GtkEditable widget.<!-- ##### FUNCTION gtk_editable_paste_clipboard ##### --><para>Causes the contents of the clipboard to be pasted intothe given widget at the current cursor position.</para>@editable: a #GtkEditable widget.<!-- ##### FUNCTION gtk_editable_delete_selection ##### --><para>Deletes the current contents of the widgets selection anddisclaims the selection.</para>@editable: a #GtkEditable widget.<!-- ##### FUNCTION gtk_editable_set_position ##### --><para>Sets the cursor position.</para>@editable: a #GtkEditable widget.@position: the position of the cursor. The cursor is displayed           before the character with the given (base 0) index           in the widget. The value must be less than or           equal to the number of characters in the widget.           A value of -1 indicates that the position should           be set after the last character in the entry.           Note that this position is in characters, not in           bytes.<!-- ##### FUNCTION gtk_editable_get_position ##### --><para>Retrieves the current cursor position.</para>@editable: a #GtkEditable widget.@Returns: the position of the cursor. The cursor is displayed           before the character with the given (base 0) index           in the widget. The value will be less than or           equal to the number of characters in the widget.           Note that this position is in characters, not in           bytes.<!-- ##### FUNCTION gtk_editable_set_editable ##### --><para>Determines if the user can edit the text in the editablewidget or not.</para>@editable: a #GtkEditable widget.@is_editable: %TRUE if the user is allowed to edit the text  in the widget.<!-- ##### FUNCTION gtk_editable_get_editable ##### --><para></para>@editable: @Returns: 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -