[maemo-commits] [maemo-commits] r10078 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Feb 20 17:43:54 EET 2007
- Previous message: [maemo-commits] r10077 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gtk
- Next message: [maemo-commits] r10079 - projects/haf/trunk/hildon-fm/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: lucasr Date: 2007-02-20 17:43:53 +0200 (Tue, 20 Feb 2007) New Revision: 10078 Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c Log: 2007-02-20 Lucas Rocha <lucas.rocha at nokia.com> * gtk/gtkiconview.c: selection painted around the item, not just the text. (gtk_icon_view_paint_item): paint selection around the role item instead of just around the text cell. If an editable/activatable cell is found, draw focus on it. If none is found, draw focus around the whole item. (gtk_icon_view_button_press): handle button press considering button press inside item's area, not only on item cells. (gtk_icon_view_get_path_at_pos): consider the whole item area, not only its cells. Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog =================================================================== --- projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog 2007-02-20 15:22:02 UTC (rev 10077) +++ projects/haf/branches/gtk+/maemo-gtk-2-10/ChangeLog 2007-02-20 15:43:53 UTC (rev 10078) @@ -1,3 +1,16 @@ +2007-02-20 Lucas Rocha <lucas.rocha at nokia.com> + + * gtk/gtkiconview.c: selection painted around the item, not just the + text. + (gtk_icon_view_paint_item): paint selection around the role item + instead of just around the text cell. If an editable/activatable + cell is found, draw focus on it. If none is found, draw focus + around the whole item. + (gtk_icon_view_button_press): handle button press considering button + press inside item's area, not only on item cells. + (gtk_icon_view_get_path_at_pos): consider the whole item area, not + only its cells. + 2007-02-20 Michael Natterer <mitch at imendio.com> * gtk/gtkcombobox.c (gtk_combo_box_list_key_press): pop down @@ -21,7 +34,7 @@ Merge from upstream trunk: - 2006-12-15 Dom Lachowicz <domlachowicz at gmail.com> +2006-12-15 Dom Lachowicz <domlachowicz at gmail.com> * gtk/gtkcombobox.c: Make GtkComboBox in "appears-as-list" mode more closely resemble its Win32 counterpart. Bug #340204. Modified: projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c =================================================================== --- projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c 2007-02-20 15:22:02 UTC (rev 10077) +++ projects/haf/branches/gtk+/maemo-gtk-2-10/gtk/gtkiconview.c 2007-02-20 15:43:53 UTC (rev 10078) @@ -1894,7 +1894,7 @@ GtkIconViewCellInfo *info = NULL; gboolean dirty = FALSE; GtkCellRendererMode mode; - gint cursor_cell; + gint cursor_cell = -1; icon_view = GTK_ICON_VIEW (widget); @@ -1908,20 +1908,21 @@ { item = gtk_icon_view_get_item_at_coords (icon_view, event->x, event->y, - TRUE, - &info); + FALSE, + &info); if (item != NULL) { - g_object_get (info->cell, "mode", &mode, NULL); - - if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE || - mode == GTK_CELL_RENDERER_MODE_EDITABLE) - cursor_cell = g_list_index (icon_view->priv->cell_list, info); - else - cursor_cell = -1; - + if (info != NULL) + { + g_object_get (info->cell, "mode", &mode, NULL); + + if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE || + mode == GTK_CELL_RENDERER_MODE_EDITABLE) + cursor_cell = g_list_index (icon_view->priv->cell_list, info); + } + gtk_icon_view_scroll_to_item (icon_view, item); - + if (icon_view->priv->selection_mode == GTK_SELECTION_NONE) { gtk_icon_view_set_cursor_item (icon_view, item, cursor_cell); @@ -1978,13 +1979,16 @@ /* cancel the current editing, if it exists */ gtk_icon_view_stop_editing (icon_view, TRUE); - - if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) - gtk_icon_view_item_activate_cell (icon_view, item, info, - (GdkEvent *)event); - else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE) - gtk_icon_view_start_editing (icon_view, item, info, - (GdkEvent *)event); + + if (info != NULL) + { + if (mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE) + gtk_icon_view_item_activate_cell (icon_view, item, info, + (GdkEvent *)event); + else if (mode == GTK_CELL_RENDERER_MODE_EDITABLE) + gtk_icon_view_start_editing (icon_view, item, info, + (GdkEvent *)event); + } } else { @@ -2875,28 +2879,16 @@ #endif if (item->selected) - for (l = icon_view->priv->cell_list; l; l = l->next) - { - GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data; - - if (!info->cell->visible) - continue; - - gtk_icon_view_get_cell_box (icon_view, item, info, &box); + { + gdk_cairo_set_source_color (cr, >K_WIDGET (icon_view)->style->base[state]); - /* FIXME we hardwire background drawing behind text - * cell renderers here - */ - if (GTK_IS_CELL_RENDERER_TEXT (info->cell)) - { - gdk_cairo_set_source_color (cr, >K_WIDGET (icon_view)->style->base[state]); - cairo_rectangle (cr, - x - item->x + box.x, - y - item->y + box.y, - box.width, box.height); - cairo_fill (cr); - } - } + cairo_rectangle (cr, + x, + y, + item->width, item->height); + + cairo_fill (cr); + } for (l = icon_view->priv->cell_list; l; l = l->next) { @@ -2916,7 +2908,7 @@ cell_area.width, cell_area.height); gtk_icon_view_get_cell_box (icon_view, item, info, &box); - + gdk_draw_rectangle (drawable, GTK_WIDGET (icon_view)->style->black_gc, FALSE, @@ -2935,39 +2927,54 @@ } - /* FIXME where to draw the focus with generic cell renderers ? */ if (draw_focus && GTK_WIDGET_HAS_FOCUS (icon_view) && item == icon_view->priv->cursor_item) - for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++) - { - GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data; - - if (!info->cell->visible) - continue; - - if (icon_view->priv->cursor_cell < 0 && - (info->cell->mode != GTK_CELL_RENDERER_MODE_INERT || - GTK_IS_CELL_RENDERER_TEXT (info->cell))) - icon_view->priv->cursor_cell = i; - - if (i == icon_view->priv->cursor_cell) - { - gtk_icon_view_get_cell_box (icon_view, item, info, &box); + { + for (l = icon_view->priv->cell_list, i = 0; l; l = l->next, i++) + { + GtkIconViewCellInfo *info = (GtkIconViewCellInfo *)l->data; + + if (!info->cell->visible) + continue; - gtk_paint_focus (GTK_WIDGET (icon_view)->style, - drawable, - GTK_STATE_NORMAL, - area, - GTK_WIDGET (icon_view), - "icon_view", - x - item->x + box.x - padding, - y - item->y + box.y - padding, - box.width + 2 * padding, - box.height + 2 * padding); - break; - } - } + /* If found a editable/activatable cell, draw focus on it. */ + if (icon_view->priv->cursor_cell < 0 && + info->cell->mode != GTK_CELL_RENDERER_MODE_INERT) + icon_view->priv->cursor_cell = i; + + gtk_icon_view_get_cell_box (icon_view, item, info, &box); + + if (i == icon_view->priv->cursor_cell) + { + gtk_paint_focus (GTK_WIDGET (icon_view)->style, + drawable, + GTK_STATE_NORMAL, + area, + GTK_WIDGET (icon_view), + "icon_view", + x - item->x + box.x - padding, + y - item->y + box.y - padding, + box.width + 2 * padding, + box.height + 2 * padding); + break; + } + } + + /* If there are no editable/activatable cells, draw focus + * around the whole item. */ + if (icon_view->priv->cursor_cell < 0) + gtk_paint_focus (GTK_WIDGET (icon_view)->style, + drawable, + GTK_STATE_NORMAL, + area, + GTK_WIDGET (icon_view), + "icon_view", + x - padding, + y - padding, + item->width + 2 * padding, + item->height + 2 * padding); + } } static void @@ -4441,7 +4448,7 @@ g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), NULL); - item = gtk_icon_view_get_item_at_coords (icon_view, x, y, TRUE, NULL); + item = gtk_icon_view_get_item_at_coords (icon_view, x, y, FALSE, NULL); if (!item) return NULL;
- Previous message: [maemo-commits] r10077 - in projects/haf/branches/gtk+/maemo-gtk-2-10: . gtk
- Next message: [maemo-commits] r10079 - projects/haf/trunk/hildon-fm/debian
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]