From 47425e34a44b4abfbab17d2aa69ac7e94852ddd7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 16 Jun 2004 00:03:31 +0000 Subject: [PATCH] The property editor, copied from testgtk. Tue Jun 15 19:59:33 2004 Matthias Clasen * libegg/iconlist/prop-editor.[hc]: The property editor, copied from testgtk. Tue Jun 15 19:57:44 2004 Matthias Clasen * libegg/iconlist/testiconlist.c (main): Show off some more features of the icon list: rtl layout, sorting, context menus. Also add a property editor. Tue Jun 15 20:01:49 2004 Matthias Clasen * libegg/iconlist/eggiconlist.c (egg_icon_list_layout_single_row): Support rtl layout. --- gtk/gtkiconview.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 1a6dbe561c..cdaeeba915 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -1452,7 +1452,8 @@ egg_icon_list_layout_single_row (EggIconList *icon_list, GList *first_item, gint gint icon_padding; gint left_margin, right_margin; gint maximum_layout_width; - + gboolean rtl = gtk_widget_get_direction (GTK_WIDGET (icon_list)) == GTK_TEXT_DIR_RTL; + x = 0; max_height = 0; max_pixbuf_height = 0; @@ -1486,10 +1487,13 @@ egg_icon_list_layout_single_row (EggIconList *icon_list, GList *first_item, gint maximum_layout_width = MAX (item->pixbuf_width, MINIMUM_ICON_ITEM_WIDTH); item->y = *y; - item->x = x; + item->x = rtl ? GTK_WIDGET (icon_list)->allocation.width - item->width - x : x; if (item->width < MINIMUM_ICON_ITEM_WIDTH) { - item->x += (MINIMUM_ICON_ITEM_WIDTH - item->width) / 2; + if (rtl) + item->x -= (MINIMUM_ICON_ITEM_WIDTH - item->width) / 2; + else + item->x += (MINIMUM_ICON_ITEM_WIDTH - item->width) / 2; x += (MINIMUM_ICON_ITEM_WIDTH - item->width); } @@ -1570,7 +1574,7 @@ egg_icon_list_layout (EggIconList *icon_list) "bottom_margin", &bottom_margin, NULL); y += top_margin; - + do { icons = egg_icon_list_layout_single_row (icon_list, icons, &y, &maximum_width); @@ -2278,7 +2282,7 @@ egg_icon_list_get_item_at_pos (EggIconList *icon_list, if (x > item->x && x < item->x + item->width && y > item->y && y < item->y + item->height) { - gint layout_x = item->x + (item->width - item->layout_width) / 2; + gint layout_x = item->x + (item->width - item->layout_width) / 2; /* Check if the mouse is inside the icon or the label */ if ((x > item->pixbuf_x && x < item->pixbuf_x + item->pixbuf_width && y > item->pixbuf_y && y < item->pixbuf_y + item->pixbuf_height) ||