Implemented BSize returning layout methods.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27406 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8bd9493d55
commit
7bf5abf425
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||
* Copyright (c) 2001-2008, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*
|
||||
* Authors:
|
||||
@ -71,6 +71,10 @@ class BScrollBar : public BView {
|
||||
virtual void AllDetached();
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
|
||||
virtual BSize MinSize();
|
||||
virtual BSize MaxSize();
|
||||
virtual BSize PreferredSize();
|
||||
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
|
||||
#if DISABLES_ON_WINDOW_DEACTIVATION
|
||||
@ -106,6 +110,8 @@ class BScrollBar : public BView {
|
||||
const BRect& updateRect,
|
||||
bool enabled, bool down);
|
||||
|
||||
BSize _MinSize() const;
|
||||
|
||||
float fMin;
|
||||
float fMax;
|
||||
float fSmallStep;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <ScrollBar.h>
|
||||
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
#include <OS.h>
|
||||
#include <Shape.h>
|
||||
@ -1083,6 +1084,37 @@ BScrollBar::GetSupportedSuites(BMessage *message)
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
BScrollBar::MinSize()
|
||||
{
|
||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), _MinSize());
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
BScrollBar::MaxSize()
|
||||
{
|
||||
BSize maxSize = _MinSize();
|
||||
if (fOrientation == B_HORIZONTAL)
|
||||
maxSize.width = B_SIZE_UNLIMITED;
|
||||
else
|
||||
maxSize.height = B_SIZE_UNLIMITED;
|
||||
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), maxSize);
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
BScrollBar::PreferredSize()
|
||||
{
|
||||
BSize preferredSize = _MinSize();
|
||||
if (fOrientation == B_HORIZONTAL)
|
||||
preferredSize.width = 2 * preferredSize.width;
|
||||
else
|
||||
preferredSize.height = 2 * preferredSize.height;
|
||||
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), preferredSize);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BScrollBar::Perform(perform_code d, void* arg)
|
||||
{
|
||||
@ -1643,3 +1675,20 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
||||
EndLineArray();
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
BScrollBar::_MinSize() const
|
||||
{
|
||||
BSize minSize;
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
minSize.width = 2 * B_V_SCROLL_BAR_WIDTH
|
||||
+ 2 * fPrivateData->fScrollBarInfo.min_knob_size;
|
||||
minSize.height = B_H_SCROLL_BAR_HEIGHT;
|
||||
} else {
|
||||
minSize.width = B_V_SCROLL_BAR_WIDTH;
|
||||
minSize.height = 2 * B_H_SCROLL_BAR_HEIGHT
|
||||
+ 2 * fPrivateData->fScrollBarInfo.min_knob_size;
|
||||
}
|
||||
return minSize;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user