Gravity: Fixup scroll bar range

This commit is contained in:
John Scipione
2016-04-13 14:13:23 -07:00
parent 3456c51030
commit 263e936e87
2 changed files with 14 additions and 2 deletions
@@ -53,8 +53,6 @@ ConfigView::ConfigView(BRect frame, Gravity* parent)
fShadeList->AddItem(new ColorItem("White", (rgb_color){ 255, 255, 255 }));
fShadeList->AddItem(new RainbowItem("Rainbow"));
fShadeList->Select(parent->Config.ShadeID);
fShadeScroll = new BScrollView(B_EMPTY_STRING, fShadeList,
B_WILL_DRAW | B_FRAME_EVENTS, false, true);
@@ -76,6 +74,19 @@ ConfigView::ConfigView(BRect frame, Gravity* parent)
}
void
ConfigView::AllAttached()
{
// fixup scroll bar range
fShadeScroll->ScrollBar(B_VERTICAL)->SetRange(0.0f,
fShadeList->ItemFrame(fShadeList->CountItems()).bottom
- fShadeList->ItemFrame((int32)0).top);
// select the shade
fShadeList->Select(fParent->Config.ShadeID);
}
void
ConfigView::AttachedToWindow()
{
@@ -27,6 +27,7 @@ class ConfigView : public BView {
public:
ConfigView(BRect frame, Gravity* parent);
void AllAttached();
void AttachedToWindow();
void MessageReceived(BMessage* message);