gtk2/gtk/gtkentry.c

3797 lines
115 KiB
C
Raw Normal View History

/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* GTK - The GIMP Toolkit
1997-11-24 22:37:52 +00:00
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 2004-2006 Christian Hammond
* Copyright (C) 2008 Cody Russell
* Copyright (C) 2008 Red Hat, Inc.
1997-11-24 22:37:52 +00:00
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
1997-11-24 22:37:52 +00:00
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
1997-11-24 22:37:52 +00:00
*
* You should have received a copy of the GNU Lesser General Public
2012-02-27 13:01:10 +00:00
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
1997-11-24 22:37:52 +00:00
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkentryprivate.h"
#include "gtkaccessibleprivate.h"
#include "gtkadjustment.h"
#include "gtkbox.h"
#include "gtkbutton.h"
#include "deprecated/gtkcelleditable.h"
#include "gtkdebug.h"
#include "gtkeditable.h"
#include "gtkemojichooser.h"
#include "gtkemojicompletion.h"
#include "gtkentrybuffer.h"
#include "gtkgesturedrag.h"
#include "gtkimageprivate.h"
#include "gtkimcontextsimple.h"
#include <glib/gi18n-lib.h>
#include "gtklabel.h"
1997-11-24 22:37:52 +00:00
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkpangoprivate.h"
#include "gtkpopover.h"
#include "gtkprivate.h"
#include "gtkprogressbar.h"
#include "gtksettings.h"
#include "gtksnapshot.h"
#include "gtktextprivate.h"
#include "gtktexthandleprivate.h"
#include "gtktextutilprivate.h"
#include "gtktooltip.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
#include "gtkwindow.h"
2019-05-04 18:10:12 +00:00
#include "gtknative.h"
#include "gtkgestureclick.h"
#include "gtkdragsourceprivate.h"
#include "gtkdragicon.h"
#include "gtkwidgetpaintable.h"
#include <cairo-gobject.h>
#include <string.h>
/**
* GtkEntry:
*
* `GtkEntry` is a single line text entry widget.
*
* ![An example GtkEntry](entry.png)
*
* A fairly large set of key bindings are supported by default. If the
* entered text is longer than the allocation of the widget, the widget
* will scroll so that the cursor position is visible.
*
* When using an entry for passwords and other sensitive information, it
* can be put into password mode using [method@Gtk.Entry.set_visibility].
* In this mode, entered text is displayed using a invisible character.
* By default, GTK picks the best invisible character that is available
* in the current font, but it can be changed with
* [method@Gtk.Entry.set_invisible_char].
*
* `GtkEntry` has the ability to display progress or activity
* information behind the text. To make an entry display such information,
* use [method@Gtk.Entry.set_progress_fraction] or
* [method@Gtk.Entry.set_progress_pulse_step].
*
* Additionally, `GtkEntry` can show icons at either side of the entry.
* These icons can be activatable by clicking, can be set up as drag source
* and can have tooltips. To add an icon, use
* [method@Gtk.Entry.set_icon_from_gicon] or one of the various other functions
* that set an icon from an icon name or a paintable. To trigger an action when
* the user clicks an icon, connect to the [signal@Gtk.Entry::icon-press] signal.
* To allow DND operations from an icon, use
* [method@Gtk.Entry.set_icon_drag_source]. To set a tooltip on an icon, use
* [method@Gtk.Entry.set_icon_tooltip_text] or the corresponding function
* for markup.
*
* Note that functionality or information that is only available by clicking
* on an icon in an entry may not be accessible at all to users which are not
* able to use a mouse or other pointing device. It is therefore recommended
* that any such functionality should also be available by other means, e.g.
* via the context menu of the entry.
*
* # CSS nodes
*
2021-02-28 00:46:32 +00:00
* ```
* entry[.flat][.warning][.error]
* text[.readonly]
2015-11-03 14:53:00 +00:00
* image.left
* image.right
* [progress[.pulse]]
2021-02-28 00:46:32 +00:00
* ```
2015-11-03 14:53:00 +00:00
*
* `GtkEntry` has a main node with the name entry. Depending on the properties
* of the entry, the style classes .read-only and .flat may appear. The style
* classes .warning and .error may also be used with entries.
*
* When the entry shows icons, it adds subnodes with the name image and the
* style class .left or .right, depending on where the icon appears.
*
* When the entry shows progress, it adds a subnode with the name progress.
* The node has the style class .pulse when the shown progress is pulsing.
*
* For all the subnodes added to the text node in various situations,
* see [class@Gtk.Text].
2020-04-07 03:29:47 +00:00
*
* # GtkEntry as GtkBuildable
*
* The `GtkEntry` implementation of the `GtkBuildable` interface supports a
2020-04-07 03:29:47 +00:00
* custom <attributes> element, which supports any number of <attribute>
* elements. The <attribute> element has attributes named name, value,
* start and end and allows you to specify `PangoAttribute` values for
2020-04-07 03:29:47 +00:00
* this label.
*
* An example of a UI definition fragment specifying Pango attributes:
2021-02-28 00:46:32 +00:00
* ```xml
2021-06-02 10:47:27 +00:00
* <object class="GtkEntry">
2020-04-07 03:29:47 +00:00
* <attributes>
* <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
* <attribute name="background" value="red" start="5" end="10"/>
* </attributes>
* </object>
2021-02-28 00:46:32 +00:00
* ```
2020-04-07 03:29:47 +00:00
*
* The start and end attributes specify the range of characters to which the
* Pango attribute applies. If start and end are not specified, the attribute
* is applied to the whole text. Note that specifying ranges does not make much
2020-04-07 03:29:47 +00:00
* sense with translatable attributes. Use markup embedded in the translatable
* content instead.
*
* # Accessibility
*
* `GtkEntry` uses the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role.
*/
#define MAX_ICONS 2
#define IS_VALID_ICON_POSITION(pos) \
((pos) == GTK_ENTRY_ICON_PRIMARY || \
(pos) == GTK_ENTRY_ICON_SECONDARY)
static GQuark quark_entry_completion = 0;
typedef struct _EntryIconInfo EntryIconInfo;
2019-05-27 03:03:47 +00:00
typedef struct _GtkEntryPrivate GtkEntryPrivate;
struct _GtkEntryPrivate
{
EntryIconInfo *icons[MAX_ICONS];
GtkWidget *text;
GtkWidget *progress_widget;
guint show_emoji_icon : 1;
guint editing_canceled : 1; /* Only used by GtkCellRendererText */
};
struct _EntryIconInfo
{
2017-06-16 09:19:52 +00:00
GtkWidget *widget;
2020-07-24 18:40:36 +00:00
char *tooltip;
guint nonactivatable : 1;
guint in_drag : 1;
GdkDragAction actions;
GdkContentProvider *content;
};
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
enum {
ACTIVATE,
ICON_PRESS,
ICON_RELEASE,
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
LAST_SIGNAL
};
enum {
PROP_0,
PROP_BUFFER,
PROP_MAX_LENGTH,
PROP_VISIBILITY,
PROP_HAS_FRAME,
PROP_INVISIBLE_CHAR,
PROP_ACTIVATES_DEFAULT,
PROP_SCROLL_OFFSET,
PROP_TRUNCATE_MULTILINE,
PROP_OVERWRITE_MODE,
PROP_TEXT_LENGTH,
PROP_INVISIBLE_CHAR_SET,
PROP_PROGRESS_FRACTION,
PROP_PROGRESS_PULSE_STEP,
2018-03-16 02:32:05 +00:00
PROP_PAINTABLE_PRIMARY,
PROP_PAINTABLE_SECONDARY,
PROP_ICON_NAME_PRIMARY,
PROP_ICON_NAME_SECONDARY,
PROP_GICON_PRIMARY,
PROP_GICON_SECONDARY,
PROP_STORAGE_TYPE_PRIMARY,
PROP_STORAGE_TYPE_SECONDARY,
PROP_ACTIVATABLE_PRIMARY,
PROP_ACTIVATABLE_SECONDARY,
PROP_SENSITIVE_PRIMARY,
PROP_SENSITIVE_SECONDARY,
PROP_TOOLTIP_TEXT_PRIMARY,
PROP_TOOLTIP_TEXT_SECONDARY,
PROP_TOOLTIP_MARKUP_PRIMARY,
PROP_TOOLTIP_MARKUP_SECONDARY,
PROP_IM_MODULE,
2011-04-01 22:35:32 +00:00
PROP_PLACEHOLDER_TEXT,
PROP_COMPLETION,
PROP_INPUT_PURPOSE,
PROP_INPUT_HINTS,
PROP_ATTRIBUTES,
PROP_TABS,
PROP_EXTRA_MENU,
PROP_SHOW_EMOJI_ICON,
PROP_ENABLE_EMOJI_COMPLETION,
PROP_EDITING_CANCELED,
NUM_PROPERTIES = PROP_EDITING_CANCELED,
};
static GParamSpec *entry_props[NUM_PROPERTIES] = { NULL, };
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
static guint signals[LAST_SIGNAL] = { 0 };
typedef enum {
CURSOR_STANDARD,
CURSOR_DND
} CursorType;
typedef enum
{
DISPLAY_NORMAL, /* The entry text is being shown */
DISPLAY_INVISIBLE, /* In invisible mode, text replaced by (eg) bullets */
DISPLAY_BLANK /* In invisible mode, nothing shown at all */
} DisplayMode;
/* GObject methods
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
*/
static void gtk_entry_editable_init (GtkEditableInterface *iface);
static void gtk_entry_cell_editable_init (GtkCellEditableIface *iface);
static void gtk_entry_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec);
static void gtk_entry_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_entry_finalize (GObject *object);
static void gtk_entry_dispose (GObject *object);
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
/* GtkWidget methods
*/
static void gtk_entry_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline);
2016-11-14 00:52:22 +00:00
static void gtk_entry_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot);
static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
2020-07-24 13:54:49 +00:00
int x,
int y,
gboolean keyboard_tip,
GtkTooltip *tooltip);
static void gtk_entry_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir);
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
/* GtkCellEditable method implementations
*/
static void gtk_entry_start_editing (GtkCellEditable *cell_editable,
GdkEvent *event);
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
/* Default signal handlers
*/
static GtkEntryBuffer *get_buffer (GtkEntry *entry);
static void set_show_emoji_icon (GtkEntry *entry,
gboolean value);
2017-06-16 09:19:52 +00:00
static void gtk_entry_measure (GtkWidget *widget,
2017-05-04 16:58:47 +00:00
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline);
static GtkBuildableIface *buildable_parent_iface = NULL;
static void gtk_entry_buildable_interface_init (GtkBuildableIface *iface);
static void gtk_entry_accessible_interface_init (GtkAccessibleInterface *iface);
2006-05-02 23:56:43 +00:00
G_DEFINE_TYPE_WITH_CODE (GtkEntry, gtk_entry, GTK_TYPE_WIDGET,
G_ADD_PRIVATE (GtkEntry)
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE,
gtk_entry_accessible_interface_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
gtk_entry_buildable_interface_init)
2006-05-02 23:56:43 +00:00
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
gtk_entry_editable_init)
G_IMPLEMENT_INTERFACE (GTK_TYPE_CELL_EDITABLE,
2006-05-14 04:25:34 +00:00
gtk_entry_cell_editable_init))
1997-11-24 22:37:52 +00:00
/* Implement the GtkAccessible interface, in order to obtain focus
* state from the GtkText widget that we are wrapping. The GtkText
* widget is ignored for accessibility purposes (it has role NONE),
* and any a11y text functionality is implemented for GtkEntry and
* similar wrappers (GtkPasswordEntry, GtkSpinButton, etc).
*/
static gboolean
gtk_entry_accessible_get_platform_state (GtkAccessible *self,
GtkAccessiblePlatformState state)
{
GtkEntry *entry = GTK_ENTRY (self);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
switch (state)
{
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSABLE:
return gtk_widget_get_focusable (GTK_WIDGET (priv->text));
case GTK_ACCESSIBLE_PLATFORM_STATE_FOCUSED:
return gtk_widget_has_focus (GTK_WIDGET (priv->text));
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
return FALSE;
default:
g_assert_not_reached ();
}
}
static void
gtk_entry_accessible_interface_init (GtkAccessibleInterface *iface)
{
GtkAccessibleInterface *parent_iface = g_type_interface_peek_parent (iface);
iface->get_at_context = parent_iface->get_at_context;
iface->get_platform_state = gtk_entry_accessible_get_platform_state;
}
static const GtkBuildableParser pango_parser =
{
gtk_pango_attribute_start_element,
};
static gboolean
gtk_entry_buildable_custom_tag_start (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
2020-07-24 18:40:36 +00:00
const char *tagname,
GtkBuildableParser *parser,
gpointer *data)
{
if (buildable_parent_iface->custom_tag_start (buildable, builder, child,
tagname, parser, data))
return TRUE;
if (strcmp (tagname, "attributes") == 0)
{
GtkPangoAttributeParserData *parser_data;
parser_data = g_slice_new0 (GtkPangoAttributeParserData);
parser_data->builder = g_object_ref (builder);
parser_data->object = (GObject *) g_object_ref (buildable);
*parser = pango_parser;
*data = parser_data;
return TRUE;
}
return FALSE;
}
static void
gtk_entry_buildable_custom_finished (GtkBuildable *buildable,
GtkBuilder *builder,
GObject *child,
2020-07-24 18:40:36 +00:00
const char *tagname,
gpointer user_data)
{
GtkPangoAttributeParserData *data = user_data;
buildable_parent_iface->custom_finished (buildable, builder, child,
tagname, user_data);
if (strcmp (tagname, "attributes") == 0)
{
if (data->attrs)
{
gtk_entry_set_attributes (GTK_ENTRY (buildable), data->attrs);
pango_attr_list_unref (data->attrs);
}
g_object_unref (data->object);
g_object_unref (data->builder);
g_slice_free (GtkPangoAttributeParserData, data);
}
}
static void
gtk_entry_buildable_interface_init (GtkBuildableIface *iface)
{
buildable_parent_iface = g_type_interface_peek_parent (iface);
iface->custom_tag_start = gtk_entry_buildable_custom_tag_start;
iface->custom_finished = gtk_entry_buildable_custom_finished;
}
static gboolean
gtk_entry_grab_focus (GtkWidget *widget)
2017-12-01 06:21:21 +00:00
{
GtkEntry *entry = GTK_ENTRY (widget);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
2017-12-01 06:21:21 +00:00
return gtk_widget_grab_focus (priv->text);
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
}
static gboolean
gtk_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling)
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
gtk_widget_grab_focus (priv->text);
return TRUE;
}
1997-11-24 22:37:52 +00:00
static void
gtk_entry_class_init (GtkEntryClass *class)
{
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
1997-11-24 22:37:52 +00:00
GtkWidgetClass *widget_class;
widget_class = (GtkWidgetClass*) class;
gobject_class->dispose = gtk_entry_dispose;
documented necessary changes for 1.4 transition. Fri May 12 17:13:32 2000 Tim Janik <timj@gtk.org> * docs/Changes-1.4.txt: documented necessary changes for 1.4 transition. * gtk/gtktext.c: made the adjustments no-construct args, simply provide default adjustments. (gtk_text_destroy): release adjustments. * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): made the adjustment argument non-construct. * gtk/gtkprogress.c (gtk_progress_destroy): release adjustment here, instead of in finalize. (gtk_progress_get_text_from_value): (gtk_progress_get_current_text): (gtk_progress_set_value): (gtk_progress_get_percentage_from_value): (gtk_progress_get_current_percentage): (gtk_progress_set_percentage): (gtk_progress_configure): ensure an adjustment is present. Thu May 11 01:24:08 2000 Tim Janik <timj@gtk.org> * gtk/gtkcolorsel.[hc]: * gtk/gtkcolorseldialog.[hc]: * gtk/gtkhsv.[hc]: major code cleanups, destroy handlers need to chain their parent implementation, use bit fields for boolean values, don't create unused widgets, usage of glib types, braces go on their own lines, function argument alignment, #include directives etc. etc. etc.. * gtk/Makefile.am (gtk_public_h_sources): install gtkhsv.h. Wed May 10 23:29:52 2000 Tim Janik <timj@gtk.org> * gtk/gtktoolbar.c (gtk_toolbar_destroy): don't unref a NULL tooltips. * gtk/gtkfilesel.c (gtk_file_selection_destroy): don't free a cmpl_state of NULL. * gtk/gtkcombo.c (gtk_combo_item_destroy): don#t keep references to freed data. (gtk_combo_destroy): don't keep a pointer to a destroyed window. * gtk/gtkmenu.c (gtk_menu_init): reset the menu's toplevel pointer to NULL when the toplevel is getting destroyed. (gtk_menu_set_tearoff_state): same here for the tearoff_window. (gtk_menu_destroy): (gtk_menu_init): store the information of whether we have to readd the initial child ref_count during destruction in a new GtkMenu field needs_destruction_ref_count. * gtk/gtkviewport.c: SHAME! ok this one is tricky, so i note it here, those reading: learn from my mistake! ;) in order for set_?adjustment to support a default adjustemnt if invoked with an adjustment pointer of NULL, the code read (pseudo): if (v->adjustment) unref (v->adjustment); if (!adjustment) adjustment = adjustment_new (); if (v->adjustment != adjustment) v->adjustment = ref (adjustment); now imagine the first unref to actually free the old adjustment and adjustment_new() creating a new adjustment from the very same memory portion. here, the latter comparision will unintendedly fail, and all hell breaks loose. (gtk_viewport_set_hadjustment): (gtk_viewport_set_vadjustment): reset viewport->?adjustment to NULL after unreferencing it. * gtk/gtkcontainer.[hc]: removed toplevel registration functions: gtk_container_register_toplevel(), gtk_container_unregister_toplevel() and gtk_container_get_toplevels() which had wrong semantics anyways: it didn't reference and copy the list. * gtk/gtkwindow.c: we take over the container toplevel registration bussiness now. windows are registered across multiple destructions, untill they are finalized. the initial implicit reference count users are holding on windows is removed with the first destruction though. (gtk_window_init): ref & sink and set has_user_ref_count, got rid of gtk_container_register_toplevel() call. add window to toplevel_list. (gtk_window_destroy): unref the window if has_user_ref_count is still set, got rid of call to gtk_container_unregister_toplevel(). (gtk_window_finalize): remove window from toplevel list. (gtk_window_list_toplevels): new function to return a newly created list with referenced toplevels. (gtk_window_read_rcfiles): use gtk_window_list_toplevels(). * gtk/gtkhscale.c (gtk_hscale_class_init): made the GtkRange adjustment a non-construct arg. * gtk/gtkvscale.c (gtk_vscale_class_init): likewise. * gtk/gtkhscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkvscrollbar.c (gtk_vscrollbar_class_init): likewise. * gtk/gtkrange.c: added some realized checks. (gtk_range_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. remove timer. (gtk_range_get_adjustment): demand create adjustment. * gtk/gtkviewport.c: made h/v adjustment non-construct args. we simply create them on demand now and get rid of them in the destroy handler. (gtk_viewport_destroy): get rid of the h/v adjustments in the destroy handler instead of finalize. (gtk_viewport_get_hadjustment): (gtk_viewport_get_vadjustment): (gtk_viewport_size_allocate): demand create h/v adjustment if required. * gtk/gtkwidget.c (gtk_widget_finalize): duplicate part of the gtk_widget_real_destroy () functionality. (gtk_widget_real_destroy): reinitialize with a new style, instead of setting widget->style to NULL. Fri May 5 13:02:09 2000 Tim Janik <timj@gtk.org> * gtk/gtkcalendar.c: * gtk/gtkbutton.c: ported _get_type() implementation over to GType, either to preserve memchunks allocation facilities, or because Gtk+ 1.0 GtkTypeInfo was still being used. * gtk/gtkobject.[hc]: derive from GObject. ported various functions over. prepare for ::destroy to be emitted multiple times. removed reference tracer magic. chain into GObjectClass.shutdown() to emit ::destroy signal. * gtk/gtksignal.c: removed assumptions about GTK_TYPE_OBJECT being fundamental. * gtk/gtkmain.c: removed gtk_object_post_arg_parsing_init() cludge. * gtk/gtksocket.c: * gtk/gtkplug.c: * gtk/gtklayout.c: * gtk/gtklabel.c: * gtk/gtkargcollector.c: * gtk/gtkarg.c: various fixups to work with GTK_TYPE_OBJECT not being a fundamental anymore, and to work with the new type system (nuked fundamental type varargs clutter). * gtk/*.c: install finalize handlers in the GObjectClass part of the class structure. changed direct GTK_OBJECT()->klass accesses to GTK_*_GET_CLASS(). changed direct object_class->type accesses to GTK_CLASS_TYPE(). * gtktypeutils.[hc]: use the reserved fundamental ids provided by GType. made most of the GTK_*() type macros and Gtk* typedefs simple wrappers around macros and types provided by GType. most notably, a significant portion of the old API vanished: GTK_TYPE_MAKE(), GTK_TYPE_SEQNO(), GTK_TYPE_FLAT_FIRST, GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST, GTK_TYPE_STRUCTURED_LAST, GTK_TYPE_ARGS, GTK_TYPE_CALLBACK, GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN, GtkTypeQuery, gtk_type_query(), gtk_type_set_varargs_type(), gtk_type_get_varargs_type(), gtk_type_check_object_cast(), gtk_type_check_class_cast(), gtk_type_describe_tree(), gtk_type_describe_heritage(), gtk_type_free(), gtk_type_children_types(), gtk_type_set_chunk_alloc(), gtk_type_register_enum(), gtk_type_register_flags(), gtk_type_parent_class(). replacements, where available are described in ../docs/Changes-1.4.txt. implemented compatibility functions for the remaining API. * configure.in: depend on glib 1.3.1, use gobject module.
2000-05-12 15:25:50 +00:00
gobject_class->finalize = gtk_entry_finalize;
gobject_class->set_property = gtk_entry_set_property;
gobject_class->get_property = gtk_entry_get_property;
doh, this was broken beyond believe. Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org> * gtk/stock-icons/Makefile.am: doh, this was broken beyond believe. * gtk/gtkbox.c: change property types from (u)long to (u)int for ::position and ::padding. * gtk/gtkcontainer.c: make ::border_width an INT property. * gtk/gtkpacker.c: make ::position an INT property. * gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed): guard against NULL h/v scrollbars, since this is used at construction time. * gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented internal gtk_clist_constructor(). * gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented gtk_ctree_constructor(). * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property ::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION. * docs/reference/Makefile.am: fun stuff, disabled docs generation again, gtk-scan.c needs to introspec paramspecs, not GtkAgs. * gtk/gtkwidget.[hc]: removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv() and gtk_widget_get(). (gtk_widget_new): use g_object_new_valist(). (gtk_widget_set): use g_object_set_valist(). * gtk/gtkobject.[hc]: removed gtk_object_arg_get_info(), gtk_object_getv(), gtk_object_query_args(), gtk_object_newv(), gtk_object_class_add_signals(), gtk_object_class_user_signal_new(), gtk_object_class_user_signal_newv(), gtk_object_arg_set(), gtk_object_arg_get(), gtk_object_args_collect(), gtk_object_default_construct(), gtk_object_constructed(), GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED(). removed nsignals, signals and n_args members from GtkObjectClass. (gtk_object_new): use g_object_new_valist(). (gtk_object_set): use g_object_set_valist(). (gtk_object_get): use g_object_get_valist(). * gtk/gtkcompat.h: define gtk_object_default_construct(). * gtk/gtktypeutils.c (gtk_type_new): create constructed objects via g_object_new(). * gtk/*.c: removed gtk_object_class_add_signals() from class_init() fucntions, cleaned up method assignments (make sure your structures are setup properly before calling out). removed all GTK_CONSTRUCTED hacks ;)
2000-12-13 01:34:41 +00:00
2017-05-04 16:58:47 +00:00
widget_class->measure = gtk_entry_measure;
doh, this was broken beyond believe. Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org> * gtk/stock-icons/Makefile.am: doh, this was broken beyond believe. * gtk/gtkbox.c: change property types from (u)long to (u)int for ::position and ::padding. * gtk/gtkcontainer.c: make ::border_width an INT property. * gtk/gtkpacker.c: make ::position an INT property. * gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed): guard against NULL h/v scrollbars, since this is used at construction time. * gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented internal gtk_clist_constructor(). * gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented gtk_ctree_constructor(). * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property ::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION. * docs/reference/Makefile.am: fun stuff, disabled docs generation again, gtk-scan.c needs to introspec paramspecs, not GtkAgs. * gtk/gtkwidget.[hc]: removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv() and gtk_widget_get(). (gtk_widget_new): use g_object_new_valist(). (gtk_widget_set): use g_object_set_valist(). * gtk/gtkobject.[hc]: removed gtk_object_arg_get_info(), gtk_object_getv(), gtk_object_query_args(), gtk_object_newv(), gtk_object_class_add_signals(), gtk_object_class_user_signal_new(), gtk_object_class_user_signal_newv(), gtk_object_arg_set(), gtk_object_arg_get(), gtk_object_args_collect(), gtk_object_default_construct(), gtk_object_constructed(), GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED(). removed nsignals, signals and n_args members from GtkObjectClass. (gtk_object_new): use g_object_new_valist(). (gtk_object_set): use g_object_set_valist(). (gtk_object_get): use g_object_get_valist(). * gtk/gtkcompat.h: define gtk_object_default_construct(). * gtk/gtktypeutils.c (gtk_type_new): create constructed objects via g_object_new(). * gtk/*.c: removed gtk_object_class_add_signals() from class_init() fucntions, cleaned up method assignments (make sure your structures are setup properly before calling out). removed all GTK_CONSTRUCTED hacks ;)
2000-12-13 01:34:41 +00:00
widget_class->size_allocate = gtk_entry_size_allocate;
2016-11-14 00:52:22 +00:00
widget_class->snapshot = gtk_entry_snapshot;
widget_class->query_tooltip = gtk_entry_query_tooltip;
doh, this was broken beyond believe. Tue Dec 12 23:46:44 2000 Tim Janik <timj@gtk.org> * gtk/stock-icons/Makefile.am: doh, this was broken beyond believe. * gtk/gtkbox.c: change property types from (u)long to (u)int for ::position and ::padding. * gtk/gtkcontainer.c: make ::border_width an INT property. * gtk/gtkpacker.c: make ::position an INT property. * gtk/gtkscrolledwindow.c (gtk_scrolled_window_adjustment_changed): guard against NULL h/v scrollbars, since this is used at construction time. * gtk/gtkclist.[hc]: nuked gtk_clist_construct(), implemented internal gtk_clist_constructor(). * gtk/gtkctree.[hc]: nuked gtk_ctree_construct(), implemented gtk_ctree_constructor(). * gtk/gtkprogressbar.c (gtk_progress_bar_class_init): property ::pulse_step should use ARG_PULSE_STEP, not ARG_FRACTION. * docs/reference/Makefile.am: fun stuff, disabled docs generation again, gtk-scan.c needs to introspec paramspecs, not GtkAgs. * gtk/gtkwidget.[hc]: removed gtk_widget_setv(), gtk_widget_getv(), gtk_widget_newv() and gtk_widget_get(). (gtk_widget_new): use g_object_new_valist(). (gtk_widget_set): use g_object_set_valist(). * gtk/gtkobject.[hc]: removed gtk_object_arg_get_info(), gtk_object_getv(), gtk_object_query_args(), gtk_object_newv(), gtk_object_class_add_signals(), gtk_object_class_user_signal_new(), gtk_object_class_user_signal_newv(), gtk_object_arg_set(), gtk_object_arg_get(), gtk_object_args_collect(), gtk_object_default_construct(), gtk_object_constructed(), GTK_CONSTRUCTED and GTK_OBJECT_CONSTRUCTED(). removed nsignals, signals and n_args members from GtkObjectClass. (gtk_object_new): use g_object_new_valist(). (gtk_object_set): use g_object_set_valist(). (gtk_object_get): use g_object_get_valist(). * gtk/gtkcompat.h: define gtk_object_default_construct(). * gtk/gtktypeutils.c (gtk_type_new): create constructed objects via g_object_new(). * gtk/*.c: removed gtk_object_class_add_signals() from class_init() fucntions, cleaned up method assignments (make sure your structures are setup properly before calling out). removed all GTK_CONSTRUCTED hacks ;)
2000-12-13 01:34:41 +00:00
widget_class->direction_changed = gtk_entry_direction_changed;
widget_class->grab_focus = gtk_entry_grab_focus;
widget_class->focus = gtk_widget_focus_child;
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
quark_entry_completion = g_quark_from_static_string ("gtk-entry-completion-key");
/**
* GtkEntry:buffer: (attributes org.gtk.Property.get=gtk_entry_get_buffer org.gtk.Property.set=gtk_entry_set_buffer)
*
* The buffer object which actually stores the text.
*/
entry_props[PROP_BUFFER] =
g_param_spec_object ("buffer", NULL, NULL,
GTK_TYPE_ENTRY_BUFFER,
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:max-length: (attributes org.gtk.Property.get=gtk_entry_get_max_length org.gtk.Property.set=gtk_entry_set_max_length)
*
* Maximum number of characters for this entry.
*/
entry_props[PROP_MAX_LENGTH] =
g_param_spec_int ("max-length", NULL, NULL,
0, GTK_ENTRY_BUFFER_MAX_SIZE,
0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:visibility: (attributes org.gtk.Property.get=gtk_entry_get_visibility org.gtk.Property.set=gtk_entry_set_visibility)
*
* Whether the entry should show the invisible char instead of the
* actual text (password mode).
*/
entry_props[PROP_VISIBILITY] =
g_param_spec_boolean ("visibility", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:has-frame: (attributes org.gtk.Property.get=gtk_entry_get_has_frame org.gtk.Property.set=gtk_entry_set_has_frame)
*
* Whehter the entry should draw a frame.
*/
entry_props[PROP_HAS_FRAME] =
g_param_spec_boolean ("has-frame", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:invisible-char: (attributes org.gtk.Property.get=gtk_entry_get_invisible_char org.gtk.Property.set=gtk_entry_set_invisible_char)
*
* The character to use when masking entry contents (password mode).
*/
entry_props[PROP_INVISIBLE_CHAR] =
g_param_spec_unichar ("invisible-char", NULL, NULL,
'*',
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:activates-default: (attributes org.gtk.Property.get=gtk_entry_get_activates_default org.gtk.Property.set=gtk_entry_set_activates_default)
*
* Whether to activate the default widget when Enter is pressed.
*/
entry_props[PROP_ACTIVATES_DEFAULT] =
g_param_spec_boolean ("activates-default", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:scroll-offset:
*
* Number of pixels of the entry scrolled off the screen to the left.
*/
entry_props[PROP_SCROLL_OFFSET] =
g_param_spec_int ("scroll-offset", NULL, NULL,
0, G_MAXINT,
0,
GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:truncate-multiline:
*
* When %TRUE, pasted multi-line text is truncated to the first line.
*/
entry_props[PROP_TRUNCATE_MULTILINE] =
g_param_spec_boolean ("truncate-multiline", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:overwrite-mode: (attributes org.gtk.Property.get=gtk_entry_get_overwrite_mode org.gtk.Property.set=gtk_entry_set_overwrite_mode)
*
* If text is overwritten when typing in the `GtkEntry`.
*/
entry_props[PROP_OVERWRITE_MODE] =
g_param_spec_boolean ("overwrite-mode", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:text-length: (attributes org.gtk.Property.get=gtk_entry_get_text_length)
*
* The length of the text in the `GtkEntry`.
*/
entry_props[PROP_TEXT_LENGTH] =
g_param_spec_uint ("text-length", NULL, NULL,
0, G_MAXUINT16,
0,
GTK_PARAM_READABLE);
/**
* GtkEntry:invisible-char-set:
*
* Whether the invisible char has been set for the `GtkEntry`.
*/
entry_props[PROP_INVISIBLE_CHAR_SET] =
g_param_spec_boolean ("invisible-char-set", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE);
/**
* GtkEntry:progress-fraction: (attributes org.gtk.Property.get=gtk_entry_get_progress_fraction org.gtk.Property.set=gtk_entry_set_progress_fraction)
*
* The current fraction of the task that's been completed.
*/
entry_props[PROP_PROGRESS_FRACTION] =
g_param_spec_double ("progress-fraction", NULL, NULL,
0.0, 1.0,
0.0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:progress-pulse-step: (attributes org.gtk.Property.get=gtk_entry_get_progress_pulse_step org.gtk.Property.set=gtk_entry_set_progress_pulse_step)
*
* The fraction of total entry width to move the progress
* bouncing block for each pulse.
*
* See [method@Gtk.Entry.progress_pulse].
*/
entry_props[PROP_PROGRESS_PULSE_STEP] =
g_param_spec_double ("progress-pulse-step", NULL, NULL,
0.0, 1.0,
0.0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:placeholder-text: (attributes org.gtk.Property.get=gtk_entry_get_placeholder_text org.gtk.Property.set=gtk_entry_set_placeholder_text)
*
* The text that will be displayed in the `GtkEntry` when it is empty
* and unfocused.
*/
entry_props[PROP_PLACEHOLDER_TEXT] =
g_param_spec_string ("placeholder-text", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
2018-03-16 02:32:05 +00:00
* GtkEntry:primary-icon-paintable:
*
* A `GdkPaintable` to use as the primary icon for the entry.
*/
2018-03-16 02:32:05 +00:00
entry_props[PROP_PAINTABLE_PRIMARY] =
g_param_spec_object ("primary-icon-paintable", NULL, NULL,
2018-03-16 02:32:05 +00:00
GDK_TYPE_PAINTABLE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
2018-03-16 02:32:05 +00:00
* GtkEntry:secondary-icon-paintable:
*
* A `GdkPaintable` to use as the secondary icon for the entry.
*/
2018-03-16 02:32:05 +00:00
entry_props[PROP_PAINTABLE_SECONDARY] =
g_param_spec_object ("secondary-icon-paintable", NULL, NULL,
2018-03-16 02:32:05 +00:00
GDK_TYPE_PAINTABLE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-name:
*
* The icon name to use for the primary icon for the entry.
*/
entry_props[PROP_ICON_NAME_PRIMARY] =
g_param_spec_string ("primary-icon-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:secondary-icon-name:
*
* The icon name to use for the secondary icon for the entry.
*/
entry_props[PROP_ICON_NAME_SECONDARY] =
g_param_spec_string ("secondary-icon-name", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-gicon:
*
* The `GIcon` to use for the primary icon for the entry.
*/
entry_props[PROP_GICON_PRIMARY] =
g_param_spec_object ("primary-icon-gicon", NULL, NULL,
G_TYPE_ICON,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:secondary-icon-gicon:
*
* The `GIcon` to use for the secondary icon for the entry.
*/
entry_props[PROP_GICON_SECONDARY] =
g_param_spec_object ("secondary-icon-gicon", NULL, NULL,
G_TYPE_ICON,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-storage-type:
*
* The representation which is used for the primary icon of the entry.
*/
entry_props[PROP_STORAGE_TYPE_PRIMARY] =
g_param_spec_enum ("primary-icon-storage-type", NULL, NULL,
GTK_TYPE_IMAGE_TYPE,
GTK_IMAGE_EMPTY,
GTK_PARAM_READABLE);
/**
* GtkEntry:secondary-icon-storage-type:
*
* The representation which is used for the secondary icon of the entry.
*/
entry_props[PROP_STORAGE_TYPE_SECONDARY] =
g_param_spec_enum ("secondary-icon-storage-type", NULL, NULL,
GTK_TYPE_IMAGE_TYPE,
GTK_IMAGE_EMPTY,
GTK_PARAM_READABLE);
/**
* GtkEntry:primary-icon-activatable:
*
* Whether the primary icon is activatable.
*
* GTK emits the [signal@Gtk.Entry::icon-press] and
* [signal@Gtk.Entry::icon-release] signals only on sensitive,
* activatable icons.
*
* Sensitive, but non-activatable icons can be used for purely
* informational purposes.
*/
entry_props[PROP_ACTIVATABLE_PRIMARY] =
g_param_spec_boolean ("primary-icon-activatable", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:secondary-icon-activatable:
*
* Whether the secondary icon is activatable.
*
* GTK emits the [signal@Gtk.Entry::icon-press] and
* [signal@Gtk.Entry::icon-release] signals only on sensitive,
* activatable icons.
*
* Sensitive, but non-activatable icons can be used for purely
* informational purposes.
*/
entry_props[PROP_ACTIVATABLE_SECONDARY] =
g_param_spec_boolean ("secondary-icon-activatable", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-sensitive:
*
* Whether the primary icon is sensitive.
*
* An insensitive icon appears grayed out. GTK does not emit the
* [signal@Gtk.Entry::icon-press] and [signal@Gtk.Entry::icon-release]
* signals and does not allow DND from insensitive icons.
*
* An icon should be set insensitive if the action that would trigger
* when clicked is currently not available.
*/
entry_props[PROP_SENSITIVE_PRIMARY] =
g_param_spec_boolean ("primary-icon-sensitive", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:secondary-icon-sensitive:
*
* Whether the secondary icon is sensitive.
*
* An insensitive icon appears grayed out. GTK does not emit the
* [signal@Gtk.Entry::icon-press[ and [signal@Gtk.Entry::icon-release]
* signals and does not allow DND from insensitive icons.
*
* An icon should be set insensitive if the action that would trigger
* when clicked is currently not available.
*/
entry_props[PROP_SENSITIVE_SECONDARY] =
g_param_spec_boolean ("secondary-icon-sensitive", NULL, NULL,
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-tooltip-text:
*
* The contents of the tooltip on the primary icon.
*
* Also see [method@Gtk.Entry.set_icon_tooltip_text].
*/
entry_props[PROP_TOOLTIP_TEXT_PRIMARY] =
g_param_spec_string ("primary-icon-tooltip-text", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:secondary-icon-tooltip-text:
*
* The contents of the tooltip on the secondary icon.
*
* Also see [method@Gtk.Entry.set_icon_tooltip_text].
*/
entry_props[PROP_TOOLTIP_TEXT_SECONDARY] =
g_param_spec_string ("secondary-icon-tooltip-text", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:primary-icon-tooltip-markup:
*
* The contents of the tooltip on the primary icon, with markup.
*
* Also see [method@Gtk.Entry.set_icon_tooltip_markup].
*/
entry_props[PROP_TOOLTIP_MARKUP_PRIMARY] =
g_param_spec_string ("primary-icon-tooltip-markup", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:secondary-icon-tooltip-markup:
*
* The contents of the tooltip on the secondary icon, with markup.
*
* Also see [method@Gtk.Entry.set_icon_tooltip_markup].
*/
entry_props[PROP_TOOLTIP_MARKUP_SECONDARY] =
g_param_spec_string ("secondary-icon-tooltip-markup", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:im-module:
*
* Which IM (input method) module should be used for this entry.
*
* See [class@Gtk.IMContext].
*
* Setting this to a non-%NULL value overrides the system-wide IM
* module setting. See the GtkSettings [property@Gtk.Settings:gtk-im-module]
* property.
*/
entry_props[PROP_IM_MODULE] =
g_param_spec_string ("im-module", NULL, NULL,
NULL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
2011-04-01 22:35:32 +00:00
/**
* GtkEntry:completion: (attributes org.gtk.Property.get=gtk_entry_get_completion org.gtk.Property.set=gtk_entry_set_completion)
2011-04-01 22:35:32 +00:00
*
* The auxiliary completion object to use with the entry.
*
* Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.
*/
entry_props[PROP_COMPLETION] =
g_param_spec_object ("completion", NULL, NULL,
GTK_TYPE_ENTRY_COMPLETION,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
2011-04-01 22:35:32 +00:00
/**
* GtkEntry:input-purpose: (attributes org.gtk.Property.get=gtk_entry_get_input_purpose org.gtk.Property.set=gtk_entry_set_input_purpose)
*
* The purpose of this text field.
*
* This property can be used by on-screen keyboards and other input
* methods to adjust their behaviour.
*
* Note that setting the purpose to %GTK_INPUT_PURPOSE_PASSWORD or
* %GTK_INPUT_PURPOSE_PIN is independent from setting
* [property@Gtk.Entry:visibility].
*/
entry_props[PROP_INPUT_PURPOSE] =
g_param_spec_enum ("input-purpose", NULL, NULL,
GTK_TYPE_INPUT_PURPOSE,
GTK_INPUT_PURPOSE_FREE_FORM,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:input-hints: (attributes org.gtk.Property.get=gtk_entry_get_input_hints org.gtk.Property.set=gtk_entry_set_input_hints)
*
* Additional hints that allow input methods to fine-tune their behavior.
*
* Also see [property@Gtk.Entry:input-purpose]
*/
entry_props[PROP_INPUT_HINTS] =
g_param_spec_flags ("input-hints", NULL, NULL,
GTK_TYPE_INPUT_HINTS,
GTK_INPUT_HINT_NONE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:attributes: (attributes org.gtk.Property.get=gtk_entry_get_attributes org.gtk.Property.set=gtk_entry_set_attributes)
*
* A list of Pango attributes to apply to the text of the entry.
*
* This is mainly useful to change the size or weight of the text.
*
* The `PangoAttribute`'s @start_index and @end_index must refer to the
* [class@Gtk.EntryBuffer] text, i.e. without the preedit string.
*/
entry_props[PROP_ATTRIBUTES] =
g_param_spec_boxed ("attributes", NULL, NULL,
PANGO_TYPE_ATTR_LIST,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry::tabs: (attributes org.gtk.Property.get=gtk_entry_get_tabs org.gtk.Property.set=gtk_entry_set_tabs)
*
* A list of tabstops to apply to the text of the entry.
*/
entry_props[PROP_TABS] =
g_param_spec_boxed ("tabs", NULL, NULL,
PANGO_TYPE_TAB_ARRAY,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry::show-emoji-icon:
*
* Whether the entry will sohw an Emoji icon in the secondary icon position
* to open the Emoji chooser.
*/
entry_props[PROP_SHOW_EMOJI_ICON] =
g_param_spec_boolean ("show-emoji-icon", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:extra-menu: (attributes org.gtk.Property.get=gtk_entry_get_extra_menu org.gtk.Property.set=gtk_entry_set_extra_menu)
*
* A menu model whose contents will be appended to the context menu.
*/
entry_props[PROP_EXTRA_MENU] =
g_param_spec_object ("extra-menu", NULL, NULL,
G_TYPE_MENU_MODEL,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/**
* GtkEntry:enable-emoji-completion:
*
* Whether to suggest Emoji replacements for :-delimited names
* like `:heart:`.
*/
entry_props[PROP_ENABLE_EMOJI_COMPLETION] =
g_param_spec_boolean ("enable-emoji-completion", NULL, NULL,
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, entry_props);
g_object_class_override_property (gobject_class, PROP_EDITING_CANCELED, "editing-canceled");
gtk_editable_install_properties (gobject_class, PROP_EDITING_CANCELED + 1);
/**
* GtkEntry::activate:
* @self: The widget on which the signal is emitted
*
* Emitted when the entry is activated.
*
* The keybindings for this signal are all forms of the Enter key.
*/
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
signals[ACTIVATE] =
g_signal_new (I_("activate"),
G_OBJECT_CLASS_TYPE (gobject_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GtkEntryClass, activate),
NULL, NULL,
NULL,
G_TYPE_NONE, 0);
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
/**
* GtkEntry::icon-press:
* @entry: The entry on which the signal is emitted
* @icon_pos: The position of the clicked icon
*
* Emitted when an activatable icon is clicked.
*/
signals[ICON_PRESS] =
g_signal_new (I_("icon-press"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
GTK_TYPE_ENTRY_ICON_POSITION);
/**
* GtkEntry::icon-release:
* @entry: The entry on which the signal is emitted
* @icon_pos: The position of the clicked icon
*
* Emitted on the button release from a mouse click
* over an activatable icon.
*/
signals[ICON_RELEASE] =
g_signal_new (I_("icon-release"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
NULL,
G_TYPE_NONE, 1,
GTK_TYPE_ENTRY_ICON_POSITION);
gtk_widget_class_set_css_name (widget_class, I_("entry"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_TEXT_BOX);
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
}
Remove --g-fatal-warnings flag from argv. Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag from argv. Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> * gtk/genmarshal.pl: Modified to be more idiomatic Perl, to be more readable perl, to spit out stuff that looks more like readable C, and to pipe output through indent so output looks a lot like readable C. No functional changes. Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if necessary when switching to a masked pixmap. (Based on a patch from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkeditable.[ch]: Added action signals for keyboard bindings. (move_cursor, kill_word, etc, etc, etc). removed the time argument from gtk_editable_cut/copy/paste_clipboard (source but not binary incompatible...) Instead get time from gtk_get_current_event (). * gtk/gtktext.c gtk/gtkentry.c: Support the new editable signals. Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> Patches from Damon Chaplin <DAChaplin@email.msn.com>: gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change parent class to GtkNotebookClass when splitting the widget in two. Also updated some comments. gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' button without a font selected. Fixed bug in set_font_name - I hadn't updated the code to search for the style in the font_style clist - it was still assuming the style row was equal to its index, but it isn't any more. Changed 'Reset' button on filter page to 'Clear Filter'. Deleted old code relating to the old 'Filter Fonts' toggle Updated some comments. Cleared 'Actual Fontname' if no font is set. gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was destroying the GtkFontSelection instead of the GtkFontSelectionDialog. Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings flag to make all warnings fatal errors. * gtk/testthreads.c: moved <pthreads.h> include inside #ifdef USE_PTHREADS Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: - Added new function gtk_container_set_resize_mode() for fine-grained control of where resize-queueing is done. - Removed GtkContainer::need_resize and GtkWindow::move_resize - Added GtkContainer::check_resize to replace need_resize. - Added function gtk_container_check_resize() to trigger queued resizes, and gtk_container_resize_children() to Figure which children need to be size-allocated. (logic moved from gtkwindow.c) - Reorganized code in gtkwindow.c - Set the resize-mode for viewports so that resizes within a viewport don't propagate out of it.
1998-06-19 01:26:24 +00:00
static GtkEditable *
gtk_entry_get_delegate (GtkEditable *editable)
2019-02-14 04:07:36 +00:00
{
GtkEntry *entry = GTK_ENTRY (editable);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
return GTK_EDITABLE (priv->text);
2019-02-14 04:07:36 +00:00
}
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
static void
gtk_entry_editable_init (GtkEditableInterface *iface)
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
{
iface->get_delegate = gtk_entry_get_delegate;
1997-11-24 22:37:52 +00:00
}
static void
gtk_entry_cell_editable_init (GtkCellEditableIface *iface)
{
iface->start_editing = gtk_entry_start_editing;
}
static void
gtk_entry_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
GtkEntry *entry = GTK_ENTRY (object);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
{
if (prop_id == PROP_EDITING_CANCELED + 1 + GTK_EDITABLE_PROP_EDITABLE)
{
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_READ_ONLY, !g_value_get_boolean (value),
-1);
}
return;
}
switch (prop_id)
{
case PROP_BUFFER:
case PROP_MAX_LENGTH:
case PROP_VISIBILITY:
case PROP_INVISIBLE_CHAR:
case PROP_INVISIBLE_CHAR_SET:
case PROP_ACTIVATES_DEFAULT:
case PROP_TRUNCATE_MULTILINE:
case PROP_OVERWRITE_MODE:
case PROP_IM_MODULE:
case PROP_INPUT_PURPOSE:
case PROP_INPUT_HINTS:
case PROP_ATTRIBUTES:
case PROP_TABS:
case PROP_ENABLE_EMOJI_COMPLETION:
g_object_set_property (G_OBJECT (priv->text), pspec->name, value);
break;
case PROP_PLACEHOLDER_TEXT:
gtk_entry_set_placeholder_text (entry, g_value_get_string (value));
break;
case PROP_HAS_FRAME:
gtk_entry_set_has_frame (entry, g_value_get_boolean (value));
break;
case PROP_PROGRESS_FRACTION:
gtk_entry_set_progress_fraction (entry, g_value_get_double (value));
break;
case PROP_PROGRESS_PULSE_STEP:
gtk_entry_set_progress_pulse_step (entry, g_value_get_double (value));
break;
2018-03-16 02:32:05 +00:00
case PROP_PAINTABLE_PRIMARY:
gtk_entry_set_icon_from_paintable (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_object (value));
break;
2018-03-16 02:32:05 +00:00
case PROP_PAINTABLE_SECONDARY:
gtk_entry_set_icon_from_paintable (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_object (value));
break;
case PROP_ICON_NAME_PRIMARY:
gtk_entry_set_icon_from_icon_name (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_string (value));
break;
case PROP_ICON_NAME_SECONDARY:
gtk_entry_set_icon_from_icon_name (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_string (value));
break;
case PROP_GICON_PRIMARY:
gtk_entry_set_icon_from_gicon (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_object (value));
break;
case PROP_GICON_SECONDARY:
gtk_entry_set_icon_from_gicon (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_object (value));
break;
case PROP_ACTIVATABLE_PRIMARY:
gtk_entry_set_icon_activatable (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_boolean (value));
break;
case PROP_ACTIVATABLE_SECONDARY:
gtk_entry_set_icon_activatable (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_boolean (value));
break;
case PROP_SENSITIVE_PRIMARY:
gtk_entry_set_icon_sensitive (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_boolean (value));
break;
case PROP_SENSITIVE_SECONDARY:
gtk_entry_set_icon_sensitive (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_boolean (value));
break;
case PROP_TOOLTIP_TEXT_PRIMARY:
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_string (value));
break;
case PROP_TOOLTIP_TEXT_SECONDARY:
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_string (value));
break;
case PROP_TOOLTIP_MARKUP_PRIMARY:
gtk_entry_set_icon_tooltip_markup (entry,
GTK_ENTRY_ICON_PRIMARY,
g_value_get_string (value));
break;
case PROP_TOOLTIP_MARKUP_SECONDARY:
gtk_entry_set_icon_tooltip_markup (entry,
GTK_ENTRY_ICON_SECONDARY,
g_value_get_string (value));
break;
case PROP_EDITING_CANCELED:
2014-06-07 18:08:28 +00:00
if (priv->editing_canceled != g_value_get_boolean (value))
{
priv->editing_canceled = g_value_get_boolean (value);
g_object_notify (object, "editing-canceled");
}
break;
2011-04-01 22:35:32 +00:00
case PROP_COMPLETION:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
2011-04-01 22:35:32 +00:00
gtk_entry_set_completion (entry, GTK_ENTRY_COMPLETION (g_value_get_object (value)));
G_GNUC_END_IGNORE_DEPRECATIONS
2011-04-01 22:35:32 +00:00
break;
case PROP_SHOW_EMOJI_ICON:
set_show_emoji_icon (entry, g_value_get_boolean (value));
break;
case PROP_EXTRA_MENU:
gtk_entry_set_extra_menu (entry, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_entry_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkEntry *entry = GTK_ENTRY (object);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
if (gtk_editable_delegate_get_property (object, prop_id, value, pspec))
return;
switch (prop_id)
{
case PROP_BUFFER:
case PROP_IM_MODULE:
case PROP_MAX_LENGTH:
case PROP_VISIBILITY:
case PROP_INVISIBLE_CHAR:
case PROP_INVISIBLE_CHAR_SET:
case PROP_ACTIVATES_DEFAULT:
case PROP_SCROLL_OFFSET:
case PROP_TRUNCATE_MULTILINE:
case PROP_OVERWRITE_MODE:
case PROP_PLACEHOLDER_TEXT:
case PROP_INPUT_PURPOSE:
case PROP_INPUT_HINTS:
case PROP_ATTRIBUTES:
case PROP_TABS:
case PROP_ENABLE_EMOJI_COMPLETION:
g_object_get_property (G_OBJECT (priv->text), pspec->name, value);
break;
case PROP_HAS_FRAME:
g_value_set_boolean (value, gtk_entry_get_has_frame (entry));
break;
case PROP_TEXT_LENGTH:
g_value_set_uint (value, gtk_entry_get_text_length (entry));
break;
case PROP_PROGRESS_FRACTION:
g_value_set_double (value, gtk_entry_get_progress_fraction (entry));
break;
case PROP_PROGRESS_PULSE_STEP:
g_value_set_double (value, gtk_entry_get_progress_pulse_step (entry));
break;
2018-03-16 02:32:05 +00:00
case PROP_PAINTABLE_PRIMARY:
g_value_set_object (value,
2018-03-16 02:32:05 +00:00
gtk_entry_get_icon_paintable (entry,
GTK_ENTRY_ICON_PRIMARY));
break;
2018-03-16 02:32:05 +00:00
case PROP_PAINTABLE_SECONDARY:
g_value_set_object (value,
2018-03-16 02:32:05 +00:00
gtk_entry_get_icon_paintable (entry,
GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_ICON_NAME_PRIMARY:
g_value_set_string (value,
gtk_entry_get_icon_name (entry,
GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_ICON_NAME_SECONDARY:
g_value_set_string (value,
gtk_entry_get_icon_name (entry,
GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_GICON_PRIMARY:
g_value_set_object (value,
gtk_entry_get_icon_gicon (entry,
GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_GICON_SECONDARY:
g_value_set_object (value,
gtk_entry_get_icon_gicon (entry,
GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_STORAGE_TYPE_PRIMARY:
g_value_set_enum (value,
gtk_entry_get_icon_storage_type (entry,
GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_STORAGE_TYPE_SECONDARY:
g_value_set_enum (value,
gtk_entry_get_icon_storage_type (entry,
GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_ACTIVATABLE_PRIMARY:
g_value_set_boolean (value,
gtk_entry_get_icon_activatable (entry, GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_ACTIVATABLE_SECONDARY:
g_value_set_boolean (value,
gtk_entry_get_icon_activatable (entry, GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_SENSITIVE_PRIMARY:
g_value_set_boolean (value,
gtk_entry_get_icon_sensitive (entry, GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_SENSITIVE_SECONDARY:
g_value_set_boolean (value,
gtk_entry_get_icon_sensitive (entry, GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_TOOLTIP_TEXT_PRIMARY:
g_value_take_string (value,
gtk_entry_get_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_TOOLTIP_TEXT_SECONDARY:
g_value_take_string (value,
gtk_entry_get_icon_tooltip_text (entry, GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_TOOLTIP_MARKUP_PRIMARY:
g_value_take_string (value,
gtk_entry_get_icon_tooltip_markup (entry, GTK_ENTRY_ICON_PRIMARY));
break;
case PROP_TOOLTIP_MARKUP_SECONDARY:
g_value_take_string (value,
gtk_entry_get_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY));
break;
case PROP_EDITING_CANCELED:
g_value_set_boolean (value,
priv->editing_canceled);
break;
2011-04-01 22:35:32 +00:00
case PROP_COMPLETION:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
2011-04-01 22:35:32 +00:00
g_value_set_object (value, G_OBJECT (gtk_entry_get_completion (entry)));
G_GNUC_END_IGNORE_DEPRECATIONS
2011-04-01 22:35:32 +00:00
break;
case PROP_SHOW_EMOJI_ICON:
g_value_set_boolean (value, priv->show_emoji_icon);
break;
case PROP_EXTRA_MENU:
g_value_set_object (value, gtk_entry_get_extra_menu (entry));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
activate_cb (GtkText *text, GtkEntry *entry)
{
g_signal_emit (entry, signals[ACTIVATE], 0);
}
static void
notify_cb (GObject *object,
GParamSpec *pspec,
gpointer data)
{
gpointer iface;
gpointer class;
/* The editable interface properties are already forwarded by the editable delegate setup */
iface = g_type_interface_peek (g_type_class_peek (G_OBJECT_TYPE (object)), gtk_editable_get_type ());
class = g_type_class_peek (GTK_TYPE_ENTRY);
if (!g_object_interface_find_property (iface, pspec->name) &&
g_object_class_find_property (class, pspec->name))
g_object_notify (data, pspec->name);
}
static void
connect_text_signals (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_signal_connect (priv->text, "activate", G_CALLBACK (activate_cb), entry);
g_signal_connect (priv->text, "notify", G_CALLBACK (notify_cb), entry);
}
static void
disconnect_text_signals (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_signal_handlers_disconnect_by_func (priv->text, activate_cb, entry);
g_signal_handlers_disconnect_by_func (priv->text, notify_cb, entry);
}
static void
catchall_click_press (GtkGestureClick *gesture,
int n_press,
double x,
double y,
gpointer user_data)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
1997-11-24 22:37:52 +00:00
static void
gtk_entry_init (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
GtkGesture *catchall;
priv->text = gtk_text_new ();
gtk_widget_set_parent (priv->text, GTK_WIDGET (entry));
gtk_editable_init_delegate (GTK_EDITABLE (entry));
connect_text_signals (entry);
catchall = gtk_gesture_click_new ();
g_signal_connect (catchall, "pressed",
G_CALLBACK (catchall_click_press), entry);
gtk_widget_add_controller (GTK_WIDGET (entry),
GTK_EVENT_CONTROLLER (catchall));
priv->editing_canceled = FALSE;
}
1997-11-24 22:37:52 +00:00
static void
gtk_entry_dispose (GObject *object)
1997-11-24 22:37:52 +00:00
{
GtkEntry *entry = GTK_ENTRY (object);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
gtk_entry_set_icon_from_paintable (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
gtk_entry_set_icon_tooltip_markup (entry, GTK_ENTRY_ICON_SECONDARY, NULL);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_entry_set_completion (entry, NULL);
G_GNUC_END_IGNORE_DEPRECATIONS
if (priv->text)
{
disconnect_text_signals (entry);
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
}
g_clear_pointer (&priv->text, gtk_widget_unparent);
1997-11-24 22:37:52 +00:00
G_OBJECT_CLASS (gtk_entry_parent_class)->dispose (object);
}
Remove all references to offscreen flag which was no longer used. Thu Jun 1 23:05:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Remove all references to offscreen flag which was no longer used. * gtk/gtkprivate.h (enum): Remove unused flags and compress. * gtk/gtkframe.c (gtk_frame_set_label_widget): Check for non-null label_widget->parent. * gtk/gtkentry.c: Get rid of code to deal with PangoAttribute which no longer was used. * gdk/gdkpango.c (gdk_pango_context_get_info): make static. * gdk/gdkpango.c (gdk_draw_layout[_line]): Add checks for null arguments. * gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): add check for destroyed windows. Thu Jun 1 13:48:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmulticontext.c: Add a finalize method and unref the slave context there. * gtk/gtkinvisible.[ch]: Make reference counting behavior identical to GtkWindow. Thu Jun 1 01:54:11 2000 Owen Taylor <otaylor@redhat.com> * Makefile.am gdk/gdkpango.c: Copy the layout render function from pangox to here, so we can write them independent of rendering system, using GDK primitives. * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Remove draw_layout() from the vtable, since we have a rendering-system independent implementation in terms of draw_glyphs(). * gdk/gdkpango.c gdkdrawable.h (gdk_draw_layout_line): New function to render a single line. * gdk/x11/gdkpango.c: Move the guts of this file mostly into ../gdkpango.c, which simplifies things, since we don't have to deal with raw X gc's. Fri May 19 04:28:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add get_log_attrs() function to get the logical attributes for a given GtkTextLine. Tue May 30 16:05:39 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Track g_locale_get_codeset() to g_get_codeset() change. Tue May 30 15:03:19 2000 Owen Taylor <otaylor@redhat.com> * gtk/testcalendar.c (calendar_font_selection_ok): Use font descriptions. * gtk/gtkentry.c (gtk_entry_draw_text): Center text within the entry. * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Start of redoing (vastly simplifying) for Pango. Still needs quite a bit of work. (Size selection is currently poor. List of predefined sizes is not a good idea, since all of these sizes won't necessarily be distinct.) Tue May 30 13:50:19 2000 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkfont-x11.c (gdk_font_charset_for_locale): Handle CODESET results for LANG=C. Mon May 29 15:49:10 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkrc.[ch]: Add a 'font_name' declaration to RC which takes a stringized pango font description; ignore the older 'font' and 'fontset' declarations. * gtk/gtkstyle.c gtk/gtkrc.c: Fill in the style->font field with a GdkFont derived via gdk_font_from_description(), for compatibility. (Should we just remove it entirely? Probably too much compatibility breakage, but people should be migrating to the new Pango stuff as quickly as possible.) Mon May 29 15:47:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtkclist.c: s/pango_font_unref/g_object_unref/. Mon May 29 15:44:46 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcalender.c: Roughly pango-ized. Really needs redoing; there are some bugs in size allocation right now, the semi-existant distinction between header / day fonts was removed, but, with Pango, could actually be made functional in a nice way. * gtk/testcalender: Move calender from examples into this directory as a test program. (We really need to restrcture testgtk into a whole directory full of tests for every widget or functionality group, separated into multiple .c files.) Mon May 29 15:19:56 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c (file_exists): Fix stupid typo that was keeping RC file from being loaded. * gtk/testgtkrc gtk/testgtkrc2: Test new pango-ized RC file font code. Mon May 29 14:31:27 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkfont.h gdk/x11/gdkfont-x11.c (gdk_font_from_description): Add function to load a GdkFont from a PangoFontDescription. Fri May 26 17:16:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/frame.[ch] gtkaspectframe.c: Make frame widgets able to have any widget for the label, use a GtkLabel widget to display the text. (Based partially on a patch from Anders Carlson.) (Quite a bit of code reorganization - strip 90% of the guts out of gtkaspectframe and add a single virtual func to GtkFrameClass - compute_child_allocation.) Fri May 26 12:00:02 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkctree.c gtk/gtkclist.[ch]: Pangoized. (Removed clist->row_center_offset field because caching it wasn't saving time or code, added private function _gtk_clist_create_cell_layout()). Wed May 24 15:59:37 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkaccellabel.c: Pangoized. * gtk/[hv]ruler.c: Pangoized Mon May 22 19:23:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkfilesel.c (gtk_file_selection_init): Use gtk_clist_set_column_auto_resize() to remove need need for manual column width computations. Mon May 22 18:50:26 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktooltips.[ch]: Replace custom drawing with a GtkLabel, ensuring Pango correctness, and considerably simplifying the code. * gtk/gtklabel.c gtk[hv]scale.c: 1000 => PANGO_SCALE. * gtk/gtklabel.c (gtk_label_size_request): Fixed incorrect getting of numbers of lines. * gtk/gtklabel.c (gtk_label_size_request): Set the requisition to the actual requested width of the lable, not to the wrap width we set. * gtk/gtktextchild.h: Remove extraneous include of gtk/gtk.h. * gtk/gtktextbtree.c gtk/gtktextbuffer.c gtk/gtktextlayout.c gtk/gtktextview.c gtk/gtktextview.[ch]: Fix up includes. * gtk/gtktextview.c: Fix structure inheritance. * gtk/gtkprogressbar.c: Pangoize. Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate in a function. * gtk/gtktextlayout.c (find_display_line_above): Fixed bug with computing line tops. * gtk/gtktextview.c (changed_handler): Fix < , <= confusion. Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset and y_offset coordinates to do what we need now. (The offset between buffer and layout coordinates has been reintroduced, but is a bit different than before.) * gtk/gtktextview.[ch]: No longer inherit from GtkLayout; instead handle the adjustments ourselves, and scroll as necessary using the new gdk_window_scroll(). The advantage of this is that when we are incrementally revalidating, we are essentially rearranging things around the visible portion of the screen. With the old setup, the visible portion of the screen was moved around in the layout, so scrolling and redrawing to track that caused jumping of the display. Since we now control the scrolling ourselves, we can suppress this and only redraw when things actually change. Thu May 18 18:47:25 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (redisplay_mark): We need to invalidate the region not just redisplay it after-all, since we store the cursors in the LineDisplay. (Ugly interactions here between GtkLayout and GtkTextBTree here.) * gtk/gtktextbtree.c (redisplay_region): Fixed reversed comparison. Thu May 18 18:43:21 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkwindow.h gdk/x11/gdkgeometry-x11.c (gdk_window_scroll): Added function to scroll contents of a window while keeping the window constant. Works by XCopyArea or guffaw-scrolling depending on the details of how the window is set up. (guffaw-scrolling still needs to be filled in.) Wed May 17 22:36:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextiter.c gtk/gtkmain.c: Add a debug key for the text widget, move the debugging that was tied to a global variable to that. * gtk/gtkmarshal.list: Add NONE:INT,INT,INT * gtk/gtktextbtree.[ch] gtk/gtktextlayout.c: Keep a separate validated flag, in line data instead of setting height/width to -1. This allows us to perform operations with partially invalid buffer (using the old size for invalid lines) and thus to do incremental vaidation. Keep height/width aggregates up to date when deleting text and rebalancing the tree. * gtk/gtktextbtree.[ch]: Add functions validate a line (gtk_text_btree_validate_line), and to validate up to a number of pixels (gtk_text_btree_validate). * gtk/gtktextlayout.[ch]: Add an ::invalidated signal that indicates that something is changed and a revalidation pass is needed. Change ::need_repaint to ::changed, and make it take old and new yranges instead of a rectangle. * gtk/gtktextbtree.[ch] gtk/gtktextlayout.[ch]: Move the line_data_destroy() function from gtk_text_btree_add_view() to a virtual function in GtkTextLayout * gtk/gtktextbtree.[ch]: Remove gtk_text_btree_get_damage_range(), since we are handling partial repaints in a different fashion now. * gtk/gtktextbtree.[ch]: Only repaint the changed portion of the selection instead of queueing a repaint on the entire widget. * gtk/gtktextbuffer.[ch] gtk/gtktextbtree.[ch]: Move get_selection_bounds() down to btree, make the function in buffer a wrapper around the btree function. * gtk/gtktextlayout.[ch]: Add functions to check if the layout is valid and to recompute either a range of pixels aroudn a line or a certain total number of pixels. * gtk/gtktextlayout.[ch]: Cache a single line display; now that we only redraw the needed portions, the hit rate for this cache is quite high. * gtk/gtktextview.[ch]: Keep track of the first paragraph on the screen so that when re-laying-out the buffer, we can keep the same place. This requires connecting to ::value_changed on the adjustments * gtk/gtktextview.[ch]: Add idle functions to revalidate the buffer after we receive an ::invalidated signal. Wed May 17 22:10:47 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_size_allocate): Set upper to max of allocation and layout size, not just to the layout size. * gtk/gtk[hv]scrollbar.c (gtk_[hv]scrollbar_calc_slider_size): Invalidate window so it gets redrawn properly. * gdk/gdkwindow.c (gdk_window_invalidate_rect): Allow rect == NULL to mean the entire window. * gdk/gdkevents.h: Move definition for GDK_PRIORITY_REDRAW into public header. Mon May 15 14:51:31 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextmark.c (gtk_text_mark_get_name): Add function to get the name of a mark. * gtk/gtktextlayout.c (gtk_text_layout_get_line_at_y): Add a function to find the paragraph from a y position. Thu May 11 12:57:20 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextbtree.c (gtk_text_btree_node_invalidate_upward): Valid nodes have width/height >= 0, not > 0. Tue May 9 21:29:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c (gtk_text_layout_get_line_display): Add a size_only flag, so when we only need the size, we don't create useless appearance attributes. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Remove duplicate setting of font description. * gtk/gtkscale.c: Use PANGO_SCALE instead of 1000 Wed Apr 26 01:53:23 2000 Owen Taylor <otaylor@redhat.com> * gtk/Makefile.am (EXTRA_DIST): Add OLD_STAMP into EXTRA_DIST. It does not work well when the file that everything depends on is not in the tarball. Wed Apr 26 00:56:14 2000 Owen Taylor <otaylor@redhat.com> * gtk/testgtk.c: Some hacks and fixes so that it basically works when not sitting in the GTK+ build tree. 2000-05-03 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (gtk_text_line_next_could_contain_tag): Properly determine the ordering of the tag root and the current line within the tree. Previous algorithm only worked if the tag root's immediate parent was the common root of both the current line and the tag root. Wed Apr 26 00:43:00 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (set_para_values): Fix some bugs in alignment. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Track the widget text directional dynamically. * gtk/gtktextview.[ch]: Added functions to get and set default wrap mode. Tue Apr 25 23:47:38 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_get_iter_location): Fix bug in cursor location computation. Tue Apr 25 23:22:59 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c (gtk_layout_set_size): Clamp hadjustment/ vadjusment values properly when layout gets smaller. * gtk/gtktextview.c (need_repaint_handler): Areas being passed in are far completely inaccurate, and sometimes too small, so, for now, just queue a redraw on the whole visible region. 2000-04-25 Havoc Pennington <hp@redhat.com> * gtk/gtktextbtree.c (summary_destroy): new function to destroy tag summary nodes (gtk_text_line_next_could_contain_tag): this function was totally broken if the line passed in wasn't below the tag root. Fix it. (gtk_text_btree_first_could_contain_tag): In the tag == NULL "wildcard" case, we have to do a linear scan. Blah. (gtk_text_btree_last_could_contain_tag): In tag == NULL case, we have to do the linear scan (tag_removed_cb): When a tag is removed from the tag table, remove the GtkTextTagInfo node from the btree. (gtk_text_btree_spew): Implement the spew function, for our debugging pleasure. Tue Apr 25 19:40:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (gtk_text_layout_set_buffer): Fix a problem with referring to the wrong buffer. * gtk/gtkentry.c: Fix focus-in/focus-out confusion. * gtk/gtkrc.c gtk/gtkstyle.c: Moving setting default font description to gtk_style_new() - otherwise things don't work without a .gtkrc file. * gtk/gtktextbuffer.c (gtk_text_buffer_new): Sink the tags table if we create it ourself, too. * gdk/gdktypes.h (enum): Move GDK_RELEASE_MASK, since it was conflicting with XKB modifiers. * gtk/gtktextview.[ch]: Add simple support for GtkIMContext. Mon Apr 24 19:34:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_move_cursor_visually): Fix problem with deletion from last commit. Mon Apr 24 19:29:40 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c (gtk_widget_create_pango_context): Set the language in the context from the current locale. * gtk/gtkentry.c (gtk_entry_size_request): Use language from the context, not hardcoded value. * gtk/gtkentry.c (gtk_entry_move_cursor): Make character movement visual, not logical. Sun Apr 23 23:39:18 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtktextdisplay.c: Don't handle selections as attributes - that doesn't handle partial-glyph selection properly. Instead use new pango_layout_line_get_x_ranges() functionality to draw the selection. * gtk/gtkentry.c: Simplify code since pango_layout_line_index_to_x() now properly handles out-of-range coordinates. * gtk/gtktextbuffer.c: Emit "mark_set" when the cursor is moved. * gtk/gtktextiter.h gtk/gtktextiterprivate.h: Make gtk_text_iter_get_line_byte() public. * gtk/gtktextlayout.[ch]: Properly set the direction in the PangoContext for paragraphs opposite to the base direction of the widget. * gtk/gtktextlayout.[ch] gtk/gtktextdisplay.c: Fixes for alignment. * gtk/gtktextlayout.c: Don't split segments on marks, since that causes Arabic words to reshape as you cursor through. * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Implement virtual cursor position when moving vertically with the arrow keys and scrolling with page-up/page-down. (Arrow keys save only the X, scrolling saves both X and Y.) This means you can line-up / line-down or page-up / page-down without losing your place, and also that moving vertically with the cursor keys keeps the same X position, not the same character count: * gtk/gtktextlayout.[ch] gtk/gtktextview.[ch]: Make vertical arrow keys move by display lines, not paragraphs. Tue Apr 18 14:16:50 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtklayout.c: Make sure that the bin window is at least as big as the allocation. (Should we also make sure that the bin window is big enough to completely cover widget->window?) * gtk/gtktextview.c (gtk_text_view_get_visible_rect): Add function to get the onscreen rectangle. * gdk/x11/gdkwindow-x11.c (gdk_window_get_pointer): Correctly account for offsets in window coordinates. Sun Apr 16 16:13:27 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c (gtk_entry_get_cursor_locations): Fix index/offset confusion. * gtk/gtktextview.c (gtk_text_view_ensure_layout): Set the default direction from the widget direction. * gtk/gtktexttag.c gtk/gtktexttagprivate.h (gtk_text_tag_set_arg): Add a "direction" attribute. * gtk/gtktextview.c: global s/tkxt/text_view/. * gtk/testtext.c: Added long block of text in Arabic, to test out the direction attributes. (Some problems with the shaping system for arabic become obvious - like the fact the cursor splits words into unjoined pieces.) Fri Apr 14 12:54:34 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextdisplay.c (render_layout): Add overstrike handling. * gtk/gtktextlayout.c: Fix up alignment. * gtk/testtext.c: Add some tests for centering, wrapping. Fri Apr 14 09:26:22 2000 Owen Taylor <otaylor@redhat.com> * gdk/gdkdrawable.h gdk/gdkdraw.c gdk/gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add a draw_glyphs() operation to the drawable vtable and gdk_draw_glyphs(). If we wrote GTK+-specific layout-render function this could just replace the draw_layout() operation in the vtable. * gtk/gtkentry.c: Move guts of gtk_entry_get_cursor_locations to pango_layout_get_cursor_pos() and use that function. * gtk/gtktextchild.[ch]: add gtk_ onto pixmap_segment_new(), since it is a non-static symbol. * gtk/gtktextbtree.[ch]: Replace gtk_text_btree_find_line_data_by_y() with gtk_text_btree_find_line_by_y() * gtk/gtktextdisplay.c: Rewrote for Pango - uses a custom layout renderer that handles GtkTextAppearance attributes. * gtk/gtktexttag.[ch] gtk/gtktexttagprivate.h: - Move the values in the style that don't affect geometry into a GtkTextAppearance structure. - Change underline to take a PangoUnderline and "font" a string representation of a font description - Add a "font_desc" attribute which takes a FontDescription structure. * gtk/gtktextlayout.[ch]: - Get rid of the display-line list per each line. Instead, we generate, on demand, a GtkTextLineDisplay structure which] contains a PangoLayout * and other necesary information (offsets, cursor locations) for displaying a paragraph. - Get rid of the code to wrap lines, create display chunks, etc. Instead, we just go through a paragraph and convert it into the necessary inputs to a PangoLayout. - Implement a new attribute type, GtkTextAttrAppearance. This holds a GtkTextAppearance, and is used to pass colors, stipple, etc, through from the layout to the display without having to use lots and lots of individual attributes. - Reimplement gtk_layout_get_iter_at_pixel() gtk_layout_get_iter_pos() in terms of PangoLayout functions. * gtk/gtktextview.c: - Handle passing the necessary PangoContext to the layout - Some fixups in painting to deal with the automatic backing store and offsetting of GTK+-1.4 - Add a style_set handler so that the default style reacts properly to theme changes. * gtk/gtktext?*.[ch]: Random code-style fixes. * gtk/testtext.c: Substitute in languages that Pango handles now for Thai Mon Apr 10 10:33:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktext?*.[ch]: Check in Havoc's port of the Tk text widget, in original form preparatory to Pango-ization and gdkimcontext-ization. Thu Apr 6 19:25:39 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.c: Move default implementations to real_* vfuncs, so that we can derive from gtkimcontext in language bindings properly. Thu Apr 6 16:02:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.[ch]: Use gdk_keyval_to_unicode to gdk_unicode_to_keyval. Add a compose table including (almost) all the compose combinations from X. This is 6k of static, shared data as opposed to 50k or so of dynamic data in the XIM implementation. * gdk/gdk.h gdk/gdkkeyuni.c gdk/win32/gdkevents-win32.c (gdk_keyval_to_unicode, gdk_unicode_to_keyval): Moved functions to convert keyvalues from and to unicode here from the win32 port and made them public. Wed Apr 5 16:37:29 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.c (gtk_editable_insert_text): Allow new_text_length == -1. Wed Apr 5 16:27:45 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext.[ch]: Base class for new input context system * gtk/gtkimmulticontext.[ch]: Proxy input context that allows the real input context implementation to be loaded from modules and switched on the fly. * gtk/gtkcontextsimple.[ch]: Simple implementation of an input context that just does direct keysymbol => unicode translation. * gtk/gtkentry.[ch]: Start switching editing over to using GtkInputContext. (No handling of preedit yet.) Wed Apr 5 15:48:41 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktypeutils.h (GTK_CHECK_GET_CLASS): Fix problem with one too many substitutions. (klass should not be subsituted.) Wed Apr 5 00:18:14 2000 Owen Taylor <otaylor@redhat.com> * configure.in: Add checks for Pango * configure.in docs/Makefile.am: Add test for sgml2html and allow 'make dist' without building html, but print out warnings in that case. (For making snapshots) * gdk/Makefile.am gdk/x11/Makefile.am gtk/Makefile.am: Add Pango libraries and C flags * gdk/gdkdraw.c gdk/gdkdrawable.h gdkwindow.c gdk/x11/gdkdrawable-x11.c: Add function (gdk_draw_layout) to draw a pango layout. * gdk/gdkpango.h gdk/x11/gdkpango-x11.c: New file with functions for getting Pango contexts for GDK. * gtk/gtkeditable.c: Get rid of dead code gtk_editable_parent_set() * gtk/gtkentry.[ch]: Complete rewrite to use Pango, add bidirectional editing. * gtk/gtkentry.c: Hack in simple Hebrew input with direct keysym => unicode translations. More languages can be added here, but real input-method support is needed. * docs/Changes-1.4.txt: Added note about entry behavior. * gtk/gtkenums.h gtk/gtkwidget.[ch] testgtk.c gtkprivate.h: Add functions to set the reading direction for a widget and the global direction. Add test which allows toggling the global direction. Two private flags are used to store the direction. (GTK_DIRECTION_SET + GTK_DIRECTION_LTR) * gtk/gtkcheckbutton.c gtk/gtkframe.c gtk/gtkhbbox.c gtk/gtkhbox.c gtk/gtkradiobutton.c gtk/gtkspinbutton.c gtk/gtktable.c * gtk/gtk[hv]scale.c gtk/gtkscale.[ch]: Draw numbers using Pango * gtk/gtklabel.[ch]: Moved to Pango and considerably rewritten. Line breaking, underlining now handled by Pango. * gtk/gtkstyle.[ch] gtk/gtkrc.[ch]: Add a PangoFontDescription to RCStyle and Style. (Having both this and the old font name and GdkFont is temporary.) * gtk/gtkwidget.[ch] (gtk_widget_create_pango_{context,layout}): Added convenience functions for creating contexts and layouts for widgets. * gtk/testgtk.c: Enhance label tests with multilingual labels.
2000-06-02 03:14:07 +00:00
static void
gtk_entry_finalize (GObject *object)
{
GtkEntry *entry = GTK_ENTRY (object);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info = NULL;
2020-07-24 13:54:49 +00:00
int i;
for (i = 0; i < MAX_ICONS; i++)
{
icon_info = priv->icons[i];
if (icon_info == NULL)
continue;
g_clear_object (&icon_info->content);
2011-11-30 14:43:09 +00:00
2017-06-16 09:19:52 +00:00
gtk_widget_unparent (icon_info->widget);
g_slice_free (EntryIconInfo, icon_info);
}
g_clear_pointer (&priv->progress_widget, gtk_widget_unparent);
G_OBJECT_CLASS (gtk_entry_parent_class)->finalize (object);
}
static void
update_icon_style (GtkWidget *widget,
GtkEntryIconPosition icon_pos)
{
GtkEntry *entry = GTK_ENTRY (widget);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info = priv->icons[icon_pos];
const char *sides[2] = { "left", "right" };
if (icon_info == NULL)
return;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
icon_pos = 1 - icon_pos;
gtk_widget_add_css_class (icon_info->widget, sides[icon_pos]);
gtk_widget_remove_css_class (icon_info->widget, sides[1 - icon_pos]);
}
static void
update_node_ordering (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
GtkEntryIconPosition first_icon_pos, second_icon_pos;
if (priv->progress_widget)
gtk_widget_insert_before (priv->progress_widget, GTK_WIDGET (entry), NULL);
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
{
first_icon_pos = GTK_ENTRY_ICON_SECONDARY;
second_icon_pos = GTK_ENTRY_ICON_PRIMARY;
}
else
{
first_icon_pos = GTK_ENTRY_ICON_PRIMARY;
second_icon_pos = GTK_ENTRY_ICON_SECONDARY;
}
icon_info = priv->icons[first_icon_pos];
2015-12-14 04:22:08 +00:00
if (icon_info)
gtk_widget_insert_after (icon_info->widget, GTK_WIDGET (entry), NULL);
icon_info = priv->icons[second_icon_pos];
if (icon_info)
gtk_widget_insert_before (icon_info->widget, GTK_WIDGET (entry), NULL);
}
static GtkEntryIconPosition
get_icon_position_from_controller (GtkEntry *entry,
GtkEventController *controller)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
GtkWidget *widget = gtk_event_controller_get_widget (controller);
if (priv->icons[GTK_ENTRY_ICON_PRIMARY] &&
priv->icons[GTK_ENTRY_ICON_PRIMARY]->widget == widget)
return GTK_ENTRY_ICON_PRIMARY;
else if (priv->icons[GTK_ENTRY_ICON_SECONDARY] &&
priv->icons[GTK_ENTRY_ICON_SECONDARY]->widget == widget)
return GTK_ENTRY_ICON_SECONDARY;
g_assert_not_reached ();
return -1;
}
static void
icon_pressed_cb (GtkGestureClick *gesture,
2020-07-24 13:54:49 +00:00
int n_press,
2020-07-24 20:32:16 +00:00
double x,
double y,
GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
GtkEntryIconPosition pos;
EntryIconInfo *icon_info;
pos = get_icon_position_from_controller (entry, GTK_EVENT_CONTROLLER (gesture));
icon_info = priv->icons[pos];
if (!icon_info->nonactivatable)
g_signal_emit (entry, signals[ICON_PRESS], 0, pos);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
icon_released_cb (GtkGestureClick *gesture,
2020-07-24 13:54:49 +00:00
int n_press,
2020-07-24 20:32:16 +00:00
double x,
double y,
GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
GtkEntryIconPosition pos;
EntryIconInfo *icon_info;
pos = get_icon_position_from_controller (entry, GTK_EVENT_CONTROLLER (gesture));
icon_info = priv->icons[pos];
if (!icon_info->nonactivatable)
g_signal_emit (entry, signals[ICON_RELEASE], 0, pos);
}
static void
icon_drag_update_cb (GtkGestureDrag *gesture,
double offset_x,
double offset_y,
GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
GtkEntryIconPosition pos;
EntryIconInfo *icon_info;
pos = get_icon_position_from_controller (entry, GTK_EVENT_CONTROLLER (gesture));
icon_info = priv->icons[pos];
if (icon_info->content != NULL &&
gtk_drag_check_threshold_double (icon_info->widget, 0, 0, offset_x, offset_y))
{
GdkPaintable *paintable;
GdkSurface *surface;
GdkDevice *device;
GdkDrag *drag;
double start_x, start_y;
icon_info->in_drag = TRUE;
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (entry)));
device = gtk_gesture_get_device (GTK_GESTURE (gesture));
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
drag = gdk_drag_begin (surface, device, icon_info->content, icon_info->actions, start_x, start_y);
paintable = gtk_widget_paintable_new (icon_info->widget);
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
g_object_unref (paintable);
g_object_unref (drag);
}
}
static EntryIconInfo*
construct_icon_info (GtkWidget *widget,
GtkEntryIconPosition icon_pos)
{
GtkEntry *entry = GTK_ENTRY (widget);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
GtkGesture *drag, *press;
g_return_val_if_fail (priv->icons[icon_pos] == NULL, NULL);
icon_info = g_slice_new0 (EntryIconInfo);
priv->icons[icon_pos] = icon_info;
2017-06-16 09:19:52 +00:00
icon_info->widget = gtk_image_new ();
gtk_widget_set_cursor_from_name (icon_info->widget, "default");
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
gtk_widget_insert_before (icon_info->widget, widget, priv->text);
else
gtk_widget_insert_after (icon_info->widget, widget, priv->text);
2015-12-14 04:22:08 +00:00
update_icon_style (widget, icon_pos);
update_node_ordering (entry);
press = gtk_gesture_click_new ();
g_signal_connect (press, "pressed", G_CALLBACK (icon_pressed_cb), entry);
g_signal_connect (press, "released", G_CALLBACK (icon_released_cb), entry);
gtk_widget_add_controller (icon_info->widget, GTK_EVENT_CONTROLLER (press));
drag = gtk_gesture_drag_new ();
g_signal_connect (drag, "drag-update",
G_CALLBACK (icon_drag_update_cb), entry);
gtk_widget_add_controller (icon_info->widget, GTK_EVENT_CONTROLLER (drag));
gtk_gesture_group (press, drag);
return icon_info;
}
static void
gtk_entry_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkEntry *entry = GTK_ENTRY (widget);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
int i;
gtk_widget_measure (priv->text,
orientation,
for_size,
minimum, natural,
minimum_baseline, natural_baseline);
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
int icon_min, icon_nat;
if (!icon_info)
continue;
gtk_widget_measure (icon_info->widget,
GTK_ORIENTATION_HORIZONTAL,
-1, &icon_min, &icon_nat, NULL, NULL);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
*minimum += icon_min;
*natural += icon_nat;
}
else
{
*minimum = MAX (*minimum, icon_min);
*natural = MAX (*natural, icon_nat);
}
}
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
{
int prog_min, prog_nat;
gtk_widget_measure (priv->progress_widget,
orientation,
for_size,
&prog_min, &prog_nat,
NULL, NULL);
*minimum = MAX (*minimum, prog_min);
*natural = MAX (*natural, prog_nat);
}
1997-11-24 22:37:52 +00:00
}
static void
gtk_entry_size_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
1997-11-24 22:37:52 +00:00
{
const gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
2017-05-04 16:58:47 +00:00
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
2020-07-24 13:54:49 +00:00
int i;
GtkAllocation text_alloc;
text_alloc.x = 0;
text_alloc.y = 0;
text_alloc.width = width;
text_alloc.height = height;
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
GtkAllocation icon_alloc;
int icon_width;
if (!icon_info)
continue;
2017-06-16 09:19:52 +00:00
gtk_widget_measure (icon_info->widget,
GTK_ORIENTATION_HORIZONTAL,
-1,
NULL, &icon_width,
2017-06-16 09:19:52 +00:00
NULL, NULL);
if ((is_rtl && i == GTK_ENTRY_ICON_PRIMARY) ||
(!is_rtl && i == GTK_ENTRY_ICON_SECONDARY))
icon_alloc.x = width - icon_width;
else
icon_alloc.x = 0;
icon_alloc.y = 0;
icon_alloc.width = icon_width;
icon_alloc.height = height;
gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline);
text_alloc.width -= icon_width;
if ((!is_rtl && i == GTK_ENTRY_ICON_PRIMARY) ||
(is_rtl && i == GTK_ENTRY_ICON_SECONDARY))
text_alloc.x += icon_width;
}
gtk_widget_size_allocate (priv->text, &text_alloc, baseline);
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
{
GtkAllocation progress_alloc;
int min, nat;
gtk_widget_measure (priv->progress_widget,
GTK_ORIENTATION_VERTICAL,
-1,
&min, &nat,
NULL, NULL);
progress_alloc.x = 0;
progress_alloc.y = height - nat;
progress_alloc.width = width;
progress_alloc.height = nat;
gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1);
}
/* Do this here instead of gtk_entry_size_allocate() so it works
* inside spinbuttons, which don't chain up.
*/
if (gtk_widget_get_realized (widget))
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkEntryCompletion *completion;
completion = gtk_entry_get_completion (entry);
if (completion)
_gtk_entry_completion_resize_popup (completion);
G_GNUC_END_IGNORE_DEPRECATIONS
}
}
2017-05-04 16:58:47 +00:00
static void
gtk_entry_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
2017-05-04 16:58:47 +00:00
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
2016-11-14 00:52:22 +00:00
int i;
2016-11-14 00:52:22 +00:00
/* Draw progress */
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
gtk_widget_snapshot_child (widget, priv->progress_widget, snapshot);
2016-11-14 00:52:22 +00:00
gtk_widget_snapshot_child (widget, priv->text, snapshot);
2016-11-14 00:52:22 +00:00
/* Draw icons */
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
if (icon_info != NULL)
2017-06-16 09:19:52 +00:00
gtk_widget_snapshot_child (widget, icon_info->widget, snapshot);
2016-11-14 00:52:22 +00:00
}
}
/**
* gtk_entry_grab_focus_without_selecting:
* @entry: a `GtkEntry`
*
* Causes @entry to have keyboard focus.
*
* It behaves like [method@Gtk.Widget.grab_focus], except that it doesn't
* select the contents of the entry. You only want to call this on some
* special entries which the user usually doesn't want to replace all text
* in, such as search-as-you-type entries.
*
* Returns: %TRUE if focus is now inside @self
*/
gboolean
gtk_entry_grab_focus_without_selecting (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
return gtk_text_grab_focus_without_selecting (GTK_TEXT (priv->text));
}
static void
gtk_entry_direction_changed (GtkWidget *widget,
GtkTextDirection previous_dir)
{
GtkEntry *entry = GTK_ENTRY (widget);
update_icon_style (widget, GTK_ENTRY_ICON_PRIMARY);
update_icon_style (widget, GTK_ENTRY_ICON_SECONDARY);
update_node_ordering (entry);
GTK_WIDGET_CLASS (gtk_entry_parent_class)->direction_changed (widget, previous_dir);
}
/* GtkCellEditable method implementations
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
gtk_cell_editable_entry_activated (GtkEntry *entry, gpointer data)
{
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
}
static gboolean
gtk_cell_editable_entry_key_pressed (GtkEventControllerKey *key,
guint keyval,
guint keycode,
GdkModifierType modifiers,
GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
if (keyval == GDK_KEY_Escape)
{
priv->editing_canceled = TRUE;
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
return GDK_EVENT_STOP;
}
/* override focus */
if (keyval == GDK_KEY_Up || keyval == GDK_KEY_Down)
{
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
return GDK_EVENT_STOP;
}
return GDK_EVENT_PROPAGATE;
}
static void
gtk_entry_start_editing (GtkCellEditable *cell_editable,
GdkEvent *event)
{
g_signal_connect (cell_editable, "activate",
G_CALLBACK (gtk_cell_editable_entry_activated), NULL);
g_signal_connect (gtk_entry_get_key_controller (GTK_ENTRY (cell_editable)),
"key-pressed",
G_CALLBACK (gtk_cell_editable_entry_key_pressed),
cell_editable);
}
G_GNUC_END_IGNORE_DEPRECATIONS
/* Internal functions
*/
/**
* gtk_entry_reset_im_context:
* @entry: a `GtkEntry`
*
* Reset the input method context of the entry if needed.
*
* This can be necessary in the case where modifying the buffer
* would confuse on-going input method behavior.
*/
void
gtk_entry_reset_im_context (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_reset_im_context (GTK_TEXT (priv->text));
}
static void
gtk_entry_clear_icon (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info = priv->icons[icon_pos];
GtkImageType storage_type;
if (icon_info == NULL)
return;
storage_type = gtk_image_get_storage_type (GTK_IMAGE (icon_info->widget));
if (storage_type == GTK_IMAGE_EMPTY)
return;
g_object_freeze_notify (G_OBJECT (entry));
switch (storage_type)
{
case GTK_IMAGE_PAINTABLE:
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_PAINTABLE_PRIMARY
: PROP_PAINTABLE_SECONDARY]);
break;
case GTK_IMAGE_ICON_NAME:
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_ICON_NAME_PRIMARY
: PROP_ICON_NAME_SECONDARY]);
break;
case GTK_IMAGE_GICON:
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_GICON_PRIMARY
: PROP_GICON_SECONDARY]);
break;
case GTK_IMAGE_EMPTY:
default:
g_assert_not_reached ();
break;
}
gtk_image_clear (GTK_IMAGE (icon_info->widget));
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_STORAGE_TYPE_PRIMARY
: PROP_STORAGE_TYPE_SECONDARY]);
g_object_thaw_notify (G_OBJECT (entry));
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
}
/* Public API
*/
adapt to handle PangoColor 2001-01-26 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (convert_color): adapt to handle PangoColor * gtk/gtktreeview.c (gtk_tree_view_widget_to_tree_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT (gtk_tree_view_tree_to_widget_coords): fix to not offset by TREE_VIEW_HEADER_HEIGHT * configure.in (included_loaders): for me, --with-included-loaders generates the error "the specified loader yes does not exist", i.e. the arg defaults to "yes", so change test for value "" to test for value "yes", and include all loaders in that case. * gtk/gtkrbtree.c (_gtk_rbtree_get_depth): new function * gtk/gtktreeview.c (gtk_tree_view_get_cell_rect): fix to properly handle TREE_VIEW_VERTICAL_SEPARATOR (gtk_tree_view_bin_expose): fix to consider the row offset as pointing halfway into vertical separator. (gtk_tree_view_draw_node_focus_rect): ditto * gtk/gtkdebug.h, gtk/gtkmain.c (gtk_init_check): Add --gtk-debug=updates, which causes gdk_window_set_debug_updates (TRUE) to be called. * gdk/gdkwindow.c (gdk_window_set_debug_updates): Allow enabling a debug mode where the invalid region is colored in on invalidate, so you can see the flicker and know whether your redraw code is doing a good job. * gtk/gtktreeview.c (gtk_tree_view_queue_draw_node): Work in tree window coordinates (clip rect is in tree window coords) * gtk/Makefile.am: add gtktreednd.[hc] * gtk/gtkliststore.c: implement gtktreednd interfaces. * gtk/gtktreednd.c, gtk/gtktreednd.h: New interface to support drag-and-drop data operations on a model (so we can set up tree drag-and-drop automatically) * gtk/testgtk.c: Add a window to change sensitivity in the GtkLabel test; add a way to change the entry frame in GtkEntry test * gtk/gtkentry.c (gtk_entry_set_has_frame): (gtk_entry_get_has_frame): new functions to remove the frame around an entry (gtk_entry_size_request): shrink requisition if no frame (gtk_entry_draw_focus): don't draw frame if no frame * gtk/gtkstyle.c (gtk_default_draw_check): draw custom look for checks inside a cell renderer (gtk_default_draw_option): ditto for options * gtk/gtktreeviewcolumn.c (update_button_contents): add/remove children from the alignment, not the button (gtk_tree_view_column_init): ref/sink the column, to emulate GObject refcounting. * gtk/gtkcellrenderer.c (gtk_cell_renderer_init): ref/sink * gtk/gtkcellrenderertoggle.c (gtk_cell_renderer_toggle_render): Use theme functions to draw the toggles * gdk/gdkpango.c (gdk_pango_get_gc): use GdkRGB to alloc colors * gdk/gdkpango.h, gdk/gdkpango.c: Add GdkPangoAttrStipple and GdkPangoAttrEmbossed to use in rendering insensitive text * gdk/gdkpango.c (gdk_draw_layout_line): render new properties * gtk/gtkstyle.c (gtk_default_draw_layout): handle sensitivity using new GDK features
2001-01-26 21:12:05 +00:00
/**
* gtk_entry_new:
*
* Creates a new entry.
*
* Returns: a new `GtkEntry`.
*/
GtkWidget*
gtk_entry_new (void)
{
return g_object_new (GTK_TYPE_ENTRY, NULL);
}
/**
* gtk_entry_new_with_buffer:
* @buffer: The buffer to use for the new `GtkEntry`.
*
* Creates a new entry with the specified text buffer.
*
* Returns: a new `GtkEntry`
*/
GtkWidget*
gtk_entry_new_with_buffer (GtkEntryBuffer *buffer)
{
g_return_val_if_fail (GTK_IS_ENTRY_BUFFER (buffer), NULL);
return g_object_new (GTK_TYPE_ENTRY, "buffer", buffer, NULL);
}
static GtkEntryBuffer*
get_buffer (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
return gtk_text_get_buffer (GTK_TEXT (priv->text));
}
/**
* gtk_entry_get_buffer: (attributes org.gtk.Method.get_property=buffer)
* @entry: a `GtkEntry`
*
* Get the `GtkEntryBuffer` object which holds the text for
* this widget.
*
* Returns: (transfer none): A `GtkEntryBuffer` object.
*/
GtkEntryBuffer*
gtk_entry_get_buffer (GtkEntry *entry)
{
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
return get_buffer (entry);
}
/**
* gtk_entry_set_buffer: (attributes org.gtk.Method.set_property=buffer)
* @entry: a `GtkEntry`
* @buffer: a `GtkEntryBuffer`
*
* Set the `GtkEntryBuffer` object which holds the text for
* this widget.
*/
void
gtk_entry_set_buffer (GtkEntry *entry,
GtkEntryBuffer *buffer)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_buffer (GTK_TEXT (priv->text), buffer);
}
/**
* gtk_entry_set_visibility: (attributes org.gtk.Method.set_property=visibility)
* @entry: a `GtkEntry`
* @visible: %TRUE if the contents of the entry are displayed as plaintext
*
* Sets whether the contents of the entry are visible or not.
*
* When visibility is set to %FALSE, characters are displayed
* as the invisible char, and will also appear that way when
* the text in the entry widget is copied elsewhere.
*
* By default, GTK picks the best invisible character available
* in the current font, but it can be changed with
* [method@Gtk.Entry.set_invisible_char].
*
* Note that you probably want to set [property@Gtk.Entry:input-purpose]
* to %GTK_INPUT_PURPOSE_PASSWORD or %GTK_INPUT_PURPOSE_PIN to
* inform input methods about the purpose of this entry,
* in addition to setting visibility to %FALSE.
*/
void
gtk_entry_set_visibility (GtkEntry *entry,
gboolean visible)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_visibility (GTK_TEXT (priv->text), visible);
}
/**
* gtk_entry_get_visibility: (attributes org.gtk.Method.get_property=visibility)
* @entry: a `GtkEntry`
*
* Retrieves whether the text in @entry is visible.
*
* See [method@Gtk.Entry.set_visibility].
*
* Returns: %TRUE if the text is currently visible
*/
gboolean
gtk_entry_get_visibility (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
return gtk_text_get_visibility (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_invisible_char: (attributes org.gtk.Method.sets_property=invisible-char)
* @entry: a `GtkEntry`
* @ch: a Unicode character
*
* Sets the character to use in place of the actual text
* in password mode.
*
* See [method@Gtk.Entry.set_visibility] for how to enable
* password mode.
*
* By default, GTK picks the best invisible char available in
* the current font. If you set the invisible char to 0, then
* the user will get no feedback at all; there will be no text
* on the screen as they type.
*/
void
gtk_entry_set_invisible_char (GtkEntry *entry,
gunichar ch)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_invisible_char (GTK_TEXT (priv->text), ch);
}
/**
* gtk_entry_get_invisible_char: (attributes org.gtk.Method.get_property=invisible-char)
* @entry: a `GtkEntry`
*
* Retrieves the character displayed in place of the actual text
* in password mode.
*
* Returns: the current invisible char, or 0, if the entry does not
* show invisible text at all.
*/
gunichar
gtk_entry_get_invisible_char (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
return gtk_text_get_invisible_char (GTK_TEXT (priv->text));
}
/**
* gtk_entry_unset_invisible_char:
* @entry: a `GtkEntry`
*
* Unsets the invisible char, so that the default invisible char
* is used again. See [method@Gtk.Entry.set_invisible_char].
*/
void
gtk_entry_unset_invisible_char (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_unset_invisible_char (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_overwrite_mode: (attributes org.gtk.Method.set_property=overwrite-mode)
* @entry: a `GtkEntry`
* @overwrite: new value
*
* Sets whether the text is overwritten when typing in the `GtkEntry`.
*/
void
gtk_entry_set_overwrite_mode (GtkEntry *entry,
gboolean overwrite)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_overwrite_mode (GTK_TEXT (priv->text), overwrite);
}
/**
* gtk_entry_get_overwrite_mode: (attributes org.gtk.Method.get_property=overwrite-mode)
* @entry: a `GtkEntry`
*
* Gets whether the `GtkEntry` is in overwrite mode.
*
* Returns: whether the text is overwritten when typing.
*/
gboolean
gtk_entry_get_overwrite_mode (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
return gtk_text_get_overwrite_mode (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_max_length: (attributes org.gtk.Method.set_property=max-length)
* @entry: a `GtkEntry`
* @max: the maximum length of the entry, or 0 for no maximum.
* (other than the maximum length of entries.) The value passed in will
* be clamped to the range 0-65536.
*
* Sets the maximum allowed length of the contents of the widget.
*
* If the current contents are longer than the given length, then
* they will be truncated to fit. The length is is in characters.
*
* This is equivalent to getting @entry's `GtkEntryBuffer` and
* calling [method@Gtk.EntryBuffer.set_max_length] on it.
*/
void
gtk_entry_set_max_length (GtkEntry *entry,
2020-07-24 13:54:49 +00:00
int max)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_max_length (GTK_TEXT (priv->text), max);
}
/**
* gtk_entry_get_max_length: (attributes org.gtk.Method.get_property=max-length)
* @entry: a `GtkEntry`
*
* Retrieves the maximum allowed length of the text in @entry.
*
* See [method@Gtk.Entry.set_max_length].
*
* Returns: the maximum allowed number of characters
* in `GtkEntry`, or 0 if there is no maximum.
*/
2020-07-24 13:54:49 +00:00
int
gtk_entry_get_max_length (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
return gtk_text_get_max_length (GTK_TEXT (priv->text));
}
/**
* gtk_entry_get_text_length: (attributes org.gtk.Method.get_property=text-length)
* @entry: a `GtkEntry`
*
* Retrieves the current length of the text in @entry.
*
* This is equivalent to getting @entry's `GtkEntryBuffer`
* and calling [method@Gtk.EntryBuffer.get_length] on it.
*
* Returns: the current number of characters
* in `GtkEntry`, or 0 if there are none.
*/
guint16
gtk_entry_get_text_length (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
return gtk_text_get_text_length (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_activates_default: (attributes org.gtk.Method.set_property=activates-default)
* @entry: a `GtkEntry`
* @setting: %TRUE to activate windows default widget on Enter keypress
*
* Sets whether pressing Enter in the @entry will activate the default
* widget for the window containing the entry.
*
* This usually means that the dialog containing the entry will be closed,
* since the default widget is usually one of the dialog buttons.
*/
void
gtk_entry_set_activates_default (GtkEntry *entry,
gboolean setting)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_activates_default (GTK_TEXT (priv->text), setting);
}
/**
* gtk_entry_get_activates_default: (attributes org.gtk.Method.get_property=activates-default)
* @entry: a `GtkEntry`
*
* Retrieves the value set by gtk_entry_set_activates_default().
*
* Returns: %TRUE if the entry will activate the default widget
*/
gboolean
gtk_entry_get_activates_default (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
return gtk_text_get_activates_default (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_has_frame: (attributes org.gtk.Method.set_property=has-frame)
* @entry: a `GtkEntry`
* @setting: new value
*
* Sets whether the entry has a beveled frame around it.
*/
void
gtk_entry_set_has_frame (GtkEntry *entry,
gboolean setting)
{
g_return_if_fail (GTK_IS_ENTRY (entry));
setting = (setting != FALSE);
if (setting == gtk_entry_get_has_frame (entry))
return;
if (setting)
gtk_widget_remove_css_class (GTK_WIDGET (entry), "flat");
else
gtk_widget_add_css_class (GTK_WIDGET (entry), "flat");
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_HAS_FRAME]);
}
/**
* gtk_entry_get_has_frame: (attributes org.gtk.Method.get_property=has-frame)
* @entry: a `GtkEntry`
*
* Gets the value set by gtk_entry_set_has_frame().
*
* Returns: whether the entry has a beveled frame
*/
gboolean
gtk_entry_get_has_frame (GtkEntry *entry)
{
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
return !gtk_widget_has_css_class (GTK_WIDGET (entry), "flat");
}
/**
2021-02-25 15:09:59 +00:00
* gtk_entry_set_alignment:
* @entry: a `GtkEntry`
* @xalign: The horizontal alignment, from 0 (left) to 1 (right).
* Reversed for RTL layouts
*
* Sets the alignment for the contents of the entry.
*
* This controls the horizontal positioning of the contents when
* the displayed text is shorter than the width of the entry.
*
2021-02-25 15:09:59 +00:00
* See also: [property@Gtk.Editable:xalign]
*/
void
2020-07-24 20:25:56 +00:00
gtk_entry_set_alignment (GtkEntry *entry,
float xalign)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_editable_set_alignment (GTK_EDITABLE (priv->text), xalign);
}
/**
2021-02-25 15:09:59 +00:00
* gtk_entry_get_alignment:
* @entry: a `GtkEntry`
*
* Gets the value set by gtk_entry_set_alignment().
*
2021-02-25 15:09:59 +00:00
* See also: [property@Gtk.Editable:xalign]
*
* Returns: the alignment
*/
2020-07-24 20:25:56 +00:00
float
gtk_entry_get_alignment (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0.0);
return gtk_editable_get_alignment (GTK_EDITABLE (priv->text));
}
/**
* gtk_entry_set_icon_from_paintable:
* @entry: a `GtkEntry`
* @icon_pos: Icon position
* @paintable: (nullable): A `GdkPaintable`
*
* Sets the icon shown in the specified position using a `GdkPaintable`.
*
* If @paintable is %NULL, no icon will be shown in the specified position.
*/
void
gtk_entry_set_icon_from_paintable (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkPaintable *paintable)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
g_object_freeze_notify (G_OBJECT (entry));
if (paintable)
{
EntryIconInfo *icon_info;
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_object_ref (paintable);
gtk_image_set_from_paintable (GTK_IMAGE (icon_info->widget), paintable);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PAINTABLE_PRIMARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]);
}
else
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PAINTABLE_SECONDARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]);
}
g_object_unref (paintable);
}
else
gtk_entry_clear_icon (entry, icon_pos);
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
gtk_widget_queue_resize (GTK_WIDGET (entry));
g_object_thaw_notify (G_OBJECT (entry));
}
/**
* gtk_entry_set_icon_from_icon_name:
* @entry: A `GtkEntry`
* @icon_pos: The position at which to set the icon
* @icon_name: (nullable): An icon name
*
* Sets the icon shown in the entry at the specified position
* from the current icon theme.
*
* If the icon name isnt known, a broken image icon will be
* displayed instead.
*
* If @icon_name is %NULL, no icon will be shown in the
* specified position.
*/
void
gtk_entry_set_icon_from_icon_name (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
2020-07-24 18:40:36 +00:00
const char *icon_name)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_object_freeze_notify (G_OBJECT (entry));
if (icon_name != NULL)
{
gtk_image_set_from_icon_name (GTK_IMAGE (icon_info->widget), icon_name);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_ICON_NAME_PRIMARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]);
}
else
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_ICON_NAME_SECONDARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]);
}
}
else
gtk_entry_clear_icon (entry, icon_pos);
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
gtk_widget_queue_resize (GTK_WIDGET (entry));
g_object_thaw_notify (G_OBJECT (entry));
}
/**
* gtk_entry_set_icon_from_gicon:
* @entry: A `GtkEntry`
* @icon_pos: The position at which to set the icon
* @icon: (nullable): The icon to set
*
* Sets the icon shown in the entry at the specified position
* from the current icon theme.
*
* If the icon isnt known, a broken image icon will be
* displayed instead.
*
* If @icon is %NULL, no icon will be shown in the
* specified position.
*/
void
gtk_entry_set_icon_from_gicon (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GIcon *icon)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
2017-12-01 06:21:21 +00:00
g_object_freeze_notify (G_OBJECT (entry));
if (icon)
{
gtk_image_set_from_gicon (GTK_IMAGE (icon_info->widget), icon);
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_GICON_PRIMARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_PRIMARY]);
}
else
{
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_GICON_SECONDARY]);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_STORAGE_TYPE_SECONDARY]);
}
}
else
gtk_entry_clear_icon (entry, icon_pos);
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
gtk_widget_queue_resize (GTK_WIDGET (entry));
g_object_thaw_notify (G_OBJECT (entry));
Make parent_class static. Sun Nov 5 04:24:53 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkcellrenderertextpixbuf.c: Make parent_class static. Tue Sep 19 10:54:22 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontext*.[ch] gtk/gtkimmulticontext.[ch] gtk/gtktextlayout.[ch] gtk/gtktextview.c gtk/gtkentry.c: Add support for positioning the cursor within the preedit string. Mon Sep 18 23:56:32 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c: Check for bindings after passing events to im context filter. Mon Sep 18 11:50:51 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.c (add_preedit_attrs): Handle empty attribute lists properly. Sun Sep 17 10:08:16 2000 Owen Taylor <otaylor@redhat.com> * gtk/queryimmodules.c (main): Return non-zero exit status if errors were encountered querying any modules. Sat Sep 16 14:01:52 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtk.h: include gtkmodule.h gtkoldeditable.h, don't include gtkthemes.h. * gtk/testgtk.c gtk/testtext.c: Set environment variables to point * gtk/Makefile.am: Add new .c and .h files, build gtk-query-immodules and use it to create a gtk.immodules file for use of test programs. * gtk/gtkpreview.c: remove extra blank line. Sat Sep 16 13:21:04 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimcontextsimple.c (gtk_im_context_simple_add_table): Add the ability to add extra tables beyond the default one, and also the ability to have compose sequences that are prefixes of other compose sequences. * gtk/gtkimcontextsimple.c: Export a preedit string which consists of possible candidates for keystrokes that have been entered but not yet committed. * gtk/gtkimcontext.[ch] gtk/immulticontext.[ch] gtk/gtkimcontextsimple.[ch]: add gtk_im_context_reset() * gtk/gtkmulticontext.[ch] (gtk_im_multicontext_append_menuitems): Add a function to add input-method switching menu items to a menu. * gtk/gtkimmulticontext.[ch]: Properly handly set_client_window when switching input methods. * gtk/gtkimcontextsimple.[ch]: Change the format of the compose table to allow compose tables of different lengths / sequence. Sat Sep 16 13:05:48 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkimmodule.[ch]: Support routines for loading GtkIMContext implementations dynamically at runtime. * gtk/queryimmodules.c: Program to query the available input modules and write the results into a file. * gtk/gtkrc.[ch] (gtk_rc_get_im_module_file): Add extra config options "im_module_file" (cache file for input method modules), and "im_module_path" - path to look for modules when generating cache file. This doesn't scale. Sat Sep 16 13:09:06 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkthemes.[ch] gtk/gtkmodule.[ch]: Move most of the generic code from gtkthemes into a new abstraction GtkModule which has the logic for implementing a loadable module which implements a number of GObject types. Sat Sep 16 13:07:13 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.[ch]: Convert GtkEditable from a class into an interface * gtk/gtkoldeditable.[ch]: Move the old editable implementation into here, so legacy widgets can still rely on the implemenation. GtkOldEditable exports GtkEditable. Make selection handling code use new text conversion functions (and handle UTF-8 as a side-effect). Use GtkClipboard for CLIPBOARD. * gtk/gtktext.[ch] gtk/gtkcombo.c gtk/gtkspinbutton.c: Adopt to match above changes. * gtk/gtkentry.[ch]: Implement GtkEditable directly, avoid GtkOldEditable implementation. Restructure to reduce number of places that modify state directly. Move to GtkBindingSet. Display the preedit string. Queue recomputation of PangoLayout and scroll position to improve effiency of doing complex changes naively. Add a menu with cut/copy/paste and input method selection. Thu Sep 14 22:11:05 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextlayout.[ch]: Add gtk_text_layout_set_preedit_string() to set preedit string and attributes; display preedit string by inserting string and attributes at cursor when creating the GtkTextLineDisplay. * gtk/gtktextlayout.c: Move all conversions between byte positions in PangoLayout and GtkTextIter into new functions line_display_iter_to_index/index_to_iter that properly handle the preedit string. * gtk/gtktextmark.[ch]: Restore gtk_text_mark_get_name, modify it to return const char * (eventually will end up as GCONST char *, most likely.) * gtk/gtktextview.[ch]: Handle the preedit string, call gtk_im_context_reset() as necessary, add a menu to switch input methods. * gtk/gtktextlayout.[ch]: Remove useless gtk_text_layout_get_log_attrs() function.
2000-11-12 03:43:24 +00:00
}
/**
* gtk_entry_set_icon_activatable:
* @entry: A `GtkEntry`
* @icon_pos: Icon position
* @activatable: %TRUE if the icon should be activatable
*
* Sets whether the icon is activatable.
*/
void
gtk_entry_set_icon_activatable (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
gboolean activatable)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
activatable = activatable != FALSE;
if (icon_info->nonactivatable != !activatable)
{
icon_info->nonactivatable = !activatable;
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_ACTIVATABLE_PRIMARY
: PROP_ACTIVATABLE_SECONDARY]);
}
}
/**
* gtk_entry_get_icon_activatable:
* @entry: a `GtkEntry`
* @icon_pos: Icon position
*
* Returns whether the icon is activatable.
*
* Returns: %TRUE if the icon is activatable.
*/
gboolean
gtk_entry_get_icon_activatable (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), FALSE);
icon_info = priv->icons[icon_pos];
return (!icon_info || !icon_info->nonactivatable);
}
/**
* gtk_entry_get_icon_paintable:
* @entry: A `GtkEntry`
* @icon_pos: Icon position
*
* Retrieves the `GdkPaintable` used for the icon.
*
* If no `GdkPaintable` was used for the icon, %NULL is returned.
*
* Returns: (transfer none) (nullable): A `GdkPaintable`
* if no icon is set for this position or the icon set is not
* a `GdkPaintable`.
*/
GdkPaintable *
gtk_entry_get_icon_paintable (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return NULL;
return gtk_image_get_paintable (GTK_IMAGE (icon_info->widget));
}
/**
* gtk_entry_get_icon_gicon:
* @entry: A `GtkEntry`
* @icon_pos: Icon position
*
* Retrieves the `GIcon` used for the icon.
*
* %NULL will be returned if there is no icon or if the icon was
* set by some other method (e.g., by `GdkPaintable` or icon name).
*
* Returns: (transfer none) (nullable): A `GIcon`
*/
GIcon *
gtk_entry_get_icon_gicon (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return NULL;
return gtk_image_get_gicon (GTK_IMAGE (icon_info->widget));
}
/**
* gtk_entry_get_icon_name:
* @entry: A `GtkEntry`
* @icon_pos: Icon position
*
* Retrieves the icon name used for the icon.
*
* %NULL is returned if there is no icon or if the icon was set
* by some other method (e.g., by `GdkPaintable` or gicon).
*
* Returns: (nullable): An icon name
*/
2020-07-24 18:40:36 +00:00
const char *
gtk_entry_get_icon_name (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return NULL;
return gtk_image_get_icon_name (GTK_IMAGE (icon_info->widget));
}
/**
* gtk_entry_set_icon_sensitive:
* @entry: A `GtkEntry`
* @icon_pos: Icon position
* @sensitive: Specifies whether the icon should appear
* sensitive or insensitive
*
* Sets the sensitivity for the specified icon.
*/
void
gtk_entry_set_icon_sensitive (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
gboolean sensitive)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
if (gtk_widget_get_sensitive (icon_info->widget) != sensitive)
{
gtk_widget_set_sensitive (icon_info->widget, sensitive);
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_SENSITIVE_PRIMARY
: PROP_SENSITIVE_SECONDARY]);
}
}
/**
* gtk_entry_get_icon_sensitive:
* @entry: a `GtkEntry`
* @icon_pos: Icon position
*
* Returns whether the icon appears sensitive or insensitive.
*
* Returns: %TRUE if the icon is sensitive.
*/
gboolean
gtk_entry_get_icon_sensitive (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), TRUE);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), TRUE);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return TRUE; /* Default of the property */
return gtk_widget_get_sensitive (icon_info->widget);
}
/**
* gtk_entry_get_icon_storage_type:
* @entry: a `GtkEntry`
* @icon_pos: Icon position
*
* Gets the type of representation being used by the icon
* to store image data.
*
* If the icon has no image data, the return value will
* be %GTK_IMAGE_EMPTY.
*
* Returns: image representation being used
*/
GtkImageType
gtk_entry_get_icon_storage_type (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), GTK_IMAGE_EMPTY);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), GTK_IMAGE_EMPTY);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return GTK_IMAGE_EMPTY;
return gtk_image_get_storage_type (GTK_IMAGE (icon_info->widget));
}
/**
* gtk_entry_get_icon_at_pos:
* @entry: a `GtkEntry`
* @x: the x coordinate of the position to find, relative to @entry
* @y: the y coordinate of the position to find, relative to @entry
*
* Finds the icon at the given position and return its index.
*
* The positions coordinates are relative to the @entrys
* top left corner. If @x, @y doesnt lie inside an icon,
* -1 is returned. This function is intended for use in a
* [signal@Gtk.Widget::query-tooltip] signal handler.
*
* Returns: the index of the icon at the given position, or -1
*/
2020-07-24 13:54:49 +00:00
int
gtk_entry_get_icon_at_pos (GtkEntry *entry,
2020-07-24 13:54:49 +00:00
int x,
int y)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
guint i;
g_return_val_if_fail (GTK_IS_ENTRY (entry), -1);
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
double icon_x, icon_y;
if (icon_info == NULL)
continue;
gtk_widget_translate_coordinates (GTK_WIDGET (entry), icon_info->widget,
x, y, &icon_x, &icon_y);
if (gtk_widget_contains (icon_info->widget, icon_x, icon_y))
return i;
}
return -1;
}
/**
* gtk_entry_set_icon_drag_source:
* @entry: a `GtkEntry`
* @icon_pos: icon position
* @provider: a `GdkContentProvider`
* @actions: a bitmask of the allowed drag actions
*
* Sets up the icon at the given position as drag source.
*
* This makes it so that GTK will start a drag
* operation when the user clicks and drags the icon.
*/
void
gtk_entry_set_icon_drag_source (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkContentProvider *provider,
GdkDragAction actions)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_set_object (&icon_info->content, provider);
icon_info->actions = actions;
}
/**
* gtk_entry_get_current_icon_drag_source:
* @entry: a `GtkEntry`
*
* Returns the index of the icon which is the source of the
* current DND operation, or -1.
*
* Returns: index of the icon which is the source of the
* current DND operation, or -1.
*/
2020-07-24 13:54:49 +00:00
int
gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info = NULL;
2020-07-24 13:54:49 +00:00
int i;
g_return_val_if_fail (GTK_IS_ENTRY (entry), -1);
for (i = 0; i < MAX_ICONS; i++)
{
if ((icon_info = priv->icons[i]))
{
if (icon_info->in_drag)
return i;
}
}
return -1;
}
/**
* gtk_entry_get_icon_area:
* @entry: A `GtkEntry`
* @icon_pos: Icon position
* @icon_area: (out): Return location for the icons area
*
* Gets the area where entrys icon at @icon_pos is drawn.
*
* This function is useful when drawing something to the
* entry in a draw callback.
*
* If the entry is not realized or has no icon at the given
* position, @icon_area is filled with zeros. Otherwise,
* @icon_area will be filled with the icon's allocation,
* relative to @entry's allocation.
*/
void
gtk_entry_get_icon_area (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
GdkRectangle *icon_area)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
graphene_rect_t r;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (icon_area != NULL);
icon_info = priv->icons[icon_pos];
if (icon_info &&
gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r))
{
*icon_area = (GdkRectangle){
floorf (r.origin.x),
floorf (r.origin.y),
ceilf (r.size.width),
ceilf (r.size.height),
};
}
else
{
icon_area->x = 0;
icon_area->y = 0;
icon_area->width = 0;
icon_area->height = 0;
}
}
static void
ensure_has_tooltip (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
const char *text = gtk_widget_get_tooltip_text (GTK_WIDGET (entry));
gboolean has_tooltip = text != NULL;
if (!has_tooltip)
{
int i;
for (i = 0; i < MAX_ICONS; i++)
{
EntryIconInfo *icon_info = priv->icons[i];
if (icon_info != NULL && icon_info->tooltip != NULL)
{
has_tooltip = TRUE;
break;
}
}
}
gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
}
/**
* gtk_entry_get_icon_tooltip_text:
* @entry: a `GtkEntry`
* @icon_pos: the icon position
*
* Gets the contents of the tooltip on the icon at the specified
* position in @entry.
*
* Returns: (nullable) (transfer full): the tooltip text
*/
2020-07-24 18:40:36 +00:00
char *
gtk_entry_get_icon_tooltip_text (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
2020-07-24 18:40:36 +00:00
char *text = NULL;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return NULL;
if (icon_info->tooltip &&
!pango_parse_markup (icon_info->tooltip, -1, 0, NULL, &text, NULL, NULL))
g_assert (NULL == text); /* text should still be NULL in case of markup errors */
return text;
}
/**
* gtk_entry_set_icon_tooltip_text:
* @entry: a `GtkEntry`
* @icon_pos: the icon position
* @tooltip: (nullable): the contents of the tooltip for the icon
*
* Sets @tooltip as the contents of the tooltip for the icon
* at the specified position.
*
* Use %NULL for @tooltip to remove an existing tooltip.
*
* See also [method@Gtk.Widget.set_tooltip_text] and
* [method@Gtk.Entry.set_icon_tooltip_markup].
*
* If you unset the widget tooltip via
* [method@Gtk.Widget.set_tooltip_text] or
* [method@Gtk.Widget.set_tooltip_markup], this sets
* [property@Gtk.Widget:has-tooltip] to %FALSE, which suppresses
* icon tooltips too. You can resolve this by then calling
* [method@Gtk.Widget.set_has_tooltip] to set
* [property@Gtk.Widget:has-tooltip] back to %TRUE, or
* setting at least one non-empty tooltip on any icon
* achieves the same result.
*/
void
gtk_entry_set_icon_tooltip_text (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
2020-07-24 18:40:36 +00:00
const char *tooltip)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_free (icon_info->tooltip);
/* Treat an empty string as a NULL string,
* because an empty string would be useless for a tooltip:
*/
if (tooltip && tooltip[0] == '\0')
tooltip = NULL;
icon_info->tooltip = tooltip ? g_markup_escape_text (tooltip, -1) : NULL;
ensure_has_tooltip (entry);
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_TOOLTIP_TEXT_PRIMARY
: PROP_TOOLTIP_TEXT_SECONDARY]);
}
/**
* gtk_entry_get_icon_tooltip_markup:
* @entry: a `GtkEntry`
* @icon_pos: the icon position
*
* Gets the contents of the tooltip on the icon at the specified
* position in @entry.
*
* Returns: (nullable) (transfer full): the tooltip text
*/
2020-07-24 18:40:36 +00:00
char *
gtk_entry_get_icon_tooltip_markup (GtkEntry *entry,
GtkEntryIconPosition icon_pos)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
icon_info = priv->icons[icon_pos];
if (!icon_info)
return NULL;
return g_strdup (icon_info->tooltip);
}
/**
* gtk_entry_set_icon_tooltip_markup:
* @entry: a `GtkEntry`
* @icon_pos: the icon position
* @tooltip: (nullable): the contents of the tooltip for the icon
*
* Sets @tooltip as the contents of the tooltip for the icon at
* the specified position.
*
* @tooltip is assumed to be marked up with Pango Markup.
*
* Use %NULL for @tooltip to remove an existing tooltip.
*
* See also [method@Gtk.Widget.set_tooltip_markup] and
* [method@Gtk.Entry.set_icon_tooltip_text].
*/
void
gtk_entry_set_icon_tooltip_markup (GtkEntry *entry,
GtkEntryIconPosition icon_pos,
2020-07-24 18:40:36 +00:00
const char *tooltip)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
if ((icon_info = priv->icons[icon_pos]) == NULL)
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
g_free (icon_info->tooltip);
/* Treat an empty string as a NULL string,
* because an empty string would be useless for a tooltip:
*/
if (tooltip && tooltip[0] == '\0')
tooltip = NULL;
icon_info->tooltip = g_strdup (tooltip);
ensure_has_tooltip (entry);
g_object_notify_by_pspec (G_OBJECT (entry),
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
? PROP_TOOLTIP_MARKUP_PRIMARY
: PROP_TOOLTIP_MARKUP_SECONDARY]);
}
static gboolean
gtk_entry_query_tooltip (GtkWidget *widget,
2020-07-24 13:54:49 +00:00
int x,
int y,
gboolean keyboard_tip,
GtkTooltip *tooltip)
{
GtkEntry *entry = GTK_ENTRY (widget);
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
2020-07-24 13:54:49 +00:00
int icon_pos;
if (!keyboard_tip)
{
icon_pos = gtk_entry_get_icon_at_pos (entry, x, y);
if (icon_pos != -1)
{
if ((icon_info = priv->icons[icon_pos]) != NULL)
{
if (icon_info->tooltip)
{
gtk_tooltip_set_markup (tooltip, icon_info->tooltip);
return TRUE;
}
return FALSE;
}
}
}
return GTK_WIDGET_CLASS (gtk_entry_parent_class)->query_tooltip (widget,
x, y,
keyboard_tip,
tooltip);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* gtk_entry_set_completion: (attributes org.gtk.Method.set_property=completion)
* @entry: A `GtkEntry`
* @completion: (nullable): The `GtkEntryCompletion`
*
* Sets @completion to be the auxiliary completion object
* to use with @entry.
*
* All further configuration of the completion mechanism is
* done on @completion using the `GtkEntryCompletion` API.
* Completion is disabled if @completion is set to %NULL.
*
* Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.
*/
void
gtk_entry_set_completion (GtkEntry *entry,
GtkEntryCompletion *completion)
{
GtkEntryCompletion *old;
g_return_if_fail (GTK_IS_ENTRY (entry));
g_return_if_fail (!completion || GTK_IS_ENTRY_COMPLETION (completion));
old = gtk_entry_get_completion (entry);
if (old == completion)
return;
if (old)
{
_gtk_entry_completion_disconnect (old);
g_object_unref (old);
}
if (!completion)
{
g_object_set_qdata (G_OBJECT (entry), quark_entry_completion, NULL);
return;
}
/* hook into the entry */
g_object_ref (completion);
_gtk_entry_completion_connect (completion, entry);
g_object_set_qdata (G_OBJECT (entry), quark_entry_completion, completion);
2011-04-01 22:35:32 +00:00
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_COMPLETION]);
}
/**
* gtk_entry_get_completion: (attributes org.gtk.Method.get_property=completion)
* @entry: A `GtkEntry`
*
* Returns the auxiliary completion object currently
* in use by @entry.
*
* Returns: (nullable) (transfer none): The auxiliary
* completion object currently in use by @entry
*
* Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.
*/
GtkEntryCompletion *
gtk_entry_get_completion (GtkEntry *entry)
{
GtkEntryCompletion *completion;
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
completion = GTK_ENTRY_COMPLETION (g_object_get_qdata (G_OBJECT (entry), quark_entry_completion));
return completion;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
gtk_entry_ensure_progress_widget (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
if (priv->progress_widget)
return;
priv->progress_widget = g_object_new (GTK_TYPE_PROGRESS_BAR,
"css-name", "progress",
NULL);
gtk_widget_set_can_target (priv->progress_widget, FALSE);
gtk_widget_set_parent (priv->progress_widget, GTK_WIDGET (entry));
update_node_ordering (entry);
}
/**
* gtk_entry_set_progress_fraction: (attributes org.gtk.Method.set_property=progress-fraction)
* @entry: a `GtkEntry`
* @fraction: fraction of the task thats been completed
*
* Causes the entrys progress indicator to fill in the given
* fraction of the bar.
*
* The fraction should be between 0.0 and 1.0, inclusive.
*/
void
gtk_entry_set_progress_fraction (GtkEntry *entry,
2020-07-24 20:32:16 +00:00
double fraction)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
2020-07-24 20:32:16 +00:00
double old_fraction;
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_entry_ensure_progress_widget (entry);
2018-03-01 17:42:59 +00:00
old_fraction = gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (priv->progress_widget));
fraction = CLAMP (fraction, 0.0, 1.0);
if (fraction != old_fraction)
{
2018-03-01 17:42:59 +00:00
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->progress_widget), fraction);
gtk_widget_set_visible (priv->progress_widget, fraction > 0);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PROGRESS_FRACTION]);
}
}
/**
* gtk_entry_get_progress_fraction: (attributes org.gtk.Method.get_property=progress-fraction)
* @entry: a `GtkEntry`
*
* Returns the current fraction of the task thats been completed.
*
* See [method@Gtk.Entry.set_progress_fraction].
*
* Returns: a fraction from 0.0 to 1.0
*/
2020-07-24 20:32:16 +00:00
double
gtk_entry_get_progress_fraction (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0.0);
if (priv->progress_widget)
return gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (priv->progress_widget));
return 0.0;
}
/**
* gtk_entry_set_progress_pulse_step: (attributes org.gtk.Method.set_property=progress-pulse-step)
* @entry: a `GtkEntry`
* @fraction: fraction between 0.0 and 1.0
*
* Sets the fraction of total entry width to move the progress
* bouncing block for each pulse.
*
* Use [method@Gtk.Entry.progress_pulse] to pulse
* the progress.
*/
void
gtk_entry_set_progress_pulse_step (GtkEntry *entry,
2020-07-24 20:32:16 +00:00
double fraction)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
fraction = CLAMP (fraction, 0.0, 1.0);
gtk_entry_ensure_progress_widget (entry);
if (fraction != gtk_progress_bar_get_pulse_step (GTK_PROGRESS_BAR (priv->progress_widget)))
{
gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (priv->progress_widget), fraction);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PROGRESS_PULSE_STEP]);
}
}
/**
* gtk_entry_get_progress_pulse_step: (attributes org.gtk.Method.get_property=progress-pulse-step)
* @entry: a `GtkEntry`
*
* Retrieves the pulse step set with
* gtk_entry_set_progress_pulse_step().
*
* Returns: a fraction from 0.0 to 1.0
*/
2020-07-24 20:32:16 +00:00
double
gtk_entry_get_progress_pulse_step (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0.0);
if (priv->progress_widget)
return gtk_progress_bar_get_pulse_step (GTK_PROGRESS_BAR (priv->progress_widget));
return 0.0;
}
/**
* gtk_entry_progress_pulse:
* @entry: a `GtkEntry`
*
* Indicates that some progress is made, but you dont
* know how much.
*
* Causes the entrys progress indicator to enter activity
* mode, where a block bounces back and forth. Each call to
* gtk_entry_progress_pulse() causes the block to move by a
* little bit (the amount of movement per pulse is determined
* by [method@Gtk.Entry.set_progress_pulse_step]).
*/
void
gtk_entry_progress_pulse (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
if (priv->progress_widget)
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_widget));
}
/**
* gtk_entry_set_placeholder_text: (attributes org.gtk.Method.set_property=placeholder-text)
* @entry: a `GtkEntry`
* @text: (nullable): a string to be displayed when @entry is empty and unfocused
*
* Sets text to be displayed in @entry when it is empty.
*
* This can be used to give a visual hint of the expected
* contents of the `GtkEntry`.
*/
void
gtk_entry_set_placeholder_text (GtkEntry *entry,
2020-07-24 18:40:36 +00:00
const char *text)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_placeholder_text (GTK_TEXT (priv->text), text);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER, text,
-1);
}
/**
* gtk_entry_get_placeholder_text: (attributes org.gtk.Method.get_property=placeholder-text)
* @entry: a `GtkEntry`
*
* Retrieves the text that will be displayed when @entry
* is empty and unfocused
*
* Returns: (nullable) (transfer none):a pointer to the
* placeholder text as a string. This string points to
* internally allocated storage in the widget and must
* not be freed, modified or stored. If no placeholder
* text has been set, %NULL will be returned.
*/
2020-07-24 18:40:36 +00:00
const char *
gtk_entry_get_placeholder_text (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
return gtk_text_get_placeholder_text (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_input_purpose: (attributes org.gtk.Method.set_property=input-purpose)
* @entry: a `GtkEntry`
* @purpose: the purpose
*
* Sets the input purpose which can be used by input methods
* to adjust their behavior.
*/
void
gtk_entry_set_input_purpose (GtkEntry *entry,
GtkInputPurpose purpose)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_input_purpose (GTK_TEXT (priv->text), purpose);
}
/**
* gtk_entry_get_input_purpose: (attributes org.gtk.Method.get_property=input-purpose)
* @entry: a `GtkEntry`
*
* Gets the input purpose of the `GtkEntry`.
*
* Returns: the input purpose
*/
GtkInputPurpose
gtk_entry_get_input_purpose (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), GTK_INPUT_PURPOSE_FREE_FORM);
return gtk_text_get_input_purpose (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_input_hints: (attributes org.gtk.Method.set_property=input-hints)
* @entry: a `GtkEntry`
* @hints: the hints
*
* Set additional hints which allow input methods to
* fine-tune their behavior.
*/
void
gtk_entry_set_input_hints (GtkEntry *entry,
GtkInputHints hints)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_input_hints (GTK_TEXT (priv->text), hints);
}
/**
* gtk_entry_get_input_hints: (attributes org.gtk.Method.get_property=input-hints)
* @entry: a `GtkEntry`
*
* Gets the input hints of this `GtkEntry`.
*
* Returns: the input hints
*/
GtkInputHints
gtk_entry_get_input_hints (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), GTK_INPUT_HINT_NONE);
return gtk_text_get_input_hints (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_attributes: (attributes org.gtk.Method.set_property=attributes)
* @entry: a `GtkEntry`
* @attrs: a `PangoAttrList`
*
* Sets a `PangoAttrList`.
*
* The attributes in the list are applied to the entry text.
*
* Since the attributes will be applies to text that changes
* as the user types, it makes most sense to use attributes
* with unlimited extent.
*/
void
gtk_entry_set_attributes (GtkEntry *entry,
PangoAttrList *attrs)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_attributes (GTK_TEXT (priv->text), attrs);
}
/**
* gtk_entry_get_attributes: (attributes org.gtk.Method.get_property=attributes)
* @entry: a `GtkEntry`
*
* Gets the attribute list of the `GtkEntry`.
*
* See [method@Gtk.Entry.set_attributes].
*
* Returns: (transfer none) (nullable): the attribute list
*/
PangoAttrList *
gtk_entry_get_attributes (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
return gtk_text_get_attributes (GTK_TEXT (priv->text));
}
/**
* gtk_entry_set_tabs: (attributes org.gtk.Method.set_property=tabs)
* @entry: a `GtkEntry`
* @tabs: (nullable): a `PangoTabArray`
*
* Sets a `PangoTabArray`.
*
* The tabstops in the array are applied to the entry text.
*/
void
gtk_entry_set_tabs (GtkEntry *entry,
PangoTabArray *tabs)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_tabs (GTK_TEXT (priv->text), tabs);
}
/**
* gtk_entry_get_tabs: (attributes org.gtk.Method.get_property=tabs)
* @entry: a `GtkEntry`
*
* Gets the tabstops of the `GtkEntry.
*
* See [method@Gtk.Entry.set_tabs].
*
* Returns: (nullable) (transfer none): the tabstops
*/
PangoTabArray *
gtk_entry_get_tabs (GtkEntry *entry)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
return gtk_text_get_tabs (GTK_TEXT (priv->text));
}
static void
pick_emoji (GtkEntry *entry,
int icon,
GdkEvent *event,
gpointer data)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
if (gtk_widget_get_ancestor (GTK_WIDGET (entry), GTK_TYPE_EMOJI_CHOOSER) != NULL)
return;
if (icon == GTK_ENTRY_ICON_SECONDARY)
g_signal_emit_by_name (priv->text, "insert-emoji");
}
static void
set_show_emoji_icon (GtkEntry *entry,
gboolean value)
{
2018-03-01 17:42:59 +00:00
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
if (priv->show_emoji_icon == value)
return;
priv->show_emoji_icon = value;
if (priv->show_emoji_icon)
{
gtk_entry_set_icon_from_icon_name (entry,
GTK_ENTRY_ICON_SECONDARY,
"face-smile-symbolic");
gtk_entry_set_icon_sensitive (entry,
GTK_ENTRY_ICON_SECONDARY,
TRUE);
gtk_entry_set_icon_activatable (entry,
GTK_ENTRY_ICON_SECONDARY,
TRUE);
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_SECONDARY,
_("Insert Emoji"));
g_signal_connect (entry, "icon-press", G_CALLBACK (pick_emoji), NULL);
}
else
{
g_signal_handlers_disconnect_by_func (entry, pick_emoji, NULL);
gtk_entry_set_icon_from_icon_name (entry,
GTK_ENTRY_ICON_SECONDARY,
NULL);
gtk_entry_set_icon_tooltip_text (entry,
GTK_ENTRY_ICON_SECONDARY,
NULL);
}
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_SHOW_EMOJI_ICON]);
gtk_widget_queue_resize (GTK_WIDGET (entry));
}
GtkEventController *
gtk_entry_get_key_controller (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
return gtk_text_get_key_controller (GTK_TEXT (priv->text));
}
GtkText *
gtk_entry_get_text_widget (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
return GTK_TEXT (priv->text);
}
/**
* gtk_entry_set_extra_menu: (attributes org.gtk.Method.set_property=extra-menu)
* @entry: a `GtkEntry`
* @model: (nullable): a `GMenuModel`
*
* Sets a menu model to add when constructing
* the context menu for @entry.
*/
void
gtk_entry_set_extra_menu (GtkEntry *entry,
GMenuModel *model)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_if_fail (GTK_IS_ENTRY (entry));
gtk_text_set_extra_menu (GTK_TEXT (priv->text), model);
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_EXTRA_MENU]);
}
/**
* gtk_entry_get_extra_menu: (attributes org.gtk.Method.get_property=extra-menu)
* @entry: a `GtkEntry`
*
* Gets the menu model set with gtk_entry_set_extra_menu().
*
2019-09-15 15:54:52 +00:00
* Returns: (transfer none) (nullable): the menu model
*/
GMenuModel *
gtk_entry_get_extra_menu (GtkEntry *entry)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
return gtk_text_get_extra_menu (GTK_TEXT (priv->text));
}
/*< private >
* gtk_entry_activate_icon:
* @entry: a `GtkEntry`
* @pos: the icon position
*
* Activates an icon.
*
* This causes the [signal@Gtk.Entry::icon-press] and
* [signal@Gtk.Entry::icon-release] signals to be emitted
* on the @entry icon at the given @pos, if the icon is
* set and activatable.
*
* Returns: %TRUE if the signal was emitted
*/
gboolean
gtk_entry_activate_icon (GtkEntry *entry,
GtkEntryIconPosition pos)
{
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
EntryIconInfo *icon_info;
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
icon_info = priv->icons[pos];
if (icon_info != NULL &&
gtk_image_get_storage_type (GTK_IMAGE (icon_info->widget)) != GTK_IMAGE_EMPTY &&
!icon_info->nonactivatable)
{
g_signal_emit (entry, signals[ICON_PRESS], 0, pos);
g_signal_emit (entry, signals[ICON_RELEASE], 0, pos);
return TRUE;
}
return FALSE;
}