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:
@@ -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.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -71,6 +71,10 @@ class BScrollBar : public BView {
|
|||||||
virtual void AllDetached();
|
virtual void AllDetached();
|
||||||
virtual status_t GetSupportedSuites(BMessage *data);
|
virtual status_t GetSupportedSuites(BMessage *data);
|
||||||
|
|
||||||
|
virtual BSize MinSize();
|
||||||
|
virtual BSize MaxSize();
|
||||||
|
virtual BSize PreferredSize();
|
||||||
|
|
||||||
virtual status_t Perform(perform_code d, void *arg);
|
virtual status_t Perform(perform_code d, void *arg);
|
||||||
|
|
||||||
#if DISABLES_ON_WINDOW_DEACTIVATION
|
#if DISABLES_ON_WINDOW_DEACTIVATION
|
||||||
@@ -106,6 +110,8 @@ class BScrollBar : public BView {
|
|||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
bool enabled, bool down);
|
bool enabled, bool down);
|
||||||
|
|
||||||
|
BSize _MinSize() const;
|
||||||
|
|
||||||
float fMin;
|
float fMin;
|
||||||
float fMax;
|
float fMax;
|
||||||
float fSmallStep;
|
float fSmallStep;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <ScrollBar.h>
|
#include <ScrollBar.h>
|
||||||
|
|
||||||
|
#include <LayoutUtils.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Shape.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
|
status_t
|
||||||
BScrollBar::Perform(perform_code d, void* arg)
|
BScrollBar::Perform(perform_code d, void* arg)
|
||||||
{
|
{
|
||||||
@@ -1643,3 +1675,20 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
|||||||
EndLineArray();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user