Add a "style_set" callback, so the font can be changed at run time.

Mon Mar 30 21:29:43 1998  Owen Taylor  <owt1@cornell.edu>

	* gtk/gtkentry.c: Add a "style_set" callback, so the
	font can be changed at run time. (needed for GIMP text
	tool)
This commit is contained in:
Owen Taylor 1998-03-31 02:36:51 +00:00 committed by Owen Taylor
parent a20f83d9a9
commit f59f2039c0
8 changed files with 65 additions and 7 deletions

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -1,3 +1,9 @@
Mon Mar 30 21:29:43 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkentry.c: Add a "style_set" callback, so the
font can be changed at run time. (needed for GIMP text
tool)
Tue Mar 31 01:17:23 1998 Tim Janik <timj@gtk.org>
* gtk/gtknotebook.c (gtk_notebook_menu_item_create): show the menu_label
@ -55,7 +61,6 @@ Sun Mar 29 22:29:00 1998 Tim Janik <timj@gtk.org>
Added wrapping capabilities to GtkSpinButton. New function :
gtk_spin_button_set_wrap (Lars Hamann and Stefan Jeske).
>>>>>>> 1.302
Sat Mar 28 21:18:42 1998 Owen Taylor <owt1@cornell.edu>
* gtk/gtkcombo.c (gtk_combo_disable_activate):

View File

@ -65,6 +65,8 @@ static void gtk_entry_draw_cursor (GtkEntry *entry);
static void gtk_entry_draw_cursor_on_drawable
(GtkEntry *entry,
GdkDrawable *drawable);
static void gtk_entry_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void gtk_entry_queue_draw (GtkEntry *entry);
static gint gtk_entry_timer (gpointer data);
static gint gtk_entry_position (GtkEntry *entry,
@ -229,6 +231,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->key_press_event = gtk_entry_key_press;
widget_class->focus_in_event = gtk_entry_focus_in;
widget_class->focus_out_event = gtk_entry_focus_out;
widget_class->style_set = gtk_entry_style_set;
editable_class->insert_text = gtk_entry_insert_text;
editable_class->delete_text = gtk_entry_delete_text;
@ -2073,3 +2076,23 @@ gtk_entry_set_max_length (GtkEntry *entry,
gtk_editable_delete_text(GTK_EDITABLE(entry), max, -1);
entry->text_max_length = max;
}
static void
gtk_entry_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
GtkEntry *entry;
gint scroll_char;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_ENTRY (widget));
if (previous_style && GTK_WIDGET_REALIZED (widget))
{
entry = GTK_ENTRY (widget);
scroll_char = gtk_entry_find_position (entry, entry->scroll_offset);
gtk_entry_recompute_offsets (GTK_ENTRY (widget));
entry->scroll_offset = entry->char_offset[scroll_char];
}
}