[haiku-commits] haiku: hrev44734 - src/preferences/appearance

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 2 Nov 2012 06:51:09 +0100 (CET)

hrev44734 adds 1 changeset to branch 'master'
old head: 6218c8f7eaa451d45fc8febf94dd4051f33ef731
new head: 12a7abb6fab98e7f21d5b5bee418bd7b172d6e10

----------------------------------------------------------------------------

12a7abb: Make the fake scrollbar controls navigatable by the keyboard

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev44734
Commit:      12a7abb6fab98e7f21d5b5bee418bd7b172d6e10
URL:         http://cgit.haiku-os.org/haiku/commit/?id=12a7abb
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Fri Nov  2 05:50:15 2012 UTC

----------------------------------------------------------------------------

1 file changed, 26 insertions(+), 10 deletions(-)
src/preferences/appearance/FakeScrollBar.cpp | 36 +++++++++++++++++-------

----------------------------------------------------------------------------

diff --git a/src/preferences/appearance/FakeScrollBar.cpp 
b/src/preferences/appearance/FakeScrollBar.cpp
index 61a5c74..cd791cc 100644
--- a/src/preferences/appearance/FakeScrollBar.cpp
+++ b/src/preferences/appearance/FakeScrollBar.cpp
@@ -31,7 +31,7 @@ typedef enum {
 FakeScrollBar::FakeScrollBar(bool drawArrows, bool doubleArrows,
        int32 knobStyle, BMessage* message)
        :
-       BControl("FakeScrollBar", NULL, message, B_WILL_DRAW),
+       BControl("FakeScrollBar", NULL, message, B_WILL_DRAW | B_NAVIGABLE),
        fDrawArrows(drawArrows),
        fDoubleArrows(doubleArrows),
        fKnobStyle(knobStyle)
@@ -53,16 +53,32 @@ FakeScrollBar::Draw(BRect updateRect)
 
        rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR);
 
-       if (Value() == B_CONTROL_ON)
-               SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
-       else
-               SetHighColor(normal);
+       if (IsFocus()) {
+               // draw the focus indicator
+               SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
+               StrokeRect(bounds);
+               bounds.InsetBy(1.0, 1.0);
 
-       // Draw the selected border (2px)
-       StrokeRect(bounds);
-       bounds.InsetBy(1.0, 1.0);
-       StrokeRect(bounds);
-       bounds.InsetBy(1.0, 1.0);
+               // Draw the selected border (1px)
+               if (Value() == B_CONTROL_ON)
+                       SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
+               else
+                       SetHighColor(normal);
+
+               StrokeRect(bounds);
+               bounds.InsetBy(1.0, 1.0);
+       } else {
+               // Draw the selected border (2px)
+               if (Value() == B_CONTROL_ON)
+                       SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
+               else
+                       SetHighColor(normal);
+
+               StrokeRect(bounds);
+               bounds.InsetBy(1.0, 1.0);
+               StrokeRect(bounds);
+               bounds.InsetBy(1.0, 1.0);
+       }
 
        // draw a gap (1px)
        SetHighColor(normal);


Other related posts:

  • » [haiku-commits] haiku: hrev44734 - src/preferences/appearance - jscipione