diff options
author | Havoc Pennington <hp@redhat.com> | 2001-02-17 00:11:03 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-02-17 00:11:03 +0000 |
commit | 08add3cd503b3b891a0028b9b5400e271439c89f (patch) | |
tree | 1de50fc1006a3cc8c2c1de1b8742c200e7888840 /tests | |
parent | f139b1c9036128e5fef9bb0fea3a77d1afb8b8fe (diff) | |
download | gtk+-08add3cd503b3b891a0028b9b5400e271439c89f.tar.gz |
convert the X coordinates so they're with respect to the line, rather than
2001-02-15 Havoc Pennington <hp@redhat.com>
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region): convert
the X coordinates so they're with respect to the line, rather than
with respect to the layout.
* gtk/gtkalignment.c: Convert to new property API, patch from Lee
Mallabone
* gtk/testgtk.c (create_range_controls): add vscale tests,
and inverted test
* gtk/gtkrange.c (gtk_range_set_inverted): new function to fix
#50806
* gtk/gtkentry.c (gtk_entry_get_text): add G_CONST_RETURN
* gtk/gtktextiter.h (gtk_text_iter_is_last): rename
gtk_text_iter_is_end
* gtk/gtktextbuffer.h (gtk_text_buffer_get_last_iter):
rename gtk_text_buffer_get_end_iter
* gtk/testgtk.c (create_labels): Add test for selectable
* gtk/gtkentry.c (gtk_entry_draw_text): Use new GDK API to draw
the selection stuff. This code is kind of broken since it doesn't
use the theme engine.
* gdk/gdkpango.c (gdk_pango_layout_line_get_clip_region):
fix infinite loop and y offset problem
(gdk_draw_layout_line_with_colors): fix foreground color handling
* gtk/gtklabel.h, gtk/gtklabel.c: Implement a "selectable" flag
that makes the label selectable.
* gtk/gtklabel.c (gtk_label_style_set): recreate the label's
layout when the style is set, since fonts etc. could have changed.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testgtk.c | 77 | ||||
-rw-r--r-- | tests/testtext.c | 6 | ||||
-rw-r--r-- | tests/testtextbuffer.c | 8 |
3 files changed, 84 insertions, 7 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c index f257346ac9..97bf5e270d 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2004,6 +2004,59 @@ create_sensitivity_control (GtkWidget *widget) return button; } +static void +set_selectable_recursive (GtkWidget *widget, + gboolean setting) +{ + if (GTK_IS_CONTAINER (widget)) + { + GList *children; + GList *tmp; + + children = gtk_container_children (GTK_CONTAINER (widget)); + tmp = children; + while (tmp) + { + set_selectable_recursive (tmp->data, setting); + + tmp = tmp->next; + } + g_list_free (children); + } + else if (GTK_IS_LABEL (widget)) + { + gtk_label_set_selectable (GTK_LABEL (widget), setting); + } +} + +static void +selectable_toggled (GtkWidget *toggle, + GtkWidget *widget) +{ + set_selectable_recursive (widget, + GTK_TOGGLE_BUTTON (toggle)->active); +} + +static GtkWidget* +create_selectable_control (GtkWidget *widget) +{ + GtkWidget *button; + + button = gtk_toggle_button_new_with_label ("Selectable"); + + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), + FALSE); + + gtk_signal_connect (GTK_OBJECT (button), + "toggled", + GTK_SIGNAL_FUNC (selectable_toggled), + widget); + + gtk_widget_show_all (button); + + return button; +} + void create_labels (void) { static GtkWidget *window = NULL; @@ -2034,6 +2087,10 @@ void create_labels (void) button = create_sensitivity_control (hbox); gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); + + button = create_selectable_control (hbox); + + gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); vbox = gtk_vbox_new (FALSE, 5); @@ -6201,6 +6258,7 @@ create_range_controls (void) GtkWidget *scale; GtkWidget *separator; GtkObject *adjustment; + GtkWidget *hbox; if (!window) { @@ -6241,6 +6299,25 @@ create_range_controls (void) gtk_box_pack_start (GTK_BOX (box2), scrollbar, TRUE, TRUE, 0); gtk_widget_show (scrollbar); + hbox = gtk_hbox_new (FALSE, 0); + + scale = gtk_vscale_new (GTK_ADJUSTMENT (adjustment)); + gtk_widget_set_usize (scale, -1, 200); + gtk_scale_set_digits (GTK_SCALE (scale), 2); + gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); + gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); + gtk_widget_show (scale); + + scale = gtk_vscale_new (GTK_ADJUSTMENT (adjustment)); + gtk_widget_set_usize (scale, -1, 200); + gtk_scale_set_digits (GTK_SCALE (scale), 2); + gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE); + gtk_range_set_inverted (GTK_RANGE (scale), TRUE); + gtk_box_pack_start (GTK_BOX (hbox), scale, TRUE, TRUE, 0); + gtk_widget_show (scale); + + gtk_box_pack_start (GTK_BOX (box2), hbox, TRUE, TRUE, 0); + gtk_widget_show (hbox); separator = gtk_hseparator_new (); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); diff --git a/tests/testtext.c b/tests/testtext.c index 85c662ef0e..292681e2be 100644 --- a/tests/testtext.c +++ b/tests/testtext.c @@ -665,7 +665,7 @@ fill_file_buffer (GtkTextBuffer *buffer, const char *filename) /* We had a newline in the buffer to begin with. (The buffer always contains * a newline, so we delete to the end of the buffer to clean up. */ - gtk_text_buffer_get_last_iter (buffer, &end); + gtk_text_buffer_get_end_iter (buffer, &end); gtk_text_buffer_delete (buffer, &iter, &end); gtk_text_buffer_set_modified (buffer, FALSE); @@ -1281,7 +1281,7 @@ save_buffer (Buffer *buffer) else { gtk_text_buffer_get_iter_at_offset (buffer->buffer, &start, 0); - gtk_text_buffer_get_last_iter (buffer->buffer, &end); + gtk_text_buffer_get_end_iter (buffer->buffer, &end); chars = gtk_text_buffer_get_slice (buffer->buffer, &start, &end, FALSE); @@ -1972,7 +1972,7 @@ get_lines (GtkTextView *text_view, count = 0; size = 0; - while (!gtk_text_iter_is_last (&iter)) + while (!gtk_text_iter_is_end (&iter)) { gint y, height; gint line_num; diff --git a/tests/testtextbuffer.c b/tests/testtextbuffer.c index b14ce64eef..0d42dcb19a 100644 --- a/tests/testtextbuffer.c +++ b/tests/testtextbuffer.c @@ -186,7 +186,7 @@ check_specific_tag (GtkTextBuffer *buffer, state = FALSE; count = 0; - gtk_text_buffer_get_last_iter (buffer, &iter); + gtk_text_buffer_get_end_iter (buffer, &iter); last_offset = gtk_text_iter_get_offset (&iter); if (gtk_text_iter_toggles_tag (&iter, tag) || gtk_text_iter_backward_to_tag_toggle (&iter, tag)) @@ -292,7 +292,7 @@ run_tests (GtkTextBuffer *buffer) g_error ("Mark not created in the right place."); } - if (gtk_text_iter_is_last (&iter)) + if (gtk_text_iter_is_end (&iter)) g_error ("iterators ran out before chars (offset %d of %d)", i, num_chars); @@ -474,7 +474,7 @@ run_tests (GtkTextBuffer *buffer) tag_states = g_hash_table_new (NULL, NULL); count = 0; - gtk_text_buffer_get_last_iter (buffer, &iter); + gtk_text_buffer_get_end_iter (buffer, &iter); if (gtk_text_iter_toggles_tag (&iter, NULL) || gtk_text_iter_backward_to_tag_toggle (&iter, NULL)) { @@ -715,7 +715,7 @@ fill_buffer (GtkTextBuffer *buffer) gtk_text_buffer_apply_tag (buffer, tag, &iter, &iter2); tag = gtk_text_buffer_create_tag (buffer, "end_tag"); - gtk_text_buffer_get_last_iter (buffer, &iter2); + gtk_text_buffer_get_end_iter (buffer, &iter2); gtk_text_iter_backward_chars (&iter2, 12); iter = iter2; gtk_text_iter_backward_chars (&iter, 157); |