Add GO_FORWARD and GO_BACK with both left and right arrows depending on

Wed Oct  9 17:06:21 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
        Add GO_FORWARD and GO_BACK with both left and right
        arrows depending on the direction. (#92211,
        Kenneth Christiansen)

        * tests/testgtk.c (create_flipping): Add forward/back button
        pairs in default, RTL, LTR configurations.
This commit is contained in:
Owen Taylor 2002-10-09 21:38:43 +00:00 committed by Owen Taylor
parent c26538488c
commit 7eecad56f8
8 changed files with 182 additions and 49 deletions

View File

@ -1,3 +1,13 @@
Wed Oct 9 17:06:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
Add GO_FORWARD and GO_BACK with both left and right
arrows depending on the direction. (#92211,
Kenneth Christiansen)
* tests/testgtk.c (create_flipping): Add forward/back button
pairs in default, RTL, LTR configurations.
2002-10-09 Stanislav Brabec <sbrabec@suse.cz>
* gtk/gtkimcontextsimple.c: Added support for hungarian characters

View File

@ -1,3 +1,13 @@
Wed Oct 9 17:06:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
Add GO_FORWARD and GO_BACK with both left and right
arrows depending on the direction. (#92211,
Kenneth Christiansen)
* tests/testgtk.c (create_flipping): Add forward/back button
pairs in default, RTL, LTR configurations.
2002-10-09 Stanislav Brabec <sbrabec@suse.cz>
* gtk/gtkimcontextsimple.c: Added support for hungarian characters

View File

@ -1,3 +1,13 @@
Wed Oct 9 17:06:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
Add GO_FORWARD and GO_BACK with both left and right
arrows depending on the direction. (#92211,
Kenneth Christiansen)
* tests/testgtk.c (create_flipping): Add forward/back button
pairs in default, RTL, LTR configurations.
2002-10-09 Stanislav Brabec <sbrabec@suse.cz>
* gtk/gtkimcontextsimple.c: Added support for hungarian characters

View File

@ -1,3 +1,13 @@
Wed Oct 9 17:06:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
Add GO_FORWARD and GO_BACK with both left and right
arrows depending on the direction. (#92211,
Kenneth Christiansen)
* tests/testgtk.c (create_flipping): Add forward/back button
pairs in default, RTL, LTR configurations.
2002-10-09 Stanislav Brabec <sbrabec@suse.cz>
* gtk/gtkimcontextsimple.c: Added support for hungarian characters

View File

@ -1,3 +1,13 @@
Wed Oct 9 17:06:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
Add GO_FORWARD and GO_BACK with both left and right
arrows depending on the direction. (#92211,
Kenneth Christiansen)
* tests/testgtk.c (create_flipping): Add forward/back button
pairs in default, RTL, LTR configurations.
2002-10-09 Stanislav Brabec <sbrabec@suse.cz>
* gtk/gtkimcontextsimple.c: Added support for hungarian characters

View File

@ -1,3 +1,13 @@
Wed Oct 9 17:06:21 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkiconfactory.c (add_size_and_dir_with_fallback):
Add GO_FORWARD and GO_BACK with both left and right
arrows depending on the direction. (#92211,
Kenneth Christiansen)
* tests/testgtk.c (create_flipping): Add forward/back button
pairs in default, RTL, LTR configurations.
2002-10-09 Stanislav Brabec <sbrabec@suse.cz>
* gtk/gtkimcontextsimple.c: Added support for hungarian characters

View File

@ -325,6 +325,19 @@ gtk_icon_factory_lookup_default (const gchar *stock_id)
return gtk_icon_factory_lookup (gtk_default_icons, stock_id);
}
static void
add_source (GtkIconSet *set,
GtkIconSource *source,
const gchar *inline_data)
{
source->pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source->pixbuf);
gtk_icon_set_add_source (set, source);
g_object_unref (G_OBJECT (source->pixbuf));
}
#if 0
static GtkIconSet *
sized_icon_set_from_inline (const guchar *inline_data,
@ -339,21 +352,17 @@ sized_icon_set_from_inline (const guchar *inline_data,
set = gtk_icon_set_new ();
source.pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source.pixbuf);
gtk_icon_set_add_source (set, &source);
g_object_unref (G_OBJECT (source.pixbuf));
add_source (set, source, inline_data);
return set;
}
#endif
static GtkIconSet *
sized_with_fallback_icon_set_from_inline (const guchar *fallback_data,
const guchar *inline_data,
sized_with_fallback_icon_set_from_inline (const guchar *fallback_data_ltr,
const guchar *fallback_data_rtl,
const guchar *inline_data_ltr,
const guchar *inline_data_rtl,
GtkIconSize size)
{
GtkIconSet *set;
@ -361,27 +370,31 @@ sized_with_fallback_icon_set_from_inline (const guchar *fallback_data,
GtkIconSource source = { NULL, NULL, 0, 0, 0,
TRUE, TRUE, FALSE };
source.size = size;
set = gtk_icon_set_new ();
source.pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source.pixbuf);
gtk_icon_set_add_source (set, &source);
g_object_unref (G_OBJECT (source.pixbuf));
source.size = size;
source.any_direction = inline_data_rtl == NULL;
source.direction = GTK_TEXT_DIR_LTR;
add_source (set, &source, inline_data_ltr);
if (inline_data_rtl != NULL)
{
source.direction = GTK_TEXT_DIR_RTL;
add_source (set, &source, inline_data_rtl);
}
source.any_size = TRUE;
source.any_direction = fallback_data_rtl == NULL;
source.pixbuf = gdk_pixbuf_new_from_inline (-1, fallback_data, FALSE, NULL);
g_assert (source.pixbuf);
gtk_icon_set_add_source (set, &source);
g_object_unref (G_OBJECT (source.pixbuf));
source.direction = GTK_TEXT_DIR_LTR;
add_source (set, &source, fallback_data_ltr);
if (fallback_data_rtl != NULL)
{
source.direction = GTK_TEXT_DIR_RTL;
add_source (set, &source, fallback_data_rtl);
}
return set;
}
@ -397,13 +410,7 @@ unsized_icon_set_from_inline (const guchar *inline_data)
set = gtk_icon_set_new ();
source.pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
g_assert (source.pixbuf);
gtk_icon_set_add_source (set, &source);
g_object_unref (G_OBJECT (source.pixbuf));
add_source (set, &source, inline_data);
return set;
}
@ -426,21 +433,38 @@ add_sized (GtkIconFactory *factory,
#endif
static void
add_sized_with_fallback (GtkIconFactory *factory,
const guchar *fallback_data,
const guchar *inline_data,
GtkIconSize size,
const gchar *stock_id)
add_sized_with_fallback_and_rtl (GtkIconFactory *factory,
const guchar *fallback_data_ltr,
const guchar *fallback_data_rtl,
const guchar *inline_data_ltr,
const guchar *inline_data_rtl,
GtkIconSize size,
const gchar *stock_id)
{
GtkIconSet *set;
set = sized_with_fallback_icon_set_from_inline (fallback_data, inline_data, size);
set = sized_with_fallback_icon_set_from_inline (fallback_data_ltr, fallback_data_rtl,
inline_data_ltr, inline_data_rtl,
size);
gtk_icon_factory_add (factory, stock_id, set);
gtk_icon_set_unref (set);
}
static void
add_sized_with_fallback (GtkIconFactory *factory,
const guchar *fallback_data,
const guchar *inline_data,
GtkIconSize size,
const gchar *stock_id)
{
add_sized_with_fallback_and_rtl (factory,
fallback_data, NULL,
inline_data, NULL,
size, stock_id);
}
static void
add_unsized (GtkIconFactory *factory,
const guchar *inline_data,
@ -603,11 +627,13 @@ get_default_icons (GtkIconFactory *factory)
GTK_ICON_SIZE_MENU,
GTK_STOCK_GOTO_LAST);
add_sized_with_fallback (factory,
stock_left_arrow_24,
stock_left_arrow_16,
GTK_ICON_SIZE_MENU,
GTK_STOCK_GO_BACK);
add_sized_with_fallback_and_rtl (factory,
stock_left_arrow_24,
stock_right_arrow_24,
stock_left_arrow_16,
stock_right_arrow_16,
GTK_ICON_SIZE_MENU,
GTK_STOCK_GO_BACK);
add_sized_with_fallback (factory,
stock_missing_image_24,
@ -681,11 +707,13 @@ get_default_icons (GtkIconFactory *factory)
GTK_ICON_SIZE_MENU,
GTK_STOCK_REVERT_TO_SAVED);
add_sized_with_fallback (factory,
stock_right_arrow_24,
stock_right_arrow_16,
GTK_ICON_SIZE_MENU,
GTK_STOCK_GO_FORWARD);
add_sized_with_fallback_and_rtl (factory,
stock_right_arrow_24,
stock_left_arrow_24,
stock_right_arrow_16,
stock_left_arrow_16,
GTK_ICON_SIZE_MENU,
GTK_STOCK_GO_FORWARD);
add_sized_with_fallback (factory,
stock_save_24,

View File

@ -6957,6 +6957,39 @@ flipping_toggled_cb (GtkWidget *widget, gpointer data)
gtk_widget_set_default_direction (new_direction);
}
static void
set_direction_recurse (GtkWidget *widget,
gpointer data)
{
GtkTextDirection *dir = data;
gtk_widget_set_direction (widget, *dir);
if (GTK_IS_CONTAINER (widget))
gtk_container_foreach (GTK_CONTAINER (widget),
set_direction_recurse,
data);
}
static GtkWidget *
create_forward_back (const char *title,
GtkTextDirection text_dir)
{
GtkWidget *frame = gtk_frame_new (title);
GtkWidget *bbox = gtk_hbutton_box_new ();
GtkWidget *back_button = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
GtkWidget *forward_button = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
gtk_container_add (GTK_CONTAINER (frame), bbox);
gtk_container_add (GTK_CONTAINER (bbox), back_button);
gtk_container_add (GTK_CONTAINER (bbox), forward_button);
set_direction_recurse (frame, &text_dir);
return frame;
}
void
create_flipping (GtkWidget *widget)
{
@ -6980,6 +7013,18 @@ create_flipping (GtkWidget *widget)
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
check_button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
create_forward_back ("Default", GTK_TEXT_DIR_NONE),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
create_forward_back ("Left-to-Right", GTK_TEXT_DIR_LTR),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
create_forward_back ("Right-to-Left", GTK_TEXT_DIR_RTL),
TRUE, TRUE, 0);
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);