[Xfce4-commits] <design:master> A bit more work on the action button cell renderer.

Jannis Pohlmann noreply at xfce.org
Mon May 30 03:10:01 CEST 2011


Updating branch refs/heads/master
         to 18e13ac773161748af41700a6fbe393718cdb127 (commit)
       from 41ab8f6d7ac13a6b6f09133fa990506cb1dddeab (commit)

commit 18e13ac773161748af41700a6fbe393718cdb127
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Mon May 30 03:08:14 2011 +0200

    A bit more work on the action button cell renderer.

 .../treeview-mockup/vala/mockup.vala               |   40 +++++++++++++++----
 1 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/thunar/shortcuts-pane/treeview-mockup/vala/mockup.vala b/thunar/shortcuts-pane/treeview-mockup/vala/mockup.vala
index 201dc9d..0a5339d 100644
--- a/thunar/shortcuts-pane/treeview-mockup/vala/mockup.vala
+++ b/thunar/shortcuts-pane/treeview-mockup/vala/mockup.vala
@@ -748,8 +748,8 @@ public class ShortcutActionRenderer : CellRenderer {
                                CellRendererState flags)
   {
     if (icon != null) {
-      render_button (window, widget, background_area, cell_area, expose_area, flags);
-      render_icon (window, widget, background_area, cell_area, expose_area, flags);
+      render_button (window, widget, background_area, cell_area, expose_area, flags, false);
+      render_icon (window, widget, background_area, cell_area, expose_area, flags, false);
     }
   }
 
@@ -758,7 +758,8 @@ public class ShortcutActionRenderer : CellRenderer {
                              Gdk.Rectangle background_area,
                              Gdk.Rectangle cell_area,
                              Gdk.Rectangle expose_area,
-                             CellRendererState flags)
+                             CellRendererState flags,
+                             bool active)
   {
     int x, y, width, height;
     get_size (widget, cell_area, out x, out y, out width, out height);
@@ -771,6 +772,11 @@ public class ShortcutActionRenderer : CellRenderer {
       shadow = ShadowType.ETCHED_OUT;
     }
 
+    if (active) {
+      state = StateType.ACTIVE;
+      shadow = ShadowType.OUT;
+    }
+
     if (shadow != ShadowType.NONE) {
       Gtk.paint_box (widget.style, window, state, shadow, cell_area, widget, "button",
                      cell_area.x + x + (int) xpad,
@@ -785,7 +791,8 @@ public class ShortcutActionRenderer : CellRenderer {
                            Gdk.Rectangle background_area,
                            Gdk.Rectangle cell_area,
                            Gdk.Rectangle expose_area,
-                           CellRendererState flags)
+                           CellRendererState flags,
+                           bool active)
   {
     Gdk.Pixbuf pixbuf = null;
 
@@ -837,6 +844,18 @@ public class ShortcutActionRenderer : CellRenderer {
                        0, 0);
     }
   }
+
+  public override bool activate (Gdk.Event event,
+                                 Widget widget,
+                                 string path,
+                                 Gdk.Rectangle background_area,
+                                 Gdk.Rectangle cell_area,
+                                 CellRendererState flags)
+  {
+    render_button (widget.window, widget, background_area, cell_area, cell_area, flags, true);
+    render_icon (widget.window, widget, background_area, cell_area, cell_area, flags, true);
+    return true;
+  }
 }
 
 
@@ -885,13 +904,16 @@ public class ShortcutsView : Frame {
                                     "sensitive", ShortcutsModel.Column.SENSITIVE,
                                     "height", ShortcutsModel.Column.HEIGHT,
                                     "ypad", ShortcutsModel.Column.YPAD);
-    shortcut_column.pack_start (action_renderer, false);
-    shortcut_column.set_attributes (action_renderer,
-                                    "icon", ShortcutsModel.Column.ACTION_ICON,
-                                    "sensitive", ShortcutsModel.Column.SENSITIVE,
-                                    "height", ShortcutsModel.Column.HEIGHT);
     view.append_column(shortcut_column);
 
+    var action_column = new TreeViewColumn ();
+    action_column.pack_start (action_renderer, false);
+    action_column.set_attributes (action_renderer,
+                                  "icon", ShortcutsModel.Column.ACTION_ICON,
+                                  "sensitive", ShortcutsModel.Column.SENSITIVE,
+                                  "height", ShortcutsModel.Column.HEIGHT);
+    view.append_column(action_column);
+
     view.expand_all ();
   }
 



More information about the Xfce4-commits mailing list