[maemo-commits] [maemo-commits] r9394 - in projects/haf/trunk/sapwood: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Jan 29 13:42:52 EET 2007
- Previous message: [maemo-commits] r9393 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r9395 - in projects/haf/branches/hildon-libs/hildon-1: . doc src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: tko Date: 2007-01-29 13:42:50 +0200 (Mon, 29 Jan 2007) New Revision: 9394 Modified: projects/haf/trunk/sapwood/ChangeLog projects/haf/trunk/sapwood/src/sapwood-draw.c Log: Add active/passive focus special cases for treeview 2007-01-29 Tommi Komulainen <tommi.komulainen at nokia.com> * src/sapwood-draw.c (maybe_check_cursor_position) (draw_flat_box): When painting a treeview check if painting the cursor row, and adjust matching rules accordingly for active/passive focus Focus row background: function = FLAT_BOX state = ACTIVE shadow = NONE for active, OUT for passive focus Modified: projects/haf/trunk/sapwood/ChangeLog =================================================================== --- projects/haf/trunk/sapwood/ChangeLog 2007-01-29 11:32:45 UTC (rev 9393) +++ projects/haf/trunk/sapwood/ChangeLog 2007-01-29 11:42:50 UTC (rev 9394) @@ -1,3 +1,14 @@ +2007-01-29 Tommi Komulainen <tommi.komulainen at nokia.com> + + * src/sapwood-draw.c (maybe_check_cursor_position) + (draw_flat_box): When painting a treeview check if painting the cursor + row, and adjust matching rules accordingly for active/passive focus + + Focus row background: + function = FLAT_BOX + state = ACTIVE + shadow = NONE for active, OUT for passive focus + 2007-01-27 Tommi Komulainen <tommi.komulainen at nokia.com> * src/sapwood-draw.c (get_window_for_shape): Consider setting the Modified: projects/haf/trunk/sapwood/src/sapwood-draw.c =================================================================== --- projects/haf/trunk/sapwood/src/sapwood-draw.c 2007-01-29 11:32:45 UTC (rev 9393) +++ projects/haf/trunk/sapwood/src/sapwood-draw.c 2007-01-29 11:42:50 UTC (rev 9394) @@ -742,6 +742,53 @@ } static void +maybe_check_cursor_position (GtkTreeView *treeview, + gint x, gint y, gint width, gint height, + ThemeMatchData *match_data) +{ + GtkTreePath *cursor_path; + GdkRectangle cursor_rect; + GdkRectangle paint_rect; + + gtk_tree_view_get_cursor (treeview, &cursor_path, NULL); + if (!cursor_path) + return; + + /* we only really care about the vertical position here */ + + gtk_tree_view_get_background_area (treeview, cursor_path, NULL, &cursor_rect); + gtk_tree_path_free (cursor_path); + + paint_rect.y = y; + paint_rect.height = height; + + paint_rect.x = cursor_rect.x = x; + paint_rect.width = cursor_rect.width = width; + + if (!gdk_rectangle_intersect (&paint_rect, &cursor_rect, &paint_rect)) + return; + + /* We're painting the cursor row background, so distinguish between active + * and passive focus. Knowing that GTK_STATE_ACTIVE and GTK_SHADOW_NONE are + * never used in treeview, it should be (more or less) safe to (ab)use them + * for active/passive focus. + * + * Active focus: + * function = FLAT_BOX + * state = ACTIVE + * shadow = NONE + * + * Passive focus: + * function = FLAT_BOX + * state = ACTIVE + * shadow = OUT + */ + match_data->state = GTK_STATE_ACTIVE; + if (!GTK_WIDGET_HAS_FOCUS (treeview)) + match_data->shadow = GTK_SHADOW_OUT; +} + +static void draw_flat_box (GtkStyle *style, GdkWindow *window, GtkStateType state, @@ -765,6 +812,10 @@ match_data.shadow = shadow; match_data.state = state; + /* Special handling for treeview cursor row */ + if (GTK_IS_TREE_VIEW (widget)) + maybe_check_cursor_position (GTK_TREE_VIEW (widget), x, y, width, height, &match_data); + if (!draw_simple_image (style, window, area, widget, &match_data, TRUE, x, y, width, height)) parent_class->draw_flat_box (style, window, state, shadow, area, widget, detail,
- Previous message: [maemo-commits] r9393 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r9395 - in projects/haf/branches/hildon-libs/hildon-1: . doc src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]