[Xfce4-commits] <design:master> Dirty row height trick, make keybord focus cycling work.
Jannis Pohlmann
noreply at xfce.org
Tue May 31 04:16:01 CEST 2011
Updating branch refs/heads/master
to 4b76c52a753c1f7b765fb77bc6c1cc26d556f831 (commit)
from aa180f2162457baf604f4ffe91e37cd7479252e5 (commit)
commit 4b76c52a753c1f7b765fb77bc6c1cc26d556f831
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Tue May 31 04:14:14 2011 +0200
Dirty row height trick, make keybord focus cycling work.
.../demo-code/custom-view/shortcut-row.vala | 51 ++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala b/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
index 779648f..5bd9324 100644
--- a/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
+++ b/thunar/shortcuts-pane/demo-code/custom-view/shortcut-row.vala
@@ -54,6 +54,7 @@ public class ShortcutRow : EventBox {
icon.show ();
var label = new Label (title);
+ label.set_ellipsize (Pango.EllipsizeMode.END);
label.set_alignment (0.0f, 0.5f);
box.add (label);
label.show ();
@@ -125,9 +126,27 @@ public class ShortcutRow : EventBox {
return false;
}
+ public override void size_request (out Requisition requisition) {
+ requisition.width = (int) border_width * 2;
+ requisition.height = (int) border_width * 2;
+
+ foreach (var child in get_children ()) {
+ Requisition child_requisition;
+ child.size_request (out child_requisition);
+
+ requisition.width += child_requisition.width;
+ requisition.height = int.max (requisition.height, child_requisition.height);
+ }
+
+ requisition.height = int.max (requisition.height, 26);
+ }
+
public override bool expose_event (Gdk.EventExpose event) {
StateType state = get_state ();
+ Requisition requisition;
+ size_request (out requisition);
+
paint_flat_box (style, event.window, state, ShadowType.NONE,
event.area, this, "cell_even_middle",
event.area.x, event.area.y,
@@ -140,6 +159,38 @@ public class ShortcutRow : EventBox {
return false;
}
+ public override bool focus (DirectionType direction) {
+ switch (direction) {
+ case DirectionType.TAB_FORWARD:
+ return false;
+ case DirectionType.TAB_BACKWARD:
+ return false;
+ case DirectionType.UP:
+ if (is_focus || disconnect_button.is_focus) {
+ return false;
+ } else {
+ grab_focus ();
+ return true;
+ }
+ case DirectionType.DOWN:
+ if (is_focus || disconnect_button.is_focus) {
+ return false;
+ } else {
+ grab_focus ();
+ return true;
+ }
+ case DirectionType.LEFT:
+ grab_focus ();
+ return true;
+ case DirectionType.RIGHT:
+ if (disconnect_button.visible)
+ disconnect_button.grab_focus ();
+ return true;
+ default:
+ return false;
+ }
+ }
+
public override bool focus_in_event (Gdk.EventFocus event) {
set_state (StateType.SELECTED);
return true;
More information about the Xfce4-commits
mailing list