mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Patch from Bill Haneman and Padraig O'Briain to add cursor_aspect_ratio
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill Haneman and Padraig O'Briain to add cursor_aspect_ratio style property to GtkWidget to allow theming the aspect ratio of the cursor. * gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property to GtkWidget.
This commit is contained in:
parent
f412d947c5
commit
8f5c2c7625
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -1,3 +1,15 @@
|
||||
Thu Feb 14 16:46:48 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextdisplay.c gtk/gtklabel.c
|
||||
gtk/gtkstyle.[ch] gtk/gtkwidget.c: Patch from Bill
|
||||
Haneman and Padraig O'Briain to add cursor_aspect_ratio
|
||||
style property to GtkWidget to allow theming the aspect
|
||||
ratio of the cursor.
|
||||
|
||||
* gtk/gtkentry.c gtk/gtktextview.c gtk/gtklabel.c
|
||||
gtk/gtkwidget.c tests/testgtkrc: Move cursor-color style property
|
||||
to GtkWidget.
|
||||
|
||||
Thu Feb 14 11:13:22 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtkimmulticontext.c (gtk_im_multicontext_get_surrounding):
|
||||
|
@ -524,13 +524,6 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
"",
|
||||
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"),
|
||||
GDK_TYPE_COLOR,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
signals[POPULATE_POPUP] =
|
||||
gtk_signal_new ("populate_popup",
|
||||
GTK_RUN_LAST,
|
||||
@ -937,7 +930,7 @@ gtk_entry_realize_cursor_gc (GtkEntry *entry)
|
||||
if (entry->cursor_gc)
|
||||
gdk_gc_unref (entry->cursor_gc);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (entry), "cursor_color", &cursor_color, NULL);
|
||||
gtk_widget_style_get (GTK_WIDGET (entry), "cursor-color", &cursor_color, NULL);
|
||||
entry->cursor_gc = gdk_gc_new (entry->text_area);
|
||||
if (cursor_color)
|
||||
gdk_gc_set_rgb_fg_color (entry->cursor_gc, cursor_color);
|
||||
@ -2739,13 +2732,13 @@ gtk_entry_draw_cursor (GtkEntry *entry,
|
||||
cursor_location.width = 0;
|
||||
cursor_location.height = text_area_height - 2 * INNER_BORDER ;
|
||||
|
||||
_gtk_draw_insertion_cursor (entry->text_area, gc1,
|
||||
_gtk_draw_insertion_cursor (widget, entry->text_area, gc1,
|
||||
&cursor_location, dir1);
|
||||
|
||||
if (gc2)
|
||||
{
|
||||
cursor_location.x = xoffset + x2;
|
||||
_gtk_draw_insertion_cursor (entry->text_area, gc2,
|
||||
_gtk_draw_insertion_cursor (widget, entry->text_area, gc2,
|
||||
&cursor_location, dir2);
|
||||
}
|
||||
}
|
||||
|
@ -373,13 +373,6 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
0,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_boxed ("cursor_color",
|
||||
_("Cursor color"),
|
||||
_("Color with which to draw insertion cursor"),
|
||||
GDK_TYPE_COLOR,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
/*
|
||||
* Key bindings
|
||||
*/
|
||||
@ -1685,7 +1678,7 @@ gtk_label_draw_cursor (GtkLabel *label, gint xoffset, gint yoffset)
|
||||
cursor_location.width = 0;
|
||||
cursor_location.height = PANGO_PIXELS (cursor1->height);
|
||||
|
||||
_gtk_draw_insertion_cursor (widget->window, gc1,
|
||||
_gtk_draw_insertion_cursor (widget, widget->window, gc1,
|
||||
&cursor_location, dir1);
|
||||
|
||||
if (gc2)
|
||||
@ -1695,7 +1688,7 @@ gtk_label_draw_cursor (GtkLabel *label, gint xoffset, gint yoffset)
|
||||
cursor_location.width = 0;
|
||||
cursor_location.height = PANGO_PIXELS (cursor2->height);
|
||||
|
||||
_gtk_draw_insertion_cursor (widget->window, gc2,
|
||||
_gtk_draw_insertion_cursor (widget, widget->window, gc2,
|
||||
&cursor_location, dir2);
|
||||
}
|
||||
}
|
||||
@ -1938,7 +1931,7 @@ gtk_label_realize_cursor_gc (GtkLabel *label)
|
||||
if (label->select_info->cursor_gc)
|
||||
gdk_gc_unref (label->select_info->cursor_gc);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (label), "cursor_color", &cursor_color, NULL);
|
||||
gtk_widget_style_get (GTK_WIDGET (label), "cursor-color", &cursor_color, NULL);
|
||||
label->select_info->cursor_gc = gdk_gc_new (GTK_WIDGET (label)->window);
|
||||
if (cursor_color)
|
||||
gdk_gc_set_rgb_fg_color (label->select_info->cursor_gc, cursor_color);
|
||||
|
@ -5474,6 +5474,7 @@ gtk_style_set_font (GtkStyle *style,
|
||||
|
||||
/**
|
||||
* _gtk_draw_insertion_cursor:
|
||||
* @widget: a #GtkWidget
|
||||
* @drawable: a #GdkDrawable
|
||||
* @gc: a #GdkGC
|
||||
* @location: location where to draw the cursor (@location->width is ignored)
|
||||
@ -5485,16 +5486,23 @@ gtk_style_set_font (GtkStyle *style,
|
||||
* but merely a convenience function for drawing the standard cursor shape.
|
||||
**/
|
||||
void
|
||||
_gtk_draw_insertion_cursor (GdkDrawable *drawable,
|
||||
_gtk_draw_insertion_cursor (GtkWidget *widget,
|
||||
GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkRectangle *location,
|
||||
GtkTextDirection dir)
|
||||
{
|
||||
gint stem_width = location->height / 30 + 1;
|
||||
gint arrow_width = stem_width + 1;
|
||||
gint stem_width;
|
||||
gint arrow_width;
|
||||
gint x, y;
|
||||
gint i;
|
||||
gfloat cursor_aspect_ratio;
|
||||
|
||||
gtk_widget_style_get (widget, "cursor-aspect-ratio", &cursor_aspect_ratio, NULL);
|
||||
|
||||
stem_width = location->height * cursor_aspect_ratio + 1;
|
||||
arrow_width = stem_width + 1;
|
||||
|
||||
for (i = 0; i < stem_width; i++)
|
||||
gdk_draw_line (drawable, gc,
|
||||
location->x + i - stem_width / 2, location->y,
|
||||
|
@ -866,7 +866,8 @@ void gtk_paint_string (GtkStyle *style,
|
||||
const gchar *string);
|
||||
#endif /* GTK_DISABLE_DEPRECATED */
|
||||
|
||||
void _gtk_draw_insertion_cursor (GdkDrawable *drawable,
|
||||
void _gtk_draw_insertion_cursor (GtkWidget *widget,
|
||||
GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkRectangle *location,
|
||||
GtkTextDirection dir);
|
||||
|
@ -859,7 +859,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
|
||||
cursor_location.height = cursor->height;
|
||||
|
||||
gdk_gc_set_clip_rectangle(gc, &clip);
|
||||
_gtk_draw_insertion_cursor (drawable, gc, &cursor_location, dir);
|
||||
_gtk_draw_insertion_cursor (widget, drawable, gc, &cursor_location, dir);
|
||||
gdk_gc_set_clip_rectangle (gc, NULL);
|
||||
|
||||
cursor_list = cursor_list->next;
|
||||
|
@ -326,7 +326,7 @@ static void gtk_text_view_remove (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
static void gtk_text_view_forall (GtkContainer *container,
|
||||
gboolean include_internals,
|
||||
GtkCallback callback,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data);
|
||||
|
||||
/* FIXME probably need the focus methods. */
|
||||
@ -633,18 +633,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
|
||||
/*
|
||||
* Style properties
|
||||
*/
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_boxed ("cursor_color",
|
||||
_("Cursor color"),
|
||||
_("Color with which to draw insertion cursor"),
|
||||
GDK_TYPE_COLOR,
|
||||
G_PARAM_READABLE));
|
||||
|
||||
|
||||
/*
|
||||
* Signals
|
||||
*/
|
||||
@ -3270,7 +3258,7 @@ gtk_text_view_realize_cursor_gc (GtkTextView *text_view)
|
||||
if (text_view->cursor_gc)
|
||||
gdk_gc_unref (text_view->cursor_gc);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (text_view), "cursor_color", &cursor_color, NULL);
|
||||
gtk_widget_style_get (GTK_WIDGET (text_view), "cursor-color", &cursor_color, NULL);
|
||||
|
||||
if (!cursor_color)
|
||||
cursor_color = &red;
|
||||
|
@ -1074,7 +1074,18 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
||||
_("Width, in pixels, between focus indicator and the widget 'box'."),
|
||||
0, G_MAXINT, 1,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (klass,
|
||||
g_param_spec_boxed ("cursor-color",
|
||||
_("Cursor color"),
|
||||
_("Color with which to draw insertion cursor"),
|
||||
GDK_TYPE_COLOR,
|
||||
G_PARAM_READABLE));
|
||||
gtk_widget_class_install_style_property (klass,
|
||||
g_param_spec_float ("cursor-aspect-ratio",
|
||||
_("Cursor line aspect ratio"),
|
||||
_("Aspect ratio with which to draw insertion cursor"),
|
||||
0.0, 1.0, 0.033,
|
||||
G_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -34,8 +34,7 @@ style "global-style-properties"
|
||||
# xthickness = 20
|
||||
GtkButton::child_displacement_x = 1
|
||||
GtkButton::child_displacement_y = 1
|
||||
GtkSpinButton::shadow_type = etched-out
|
||||
GtkEntry::cursor_color = "#ff0000"
|
||||
GtkWidget::cursor_color = "#ff0000"
|
||||
GtkToolbar::space_size = 10
|
||||
GtkToolbar::space_style = line
|
||||
GtkToolbar::button_relief = none
|
||||
|
Loading…
Reference in New Issue
Block a user