mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-20 22:10:40 +00:00
Bug 560139 – GtkEntry doesn't paint with the right state
2008-11-12 Christian Dywan <christian@imendio.com> Bug 560139 – GtkEntry doesn't paint with the right state * gtk/gtkentry.c (gtk_entry_class_init), (gtk_entry_draw_frame), (gtk_entry_expose): Reflect the right state if state-hint is set svn path=/trunk/; revision=21787
This commit is contained in:
parent
ba9c358b53
commit
207f3f8685
@ -1,3 +1,10 @@
|
||||
2008-11-12 Christian Dywan <christian@imendio.com>
|
||||
|
||||
Bug 560139 – GtkEntry doesn't paint with the right state
|
||||
|
||||
* gtk/gtkentry.c (gtk_entry_class_init), (gtk_entry_draw_frame),
|
||||
(gtk_entry_expose): Reflect the right state if state-hint is set
|
||||
|
||||
2008-11-12 Christian Dywan <christian@imendio.com>
|
||||
|
||||
Bug 559619 – invisible-char default cannot be tested
|
||||
|
@ -987,6 +987,21 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkEntry:state-hint:
|
||||
*
|
||||
* Indicates whether to pass a proper widget state when
|
||||
* drawing the shadow and the widget background.
|
||||
*
|
||||
* Since: 2.16
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_boolean ("state-hint",
|
||||
P_("State Hint"),
|
||||
P_("Whether to pass a proper state when drawing shadow or background"),
|
||||
FALSE,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_settings_install_property (g_param_spec_boolean ("gtk-entry-select-on-focus",
|
||||
P_("Select on focus"),
|
||||
P_("Whether to select the contents of an entry when it is focused"),
|
||||
@ -1719,6 +1734,8 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
{
|
||||
GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (widget);
|
||||
gint x = 0, y = 0, width, height;
|
||||
gboolean state_hint;
|
||||
GtkStateType state;
|
||||
|
||||
gdk_drawable_get_size (widget->window, &width, &height);
|
||||
|
||||
@ -1743,8 +1760,15 @@ gtk_entry_draw_frame (GtkWidget *widget,
|
||||
height -= 2 * priv->focus_width;
|
||||
}
|
||||
|
||||
gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
|
||||
if (state_hint)
|
||||
state = GTK_WIDGET_HAS_FOCUS (widget) ?
|
||||
GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
|
||||
else
|
||||
state = GTK_STATE_NORMAL;
|
||||
|
||||
gtk_paint_shadow (widget->style, widget->window,
|
||||
GTK_STATE_NORMAL, priv->shadow_type,
|
||||
state, priv->shadow_type,
|
||||
area, widget, "entry", x, y, width, height);
|
||||
|
||||
if (GTK_WIDGET_HAS_FOCUS (widget) && !priv->interior_focus)
|
||||
@ -1765,6 +1789,8 @@ gtk_entry_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
gboolean state_hint;
|
||||
GtkStateType state;
|
||||
|
||||
if (widget->window == event->window)
|
||||
gtk_entry_draw_frame (widget, &event->area);
|
||||
@ -1773,8 +1799,15 @@ gtk_entry_expose (GtkWidget *widget,
|
||||
gint area_width, area_height;
|
||||
gdk_drawable_get_size (entry->text_area, &area_width, &area_height);
|
||||
|
||||
gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
|
||||
if (state_hint)
|
||||
state = GTK_WIDGET_HAS_FOCUS (widget) ?
|
||||
GTK_STATE_ACTIVE : GTK_WIDGET_STATE (widget);
|
||||
else
|
||||
state = GTK_WIDGET_STATE(widget);
|
||||
|
||||
gtk_paint_flat_box (widget->style, entry->text_area,
|
||||
GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
|
||||
state, GTK_SHADOW_NONE,
|
||||
&event->area, widget, "entry_bg",
|
||||
0, 0, area_width, area_height);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user