Make the fake scrollbar controls navigatable by the keyboard
This commit is contained in:
@@ -31,7 +31,7 @@ typedef enum {
|
|||||||
FakeScrollBar::FakeScrollBar(bool drawArrows, bool doubleArrows,
|
FakeScrollBar::FakeScrollBar(bool drawArrows, bool doubleArrows,
|
||||||
int32 knobStyle, BMessage* message)
|
int32 knobStyle, BMessage* message)
|
||||||
:
|
:
|
||||||
BControl("FakeScrollBar", NULL, message, B_WILL_DRAW),
|
BControl("FakeScrollBar", NULL, message, B_WILL_DRAW | B_NAVIGABLE),
|
||||||
fDrawArrows(drawArrows),
|
fDrawArrows(drawArrows),
|
||||||
fDoubleArrows(doubleArrows),
|
fDoubleArrows(doubleArrows),
|
||||||
fKnobStyle(knobStyle)
|
fKnobStyle(knobStyle)
|
||||||
@@ -53,16 +53,32 @@ FakeScrollBar::Draw(BRect updateRect)
|
|||||||
|
|
||||||
rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR);
|
rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
|
||||||
if (Value() == B_CONTROL_ON)
|
if (IsFocus()) {
|
||||||
SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
|
// draw the focus indicator
|
||||||
else
|
SetHighColor(ui_color(B_NAVIGATION_BASE_COLOR));
|
||||||
SetHighColor(normal);
|
StrokeRect(bounds);
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
// Draw the selected border (2px)
|
// Draw the selected border (1px)
|
||||||
StrokeRect(bounds);
|
if (Value() == B_CONTROL_ON)
|
||||||
bounds.InsetBy(1.0, 1.0);
|
SetHighColor(ui_color(B_CONTROL_MARK_COLOR));
|
||||||
StrokeRect(bounds);
|
else
|
||||||
bounds.InsetBy(1.0, 1.0);
|
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)
|
// draw a gap (1px)
|
||||||
SetHighColor(normal);
|
SetHighColor(normal);
|
||||||
|
|||||||
Reference in New Issue
Block a user