Added layout friendly constructor (untested).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27407 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-09-10 21:07:32 +00:00
parent 7bf5abf425
commit 1b0471487a
2 changed files with 34 additions and 6 deletions

View File

@ -27,12 +27,15 @@
class BScrollBar : public BView {
public:
BScrollBar(BRect frame, const char *name, BView *target,
public:
BScrollBar(BRect frame, const char* name,
BView* target, float min, float max,
orientation direction);
BScrollBar(const char* name, BView* target,
float min, float max, orientation direction);
BScrollBar(BMessage *data);
BScrollBar(BMessage* data);
virtual ~BScrollBar();
static BArchivable *Instantiate(BMessage *data);
static BArchivable *Instantiate(BMessage* data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void AttachedToWindow();

View File

@ -207,6 +207,31 @@ BScrollBar::BScrollBar(BRect frame, const char* name, BView *target,
}
BScrollBar::BScrollBar(const char* name, BView *target,
float min, float max, orientation direction)
: BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS),
fMin(min),
fMax(max),
fSmallStep(1),
fLargeStep(10),
fValue(0),
fProportion(0.0),
fTarget(NULL),
fOrientation(direction),
fTargetName(NULL)
{
SetViewColor(B_TRANSPARENT_COLOR);
fPrivateData = new BScrollBar::Private(this);
SetTarget(target);
SetEventMask(B_NO_POINTER_HISTORY);
_UpdateThumbFrame();
_UpdateArrowButtons();
}
BScrollBar::BScrollBar(BMessage* data)
: BView(data),
fTarget(NULL),
@ -1108,9 +1133,9 @@ BScrollBar::PreferredSize()
{
BSize preferredSize = _MinSize();
if (fOrientation == B_HORIZONTAL)
preferredSize.width = 2 * preferredSize.width;
preferredSize.width *= 2;
else
preferredSize.height = 2 * preferredSize.height;
preferredSize.height *= 2;
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), preferredSize);
}