2005-07-11 17:51:54 +00:00
|
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2008-07-01 22:57:50 +00:00
|
|
|
|
/* GTK - The GIMP Toolkit
|
1997-11-24 22:37:52 +00:00
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
2008-12-19 17:44:56 +00:00
|
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +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
|
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
2008-10-30 18:38:06 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
1999-02-24 07:37:18 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtkentryprivate.h"
|
2017-10-23 10:49:42 +00:00
|
|
|
|
|
2020-10-13 00:18:48 +00:00
|
|
|
|
#include "gtkaccessibleprivate.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtkadjustment.h"
|
|
|
|
|
#include "gtkbox.h"
|
|
|
|
|
#include "gtkbutton.h"
|
2022-10-07 21:47:28 +00:00
|
|
|
|
#include "deprecated/gtkcelleditable.h"
|
2014-07-10 14:10:11 +00:00
|
|
|
|
#include "gtkdebug.h"
|
2019-02-16 05:50:40 +00:00
|
|
|
|
#include "gtkeditable.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtkemojichooser.h"
|
2017-08-19 18:08:15 +00:00
|
|
|
|
#include "gtkemojicompletion.h"
|
2009-07-09 01:41:53 +00:00
|
|
|
|
#include "gtkentrybuffer.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtkgesturedrag.h"
|
|
|
|
|
#include "gtkimageprivate.h"
|
2005-11-23 14:35:05 +00:00
|
|
|
|
#include "gtkimcontextsimple.h"
|
2022-09-24 13:07:56 +00:00
|
|
|
|
#include <glib/gi18n-lib.h>
|
2008-09-29 21:57:29 +00:00
|
|
|
|
#include "gtklabel.h"
|
1997-11-24 22:37:52 +00:00
|
|
|
|
#include "gtkmain.h"
|
2001-11-17 23:28:51 +00:00
|
|
|
|
#include "gtkmarshalers.h"
|
2022-10-06 02:59:51 +00:00
|
|
|
|
#include "gtkpangoprivate.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtkpopover.h"
|
|
|
|
|
#include "gtkprivate.h"
|
|
|
|
|
#include "gtkprogressbar.h"
|
2001-05-30 20:40:28 +00:00
|
|
|
|
#include "gtksettings.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtksnapshot.h"
|
2019-02-16 05:50:40 +00:00
|
|
|
|
#include "gtktextprivate.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtktexthandleprivate.h"
|
2022-10-06 02:59:51 +00:00
|
|
|
|
#include "gtktextutilprivate.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtktooltip.h"
|
2011-01-04 19:51:19 +00:00
|
|
|
|
#include "gtktypebuiltins.h"
|
2011-01-24 05:24:12 +00:00
|
|
|
|
#include "gtkwidgetprivate.h"
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include "gtkwindow.h"
|
2019-05-04 18:10:12 +00:00
|
|
|
|
#include "gtknative.h"
|
2019-05-29 17:10:46 +00:00
|
|
|
|
#include "gtkgestureclick.h"
|
2020-12-25 17:57:48 +00:00
|
|
|
|
#include "gtkdragsourceprivate.h"
|
2020-01-06 22:36:18 +00:00
|
|
|
|
#include "gtkdragicon.h"
|
2019-12-31 07:45:02 +00:00
|
|
|
|
#include "gtkwidgetpaintable.h"
|
2010-11-05 19:49:20 +00:00
|
|
|
|
|
2018-02-08 13:39:45 +00:00
|
|
|
|
#include <cairo-gobject.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2010-11-05 19:49:20 +00:00
|
|
|
|
/**
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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].
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* In this mode, entered text is displayed using a “invisible” character.
|
2020-09-12 16:01:04 +00:00
|
|
|
|
* By default, GTK picks the best invisible character that is available
|
2010-11-05 19:49:20 +00:00
|
|
|
|
* in the current font, but it can be changed with
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* [method@Gtk.Entry.set_invisible_char].
|
2010-11-05 19:49:20 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* `GtkEntry` has the ability to display progress or activity
|
2010-11-05 19:49:20 +00:00
|
|
|
|
* information behind the text. To make an entry display such information,
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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
|
2010-11-05 19:49:20 +00:00
|
|
|
|
* 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.
|
2015-10-23 20:22:25 +00:00
|
|
|
|
*
|
|
|
|
|
* # CSS nodes
|
|
|
|
|
*
|
2021-02-28 00:46:32 +00:00
|
|
|
|
* ```
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* entry[.flat][.warning][.error]
|
|
|
|
|
* ├── text[.readonly]
|
2015-11-03 14:53:00 +00:00
|
|
|
|
* ├── image.left
|
|
|
|
|
* ├── image.right
|
2020-06-26 15:56:27 +00:00
|
|
|
|
* ╰── [progress[.pulse]]
|
2021-02-28 00:46:32 +00:00
|
|
|
|
* ```
|
2015-11-03 14:53:00 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* `GtkEntry` has a main node with the name entry. Depending on the properties
|
2015-10-23 20:22:25 +00:00
|
|
|
|
* 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.
|
|
|
|
|
*
|
2015-10-27 01:32:26 +00:00
|
|
|
|
* When the entry shows progress, it adds a subnode with the name progress.
|
2015-10-23 20:22:25 +00:00
|
|
|
|
* The node has the style class .pulse when the shown progress is pulsing.
|
2015-11-10 04:45:29 +00:00
|
|
|
|
*
|
2019-03-06 08:03:17 +00:00
|
|
|
|
* For all the subnodes added to the text node in various situations,
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* see [class@Gtk.Text].
|
2020-04-07 03:29:47 +00:00
|
|
|
|
*
|
|
|
|
|
* # GtkEntry as GtkBuildable
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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“,
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* “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
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2020-07-28 20:11:45 +00:00
|
|
|
|
*
|
|
|
|
|
* # Accessibility
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* `GtkEntry` uses the %GTK_ACCESSIBLE_ROLE_TEXT_BOX role.
|
2010-11-05 19:49:20 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
#define MAX_ICONS 2
|
|
|
|
|
|
|
|
|
|
#define IS_VALID_ICON_POSITION(pos) \
|
|
|
|
|
((pos) == GTK_ENTRY_ICON_PRIMARY || \
|
|
|
|
|
(pos) == GTK_ENTRY_ICON_SECONDARY)
|
|
|
|
|
|
2015-09-20 04:04:30 +00:00
|
|
|
|
static GQuark quark_entry_completion = 0;
|
2006-03-10 10:30:36 +00:00
|
|
|
|
|
2010-10-20 15:14:11 +00:00
|
|
|
|
typedef struct _EntryIconInfo EntryIconInfo;
|
2004-03-01 03:30:27 +00:00
|
|
|
|
|
2019-05-27 03:03:47 +00:00
|
|
|
|
typedef struct _GtkEntryPrivate GtkEntryPrivate;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
struct _GtkEntryPrivate
|
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icons[MAX_ICONS];
|
2014-05-15 13:03:18 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkWidget *text;
|
2017-06-16 13:27:08 +00:00
|
|
|
|
GtkWidget *progress_widget;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2017-08-11 16:05:24 +00:00
|
|
|
|
guint show_emoji_icon : 1;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
guint editing_canceled : 1; /* Only used by GtkCellRendererText */
|
|
|
|
|
};
|
2004-03-01 03:30:27 +00:00
|
|
|
|
|
2010-10-20 15:14:11 +00:00
|
|
|
|
struct _EntryIconInfo
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2017-06-16 09:19:52 +00:00
|
|
|
|
GtkWidget *widget;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tooltip;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
guint nonactivatable : 1;
|
|
|
|
|
guint in_drag : 1;
|
|
|
|
|
|
|
|
|
|
GdkDragAction actions;
|
2019-12-31 07:45:02 +00:00
|
|
|
|
GdkContentProvider *content;
|
2006-03-22 16:17:52 +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
|
|
|
|
enum {
|
|
|
|
|
ACTIVATE,
|
2008-12-31 07:29:23 +00:00
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
|
enum {
|
2001-02-21 20:22:25 +00:00
|
|
|
|
PROP_0,
|
2009-07-09 01:41:53 +00:00
|
|
|
|
PROP_BUFFER,
|
2001-02-21 20:22:25 +00:00
|
|
|
|
PROP_MAX_LENGTH,
|
|
|
|
|
PROP_VISIBILITY,
|
2001-09-18 22:49:02 +00:00
|
|
|
|
PROP_HAS_FRAME,
|
2001-03-02 20:02:17 +00:00
|
|
|
|
PROP_INVISIBLE_CHAR,
|
2001-03-07 21:32:51 +00:00
|
|
|
|
PROP_ACTIVATES_DEFAULT,
|
2001-10-18 00:53:04 +00:00
|
|
|
|
PROP_SCROLL_OFFSET,
|
2007-03-08 02:36:46 +00:00
|
|
|
|
PROP_TRUNCATE_MULTILINE,
|
2008-06-20 11:01:56 +00:00
|
|
|
|
PROP_OVERWRITE_MODE,
|
2008-09-19 13:45:07 +00:00
|
|
|
|
PROP_TEXT_LENGTH,
|
2008-09-29 21:57:29 +00:00
|
|
|
|
PROP_INVISIBLE_CHAR_SET,
|
2008-12-05 11:31:30 +00:00
|
|
|
|
PROP_PROGRESS_FRACTION,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
PROP_PROGRESS_PULSE_STEP,
|
2018-03-16 02:32:05 +00:00
|
|
|
|
PROP_PAINTABLE_PRIMARY,
|
|
|
|
|
PROP_PAINTABLE_SECONDARY,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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,
|
2009-01-13 19:15:42 +00:00
|
|
|
|
PROP_SENSITIVE_SECONDARY,
|
2009-01-18 20:22:10 +00:00
|
|
|
|
PROP_TOOLTIP_TEXT_PRIMARY,
|
|
|
|
|
PROP_TOOLTIP_TEXT_SECONDARY,
|
|
|
|
|
PROP_TOOLTIP_MARKUP_PRIMARY,
|
|
|
|
|
PROP_TOOLTIP_MARKUP_SECONDARY,
|
2009-10-21 16:40:19 +00:00
|
|
|
|
PROP_IM_MODULE,
|
2011-04-01 22:35:32 +00:00
|
|
|
|
PROP_PLACEHOLDER_TEXT,
|
2012-08-16 18:27:51 +00:00
|
|
|
|
PROP_COMPLETION,
|
|
|
|
|
PROP_INPUT_PURPOSE,
|
2012-08-31 18:46:07 +00:00
|
|
|
|
PROP_INPUT_HINTS,
|
2013-02-06 06:20:02 +00:00
|
|
|
|
PROP_ATTRIBUTES,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
PROP_TABS,
|
2019-04-08 04:27:59 +00:00
|
|
|
|
PROP_EXTRA_MENU,
|
2017-08-11 16:05:24 +00:00
|
|
|
|
PROP_SHOW_EMOJI_ICON,
|
2017-08-19 18:08:15 +00:00
|
|
|
|
PROP_ENABLE_EMOJI_COMPLETION,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
PROP_EDITING_CANCELED,
|
2019-02-16 05:50:40 +00:00
|
|
|
|
NUM_PROPERTIES = PROP_EDITING_CANCELED,
|
1998-07-16 20:23:12 +00:00
|
|
|
|
};
|
|
|
|
|
|
2015-09-06 02:34:13 +00:00
|
|
|
|
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 };
|
1998-07-16 20:23:12 +00:00
|
|
|
|
|
2001-01-17 20:05:08 +00:00
|
|
|
|
typedef enum {
|
|
|
|
|
CURSOR_STANDARD,
|
|
|
|
|
CURSOR_DND
|
|
|
|
|
} CursorType;
|
|
|
|
|
|
2009-07-09 01:41:53 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2010-09-18 23:55:42 +00:00
|
|
|
|
/* 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
|
|
|
|
*/
|
2010-09-11 02:12:42 +00:00
|
|
|
|
static void gtk_entry_editable_init (GtkEditableInterface *iface);
|
2001-09-25 16:44:39 +00:00
|
|
|
|
static void gtk_entry_cell_editable_init (GtkCellEditableIface *iface);
|
2006-03-10 10:30:36 +00:00
|
|
|
|
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);
|
2000-07-02 18:41:29 +00:00
|
|
|
|
static void gtk_entry_finalize (GObject *object);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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
|
|
|
|
|
*/
|
2018-08-16 04:53:03 +00:00
|
|
|
|
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);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
static gboolean gtk_entry_query_tooltip (GtkWidget *widget,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
gboolean keyboard_tip,
|
|
|
|
|
GtkTooltip *tooltip);
|
2000-07-02 18:41:29 +00:00
|
|
|
|
static void gtk_entry_direction_changed (GtkWidget *widget,
|
|
|
|
|
GtkTextDirection previous_dir);
|
1998-03-22 21:31:10 +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
|
|
|
|
|
2001-09-25 16:44:39 +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
|
|
|
|
|
*/
|
2009-07-17 03:19:03 +00:00
|
|
|
|
static GtkEntryBuffer *get_buffer (GtkEntry *entry);
|
2017-08-11 16:05:24 +00:00
|
|
|
|
static void set_show_emoji_icon (GtkEntry *entry,
|
|
|
|
|
gboolean value);
|
2009-07-17 03:19:03 +00:00
|
|
|
|
|
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);
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
2020-04-07 02:13:10 +00:00
|
|
|
|
static GtkBuildableIface *buildable_parent_iface = NULL;
|
|
|
|
|
|
|
|
|
|
static void gtk_entry_buildable_interface_init (GtkBuildableIface *iface);
|
2020-10-13 00:18:48 +00:00
|
|
|
|
static void gtk_entry_accessible_interface_init (GtkAccessibleInterface *iface);
|
2020-04-07 02:13:10 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkEntry, gtk_entry, GTK_TYPE_WIDGET,
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_ADD_PRIVATE (GtkEntry)
|
2020-10-13 00:18:48 +00:00
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE,
|
|
|
|
|
gtk_entry_accessible_interface_init)
|
2020-04-07 02:13:10 +00:00
|
|
|
|
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
|
|
|
|
|
2020-10-13 01:55:25 +00:00
|
|
|
|
/* Implement the GtkAccessible interface, in order to obtain focus
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* state from the GtkText widget that we are wrapping. The GtkText
|
2020-10-13 01:55:25 +00:00
|
|
|
|
* 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).
|
|
|
|
|
*/
|
2020-10-13 00:18:48 +00:00
|
|
|
|
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));
|
2021-04-17 19:23:04 +00:00
|
|
|
|
case GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE:
|
|
|
|
|
return FALSE;
|
2020-10-13 00:18:48 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2020-04-07 02:13:10 +00:00
|
|
|
|
|
|
|
|
|
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,
|
2020-04-07 02:13:10 +00:00
|
|
|
|
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,
|
2020-04-07 02:13:10 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-15 13:34:16 +00:00
|
|
|
|
static gboolean
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_grab_focus (GtkWidget *widget)
|
2017-12-01 06:21:21 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +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
|
|
|
|
|
2019-10-15 13:34:16 +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
|
|
|
|
}
|
|
|
|
|
|
2019-03-04 03:14:19 +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;
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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;
|
2001-02-21 20:22:25 +00:00
|
|
|
|
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;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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;
|
2019-02-16 05:50:40 +00:00
|
|
|
|
widget_class->grab_focus = gtk_entry_grab_focus;
|
2020-04-08 11:43:28 +00:00
|
|
|
|
widget_class->focus = gtk_widget_focus_child;
|
2019-03-04 03:14:19 +00:00
|
|
|
|
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
|
2020-05-11 03:58:30 +00:00
|
|
|
|
|
2015-09-20 04:04:30 +00:00
|
|
|
|
quark_entry_completion = g_quark_from_static_string ("gtk-entry-completion-key");
|
2006-03-10 10:30:36 +00:00
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:buffer: (attributes org.gtk.Property.get=gtk_entry_get_buffer org.gtk.Property.set=gtk_entry_set_buffer)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* The buffer object which actually stores the text.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_BUFFER] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("buffer", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_TYPE_ENTRY_BUFFER,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:max-length: (attributes org.gtk.Property.get=gtk_entry_get_max_length org.gtk.Property.set=gtk_entry_set_max_length)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* Maximum number of characters for this entry.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_MAX_LENGTH] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_int ("max-length", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
0, GTK_ENTRY_BUFFER_MAX_SIZE,
|
|
|
|
|
0,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:visibility: (attributes org.gtk.Property.get=gtk_entry_get_visibility org.gtk.Property.set=gtk_entry_set_visibility)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether the entry should show the “invisible char” instead of the
|
|
|
|
|
* actual text (“password mode”).
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_VISIBILITY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("visibility", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:has-frame: (attributes org.gtk.Property.get=gtk_entry_get_has_frame org.gtk.Property.set=gtk_entry_set_has_frame)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* Whehter the entry should draw a frame.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_HAS_FRAME] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("has-frame", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2001-09-18 22:49:02 +00:00
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:invisible-char: (attributes org.gtk.Property.get=gtk_entry_get_invisible_char org.gtk.Property.set=gtk_entry_set_invisible_char)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* The character to use when masking entry contents (“password mode”).
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_INVISIBLE_CHAR] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_unichar ("invisible-char", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
'*',
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:activates-default: (attributes org.gtk.Property.get=gtk_entry_get_activates_default org.gtk.Property.set=gtk_entry_set_activates_default)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether to activate the default widget when Enter is pressed.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_ACTIVATES_DEFAULT] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("activates-default", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2021-02-22 00:43:32 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:scroll-offset:
|
|
|
|
|
*
|
|
|
|
|
* Number of pixels of the entry scrolled off the screen to the left.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_SCROLL_OFFSET] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_int ("scroll-offset", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
0, G_MAXINT,
|
|
|
|
|
0,
|
|
|
|
|
GTK_PARAM_READABLE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2005-12-19 19:03:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:truncate-multiline:
|
|
|
|
|
*
|
|
|
|
|
* When %TRUE, pasted multi-line text is truncated to the first line.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TRUNCATE_MULTILINE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("truncate-multiline", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2005-12-19 19:03:51 +00:00
|
|
|
|
|
2008-06-20 11:01:56 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:overwrite-mode: (attributes org.gtk.Property.get=gtk_entry_get_overwrite_mode org.gtk.Property.set=gtk_entry_set_overwrite_mode)
|
2008-06-20 11:01:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* If text is overwritten when typing in the `GtkEntry`.
|
2008-06-20 11:01:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_OVERWRITE_MODE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("overwrite-mode", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
2008-06-20 11:01:56 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:text-length: (attributes org.gtk.Property.get=gtk_entry_get_text_length)
|
2008-06-20 11:01:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The length of the text in the `GtkEntry`.
|
2008-06-20 11:01:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TEXT_LENGTH] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_uint ("text-length", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
0, G_MAXUINT16,
|
|
|
|
|
0,
|
|
|
|
|
GTK_PARAM_READABLE);
|
|
|
|
|
|
2008-09-19 13:45:07 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:invisible-char-set:
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Whether the invisible char has been set for the `GtkEntry`.
|
2008-09-19 13:45:07 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_INVISIBLE_CHAR_SET] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("invisible-char-set", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE);
|
2008-06-20 11:01:56 +00:00
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:progress-fraction: (attributes org.gtk.Property.get=gtk_entry_get_progress_fraction org.gtk.Property.set=gtk_entry_set_progress_fraction)
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
|
|
|
|
* The current fraction of the task that's been completed.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_PROGRESS_FRACTION] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_double ("progress-fraction", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
0.0, 1.0,
|
|
|
|
|
0.0,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* 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)
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
|
|
|
|
* The fraction of total entry width to move the progress
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* bouncing block for each pulse.
|
|
|
|
|
*
|
|
|
|
|
* See [method@Gtk.Entry.progress_pulse].
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_PROGRESS_PULSE_STEP] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_double ("progress-pulse-step", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
0.0, 1.0,
|
2017-06-16 13:27:08 +00:00
|
|
|
|
0.0,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:placeholder-text: (attributes org.gtk.Property.get=gtk_entry_get_placeholder_text org.gtk.Property.set=gtk_entry_set_placeholder_text)
|
2011-02-24 12:29:10 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The text that will be displayed in the `GtkEntry` when it is empty
|
2011-09-02 04:35:38 +00:00
|
|
|
|
* and unfocused.
|
2011-02-24 12:29:10 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_PLACEHOLDER_TEXT] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("placeholder-text", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2011-02-24 12:29:10 +00:00
|
|
|
|
|
2017-11-04 18:05:52 +00:00
|
|
|
|
/**
|
2018-03-16 02:32:05 +00:00
|
|
|
|
* GtkEntry:primary-icon-paintable:
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* A `GdkPaintable` to use as the primary icon for the entry.
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*/
|
2018-03-16 02:32:05 +00:00
|
|
|
|
entry_props[PROP_PAINTABLE_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("primary-icon-paintable", NULL, NULL,
|
2018-03-16 02:32:05 +00:00
|
|
|
|
GDK_TYPE_PAINTABLE,
|
2017-11-04 18:05:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-16 02:32:05 +00:00
|
|
|
|
* GtkEntry:secondary-icon-paintable:
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* A `GdkPaintable` to use as the secondary icon for the entry.
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*/
|
2018-03-16 02:32:05 +00:00
|
|
|
|
entry_props[PROP_PAINTABLE_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("secondary-icon-paintable", NULL, NULL,
|
2018-03-16 02:32:05 +00:00
|
|
|
|
GDK_TYPE_PAINTABLE,
|
2017-11-04 18:05:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:primary-icon-name:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* The icon name to use for the primary icon for the entry.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_ICON_NAME_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("primary-icon-name", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:secondary-icon-name:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* The icon name to use for the secondary icon for the entry.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_ICON_NAME_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("secondary-icon-name", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:primary-icon-gicon:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The `GIcon` to use for the primary icon for the entry.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_GICON_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("primary-icon-gicon", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
G_TYPE_ICON,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:secondary-icon-gicon:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The `GIcon` to use for the secondary icon for the entry.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_GICON_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("secondary-icon-gicon", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
G_TYPE_ICON,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:primary-icon-storage-type:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* The representation which is used for the primary icon of the entry.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_STORAGE_TYPE_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_enum ("primary-icon-storage-type", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_TYPE_IMAGE_TYPE,
|
|
|
|
|
GTK_IMAGE_EMPTY,
|
|
|
|
|
GTK_PARAM_READABLE);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:secondary-icon-storage-type:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* The representation which is used for the secondary icon of the entry.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_STORAGE_TYPE_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_enum ("secondary-icon-storage-type", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_TYPE_IMAGE_TYPE,
|
|
|
|
|
GTK_IMAGE_EMPTY,
|
|
|
|
|
GTK_PARAM_READABLE);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:primary-icon-activatable:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether the primary icon is activatable.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* GTK emits the [signal@Gtk.Entry::icon-press] and
|
|
|
|
|
* [signal@Gtk.Entry::icon-release] signals only on sensitive,
|
|
|
|
|
* activatable icons.
|
2008-12-27 05:35:09 +00:00
|
|
|
|
*
|
2015-09-06 02:34:13 +00:00
|
|
|
|
* Sensitive, but non-activatable icons can be used for purely
|
2008-12-27 05:35:09 +00:00
|
|
|
|
* informational purposes.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_ACTIVATABLE_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("primary-icon-activatable", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:secondary-icon-activatable:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether the secondary icon is activatable.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* GTK emits the [signal@Gtk.Entry::icon-press] and
|
|
|
|
|
* [signal@Gtk.Entry::icon-release] signals only on sensitive,
|
|
|
|
|
* activatable icons.
|
2008-12-27 05:35:09 +00:00
|
|
|
|
*
|
2015-09-06 02:34:13 +00:00
|
|
|
|
* Sensitive, but non-activatable icons can be used for purely
|
2008-12-27 05:35:09 +00:00
|
|
|
|
* informational purposes.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_ACTIVATABLE_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("secondary-icon-activatable", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:primary-icon-sensitive:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether the primary icon is sensitive.
|
|
|
|
|
*
|
2020-09-12 16:01:04 +00:00
|
|
|
|
* An insensitive icon appears grayed out. GTK does not emit the
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* [signal@Gtk.Entry::icon-press] and [signal@Gtk.Entry::icon-release]
|
|
|
|
|
* signals and does not allow DND from insensitive icons.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2008-12-27 05:35:09 +00:00
|
|
|
|
* An icon should be set insensitive if the action that would trigger
|
|
|
|
|
* when clicked is currently not available.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_SENSITIVE_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("primary-icon-sensitive", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2009-01-18 16:07:00 +00:00
|
|
|
|
* GtkEntry:secondary-icon-sensitive:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether the secondary icon is sensitive.
|
|
|
|
|
*
|
2020-09-12 16:01:04 +00:00
|
|
|
|
* An insensitive icon appears grayed out. GTK does not emit the
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* [signal@Gtk.Entry::icon-press[ and [signal@Gtk.Entry::icon-release]
|
|
|
|
|
* signals and does not allow DND from insensitive icons.
|
2008-12-27 05:35:09 +00:00
|
|
|
|
*
|
|
|
|
|
* An icon should be set insensitive if the action that would trigger
|
|
|
|
|
* when clicked is currently not available.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_SENSITIVE_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("secondary-icon-sensitive", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
TRUE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2009-01-18 20:22:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:primary-icon-tooltip-text:
|
2015-09-06 02:34:13 +00:00
|
|
|
|
*
|
2009-01-18 20:22:10 +00:00
|
|
|
|
* The contents of the tooltip on the primary icon.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Also see [method@Gtk.Entry.set_icon_tooltip_text].
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TOOLTIP_TEXT_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("primary-icon-tooltip-text", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2009-01-18 20:22:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:secondary-icon-tooltip-text:
|
2015-09-06 02:34:13 +00:00
|
|
|
|
*
|
2009-01-18 20:22:10 +00:00
|
|
|
|
* The contents of the tooltip on the secondary icon.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Also see [method@Gtk.Entry.set_icon_tooltip_text].
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TOOLTIP_TEXT_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("secondary-icon-tooltip-text", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:primary-icon-tooltip-markup:
|
2015-09-06 02:34:13 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The contents of the tooltip on the primary icon, with markup.
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Also see [method@Gtk.Entry.set_icon_tooltip_markup].
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TOOLTIP_MARKUP_PRIMARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("primary-icon-tooltip-markup", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:secondary-icon-tooltip-markup:
|
2015-09-06 02:34:13 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The contents of the tooltip on the secondary icon, with markup.
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Also see [method@Gtk.Entry.set_icon_tooltip_markup].
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TOOLTIP_MARKUP_SECONDARY] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("secondary-icon-tooltip-markup", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
2009-01-13 19:15:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:im-module:
|
|
|
|
|
*
|
2015-09-06 02:34:13 +00:00
|
|
|
|
* Which IM (input method) module should be used for this entry.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2015-09-06 02:34:13 +00:00
|
|
|
|
*/
|
|
|
|
|
entry_props[PROP_IM_MODULE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("im-module", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2009-01-13 19:15:42 +00:00
|
|
|
|
|
2011-04-01 22:35:32 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +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.
|
2022-10-04 02:45:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.
|
2015-09-06 02:34:13 +00:00
|
|
|
|
*/
|
|
|
|
|
entry_props[PROP_COMPLETION] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("completion", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_TYPE_ENTRY_COMPLETION,
|
2022-10-04 02:45:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_DEPRECATED);
|
2011-04-01 22:35:32 +00:00
|
|
|
|
|
2012-08-16 18:27:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:input-purpose: (attributes org.gtk.Property.get=gtk_entry_get_input_purpose org.gtk.Property.set=gtk_entry_set_input_purpose)
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*
|
|
|
|
|
* 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
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* [property@Gtk.Entry:visibility].
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_INPUT_PURPOSE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_enum ("input-purpose", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_TYPE_INPUT_PURPOSE,
|
|
|
|
|
GTK_INPUT_PURPOSE_FREE_FORM,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2012-08-16 18:27:51 +00:00
|
|
|
|
|
2012-08-16 18:27:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:input-hints: (attributes org.gtk.Property.get=gtk_entry_get_input_hints org.gtk.Property.set=gtk_entry_set_input_hints)
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Additional hints that allow input methods to fine-tune their behavior.
|
|
|
|
|
*
|
|
|
|
|
* Also see [property@Gtk.Entry:input-purpose]
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_INPUT_HINTS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_flags ("input-hints", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
GTK_TYPE_INPUT_HINTS,
|
|
|
|
|
GTK_INPUT_HINT_NONE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2012-08-16 18:27:51 +00:00
|
|
|
|
|
2012-08-31 18:46:07 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:attributes: (attributes org.gtk.Property.get=gtk_entry_get_attributes org.gtk.Property.set=gtk_entry_set_attributes)
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* The `PangoAttribute`'s @start_index and @end_index must refer to the
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* [class@Gtk.EntryBuffer] text, i.e. without the preedit string.
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_ATTRIBUTES] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boxed ("attributes", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
PANGO_TYPE_ATTR_LIST,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
2012-08-16 18:27:51 +00:00
|
|
|
|
|
2013-08-15 18:34:31 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry::tabs: (attributes org.gtk.Property.get=gtk_entry_get_tabs org.gtk.Property.set=gtk_entry_set_tabs)
|
2013-08-15 18:34:31 +00:00
|
|
|
|
*
|
|
|
|
|
* A list of tabstops to apply to the text of the entry.
|
|
|
|
|
*/
|
2015-09-06 02:34:13 +00:00
|
|
|
|
entry_props[PROP_TABS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boxed ("tabs", NULL, NULL,
|
2015-09-06 02:34:13 +00:00
|
|
|
|
PANGO_TYPE_TAB_ARRAY,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2017-08-11 16:05:24 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry::show-emoji-icon:
|
2017-08-11 16:05:24 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Whether the entry will sohw an Emoji icon in the secondary icon position
|
|
|
|
|
* to open the Emoji chooser.
|
2017-08-11 16:05:24 +00:00
|
|
|
|
*/
|
|
|
|
|
entry_props[PROP_SHOW_EMOJI_ICON] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("show-emoji-icon", NULL, NULL,
|
2017-08-11 16:05:24 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2019-04-08 04:27:59 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* GtkEntry:extra-menu: (attributes org.gtk.Property.get=gtk_entry_get_extra_menu org.gtk.Property.set=gtk_entry_set_extra_menu)
|
2019-04-08 04:27:59 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* A menu model whose contents will be appended to the context menu.
|
2019-04-08 04:27:59 +00:00
|
|
|
|
*/
|
|
|
|
|
entry_props[PROP_EXTRA_MENU] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("extra-menu", NULL, NULL,
|
2019-04-08 04:27:59 +00:00
|
|
|
|
G_TYPE_MENU_MODEL,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2021-02-25 12:01:43 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkEntry:enable-emoji-completion:
|
|
|
|
|
*
|
|
|
|
|
* Whether to suggest Emoji replacements for :-delimited names
|
|
|
|
|
* like `:heart:`.
|
|
|
|
|
*/
|
2017-08-19 18:08:15 +00:00
|
|
|
|
entry_props[PROP_ENABLE_EMOJI_COMPLETION] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("enable-emoji-completion", NULL, NULL,
|
2017-08-19 18:08:15 +00:00
|
|
|
|
FALSE,
|
|
|
|
|
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2015-09-06 02:34:13 +00:00
|
|
|
|
g_object_class_install_properties (gobject_class, NUM_PROPERTIES, entry_props);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_class_override_property (gobject_class, PROP_EDITING_CANCELED, "editing-canceled");
|
|
|
|
|
gtk_editable_install_properties (gobject_class, PROP_EDITING_CANCELED + 1);
|
2013-08-15 18:34:31 +00:00
|
|
|
|
|
2020-09-29 02:52:35 +00:00
|
|
|
|
/**
|
2020-12-16 15:29:10 +00:00
|
|
|
|
* GtkEntry::activate:
|
2020-09-29 02:52:35 +00:00
|
|
|
|
* @self: The widget on which the signal is emitted
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Emitted when the entry is activated.
|
|
|
|
|
*
|
|
|
|
|
* The keybindings for this signal are all forms of the Enter key.
|
2020-09-29 02:52:35 +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
|
|
|
|
signals[ACTIVATE] =
|
2005-09-01 05:11:46 +00:00
|
|
|
|
g_signal_new (I_("activate"),
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2008-12-31 07:29:23 +00:00
|
|
|
|
* GtkEntry::icon-press:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
* @entry: The entry on which the signal is emitted
|
|
|
|
|
* @icon_pos: The position of the clicked icon
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Emitted when an activatable icon is clicked.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2008-12-31 07:29:23 +00:00
|
|
|
|
signals[ICON_PRESS] =
|
|
|
|
|
g_signal_new (I_("icon-press"),
|
2008-12-19 17:44:56 +00:00
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
2009-03-10 17:45:25 +00:00
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
0,
|
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
|
NULL,
|
2018-06-06 11:52:08 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
GTK_TYPE_ENTRY_ICON_POSITION);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2008-12-31 07:29:23 +00:00
|
|
|
|
* GtkEntry::icon-release:
|
2008-12-19 17:44:56 +00:00
|
|
|
|
* @entry: The entry on which the signal is emitted
|
|
|
|
|
* @icon_pos: The position of the clicked icon
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Emitted on the button release from a mouse click
|
|
|
|
|
* over an activatable icon.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
2008-12-31 07:29:23 +00:00
|
|
|
|
signals[ICON_RELEASE] =
|
|
|
|
|
g_signal_new (I_("icon-release"),
|
2008-12-19 17:44:56 +00:00
|
|
|
|
G_TYPE_FROM_CLASS (gobject_class),
|
2009-03-10 17:45:25 +00:00
|
|
|
|
G_SIGNAL_RUN_LAST,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
0,
|
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
|
NULL,
|
2018-06-06 11:52:08 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
|
GTK_TYPE_ENTRY_ICON_POSITION);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2017-11-18 03:49:57 +00:00
|
|
|
|
gtk_widget_class_set_css_name (widget_class, I_("entry"));
|
2020-07-28 20:11:45 +00:00
|
|
|
|
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
|
|
|
|
}
|
1998-06-19 01:26:24 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +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);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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
|
2010-09-11 02:12:42 +00:00
|
|
|
|
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
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
iface->get_delegate = gtk_entry_get_delegate;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-09-25 16:44:39 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_entry_cell_editable_init (GtkCellEditableIface *iface)
|
|
|
|
|
{
|
|
|
|
|
iface->start_editing = gtk_entry_start_editing;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-07 21:32:51 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_entry_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
1998-07-16 20:23:12 +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
|
|
|
|
GtkEntry *entry = GTK_ENTRY (object);
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
1998-07-16 20:23:12 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (gtk_editable_delegate_set_property (object, prop_id, value, pspec))
|
2020-07-28 20:11:45 +00:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
2001-02-21 20:22:25 +00:00
|
|
|
|
switch (prop_id)
|
1998-07-16 20:23:12 +00:00
|
|
|
|
{
|
2009-07-09 01:41:53 +00:00
|
|
|
|
case PROP_BUFFER:
|
2001-02-21 20:22:25 +00:00
|
|
|
|
case PROP_MAX_LENGTH:
|
|
|
|
|
case PROP_VISIBILITY:
|
|
|
|
|
case PROP_INVISIBLE_CHAR:
|
2019-02-16 05:50:40 +00:00
|
|
|
|
case PROP_INVISIBLE_CHAR_SET:
|
2001-03-02 20:02:17 +00:00
|
|
|
|
case PROP_ACTIVATES_DEFAULT:
|
2005-12-19 19:03:51 +00:00
|
|
|
|
case PROP_TRUNCATE_MULTILINE:
|
2008-06-20 11:01:56 +00:00
|
|
|
|
case PROP_OVERWRITE_MODE:
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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);
|
2008-09-19 13:45:07 +00:00
|
|
|
|
break;
|
2008-09-29 21:57:29 +00:00
|
|
|
|
|
2020-07-28 20:11:45 +00:00
|
|
|
|
case PROP_PLACEHOLDER_TEXT:
|
|
|
|
|
gtk_entry_set_placeholder_text (entry, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
case PROP_HAS_FRAME:
|
|
|
|
|
gtk_entry_set_has_frame (entry, g_value_get_boolean (value));
|
2008-09-29 21:57:29 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
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));
|
2008-12-31 02:40:00 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
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));
|
2017-11-04 18:05:52 +00:00
|
|
|
|
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));
|
2017-11-04 18:05:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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));
|
2008-12-05 11:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2009-01-18 20:22:10 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2009-12-19 00:18:14 +00:00
|
|
|
|
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");
|
|
|
|
|
}
|
2009-12-19 00:18:14 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2011-04-01 22:35:32 +00:00
|
|
|
|
case PROP_COMPLETION:
|
2022-10-04 02:45:52 +00:00
|
|
|
|
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)));
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2011-04-01 22:35:32 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2017-08-11 16:05:24 +00:00
|
|
|
|
case PROP_SHOW_EMOJI_ICON:
|
|
|
|
|
set_show_emoji_icon (entry, g_value_get_boolean (value));
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-08 04:27:59 +00:00
|
|
|
|
case PROP_EXTRA_MENU:
|
|
|
|
|
gtk_entry_set_extra_menu (entry, g_value_get_object (value));
|
|
|
|
|
break;
|
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
|
default:
|
2001-02-21 20:22:25 +00:00
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
1998-07-16 20:23:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-07 21:32:51 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_entry_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
1998-07-16 20:23:12 +00:00
|
|
|
|
{
|
2002-01-23 23:46:25 +00:00
|
|
|
|
GtkEntry *entry = GTK_ENTRY (object);
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
1998-07-16 20:23:12 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (gtk_editable_delegate_get_property (object, prop_id, value, pspec))
|
|
|
|
|
return;
|
|
|
|
|
|
2001-02-21 20:22:25 +00:00
|
|
|
|
switch (prop_id)
|
1998-07-16 20:23:12 +00:00
|
|
|
|
{
|
2009-07-09 01:41:53 +00:00
|
|
|
|
case PROP_BUFFER:
|
2019-02-16 05:50:40 +00:00
|
|
|
|
case PROP_IM_MODULE:
|
2001-02-21 20:22:25 +00:00
|
|
|
|
case PROP_MAX_LENGTH:
|
|
|
|
|
case PROP_VISIBILITY:
|
|
|
|
|
case PROP_INVISIBLE_CHAR:
|
2019-02-16 05:50:40 +00:00
|
|
|
|
case PROP_INVISIBLE_CHAR_SET:
|
2001-03-02 20:02:17 +00:00
|
|
|
|
case PROP_ACTIVATES_DEFAULT:
|
2001-06-09 00:12:00 +00:00
|
|
|
|
case PROP_SCROLL_OFFSET:
|
2005-12-19 19:03:51 +00:00
|
|
|
|
case PROP_TRUNCATE_MULTILINE:
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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);
|
2005-12-19 19:03:51 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
case PROP_HAS_FRAME:
|
|
|
|
|
g_value_set_boolean (value, gtk_entry_get_has_frame (entry));
|
2008-06-20 11:01:56 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2008-06-20 11:01:56 +00:00
|
|
|
|
case PROP_TEXT_LENGTH:
|
2019-02-28 04:47:39 +00:00
|
|
|
|
g_value_set_uint (value, gtk_entry_get_text_length (entry));
|
2008-06-20 11:01:56 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
case PROP_PROGRESS_FRACTION:
|
2017-06-16 13:27:08 +00:00
|
|
|
|
g_value_set_double (value, gtk_entry_get_progress_fraction (entry));
|
2008-12-05 11:31:30 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
case PROP_PROGRESS_PULSE_STEP:
|
2017-06-16 13:27:08 +00:00
|
|
|
|
g_value_set_double (value, gtk_entry_get_progress_pulse_step (entry));
|
2008-12-31 02:40:00 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2018-03-16 02:32:05 +00:00
|
|
|
|
case PROP_PAINTABLE_PRIMARY:
|
2017-11-04 23:53:31 +00:00
|
|
|
|
g_value_set_object (value,
|
2018-03-16 02:32:05 +00:00
|
|
|
|
gtk_entry_get_icon_paintable (entry,
|
|
|
|
|
GTK_ENTRY_ICON_PRIMARY));
|
2017-11-04 18:05:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2018-03-16 02:32:05 +00:00
|
|
|
|
case PROP_PAINTABLE_SECONDARY:
|
2017-11-04 23:53:31 +00:00
|
|
|
|
g_value_set_object (value,
|
2018-03-16 02:32:05 +00:00
|
|
|
|
gtk_entry_get_icon_paintable (entry,
|
|
|
|
|
GTK_ENTRY_ICON_SECONDARY));
|
2017-11-04 18:05:52 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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,
|
2009-01-18 16:07:00 +00:00
|
|
|
|
gtk_entry_get_icon_gicon (entry,
|
|
|
|
|
GTK_ENTRY_ICON_PRIMARY));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PROP_GICON_SECONDARY:
|
|
|
|
|
g_value_set_object (value,
|
2009-01-18 16:07:00 +00:00
|
|
|
|
gtk_entry_get_icon_gicon (entry,
|
|
|
|
|
GTK_ENTRY_ICON_SECONDARY));
|
2008-12-31 02:40:00 +00:00
|
|
|
|
break;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
case PROP_STORAGE_TYPE_PRIMARY:
|
|
|
|
|
g_value_set_enum (value,
|
2009-01-18 16:07:00 +00:00
|
|
|
|
gtk_entry_get_icon_storage_type (entry,
|
|
|
|
|
GTK_ENTRY_ICON_PRIMARY));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case PROP_STORAGE_TYPE_SECONDARY:
|
|
|
|
|
g_value_set_enum (value,
|
2009-01-18 16:07:00 +00:00
|
|
|
|
gtk_entry_get_icon_storage_type (entry,
|
|
|
|
|
GTK_ENTRY_ICON_SECONDARY));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
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));
|
2008-12-05 11:31:30 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2009-01-18 20:22:10 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2009-10-21 16:40:19 +00:00
|
|
|
|
case PROP_EDITING_CANCELED:
|
|
|
|
|
g_value_set_boolean (value,
|
2010-10-20 15:14:11 +00:00
|
|
|
|
priv->editing_canceled);
|
2009-10-21 16:40:19 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2011-04-01 22:35:32 +00:00
|
|
|
|
case PROP_COMPLETION:
|
2022-10-04 02:45:52 +00:00
|
|
|
|
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)));
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2011-04-01 22:35:32 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2017-08-11 16:05:24 +00:00
|
|
|
|
case PROP_SHOW_EMOJI_ICON:
|
|
|
|
|
g_value_set_boolean (value, priv->show_emoji_icon);
|
|
|
|
|
break;
|
|
|
|
|
|
2019-04-08 04:27:59 +00:00
|
|
|
|
case PROP_EXTRA_MENU:
|
|
|
|
|
g_value_set_object (value, gtk_entry_get_extra_menu (entry));
|
|
|
|
|
break;
|
|
|
|
|
|
1998-07-16 20:23:12 +00:00
|
|
|
|
default:
|
2001-02-21 20:22:25 +00:00
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
1998-07-16 20:23:12 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-27 10:05:04 +00:00
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
activate_cb (GtkText *text, GtkEntry *entry)
|
2018-02-27 10:05:04 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_signal_emit (entry, signals[ACTIVATE], 0);
|
2018-02-27 10:05:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
notify_cb (GObject *object,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
gpointer data)
|
2008-09-19 13:45:07 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gpointer iface;
|
2019-05-01 04:41:28 +00:00
|
|
|
|
gpointer class;
|
2008-09-19 13:45:07 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/* 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 ());
|
2019-05-01 04:41:28 +00:00
|
|
|
|
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))
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_notify (data, pspec->name);
|
2008-09-19 13:45:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-05 13:59:33 +00:00
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
connect_text_signals (GtkEntry *entry)
|
2018-03-05 13:59:33 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2018-03-05 13:59:33 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_signal_connect (priv->text, "activate", G_CALLBACK (activate_cb), entry);
|
|
|
|
|
g_signal_connect (priv->text, "notify", G_CALLBACK (notify_cb), entry);
|
2018-03-05 13:59:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-21 23:15:24 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-23 13:31:37 +00:00
|
|
|
|
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);
|
2021-08-23 13:31:37 +00:00
|
|
|
|
GtkGesture *catchall;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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);
|
2005-09-02 19:48:53 +00:00
|
|
|
|
|
2021-08-23 13:31:37 +00:00
|
|
|
|
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));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
priv->editing_canceled = FALSE;
|
2004-07-09 15:11:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
static void
|
2008-12-19 17:44:56 +00:00
|
|
|
|
gtk_entry_dispose (GObject *object)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2002-01-23 23:46:25 +00:00
|
|
|
|
GtkEntry *entry = GTK_ENTRY (object);
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
2020-02-04 21:15:32 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_completion (entry, NULL);
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
if (priv->text)
|
2019-03-21 23:15:24 +00:00
|
|
|
|
{
|
|
|
|
|
disconnect_text_signals (entry);
|
|
|
|
|
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
|
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_clear_pointer (&priv->text, gtk_widget_unparent);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2008-12-19 17:44:56 +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
|
|
|
|
|
2008-12-19 17:44:56 +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);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
EntryIconInfo *icon_info = NULL;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int i;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_ICONS; i++)
|
|
|
|
|
{
|
2015-12-06 03:17:51 +00:00
|
|
|
|
icon_info = priv->icons[i];
|
|
|
|
|
if (icon_info == NULL)
|
|
|
|
|
continue;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-12-31 07:45:02 +00:00
|
|
|
|
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);
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
|
|
|
|
g_slice_free (EntryIconInfo, icon_info);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-11-19 17:12:27 +00:00
|
|
|
|
g_clear_pointer (&priv->progress_widget, gtk_widget_unparent);
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
2009-07-09 01:41:53 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_entry_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-23 19:39:29 +00:00
|
|
|
|
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);
|
2015-10-23 19:39:29 +00:00
|
|
|
|
EntryIconInfo *icon_info = priv->icons[icon_pos];
|
2020-08-13 23:49:02 +00:00
|
|
|
|
const char *sides[2] = { "left", "right" };
|
2015-10-23 19:39:29 +00:00
|
|
|
|
|
|
|
|
|
if (icon_info == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
|
2015-10-26 19:28:50 +00:00
|
|
|
|
icon_pos = 1 - icon_pos;
|
2015-10-23 19:39:29 +00:00
|
|
|
|
|
2020-02-06 16:32:26 +00:00
|
|
|
|
gtk_widget_add_css_class (icon_info->widget, sides[icon_pos]);
|
|
|
|
|
gtk_widget_remove_css_class (icon_info->widget, sides[1 - icon_pos]);
|
2015-10-27 02:08:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-10-29 03:32:57 +00:00
|
|
|
|
static void
|
|
|
|
|
update_node_ordering (GtkEntry *entry)
|
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2015-10-29 03:32:57 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2017-06-26 12:50:48 +00:00
|
|
|
|
GtkEntryIconPosition first_icon_pos, second_icon_pos;
|
2015-10-29 03:32:57 +00:00
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget)
|
2020-10-20 02:05:52 +00:00
|
|
|
|
gtk_widget_insert_before (priv->progress_widget, GTK_WIDGET (entry), NULL);
|
2015-10-29 03:32:57 +00:00
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
|
2017-06-26 12:50:48 +00:00
|
|
|
|
{
|
|
|
|
|
first_icon_pos = GTK_ENTRY_ICON_SECONDARY;
|
|
|
|
|
second_icon_pos = GTK_ENTRY_ICON_PRIMARY;
|
|
|
|
|
}
|
2015-10-29 03:32:57 +00:00
|
|
|
|
else
|
2017-06-26 12:50:48 +00:00
|
|
|
|
{
|
|
|
|
|
first_icon_pos = GTK_ENTRY_ICON_PRIMARY;
|
|
|
|
|
second_icon_pos = GTK_ENTRY_ICON_SECONDARY;
|
|
|
|
|
}
|
2015-10-29 03:32:57 +00:00
|
|
|
|
|
2017-06-26 12:50:48 +00:00
|
|
|
|
icon_info = priv->icons[first_icon_pos];
|
2015-12-14 04:22:08 +00:00
|
|
|
|
if (icon_info)
|
2020-10-20 02:05:52 +00:00
|
|
|
|
gtk_widget_insert_after (icon_info->widget, GTK_WIDGET (entry), NULL);
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
2017-06-26 12:50:48 +00:00
|
|
|
|
icon_info = priv->icons[second_icon_pos];
|
|
|
|
|
if (icon_info)
|
2020-10-20 02:05:52 +00:00
|
|
|
|
gtk_widget_insert_before (icon_info->widget, GTK_WIDGET (entry), NULL);
|
2015-10-29 03:32:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-06 11:52:08 +00:00
|
|
|
|
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
|
2019-05-29 17:10:46 +00:00
|
|
|
|
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,
|
2018-06-06 11:52:08 +00:00
|
|
|
|
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
|
2019-05-29 17:10:46 +00:00
|
|
|
|
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,
|
2019-05-29 17:10:46 +00:00
|
|
|
|
GtkEntry *entry)
|
2018-06-06 11:52:08 +00:00
|
|
|
|
{
|
|
|
|
|
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,
|
2021-01-19 08:00:02 +00:00
|
|
|
|
double offset_x,
|
|
|
|
|
double offset_y,
|
2018-06-06 11:52:08 +00:00
|
|
|
|
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];
|
|
|
|
|
|
2019-12-31 07:45:02 +00:00
|
|
|
|
if (icon_info->content != NULL &&
|
2020-12-25 17:57:48 +00:00
|
|
|
|
gtk_drag_check_threshold_double (icon_info->widget, 0, 0, offset_x, offset_y))
|
2018-06-06 11:52:08 +00:00
|
|
|
|
{
|
2019-12-31 07:45:02 +00:00
|
|
|
|
GdkPaintable *paintable;
|
2020-01-06 22:36:18 +00:00
|
|
|
|
GdkSurface *surface;
|
2019-12-31 07:45:02 +00:00
|
|
|
|
GdkDevice *device;
|
2020-01-06 22:36:18 +00:00
|
|
|
|
GdkDrag *drag;
|
2021-01-19 08:00:02 +00:00
|
|
|
|
double start_x, start_y;
|
2019-12-31 07:45:02 +00:00
|
|
|
|
|
2018-06-06 11:52:08 +00:00
|
|
|
|
icon_info->in_drag = TRUE;
|
2020-01-06 22:36:18 +00:00
|
|
|
|
|
|
|
|
|
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (entry)));
|
|
|
|
|
device = gtk_gesture_get_device (GTK_GESTURE (gesture));
|
|
|
|
|
|
2021-01-19 08:00:02 +00:00
|
|
|
|
gtk_gesture_drag_get_start_point (gesture, &start_x, &start_y);
|
|
|
|
|
|
2020-01-06 22:36:18 +00:00
|
|
|
|
drag = gdk_drag_begin (surface, device, icon_info->content, icon_info->actions, start_x, start_y);
|
2019-12-31 07:45:02 +00:00
|
|
|
|
paintable = gtk_widget_paintable_new (icon_info->widget);
|
2020-01-06 22:36:18 +00:00
|
|
|
|
gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
|
2019-12-31 07:45:02 +00:00
|
|
|
|
g_object_unref (paintable);
|
2020-01-06 22:36:18 +00:00
|
|
|
|
|
|
|
|
|
g_object_unref (drag);
|
2018-06-06 11:52:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
static EntryIconInfo*
|
2015-10-23 19:39:29 +00:00
|
|
|
|
construct_icon_info (GtkWidget *widget,
|
2008-12-31 02:49:31 +00:00
|
|
|
|
GtkEntryIconPosition icon_pos)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2010-10-20 15:14:11 +00:00
|
|
|
|
GtkEntry *entry = GTK_ENTRY (widget);
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2018-06-06 11:52:08 +00:00
|
|
|
|
GtkGesture *drag, *press;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
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 ();
|
2018-02-27 14:13:14 +00:00
|
|
|
|
gtk_widget_set_cursor_from_name (icon_info->widget, "default");
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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-09 17:25:36 +00:00
|
|
|
|
|
2015-12-14 04:22:08 +00:00
|
|
|
|
update_icon_style (widget, icon_pos);
|
2015-10-29 03:32:57 +00:00
|
|
|
|
update_node_ordering (entry);
|
|
|
|
|
|
2019-05-29 17:10:46 +00:00
|
|
|
|
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);
|
2018-06-06 11:52:08 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
return icon_info;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_measure (GtkWidget *widget,
|
|
|
|
|
GtkOrientation orientation,
|
|
|
|
|
int for_size,
|
|
|
|
|
int *minimum,
|
|
|
|
|
int *natural,
|
|
|
|
|
int *minimum_baseline,
|
|
|
|
|
int *natural_baseline)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2010-10-20 15:14:11 +00:00
|
|
|
|
GtkEntry *entry = GTK_ENTRY (widget);
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-07-21 07:58:08 +00:00
|
|
|
|
int i;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_widget_measure (priv->text,
|
|
|
|
|
orientation,
|
|
|
|
|
for_size,
|
|
|
|
|
minimum, natural,
|
|
|
|
|
minimum_baseline, natural_baseline);
|
2016-02-03 19:44:06 +00:00
|
|
|
|
|
2019-07-21 07:58:08 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
|
2016-02-03 19:44:06 +00:00
|
|
|
|
{
|
|
|
|
|
int prog_min, prog_nat;
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
gtk_widget_measure (priv->progress_widget,
|
|
|
|
|
orientation,
|
|
|
|
|
for_size,
|
|
|
|
|
&prog_min, &prog_nat,
|
|
|
|
|
NULL, NULL);
|
2016-02-03 19:44:06 +00:00
|
|
|
|
|
|
|
|
|
*minimum = MAX (*minimum, prog_min);
|
|
|
|
|
*natural = MAX (*natural, prog_nat);
|
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-08-16 04:53:03 +00:00
|
|
|
|
gtk_entry_size_allocate (GtkWidget *widget,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
int baseline)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-28 06:30:18 +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;
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkAllocation text_alloc;
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
text_alloc.x = 0;
|
|
|
|
|
text_alloc.y = 0;
|
|
|
|
|
text_alloc.width = width;
|
|
|
|
|
text_alloc.height = height;
|
2016-11-05 09:34:34 +00:00
|
|
|
|
|
2015-12-06 03:17:51 +00:00
|
|
|
|
for (i = 0; i < MAX_ICONS; i++)
|
|
|
|
|
{
|
|
|
|
|
EntryIconInfo *icon_info = priv->icons[i];
|
|
|
|
|
GtkAllocation icon_alloc;
|
2018-08-16 04:53:03 +00:00
|
|
|
|
int icon_width;
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
|
|
|
|
if (!icon_info)
|
|
|
|
|
continue;
|
|
|
|
|
|
2017-06-16 09:19:52 +00:00
|
|
|
|
gtk_widget_measure (icon_info->widget,
|
|
|
|
|
GTK_ORIENTATION_HORIZONTAL,
|
|
|
|
|
-1,
|
2018-08-16 04:53:03 +00:00
|
|
|
|
NULL, &icon_width,
|
2017-06-16 09:19:52 +00:00
|
|
|
|
NULL, NULL);
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
2019-04-28 06:30:18 +00:00
|
|
|
|
if ((is_rtl && i == GTK_ENTRY_ICON_PRIMARY) ||
|
|
|
|
|
(!is_rtl && i == GTK_ENTRY_ICON_SECONDARY))
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_alloc.x = width - icon_width;
|
2015-12-06 03:17:51 +00:00
|
|
|
|
else
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_alloc.x = 0;
|
2018-02-26 11:29:11 +00:00
|
|
|
|
icon_alloc.y = 0;
|
2018-08-16 04:53:03 +00:00
|
|
|
|
icon_alloc.width = icon_width;
|
|
|
|
|
icon_alloc.height = height;
|
2015-12-06 03:17:51 +00:00
|
|
|
|
|
2018-03-31 19:02:28 +00:00
|
|
|
|
gtk_widget_size_allocate (icon_info->widget, &icon_alloc, baseline);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
text_alloc.width -= icon_width;
|
2019-04-28 06:30:18 +00:00
|
|
|
|
|
|
|
|
|
if ((!is_rtl && i == GTK_ENTRY_ICON_PRIMARY) ||
|
|
|
|
|
(is_rtl && i == GTK_ENTRY_ICON_SECONDARY))
|
2019-02-16 05:50:40 +00:00
|
|
|
|
text_alloc.x += icon_width;
|
2015-12-06 03:17:51 +00:00
|
|
|
|
}
|
2016-01-25 14:04:04 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_widget_size_allocate (priv->text, &text_alloc, baseline);
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
|
2016-02-03 19:44:06 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAllocation progress_alloc;
|
2017-12-10 04:48:35 +00:00
|
|
|
|
int min, nat;
|
2016-02-03 19:44:06 +00:00
|
|
|
|
|
2017-12-10 04:48:35 +00:00
|
|
|
|
gtk_widget_measure (priv->progress_widget,
|
|
|
|
|
GTK_ORIENTATION_VERTICAL,
|
|
|
|
|
-1,
|
|
|
|
|
&min, &nat,
|
|
|
|
|
NULL, NULL);
|
2017-06-16 13:27:08 +00:00
|
|
|
|
progress_alloc.x = 0;
|
2018-08-16 04:53:03 +00:00
|
|
|
|
progress_alloc.y = height - nat;
|
|
|
|
|
progress_alloc.width = width;
|
2017-12-10 04:48:35 +00:00
|
|
|
|
progress_alloc.height = nat;
|
2016-02-03 19:44:06 +00:00
|
|
|
|
|
2018-03-31 19:02:28 +00:00
|
|
|
|
gtk_widget_size_allocate (priv->progress_widget, &progress_alloc, -1);
|
2016-02-03 19:44:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-01-25 14:04:04 +00:00
|
|
|
|
/* 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))
|
|
|
|
|
{
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2016-01-25 14:04:04 +00:00
|
|
|
|
GtkEntryCompletion *completion;
|
|
|
|
|
|
|
|
|
|
completion = gtk_entry_get_completion (entry);
|
|
|
|
|
if (completion)
|
|
|
|
|
_gtk_entry_completion_resize_popup (completion);
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2016-01-25 14:04:04 +00:00
|
|
|
|
}
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-04 16:58:47 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_entry_snapshot (GtkWidget *widget,
|
|
|
|
|
GtkSnapshot *snapshot)
|
2015-12-06 03:17:51 +00:00
|
|
|
|
{
|
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;
|
2010-09-03 15:25:26 +00:00
|
|
|
|
|
2016-11-14 00:52:22 +00:00
|
|
|
|
/* Draw progress */
|
2017-06-16 13:27:08 +00:00
|
|
|
|
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
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_widget_snapshot_child (widget, priv->text, snapshot);
|
2018-01-10 10:02:10 +00:00
|
|
|
|
|
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
|
|
|
|
}
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_grab_focus_without_selecting:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Causes @entry to have keyboard focus.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2019-10-16 19:36:05 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if focus is now inside @self
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
2019-10-16 19:36:05 +00:00
|
|
|
|
gboolean
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_grab_focus_without_selecting (GtkEntry *entry)
|
2004-08-14 15:59:39 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2004-08-14 15:59:39 +00:00
|
|
|
|
|
2019-10-16 19:36:05 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
|
|
|
|
|
|
|
|
|
return gtk_text_grab_focus_without_selecting (GTK_TEXT (priv->text));
|
2004-08-14 15:59:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_entry_direction_changed (GtkWidget *widget,
|
|
|
|
|
GtkTextDirection previous_dir)
|
2004-08-14 15:59:39 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEntry *entry = GTK_ENTRY (widget);
|
2004-08-14 15:59:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
update_icon_style (widget, GTK_ENTRY_ICON_PRIMARY);
|
|
|
|
|
update_icon_style (widget, GTK_ENTRY_ICON_SECONDARY);
|
2004-08-14 15:59:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
update_node_ordering (entry);
|
2004-08-14 15:59:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GTK_WIDGET_CLASS (gtk_entry_parent_class)->direction_changed (widget, previous_dir);
|
2004-08-14 15:59:39 +00:00
|
|
|
|
}
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/* GtkCellEditable method implementations
|
|
|
|
|
*/
|
2022-10-07 21:47:28 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2012-07-11 13:55:00 +00:00
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_cell_editable_entry_activated (GtkEntry *entry, gpointer data)
|
2012-07-11 13:55:00 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (entry));
|
|
|
|
|
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (entry));
|
|
|
|
|
}
|
2016-11-05 09:34:34 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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);
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (keyval == GDK_KEY_Escape)
|
2012-07-11 13:55:00 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/* 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));
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return GDK_EVENT_STOP;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
return GDK_EVENT_PROPAGATE;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_entry_start_editing (GtkCellEditable *cell_editable,
|
|
|
|
|
GdkEvent *event)
|
2012-07-11 13:55:00 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-07 21:47:28 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/* Internal functions
|
|
|
|
|
*/
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_reset_im_context:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* 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);
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_reset_im_context (GTK_TEXT (priv->text));
|
2012-07-11 13:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_clear_icon (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
2012-07-11 13:55:00 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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));
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (storage_type == GTK_IMAGE_EMPTY)
|
|
|
|
|
return;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (entry));
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
switch (storage_type)
|
2012-07-11 13:55:00 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
case GTK_IMAGE_EMPTY:
|
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
2012-07-11 13:55:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_image_clear (GTK_IMAGE (icon_info->widget));
|
2001-03-03 21:03:52 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry),
|
|
|
|
|
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
|
|
|
|
|
? PROP_STORAGE_TYPE_PRIMARY
|
|
|
|
|
: PROP_STORAGE_TYPE_SECONDARY]);
|
2018-03-26 17:30:40 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +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
|
|
|
|
|
2001-06-09 00:12:00 +00:00
|
|
|
|
/**
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* gtk_entry_new:
|
2001-06-09 00:12:00 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Creates a new entry.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns: a new `GtkEntry`.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
GtkWidget*
|
|
|
|
|
gtk_entry_new (void)
|
2001-06-09 00:12:00 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return g_object_new (GTK_TYPE_ENTRY, NULL);
|
2001-06-09 00:12:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* gtk_entry_new_with_buffer:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @buffer: The buffer to use for the new `GtkEntry`.
|
2016-11-25 20:32:09 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Creates a new entry with the specified text buffer.
|
2016-11-25 20:32:09 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns: a new `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
GtkWidget*
|
|
|
|
|
gtk_entry_new_with_buffer (GtkEntryBuffer *buffer)
|
2001-06-09 00:12:00 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY_BUFFER (buffer), NULL);
|
2019-02-28 04:47:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return g_object_new (GTK_TYPE_ENTRY, "buffer", buffer, NULL);
|
2001-06-09 00:12:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
static GtkEntryBuffer*
|
|
|
|
|
get_buffer (GtkEntry *entry)
|
2001-06-09 00:12:00 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_buffer (GTK_TEXT (priv->text));
|
2001-06-09 00:12:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-02 20:02:17 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_buffer: (attributes org.gtk.Method.get_property=buffer)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2001-06-09 00:12:00 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Get the `GtkEntryBuffer` object which holds the text for
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* this widget.
|
2001-06-09 00:12:00 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns: (transfer none): A `GtkEntryBuffer` object.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
GtkEntryBuffer*
|
|
|
|
|
gtk_entry_get_buffer (GtkEntry *entry)
|
2001-03-02 20:02:17 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
2001-03-02 20:02:17 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return get_buffer (entry);
|
2001-03-02 20:02:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-03-01 03:30:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_buffer: (attributes org.gtk.Method.set_property=buffer)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
|
|
|
|
* @buffer: a `GtkEntryBuffer`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Set the `GtkEntryBuffer` object which holds the text for
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* this widget.
|
|
|
|
|
*/
|
2004-03-01 03:30:27 +00:00
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_buffer (GtkEntry *entry,
|
|
|
|
|
GtkEntryBuffer *buffer)
|
2004-03-01 03:30:27 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2004-03-01 03:30:27 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_buffer (GTK_TEXT (priv->text), buffer);
|
2004-03-01 03:30:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-11-04 18:05:52 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_visibility: (attributes org.gtk.Method.set_property=visibility)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* @visible: %TRUE if the contents of the entry are displayed as plaintext
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Sets whether the contents of the entry are visible or not.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* 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.
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*
|
2020-09-12 16:01:04 +00:00
|
|
|
|
* By default, GTK picks the best invisible character available
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* in the current font, but it can be changed with
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* [method@Gtk.Entry.set_invisible_char].
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Note that you probably want to set [property@Gtk.Entry:input-purpose]
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* 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.
|
2017-11-04 18:05:52 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_visibility (GtkEntry *entry,
|
2021-02-22 00:43:32 +00:00
|
|
|
|
gboolean visible)
|
2017-11-04 18:05:52 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2017-11-04 18:05:52 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_visibility (GTK_TEXT (priv->text), visible);
|
2017-11-04 18:05:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_visibility: (attributes org.gtk.Method.get_property=visibility)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
|
|
|
|
*
|
|
|
|
|
* Retrieves whether the text in @entry is visible.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* See [method@Gtk.Entry.set_visibility].
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Returns: %TRUE if the text is currently visible
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_entry_get_visibility (GtkEntry *entry)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
2008-12-31 02:44:46 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_visibility (GTK_TEXT (priv->text));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_invisible_char: (attributes org.gtk.Method.sets_property=invisible-char)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @ch: a Unicode character
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2008-12-19 17:44:56 +00:00
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_invisible_char (GtkEntry *entry,
|
|
|
|
|
gunichar ch)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_invisible_char (GTK_TEXT (priv->text), ch);
|
|
|
|
|
}
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_invisible_char: (attributes org.gtk.Method.get_property=invisible-char)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the character displayed in place of the actual text
|
|
|
|
|
* in “password mode”.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the current invisible char, or 0, if the entry does not
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* show invisible text at all.
|
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gunichar
|
|
|
|
|
gtk_entry_get_invisible_char (GtkEntry *entry)
|
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
2008-12-31 02:44:46 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_invisible_char (GTK_TEXT (priv->text));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* gtk_entry_unset_invisible_char:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Unsets the invisible char, so that the default invisible char
|
|
|
|
|
* is used again. See [method@Gtk.Entry.set_invisible_char].
|
|
|
|
|
*/
|
2008-12-19 17:44:56 +00:00
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_unset_invisible_char (GtkEntry *entry)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_unset_invisible_char (GTK_TEXT (priv->text));
|
|
|
|
|
}
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_overwrite_mode: (attributes org.gtk.Method.set_property=overwrite-mode)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @overwrite: new value
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Sets whether the text is overwritten when typing in the `GtkEntry`.
|
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_overwrite_mode (GtkEntry *entry,
|
|
|
|
|
gboolean overwrite)
|
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_overwrite_mode (GTK_TEXT (priv->text), overwrite);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_overwrite_mode: (attributes org.gtk.Method.get_property=overwrite-mode)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Gets whether the `GtkEntry` is in overwrite mode.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Returns: whether the text is overwritten when typing.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2008-12-19 17:44:56 +00:00
|
|
|
|
gboolean
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_overwrite_mode (GtkEntry *entry)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_overwrite_mode (GTK_TEXT (priv->text));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_max_length: (attributes org.gtk.Method.set_property=max-length)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @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.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Sets the maximum allowed length of the contents of the widget.
|
|
|
|
|
*
|
|
|
|
|
* If the current contents are longer than the given length, then
|
2021-09-28 19:40:41 +00:00
|
|
|
|
* they will be truncated to fit. The length is is in characters.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* This is equivalent to getting @entry's `GtkEntryBuffer` and
|
|
|
|
|
* calling [method@Gtk.EntryBuffer.set_max_length] on it.
|
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_max_length (GtkEntry *entry,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int max)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2019-02-28 04:47:39 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
2019-02-28 04:47:39 +00:00
|
|
|
|
|
|
|
|
|
gtk_text_set_max_length (GTK_TEXT (priv->text), max);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_max_length: (attributes org.gtk.Method.get_property=max-length)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the maximum allowed length of the text in @entry.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* See [method@Gtk.Entry.set_max_length].
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the maximum allowed number of characters
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* in `GtkEntry`, or 0 if there is no maximum.
|
|
|
|
|
*/
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_max_length (GtkEntry *entry)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2019-02-28 04:47:39 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-28 04:47:39 +00:00
|
|
|
|
return gtk_text_get_max_length (GTK_TEXT (priv->text));
|
2019-02-16 05:50:40 +00:00
|
|
|
|
}
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_text_length: (attributes org.gtk.Method.get_property=text-length)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the current length of the text in @entry.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* This is equivalent to getting @entry's `GtkEntryBuffer`
|
|
|
|
|
* and calling [method@Gtk.EntryBuffer.get_length] on it.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the current number of characters
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* in `GtkEntry`, or 0 if there are none.
|
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
guint16
|
|
|
|
|
gtk_entry_get_text_length (GtkEntry *entry)
|
|
|
|
|
{
|
2019-02-28 04:47:39 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-28 04:47:39 +00:00
|
|
|
|
return gtk_text_get_text_length (GTK_TEXT (priv->text));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_activates_default: (attributes org.gtk.Method.set_property=activates-default)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @setting: %TRUE to activate window’s default widget on Enter keypress
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2008-12-19 17:44:56 +00:00
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_activates_default (GtkEntry *entry,
|
|
|
|
|
gboolean setting)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_activates_default (GTK_TEXT (priv->text), setting);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_activates_default: (attributes org.gtk.Method.get_property=activates-default)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Retrieves the value set by gtk_entry_set_activates_default().
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Returns: %TRUE if the entry will activate the default widget
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_activates_default (GtkEntry *entry)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
2009-01-01 21:14:07 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_activates_default (GTK_TEXT (priv->text));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-22 12:46:48 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_has_frame: (attributes org.gtk.Method.set_property=has-frame)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @setting: new value
|
2020-01-29 11:11:39 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Sets whether the entry has a beveled frame around it.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2010-10-22 12:46:48 +00:00
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_has_frame (GtkEntry *entry,
|
|
|
|
|
gboolean setting)
|
2010-10-22 12:46:48 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
setting = (setting != FALSE);
|
2018-04-07 11:37:24 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (setting == gtk_entry_get_has_frame (entry))
|
|
|
|
|
return;
|
2018-04-07 11:37:24 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (setting)
|
2020-08-13 23:49:02 +00:00
|
|
|
|
gtk_widget_remove_css_class (GTK_WIDGET (entry), "flat");
|
2010-10-22 12:46:48 +00:00
|
|
|
|
else
|
2020-08-13 23:49:02 +00:00
|
|
|
|
gtk_widget_add_css_class (GTK_WIDGET (entry), "flat");
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_HAS_FRAME]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_has_frame: (attributes org.gtk.Method.get_property=has-frame)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Gets the value set by gtk_entry_set_has_frame().
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Returns: whether the entry has a beveled frame
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gtk_entry_get_has_frame (GtkEntry *entry)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
|
|
|
|
|
2020-08-13 23:49:02 +00:00
|
|
|
|
return !gtk_widget_has_css_class (GTK_WIDGET (entry), "flat");
|
2010-10-22 12:46:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
2021-02-25 15:09:59 +00:00
|
|
|
|
* gtk_entry_set_alignment:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @xalign: The horizontal alignment, from 0 (left) to 1 (right).
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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 12:01:43 +00:00
|
|
|
|
*
|
2021-02-25 15:09:59 +00:00
|
|
|
|
* See also: [property@Gtk.Editable:xalign]
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
void
|
2020-07-24 20:25:56 +00:00
|
|
|
|
gtk_entry_set_alignment (GtkEntry *entry,
|
|
|
|
|
float xalign)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2017-08-01 09:09:01 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_editable_set_alignment (GTK_EDITABLE (priv->text), xalign);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-18 20:22:10 +00:00
|
|
|
|
/**
|
2021-02-25 15:09:59 +00:00
|
|
|
|
* gtk_entry_get_alignment:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2009-01-18 20:22:10 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Gets the value set by gtk_entry_set_alignment().
|
|
|
|
|
*
|
2021-02-25 15:09:59 +00:00
|
|
|
|
* See also: [property@Gtk.Editable:xalign]
|
2021-02-25 12:01:43 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Returns: the alignment
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2020-07-24 20:25:56 +00:00
|
|
|
|
float
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_alignment (GtkEntry *entry)
|
2009-01-18 20:22:10 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0.0);
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_editable_get_alignment (GTK_EDITABLE (priv->text));
|
2009-01-18 20:22:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* gtk_entry_set_icon_from_paintable:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @paintable: (nullable): A `GdkPaintable`
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Sets the icon shown in the specified position using a `GdkPaintable`.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* If @paintable is %NULL, no icon will be shown in the specified position.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_icon_from_paintable (GtkEntry *entry,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
GtkEntryIconPosition icon_pos,
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GdkPaintable *paintable)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (entry));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (paintable)
|
|
|
|
|
{
|
2020-02-04 21:15:32 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
|
|
|
|
|
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_ref (paintable);
|
2012-11-11 17:01:57 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_image_set_from_paintable (GTK_IMAGE (icon_info->widget), paintable);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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]);
|
|
|
|
|
}
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_unref (paintable);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
gtk_entry_clear_icon (entry, icon_pos);
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (entry));
|
2009-01-18 20:22:10 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_thaw_notify (G_OBJECT (entry));
|
2009-01-18 20:22:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-19 17:44:56 +00:00
|
|
|
|
/**
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* gtk_entry_set_icon_from_icon_name:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: The position at which to set the icon
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @icon_name: (nullable): An icon name
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* Sets the icon shown in the entry at the specified position
|
|
|
|
|
* from the current icon theme.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* If the icon name isn’t known, a “broken image” icon will be
|
|
|
|
|
* displayed instead.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* If @icon_name is %NULL, no icon will be shown in the
|
|
|
|
|
* specified position.
|
2008-12-19 17:44:56 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_set_icon_from_icon_name (GtkEntry *entry,
|
2008-12-19 17:44:56 +00:00
|
|
|
|
GtkEntryIconPosition icon_pos,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *icon_name)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
|
|
|
|
|
2010-12-17 09:15:08 +00:00
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (entry));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (icon_name != NULL)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_image_set_from_icon_name (GTK_IMAGE (icon_info->widget), icon_name);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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]);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
else
|
|
|
|
|
gtk_entry_clear_icon (entry, icon_pos);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (entry));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_thaw_notify (G_OBJECT (entry));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_set_icon_from_gicon:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: The position at which to set the icon
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @icon: (nullable): The icon to set
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the icon shown in the entry at the specified position
|
|
|
|
|
* from the current icon theme.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* If the icon isn’t known, a “broken image” icon will be
|
|
|
|
|
* displayed instead.
|
|
|
|
|
*
|
|
|
|
|
* If @icon is %NULL, no icon will be shown in the
|
|
|
|
|
* specified position.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_icon_from_gicon (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos,
|
|
|
|
|
GIcon *icon)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
EntryIconInfo *icon_info;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (entry));
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (icon)
|
2001-10-22 20:47:01 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_image_set_from_gicon (GTK_IMAGE (icon_info->widget), icon);
|
|
|
|
|
|
|
|
|
|
if (icon_pos == GTK_ENTRY_ICON_PRIMARY)
|
2017-09-02 12:42:52 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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]);
|
2017-09-02 12:42:52 +00:00
|
|
|
|
}
|
2001-10-22 20:47:01 +00:00
|
|
|
|
else
|
2016-07-12 18:08:36 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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]);
|
2016-07-12 18:08:36 +00:00
|
|
|
|
}
|
2001-10-22 20:47:01 +00:00
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
else
|
|
|
|
|
gtk_entry_clear_icon (entry, icon_pos);
|
2001-03-29 00:24:58 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (gtk_widget_get_visible (GTK_WIDGET (entry)))
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (entry));
|
2001-03-29 00:24:58 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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
|
|
|
|
}
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_set_icon_activatable:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @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)
|
2015-06-07 18:01:39 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2015-06-07 18:01:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
2015-06-07 18:01:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
2015-06-07 18:01:39 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
activatable = activatable != FALSE;
|
|
|
|
|
|
|
|
|
|
if (icon_info->nonactivatable != !activatable)
|
2015-06-07 18:01:39 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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]);
|
2015-06-07 18:01:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_activatable:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @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)
|
2013-02-06 05:45:45 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2015-06-07 05:08:33 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), FALSE);
|
2013-02-06 05:45:45 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
|
|
|
|
|
|
|
|
|
return (!icon_info || !icon_info->nonactivatable);
|
2013-02-06 05:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_paintable:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the `GdkPaintable` used for the icon.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* If no `GdkPaintable` was used for the icon, %NULL is returned.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (transfer none) (nullable): A `GdkPaintable`
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* if no icon is set for this position or the icon set is not
|
|
|
|
|
* a `GdkPaintable`.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
GdkPaintable *
|
|
|
|
|
gtk_entry_get_icon_paintable (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
2013-01-11 16:35:32 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2013-02-06 05:45:45 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
2013-02-06 05:45:45 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2013-02-06 05:45:45 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!icon_info)
|
|
|
|
|
return NULL;
|
2015-06-07 05:08:33 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_image_get_paintable (GTK_IMAGE (icon_info->widget));
|
|
|
|
|
}
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_gicon:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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).
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (transfer none) (nullable): A `GIcon`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
GIcon *
|
|
|
|
|
gtk_entry_get_icon_gicon (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
EntryIconInfo *icon_info;
|
2013-02-06 06:20:02 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!icon_info)
|
|
|
|
|
return NULL;
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_image_get_gicon (GTK_IMAGE (icon_info->widget));
|
|
|
|
|
}
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_name:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the icon name used for the icon.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* %NULL is returned if there is no icon or if the icon was set
|
|
|
|
|
* by some other method (e.g., by `GdkPaintable` or gicon).
|
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (nullable): An icon name
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_icon_name (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
EntryIconInfo *icon_info;
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
2015-06-08 01:13:16 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!icon_info)
|
|
|
|
|
return NULL;
|
2013-02-06 05:45:45 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_image_get_icon_name (GTK_IMAGE (icon_info->widget));
|
2013-01-11 16:35:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_set_icon_sensitive:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
|
|
|
|
* @sensitive: Specifies whether the icon should appear
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* sensitive or insensitive
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the sensitivity for the specified icon.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_icon_sensitive (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos,
|
|
|
|
|
gboolean sensitive)
|
2013-01-11 16:35:32 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (gtk_widget_get_sensitive (icon_info->widget) != sensitive)
|
2013-01-11 16:35:32 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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]);
|
2013-01-11 16:35:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_sensitive:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @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)
|
2013-01-11 16:35:32 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), TRUE);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), TRUE);
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2013-01-11 16:35:32 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!icon_info)
|
|
|
|
|
return TRUE; /* Default of the property */
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_widget_get_sensitive (icon_info->widget);
|
|
|
|
|
}
|
2015-05-21 09:34:58 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_storage_type:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
|
|
|
|
*
|
|
|
|
|
* Gets the type of representation being used by the icon
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* to store image data.
|
|
|
|
|
*
|
|
|
|
|
* If the icon has no image data, the return value will
|
|
|
|
|
* be %GTK_IMAGE_EMPTY.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: image representation being used
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkImageType
|
|
|
|
|
gtk_entry_get_icon_storage_type (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
EntryIconInfo *icon_info;
|
2015-05-21 09:34:58 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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);
|
2015-05-21 09:34:58 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2015-05-21 09:34:58 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!icon_info)
|
|
|
|
|
return GTK_IMAGE_EMPTY;
|
2018-03-26 02:38:54 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_image_get_storage_type (GTK_IMAGE (icon_info->widget));
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_at_pos:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @x: the x coordinate of the position to find, relative to @entry
|
|
|
|
|
* @y: the y coordinate of the position to find, relative to @entry
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Finds the icon at the given position and return its index.
|
|
|
|
|
*
|
|
|
|
|
* The position’s coordinates are relative to the @entry’s
|
|
|
|
|
* top left corner. If @x, @y doesn’t lie inside an icon,
|
|
|
|
|
* -1 is returned. This function is intended for use in a
|
|
|
|
|
* [signal@Gtk.Widget::query-tooltip] signal handler.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the index of the icon at the given position, or -1
|
|
|
|
|
*/
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_icon_at_pos (GtkEntry *entry,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), -1);
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_ICONS; i++)
|
|
|
|
|
{
|
2008-12-31 02:49:31 +00:00
|
|
|
|
EntryIconInfo *icon_info = priv->icons[i];
|
2020-05-17 21:08:01 +00:00
|
|
|
|
double icon_x, icon_y;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
return -1;
|
2008-12-19 17:44:56 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_set_icon_drag_source:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: icon position
|
2021-05-20 13:17:04 +00:00
|
|
|
|
* @provider: a `GdkContentProvider`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @actions: a bitmask of the allowed drag actions
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Sets up the icon at the given position as drag source.
|
|
|
|
|
*
|
|
|
|
|
* This makes it so that GTK will start a drag
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* operation when the user clicks and drags the icon.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_icon_drag_source (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos,
|
2019-12-31 07:45:02 +00:00
|
|
|
|
GdkContentProvider *provider,
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GdkDragAction actions)
|
2001-01-17 20:05:08 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-12-31 07:45:02 +00:00
|
|
|
|
g_set_object (&icon_info->content, provider);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info->actions = actions;
|
2001-10-03 15:08:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_current_icon_drag_source:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns the index of the icon which is the source of the
|
|
|
|
|
* current DND operation, or -1.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns: index of the icon which is the source of the
|
|
|
|
|
* current DND operation, or -1.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
|
2001-01-17 20:05:08 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info = NULL;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int i;
|
2014-03-07 00:21:50 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), -1);
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
for (i = 0; i < MAX_ICONS; i++)
|
2001-01-17 20:05:08 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if ((icon_info = priv->icons[i]))
|
2001-10-03 15:08:10 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (icon_info->in_drag)
|
|
|
|
|
return i;
|
2001-10-03 15:08:10 +00:00
|
|
|
|
}
|
2001-01-17 20:05:08 +00:00
|
|
|
|
}
|
2018-05-16 02:50:24 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return -1;
|
2018-05-16 02:50:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_area:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: Icon position
|
|
|
|
|
* @icon_area: (out): Return location for the icon’s area
|
|
|
|
|
*
|
|
|
|
|
* Gets the area where entry’s icon at @icon_pos is drawn.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* This function is useful when drawing something to the
|
|
|
|
|
* entry in a draw callback.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_get_icon_area (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos,
|
|
|
|
|
GdkRectangle *icon_area)
|
2001-01-17 20:05:08 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2019-02-20 03:53:47 +00:00
|
|
|
|
graphene_rect_t r;
|
2019-02-16 05:50:40 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (icon_area != NULL);
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-20 03:53:47 +00:00
|
|
|
|
if (icon_info &&
|
|
|
|
|
gtk_widget_compute_bounds (icon_info->widget, GTK_WIDGET (entry), &r))
|
2001-01-17 20:05:08 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*icon_area = (GdkRectangle){
|
|
|
|
|
floorf (r.origin.x),
|
|
|
|
|
floorf (r.origin.y),
|
|
|
|
|
ceilf (r.size.width),
|
|
|
|
|
ceilf (r.size.height),
|
|
|
|
|
};
|
2001-10-03 15:08:10 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_area->x = 0;
|
|
|
|
|
icon_area->y = 0;
|
|
|
|
|
icon_area->width = 0;
|
|
|
|
|
icon_area->height = 0;
|
2001-01-17 20:05:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-02-16 05:50:40 +00:00
|
|
|
|
ensure_has_tooltip (GtkEntry *entry)
|
2001-01-17 20:05:08 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2020-04-22 18:32:17 +00:00
|
|
|
|
const char *text = gtk_widget_get_tooltip_text (GTK_WIDGET (entry));
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gboolean has_tooltip = text != NULL;
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!has_tooltip)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
int i;
|
2008-12-31 02:49:31 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
for (i = 0; i < MAX_ICONS; i++)
|
2008-12-19 17:44:56 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info = priv->icons[i];
|
2001-01-17 20:05:08 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (icon_info != NULL && icon_info->tooltip != NULL)
|
|
|
|
|
{
|
|
|
|
|
has_tooltip = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2001-01-17 20:05:08 +00:00
|
|
|
|
}
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_widget_set_has_tooltip (GTK_WIDGET (entry), has_tooltip);
|
2001-01-17 20:05:08 +00:00
|
|
|
|
}
|
2001-05-30 20:40:28 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_tooltip_text:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: the icon position
|
2001-05-30 20:40:28 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Gets the contents of the tooltip on the icon at the specified
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* position in @entry.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (nullable) (transfer full): the tooltip text
|
2001-05-30 20:40:28 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_icon_tooltip_text (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
2001-05-30 20:40:28 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *text = NULL;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
2011-11-30 19:46:55 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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 */
|
2011-11-30 19:46:55 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return text;
|
2011-11-30 19:46:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_set_icon_tooltip_text:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: the icon position
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @tooltip: (nullable): the contents of the tooltip for the icon
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets @tooltip as the contents of the tooltip for the icon
|
|
|
|
|
* at the specified position.
|
|
|
|
|
*
|
|
|
|
|
* Use %NULL for @tooltip to remove an existing tooltip.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_icon_tooltip_text (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *tooltip)
|
2013-08-17 02:45:13 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
EntryIconInfo *icon_info;
|
2013-08-17 02:45:13 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
2013-08-17 02:45:13 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
2013-08-17 02:45:13 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_free (icon_info->tooltip);
|
2013-08-17 02:45:13 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/* 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;
|
2013-08-17 02:45:13 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info->tooltip = tooltip ? g_markup_escape_text (tooltip, -1) : NULL;
|
2010-03-01 03:21:41 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
ensure_has_tooltip (entry);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry),
|
|
|
|
|
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
|
|
|
|
|
? PROP_TOOLTIP_TEXT_PRIMARY
|
|
|
|
|
: PROP_TOOLTIP_TEXT_SECONDARY]);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_get_icon_tooltip_markup:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: the icon position
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Gets the contents of the tooltip on the icon at the specified
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* position in @entry.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (nullable) (transfer full): the tooltip text
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_entry_get_icon_tooltip_markup (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos)
|
2001-05-30 20:40:28 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2010-03-01 03:21:41 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
g_return_val_if_fail (IS_VALID_ICON_POSITION (icon_pos), NULL);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info = priv->icons[icon_pos];
|
|
|
|
|
|
|
|
|
|
if (!icon_info)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
return g_strdup (icon_info->tooltip);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_set_icon_tooltip_markup:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-02-16 05:50:40 +00:00
|
|
|
|
* @icon_pos: the icon position
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @tooltip: (nullable): the contents of the tooltip for the icon
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets @tooltip as the contents of the tooltip for the icon at
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* the specified position.
|
|
|
|
|
*
|
|
|
|
|
* @tooltip is assumed to be marked up with Pango Markup.
|
2019-02-16 05:50:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Use %NULL for @tooltip to remove an existing tooltip.
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* See also [method@Gtk.Widget.set_tooltip_markup] and
|
|
|
|
|
* [method@Gtk.Entry.set_icon_tooltip_text].
|
2001-05-30 20:40:28 +00:00
|
|
|
|
*/
|
2019-02-16 05:50:40 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_icon_tooltip_markup (GtkEntry *entry,
|
|
|
|
|
GtkEntryIconPosition icon_pos,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *tooltip)
|
2001-05-30 20:40:28 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2001-07-18 22:43:41 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
g_return_if_fail (IS_VALID_ICON_POSITION (icon_pos));
|
2006-12-29 19:26:34 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if ((icon_info = priv->icons[icon_pos]) == NULL)
|
|
|
|
|
icon_info = construct_icon_info (GTK_WIDGET (entry), icon_pos);
|
2006-12-29 19:26:34 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_free (icon_info->tooltip);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
/* 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;
|
2001-05-30 20:40:28 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
icon_info->tooltip = g_strdup (tooltip);
|
2006-09-01 02:14:30 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
ensure_has_tooltip (entry);
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry),
|
|
|
|
|
entry_props[icon_pos == GTK_ENTRY_ICON_PRIMARY
|
|
|
|
|
? PROP_TOOLTIP_MARKUP_PRIMARY
|
|
|
|
|
: PROP_TOOLTIP_MARKUP_SECONDARY]);
|
2001-05-30 20:40:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_entry_query_tooltip (GtkWidget *widget,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gboolean keyboard_tip,
|
|
|
|
|
GtkTooltip *tooltip)
|
2001-05-30 20:40:28 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEntry *entry = GTK_ENTRY (widget);
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2019-02-16 05:50:40 +00:00
|
|
|
|
EntryIconInfo *icon_info;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int icon_pos;
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
if (!keyboard_tip)
|
2001-05-30 20:40:28 +00:00
|
|
|
|
{
|
2019-02-16 05:50:40 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
2003-07-11 12:51:24 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-10-20 15:14:11 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return GTK_WIDGET_CLASS (gtk_entry_parent_class)->query_tooltip (widget,
|
|
|
|
|
x, y,
|
|
|
|
|
keyboard_tip,
|
|
|
|
|
tooltip);
|
2006-09-01 02:14:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2003-09-30 21:44:39 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_completion: (attributes org.gtk.Method.set_property=completion)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @completion: (nullable): The `GtkEntryCompletion`
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets @completion to be the auxiliary completion object
|
|
|
|
|
* to use with @entry.
|
2003-09-30 21:44:39 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* All further configuration of the completion mechanism is
|
|
|
|
|
* done on @completion using the `GtkEntryCompletion` API.
|
|
|
|
|
* Completion is disabled if @completion is set to %NULL.
|
2022-10-04 02:45:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.
|
2003-09-30 21:44:39 +00:00
|
|
|
|
*/
|
2003-07-11 12:51:24 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2004-01-23 08:38:47 +00:00
|
|
|
|
if (old == completion)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-07-11 12:51:24 +00:00
|
|
|
|
if (old)
|
|
|
|
|
{
|
2012-08-31 14:47:23 +00:00
|
|
|
|
_gtk_entry_completion_disconnect (old);
|
2003-07-11 12:51:24 +00:00
|
|
|
|
g_object_unref (old);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!completion)
|
|
|
|
|
{
|
2015-09-20 04:04:30 +00:00
|
|
|
|
g_object_set_qdata (G_OBJECT (entry), quark_entry_completion, NULL);
|
2003-07-11 12:51:24 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* hook into the entry */
|
|
|
|
|
g_object_ref (completion);
|
|
|
|
|
|
2012-08-31 14:47:23 +00:00
|
|
|
|
_gtk_entry_completion_connect (completion, entry);
|
|
|
|
|
|
2015-09-20 04:04:30 +00:00
|
|
|
|
g_object_set_qdata (G_OBJECT (entry), quark_entry_completion, completion);
|
2011-04-01 22:35:32 +00:00
|
|
|
|
|
2015-09-06 02:34:13 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_COMPLETION]);
|
2003-07-11 12:51:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-09-30 21:44:39 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_completion: (attributes org.gtk.Method.get_property=completion)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: A `GtkEntry`
|
2003-09-30 21:44:39 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns the auxiliary completion object currently
|
|
|
|
|
* in use by @entry.
|
2003-09-30 21:44:39 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): The auxiliary
|
|
|
|
|
* completion object currently in use by @entry
|
2022-10-04 02:45:52 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 4.10: GtkEntryCompletion will be removed in GTK 5.
|
2003-09-30 21:44:39 +00:00
|
|
|
|
*/
|
2003-07-11 12:51:24 +00:00
|
|
|
|
GtkEntryCompletion *
|
|
|
|
|
gtk_entry_get_completion (GtkEntry *entry)
|
|
|
|
|
{
|
|
|
|
|
GtkEntryCompletion *completion;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
|
2015-09-20 04:04:30 +00:00
|
|
|
|
completion = GTK_ENTRY_COMPLETION (g_object_get_qdata (G_OBJECT (entry), quark_entry_completion));
|
2003-07-11 12:51:24 +00:00
|
|
|
|
|
|
|
|
|
return completion;
|
|
|
|
|
}
|
2005-03-20 07:01:23 +00:00
|
|
|
|
|
2022-10-04 02:45:52 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2015-10-23 20:11:08 +00:00
|
|
|
|
static void
|
2017-06-16 13:27:08 +00:00
|
|
|
|
gtk_entry_ensure_progress_widget (GtkEntry *entry)
|
2015-10-23 20:11:08 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2015-10-23 20:11:08 +00:00
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget)
|
2015-10-23 20:11:08 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
priv->progress_widget = g_object_new (GTK_TYPE_PROGRESS_BAR,
|
|
|
|
|
"css-name", "progress",
|
|
|
|
|
NULL);
|
2019-04-07 21:36:40 +00:00
|
|
|
|
gtk_widget_set_can_target (priv->progress_widget, FALSE);
|
2015-10-29 03:32:57 +00:00
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
gtk_widget_set_parent (priv->progress_widget, GTK_WIDGET (entry));
|
2015-10-23 20:11:08 +00:00
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
update_node_ordering (entry);
|
2014-06-28 19:51:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_progress_fraction: (attributes org.gtk.Method.set_property=progress-fraction)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* @fraction: fraction of the task that’s been completed
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* Causes the entry’s progress indicator to “fill in” the given
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* fraction of the bar.
|
|
|
|
|
*
|
|
|
|
|
* The fraction should be between 0.0 and 1.0, inclusive.
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_progress_fraction (GtkEntry *entry,
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double fraction)
|
2008-12-05 11:31:30 +00:00
|
|
|
|
{
|
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;
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
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));
|
2008-12-05 11:31:30 +00:00
|
|
|
|
fraction = CLAMP (fraction, 0.0, 1.0);
|
|
|
|
|
|
2016-02-03 19:44:06 +00:00
|
|
|
|
if (fraction != old_fraction)
|
2009-03-02 18:22:56 +00:00
|
|
|
|
{
|
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);
|
2016-03-04 13:01:02 +00:00
|
|
|
|
|
2016-02-03 19:44:06 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PROGRESS_FRACTION]);
|
2009-03-02 18:22:56 +00:00
|
|
|
|
}
|
2008-12-05 11:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_progress_fraction: (attributes org.gtk.Method.get_property=progress-fraction)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* Returns the current fraction of the task that’s been completed.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* See [method@Gtk.Entry.set_progress_fraction].
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: a fraction from 0.0 to 1.0
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*/
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double
|
2008-12-05 11:31:30 +00:00
|
|
|
|
gtk_entry_get_progress_fraction (GtkEntry *entry)
|
|
|
|
|
{
|
2017-06-16 13:27:08 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0.0);
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget)
|
|
|
|
|
return gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (priv->progress_widget));
|
|
|
|
|
|
|
|
|
|
return 0.0;
|
2008-12-05 11:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_progress_pulse_step: (attributes org.gtk.Method.set_property=progress-pulse-step)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-05 11:31:30 +00:00
|
|
|
|
* @fraction: fraction between 0.0 and 1.0
|
|
|
|
|
*
|
|
|
|
|
* Sets the fraction of total entry width to move the progress
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* bouncing block for each pulse.
|
|
|
|
|
*
|
|
|
|
|
* Use [method@Gtk.Entry.progress_pulse] to pulse
|
|
|
|
|
* the progress.
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_progress_pulse_step (GtkEntry *entry,
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double fraction)
|
2008-12-05 11:31:30 +00:00
|
|
|
|
{
|
2017-06-16 13:27:08 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
|
|
|
|
fraction = CLAMP (fraction, 0.0, 1.0);
|
2017-06-16 13:27:08 +00:00
|
|
|
|
gtk_entry_ensure_progress_widget (entry);
|
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (fraction != gtk_progress_bar_get_pulse_step (GTK_PROGRESS_BAR (priv->progress_widget)))
|
2008-12-05 11:31:30 +00:00
|
|
|
|
{
|
2017-06-16 13:27:08 +00:00
|
|
|
|
gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR (priv->progress_widget), fraction);
|
2015-09-06 02:34:13 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_PROGRESS_PULSE_STEP]);
|
2008-12-05 11:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_progress_pulse_step: (attributes org.gtk.Method.get_property=progress-pulse-step)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the pulse step set with
|
|
|
|
|
* gtk_entry_set_progress_pulse_step().
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: a fraction from 0.0 to 1.0
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*/
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double
|
2008-12-05 11:31:30 +00:00
|
|
|
|
gtk_entry_get_progress_pulse_step (GtkEntry *entry)
|
|
|
|
|
{
|
2017-06-16 13:27:08 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), 0.0);
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget)
|
|
|
|
|
return gtk_progress_bar_get_pulse_step (GTK_PROGRESS_BAR (priv->progress_widget));
|
|
|
|
|
|
|
|
|
|
return 0.0;
|
2008-12-05 11:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_entry_progress_pulse:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Indicates that some progress is made, but you don’t
|
|
|
|
|
* know how much.
|
|
|
|
|
*
|
|
|
|
|
* Causes the entry’s 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]).
|
2008-12-05 11:31:30 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_entry_progress_pulse (GtkEntry *entry)
|
|
|
|
|
{
|
2017-06-16 13:27:08 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2008-12-05 11:31:30 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2017-06-16 13:27:08 +00:00
|
|
|
|
if (priv->progress_widget)
|
|
|
|
|
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (priv->progress_widget));
|
2008-12-05 11:31:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-02-24 12:29:10 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_placeholder_text: (attributes org.gtk.Method.set_property=placeholder-text)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* @text: (nullable): a string to be displayed when @entry is empty and unfocused
|
2011-02-24 12:29:10 +00:00
|
|
|
|
*
|
2019-01-18 09:47:16 +00:00
|
|
|
|
* Sets text to be displayed in @entry when it is empty.
|
2021-02-22 00:43:32 +00:00
|
|
|
|
*
|
|
|
|
|
* This can be used to give a visual hint of the expected
|
|
|
|
|
* contents of the `GtkEntry`.
|
|
|
|
|
*/
|
2011-02-24 12:29:10 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_entry_set_placeholder_text (GtkEntry *entry,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *text)
|
2011-02-24 12:29:10 +00:00
|
|
|
|
{
|
2019-02-25 14:21:56 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2011-02-24 12:29:10 +00:00
|
|
|
|
|
2019-02-25 14:21:56 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
2011-02-24 12:29:10 +00:00
|
|
|
|
|
2019-02-25 14:21:56 +00:00
|
|
|
|
gtk_text_set_placeholder_text (GTK_TEXT (priv->text), text);
|
2020-07-28 20:11:45 +00:00
|
|
|
|
|
|
|
|
|
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
|
|
|
|
GTK_ACCESSIBLE_PROPERTY_PLACEHOLDER, text,
|
|
|
|
|
-1);
|
2011-02-24 12:29:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_placeholder_text: (attributes org.gtk.Method.get_property=placeholder-text)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2011-02-24 12:29:10 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Retrieves the text that will be displayed when @entry
|
|
|
|
|
* is empty and unfocused
|
2011-02-24 12:29:10 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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 *
|
2011-02-24 12:29:10 +00:00
|
|
|
|
gtk_entry_get_placeholder_text (GtkEntry *entry)
|
|
|
|
|
{
|
2019-02-25 14:21:56 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2011-02-24 12:29:10 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
|
2019-02-25 14:21:56 +00:00
|
|
|
|
return gtk_text_get_placeholder_text (GTK_TEXT (priv->text));
|
2008-09-29 21:57:29 +00:00
|
|
|
|
}
|
2010-11-27 03:38:17 +00:00
|
|
|
|
|
2012-08-16 18:27:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_input_purpose: (attributes org.gtk.Method.set_property=input-purpose)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2012-08-16 18:27:27 +00:00
|
|
|
|
* @purpose: the purpose
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Sets the input purpose which can be used by input methods
|
|
|
|
|
* to adjust their behavior.
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*/
|
2012-08-16 18:27:51 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2012-08-16 18:27:51 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_input_purpose (GTK_TEXT (priv->text), purpose);
|
2012-08-16 18:27:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-16 18:27:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_input_purpose: (attributes org.gtk.Method.get_property=input-purpose)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Gets the input purpose of the `GtkEntry`.
|
2021-02-25 12:01:43 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the input purpose
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*/
|
2012-08-16 18:27:51 +00:00
|
|
|
|
GtkInputPurpose
|
|
|
|
|
gtk_entry_get_input_purpose (GtkEntry *entry)
|
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2012-08-16 18:27:51 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), GTK_INPUT_PURPOSE_FREE_FORM);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_input_purpose (GTK_TEXT (priv->text));
|
2012-08-16 18:27:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-16 18:27:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_input_hints: (attributes org.gtk.Method.set_property=input-hints)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2012-08-16 18:27:27 +00:00
|
|
|
|
* @hints: the hints
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Set additional hints which allow input methods to
|
|
|
|
|
* fine-tune their behavior.
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*/
|
2012-08-16 18:27:51 +00:00
|
|
|
|
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);
|
|
|
|
|
|
2012-08-16 18:27:51 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_input_hints (GTK_TEXT (priv->text), hints);
|
2012-08-16 18:27:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-16 18:27:27 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_input_hints: (attributes org.gtk.Method.get_property=input-hints)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Gets the input hints of this `GtkEntry`.
|
2021-02-25 12:01:43 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: the input hints
|
2012-08-16 18:27:27 +00:00
|
|
|
|
*/
|
2012-08-16 18:27:51 +00:00
|
|
|
|
GtkInputHints
|
|
|
|
|
gtk_entry_get_input_hints (GtkEntry *entry)
|
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2012-08-16 18:27:51 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), GTK_INPUT_HINT_NONE);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_input_hints (GTK_TEXT (priv->text));
|
2012-08-16 18:27:51 +00:00
|
|
|
|
}
|
2012-08-31 18:46:07 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_attributes: (attributes org.gtk.Method.set_property=attributes)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
|
|
|
|
* @attrs: a `PangoAttrList`
|
|
|
|
|
*
|
|
|
|
|
* Sets a `PangoAttrList`.
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*/
|
|
|
|
|
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);
|
2012-08-31 18:46:07 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
2012-08-31 18:46:07 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_attributes (GTK_TEXT (priv->text), attrs);
|
2012-08-31 18:46:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_attributes: (attributes org.gtk.Method.get_property=attributes)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
|
|
|
|
*
|
|
|
|
|
* Gets the attribute list of the `GtkEntry`.
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* See [method@Gtk.Entry.set_attributes].
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (transfer none) (nullable): the attribute list
|
2012-08-31 18:46:07 +00:00
|
|
|
|
*/
|
|
|
|
|
PangoAttrList *
|
|
|
|
|
gtk_entry_get_attributes (GtkEntry *entry)
|
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2012-08-31 18:46:07 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_attributes (GTK_TEXT (priv->text));
|
2012-08-31 18:46:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-08-15 18:34:31 +00:00
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_tabs: (attributes org.gtk.Method.set_property=tabs)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
|
|
|
|
* @tabs: (nullable): a `PangoTabArray`
|
|
|
|
|
*
|
|
|
|
|
* Sets a `PangoTabArray`.
|
2013-08-15 18:34:31 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* The tabstops in the array are applied to the entry text.
|
2013-08-15 18:34:31 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2013-08-15 18:34:31 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ENTRY (entry));
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
gtk_text_set_tabs (GTK_TEXT (priv->text), tabs);
|
2013-08-15 18:34:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_tabs: (attributes org.gtk.Method.get_property=tabs)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2013-08-15 18:34:31 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* Gets the tabstops of the `GtkEntry.
|
2013-08-15 18:34:31 +00:00
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* See [method@Gtk.Entry.set_tabs].
|
|
|
|
|
*
|
2021-05-21 00:45:06 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): the tabstops
|
2013-08-15 18:34:31 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
PangoTabArray *
|
|
|
|
|
gtk_entry_get_tabs (GtkEntry *entry)
|
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2013-08-15 18:34:31 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_tabs (GTK_TEXT (priv->text));
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-11 16:05:24 +00:00
|
|
|
|
static void
|
2019-05-04 18:51:27 +00:00
|
|
|
|
pick_emoji (GtkEntry *entry,
|
|
|
|
|
int icon,
|
|
|
|
|
GdkEvent *event,
|
|
|
|
|
gpointer data)
|
2017-08-11 16:05:24 +00:00
|
|
|
|
{
|
2018-03-01 17:42:59 +00:00
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
2017-08-11 16:05:24 +00:00
|
|
|
|
|
2017-11-19 03:44:12 +00:00
|
|
|
|
if (gtk_widget_get_ancestor (GTK_WIDGET (entry), GTK_TYPE_EMOJI_CHOOSER) != NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
2017-08-28 19:26:48 +00:00
|
|
|
|
if (icon == GTK_ENTRY_ICON_SECONDARY)
|
2019-05-04 18:51:27 +00:00
|
|
|
|
g_signal_emit_by_name (priv->text, "insert-emoji");
|
2017-08-11 16:05:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2017-08-11 16:05:24 +00:00
|
|
|
|
|
|
|
|
|
if (priv->show_emoji_icon == value)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
priv->show_emoji_icon = value;
|
|
|
|
|
|
|
|
|
|
if (priv->show_emoji_icon)
|
|
|
|
|
{
|
2017-08-28 19:34:49 +00:00
|
|
|
|
gtk_entry_set_icon_from_icon_name (entry,
|
2017-08-11 16:05:24 +00:00
|
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
|
"face-smile-symbolic");
|
|
|
|
|
|
2017-08-28 19:34:49 +00:00
|
|
|
|
gtk_entry_set_icon_sensitive (entry,
|
2017-08-11 16:05:24 +00:00
|
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
|
TRUE);
|
|
|
|
|
|
2017-08-28 19:34:49 +00:00
|
|
|
|
gtk_entry_set_icon_activatable (entry,
|
2017-08-11 16:05:24 +00:00
|
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
|
TRUE);
|
|
|
|
|
|
2017-08-30 11:48:23 +00:00
|
|
|
|
gtk_entry_set_icon_tooltip_text (entry,
|
|
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
|
_("Insert Emoji"));
|
|
|
|
|
|
2017-08-11 16:05:24 +00:00
|
|
|
|
g_signal_connect (entry, "icon-press", G_CALLBACK (pick_emoji), NULL);
|
|
|
|
|
}
|
2017-08-28 19:35:47 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (entry, pick_emoji, NULL);
|
|
|
|
|
|
|
|
|
|
gtk_entry_set_icon_from_icon_name (entry,
|
|
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
|
NULL);
|
2017-08-30 11:48:23 +00:00
|
|
|
|
|
|
|
|
|
gtk_entry_set_icon_tooltip_text (entry,
|
|
|
|
|
GTK_ENTRY_ICON_SECONDARY,
|
|
|
|
|
NULL);
|
2017-08-28 19:35:47 +00:00
|
|
|
|
}
|
2017-08-11 16:05:24 +00:00
|
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (entry), entry_props[PROP_SHOW_EMOJI_ICON]);
|
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (entry));
|
|
|
|
|
}
|
2017-08-19 18:08:15 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkEventController *
|
|
|
|
|
gtk_entry_get_key_controller (GtkEntry *entry)
|
2017-08-19 18:08:15 +00:00
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return gtk_text_get_key_controller (GTK_TEXT (priv->text));
|
2017-08-19 18:08:15 +00:00
|
|
|
|
}
|
2018-06-06 13:57:22 +00:00
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
GtkText *
|
|
|
|
|
gtk_entry_get_text_widget (GtkEntry *entry)
|
2018-06-06 13:57:22 +00:00
|
|
|
|
{
|
|
|
|
|
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
|
|
|
|
|
2019-02-16 05:50:40 +00:00
|
|
|
|
return GTK_TEXT (priv->text);
|
2018-06-06 13:57:22 +00:00
|
|
|
|
}
|
2019-04-08 04:27:59 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_set_extra_menu: (attributes org.gtk.Method.set_property=extra-menu)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2021-05-19 11:24:34 +00:00
|
|
|
|
* @model: (nullable): a `GMenuModel`
|
2019-04-08 04:27:59 +00:00
|
|
|
|
*
|
|
|
|
|
* 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]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-25 12:01:43 +00:00
|
|
|
|
* gtk_entry_get_extra_menu: (attributes org.gtk.Method.get_property=extra-menu)
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2019-04-08 04:27:59 +00:00
|
|
|
|
*
|
|
|
|
|
* 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
|
2019-04-08 04:27:59 +00:00
|
|
|
|
*/
|
|
|
|
|
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));
|
|
|
|
|
}
|
2020-10-15 20:13:19 +00:00
|
|
|
|
|
|
|
|
|
/*< private >
|
|
|
|
|
* gtk_entry_activate_icon:
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* @entry: a `GtkEntry`
|
2020-10-15 20:13:19 +00:00
|
|
|
|
* @pos: the icon position
|
|
|
|
|
*
|
2021-02-22 00:43:32 +00:00
|
|
|
|
* 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.
|
2020-10-15 20:13:19 +00:00
|
|
|
|
*
|
|
|
|
|
* 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;
|
|
|
|
|
}
|