GtkEditableLabel — A label that can be edited
GtkWidget * | gtk_editable_label_new () |
gboolean | gtk_editable_label_get_editing () |
void | gtk_editable_label_start_editing () |
void | gtk_editable_label_stop_editing () |
gboolean | editing | Read |
editing.stop | b | |
editing.start |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkEditableLabel
GtkEditableLabel implements GtkAccessible, GtkBuildable, GtkConstraintTarget and GtkEditable.
#include <gtk/gtk.h>
A GtkEditableLabel is a GtkLabel that allows users to edit the text by switching the widget to an “edit mode”.
GtkEditableLabel does not have API of its own, but it implements the GtkEditable interface.
The default bindings for activating the edit mode is to click or press the Enter key. The default bindings for leaving the edit mode are the Enter key (to save the results) or the Escape key (to cancel the editing).
editablelabel[.editing] ╰── stack ├── label ╰── text
GtkEditableLabel has a main node with the name editablelabel. When the entry is in editing mode, it gets the .editing style class.
For all the subnodes added to the text node in various situations, see GtkText.
GtkWidget *
gtk_editable_label_new (const char *str
);
Creates a new GtkEditableLabel widget.
str | the text for the label |
the new GtkEditableLabel
gboolean
gtk_editable_label_get_editing (GtkEditableLabel *self
);
Returns whether the label is currently in “editing mode”.
self |
TRUE
if self
is currently in editing mode
void
gtk_editable_label_start_editing (GtkEditableLabel *self
);
Switches the label into “editing mode”.
self |
void gtk_editable_label_stop_editing (GtkEditableLabel *self
,gboolean commit
);
Switches the label out of “editing mode”. If commit
is TRUE
, the resulting text is kept as the “text” property value, otherwise the resulting text is discarded and the label will keep its previous “text” property value.
self | ||
commit | whether to set the edited text on the label |
typedef struct _GtkEditableLabel GtkEditableLabel;
“editing”
property“editing” gboolean
This property is TRUE
while the widget is in edit mode.
Owner: GtkEditableLabel
Flags: Read
Default value: FALSE
“editing.stop”
actionSwitch the widget out of editing mode. If commit
is TRUE
, then the results of the editing are taken as the new value of “text”.
The default binding for this action is the Escape key.
This action is disabled when “editing” is FALSE
.
Parameter type: b
commit | Whether the make changes permanent |
“editing.start”
actionSwitch the widget into editing mode, so that the user can make changes to the text.
The default bindings for this action are clicking on the widget and the Enter key.
This action is disabled when “editing” is FALSE
.
© 2005–2020 The GNOME Project
Licensed under the GNU Lesser General Public License version 2.1 or later.
https://developer.gnome.org/gtk4/4.0/GtkEditableLabel.html