forked from AuroraMiddleware/gtk
Avoid chaining up to parent impl, since we have a INPUT_ONLY window.
Mon Apr 2 16:13:58 2001 Owen Taylor <otaylor@redhat.com> * gtk/gtkinvisible.c (gtk_invisible_style_set): Avoid chaining up to parent impl, since we have a INPUT_ONLY window. * gtk/gtkentry.[ch]: Add a cursor_color property to set the foreground color for the cursor.
This commit is contained in:
parent
096fdfb797
commit
3961437bab
@ -426,6 +426,13 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
-1,
|
||||
G_PARAM_READABLE | G_PARAM_WRITABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_boxed ("cursor_color",
|
||||
_("Cursor color"),
|
||||
_("Color with which to draw insertion cursor"),
|
||||
GTK_TYPE_GDK_COLOR,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
signals[INSERT_TEXT] =
|
||||
gtk_signal_new ("insert_text",
|
||||
GTK_RUN_LAST,
|
||||
@ -824,6 +831,24 @@ gtk_entry_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_realize_cursor_gc (GtkEntry *entry)
|
||||
{
|
||||
GdkColor *cursor_color;
|
||||
|
||||
if (entry->cursor_gc)
|
||||
gdk_gc_unref (entry->cursor_gc);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (entry), "cursor_color", &cursor_color, NULL);
|
||||
if (cursor_color)
|
||||
{
|
||||
entry->cursor_gc = gdk_gc_new (entry->text_area);
|
||||
gdk_gc_set_rgb_fg_color (entry->cursor_gc, cursor_color);
|
||||
}
|
||||
else
|
||||
entry->cursor_gc = gdk_gc_ref (GTK_WIDGET (entry)->style->bg_gc[GTK_STATE_SELECTED]);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_realize (GtkWidget *widget)
|
||||
{
|
||||
@ -886,6 +911,8 @@ gtk_entry_realize (GtkWidget *widget)
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gtk_entry_realize_cursor_gc (entry);
|
||||
|
||||
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
||||
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
||||
|
||||
@ -915,8 +942,17 @@ gtk_entry_unrealize (GtkWidget *widget)
|
||||
entry->text_area = NULL;
|
||||
}
|
||||
|
||||
if (entry->cursor_gc)
|
||||
{
|
||||
gdk_gc_unref (entry->cursor_gc);
|
||||
entry->cursor_gc = NULL;
|
||||
}
|
||||
|
||||
if (entry->popup_menu)
|
||||
{
|
||||
gtk_widget_destroy (entry->popup_menu);
|
||||
entry->popup_menu = NULL;
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
|
||||
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
|
||||
@ -1653,6 +1689,8 @@ gtk_entry_style_set (GtkWidget *widget,
|
||||
|
||||
gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
||||
gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]);
|
||||
|
||||
gtk_entry_realize_cursor_gc (entry);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2373,7 +2411,7 @@ gtk_entry_draw_cursor (GtkEntry *entry,
|
||||
|
||||
gtk_entry_get_cursor_locations (entry, type, &strong_x, &weak_x);
|
||||
|
||||
gdk_draw_line (entry->text_area, widget->style->bg_gc[GTK_STATE_SELECTED],
|
||||
gdk_draw_line (entry->text_area, entry->cursor_gc,
|
||||
xoffset + strong_x, INNER_BORDER,
|
||||
xoffset + strong_x, text_area_height - INNER_BORDER);
|
||||
|
||||
|
@ -102,6 +102,8 @@ struct _GtkEntry
|
||||
gunichar invisible_char;
|
||||
|
||||
gint width_chars;
|
||||
|
||||
GdkGC *cursor_gc;
|
||||
};
|
||||
|
||||
struct _GtkEntryClass
|
||||
|
@ -32,6 +32,8 @@ static void gtk_invisible_class_init (GtkInvisibleClass *klass);
|
||||
static void gtk_invisible_init (GtkInvisible *invisible);
|
||||
static void gtk_invisible_destroy (GtkObject *object);
|
||||
static void gtk_invisible_realize (GtkWidget *widget);
|
||||
static void gtk_invisible_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style);
|
||||
static void gtk_invisible_show (GtkWidget *widget);
|
||||
static void gtk_invisible_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
@ -71,6 +73,7 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
|
||||
object_class = (GtkObjectClass*) class;
|
||||
|
||||
widget_class->realize = gtk_invisible_realize;
|
||||
widget_class->style_set = gtk_invisible_style_set;
|
||||
widget_class->show = gtk_invisible_show;
|
||||
widget_class->size_allocate = gtk_invisible_size_allocate;
|
||||
|
||||
@ -138,6 +141,13 @@ gtk_invisible_realize (GtkWidget *widget)
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_style_set (GtkWidget *widget,
|
||||
GtkStyle *previous_style)
|
||||
{
|
||||
/* Don't chain up to parent implementation */
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_invisible_show (GtkWidget *widget)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user