Add the scrollbar constants enum to the header.

Also make some minor tweaks in ScrollBar.cpp
This commit is contained in:
John Scipione 2012-11-01 23:57:11 -04:00
parent 51e2ba81f1
commit 4b5a6861f2
2 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,12 @@
#define DISABLES_ON_WINDOW_DEACTIVATION 1 #define DISABLES_ON_WINDOW_DEACTIVATION 1
enum {
KNOB_STYLE_NONE = 0,
KNOB_STYLE_DOTS,
KNOB_STYLE_LINES
};
class BScrollBar : public BView { class BScrollBar : public BView {
public: public:
BScrollBar(BRect frame, const char* name, BScrollBar(BRect frame, const char* name,

View File

@ -846,6 +846,7 @@ BScrollBar::Draw(BRect updateRect)
EndLineArray(); EndLineArray();
} else } else
StrokeRect(bounds); StrokeRect(bounds);
bounds.InsetBy(1.0, 1.0); bounds.InsetBy(1.0, 1.0);
bool enabled = fPrivateData->fEnabled && fMin < fMax bool enabled = fPrivateData->fEnabled && fMin < fMax
@ -1153,7 +1154,11 @@ BScrollBar::Draw(BRect updateRect)
} }
} }
bool square = false; if (fPrivateData->fScrollBarInfo.knob == KNOB_STYLE_NONE)
return;
// draw the scrollbar thumb knobs
bool square = fPrivateData->fScrollBarInfo.knob == KNOB_STYLE_DOTS;
int32 hextent = 0; int32 hextent = 0;
int32 vextent = 0; int32 vextent = 0;
@ -1165,7 +1170,6 @@ BScrollBar::Draw(BRect updateRect)
vextent = 3; vextent = 3;
} }
// draw the marks on the scrollbar thumb
int32 flags = 0; int32 flags = 0;
if (!enabled) if (!enabled)
flags |= BControlLook::B_DISABLED; flags |= BControlLook::B_DISABLED;
@ -1209,7 +1213,7 @@ BScrollBar::Draw(BRect updateRect)
} }
} }
// draw middle mark last because it modifies middleKnob // draw middle knob last because it modifies middleKnob
be_control_look->DrawButtonBackground(this, middleKnob, updateRect, be_control_look->DrawButtonBackground(this, middleKnob, updateRect,
normal, flags, BControlLook::B_ALL_BORDERS, fOrientation); normal, flags, BControlLook::B_ALL_BORDERS, fOrientation);
} }