* the custom ScrollView supports B_NO_BORDER, B_PLAIN_BORDER and B_FANCY_BORDER
and each side of the border can be turned off or on individually * -> cosmetic improvements git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22268 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -451,6 +451,12 @@ MainWindow::_Init()
|
|||||||
// create the GUI
|
// create the GUI
|
||||||
_CreateGUI(Bounds());
|
_CreateGUI(Bounds());
|
||||||
|
|
||||||
|
// fix up scrollbar layout in listviews
|
||||||
|
_ImproveScrollBarLayout(fPathListView);
|
||||||
|
_ImproveScrollBarLayout(fStyleListView);
|
||||||
|
_ImproveScrollBarLayout(fShapeListView);
|
||||||
|
_ImproveScrollBarLayout(fTransformerListView);
|
||||||
|
|
||||||
// TODO: move this to CanvasView?
|
// TODO: move this to CanvasView?
|
||||||
fState = new MultipleManipulatorState(fCanvasView);
|
fState = new MultipleManipulatorState(fCanvasView);
|
||||||
fCanvasView->SetState(fState);
|
fCanvasView->SetState(fState);
|
||||||
@@ -615,11 +621,9 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
|
|
||||||
// scroll view around property list view
|
// scroll view around property list view
|
||||||
ScrollView* propScrollView = new ScrollView(fPropertyListView,
|
ScrollView* propScrollView = new ScrollView(fPropertyListView,
|
||||||
SCROLL_VERTICAL | SCROLL_NO_FRAME,
|
SCROLL_VERTICAL, BRect(0, 0, splitWidth, 100), "property scroll view",
|
||||||
BRect(0, 0, splitWidth, 100),
|
B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER,
|
||||||
"property scroll view",
|
BORDER_RIGHT);
|
||||||
B_FOLLOW_NONE,
|
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS);
|
|
||||||
leftSideView->AddChild(propScrollView);
|
leftSideView->AddChild(propScrollView);
|
||||||
|
|
||||||
BGroupLayout* topSide = new BGroupLayout(B_HORIZONTAL);
|
BGroupLayout* topSide = new BGroupLayout(B_HORIZONTAL);
|
||||||
@@ -635,9 +639,9 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
canvasBounds.right += B_V_SCROLL_BAR_WIDTH;
|
canvasBounds.right += B_V_SCROLL_BAR_WIDTH;
|
||||||
ScrollView* canvasScrollView
|
ScrollView* canvasScrollView
|
||||||
= new ScrollView(fCanvasView, SCROLL_VERTICAL | SCROLL_HORIZONTAL
|
= new ScrollView(fCanvasView, SCROLL_VERTICAL | SCROLL_HORIZONTAL
|
||||||
| SCROLL_NO_FRAME | SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS,
|
| SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS,
|
||||||
canvasBounds, "canvas scroll view",
|
canvasBounds, "canvas scroll view",
|
||||||
B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS);
|
B_FOLLOW_NONE, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER);
|
||||||
layout->AddView(canvasScrollView, 1, 1);
|
layout->AddView(canvasScrollView, 1, 1);
|
||||||
|
|
||||||
// views along the top
|
// views along the top
|
||||||
@@ -730,12 +734,10 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
bounds.bottom += B_H_SCROLL_BAR_HEIGHT;
|
bounds.bottom += B_H_SCROLL_BAR_HEIGHT;
|
||||||
bounds.right += B_V_SCROLL_BAR_WIDTH;
|
bounds.right += B_V_SCROLL_BAR_WIDTH;
|
||||||
ScrollView* canvasScrollView
|
ScrollView* canvasScrollView
|
||||||
= new ScrollView(fCanvasView,
|
= new ScrollView(fCanvasView, SCROLL_HORIZONTAL | SCROLL_VERTICAL
|
||||||
SCROLL_HORIZONTAL | SCROLL_VERTICAL
|
| SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS, bounds,
|
||||||
| SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS
|
"canvas scroll view", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS,
|
||||||
| SCROLL_NO_FRAME,
|
B_NO_BORDER);
|
||||||
bounds, "canvas scroll view",
|
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS);
|
|
||||||
|
|
||||||
// icon previews
|
// icon previews
|
||||||
bounds.left = 5;
|
bounds.left = 5;
|
||||||
@@ -902,11 +904,9 @@ MainWindow::_CreateGUI(BRect bounds)
|
|||||||
// scroll view around property list view
|
// scroll view around property list view
|
||||||
bounds.top = menuBar->Frame().bottom + 1;
|
bounds.top = menuBar->Frame().bottom + 1;
|
||||||
bounds.bottom = bg->Bounds().bottom;
|
bounds.bottom = bg->Bounds().bottom;
|
||||||
bg->AddChild(new ScrollView(fPropertyListView,
|
bg->AddChild(new ScrollView(fPropertyListView, SCROLL_VERTICAL,
|
||||||
SCROLL_VERTICAL | SCROLL_NO_FRAME,
|
bounds, "property scroll view", B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM,
|
||||||
bounds, "property scroll view",
|
B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER, BORDER_RIGHT));
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM,
|
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS));
|
|
||||||
|
|
||||||
|
|
||||||
bg->AddChild(canvasScrollView);
|
bg->AddChild(canvasScrollView);
|
||||||
@@ -1063,3 +1063,20 @@ MainWindow::_CreateMenuBar(BRect frame)
|
|||||||
// PathManipulator* pathManipulator = new PathManipulator(path);
|
// PathManipulator* pathManipulator = new PathManipulator(path);
|
||||||
// fState->AddManipulator(pathManipulator);
|
// fState->AddManipulator(pathManipulator);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
// _ImproveScrollBarLayout
|
||||||
|
void
|
||||||
|
MainWindow::_ImproveScrollBarLayout(BView* target)
|
||||||
|
{
|
||||||
|
// NOTE: The BListViews for which this function is used
|
||||||
|
// are directly below a BMenuBar. If the BScrollBar and
|
||||||
|
// the BMenuBar share bottom/top border respectively, the
|
||||||
|
// GUI looks a little more polished. This trick can be
|
||||||
|
// removed if/when the BScrollViews are embedded in a
|
||||||
|
// surounding border like in WonderBrush.
|
||||||
|
|
||||||
|
if (BScrollBar* scrollBar = target->ScrollBar(B_VERTICAL)) {
|
||||||
|
scrollBar->MoveBy(0, -1);
|
||||||
|
scrollBar->ResizeBy(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ class MainWindow : public BWindow,
|
|||||||
void _CreateGUI(BRect frame);
|
void _CreateGUI(BRect frame);
|
||||||
BMenuBar* _CreateMenuBar(BRect frame);
|
BMenuBar* _CreateMenuBar(BRect frame);
|
||||||
|
|
||||||
|
void _ImproveScrollBarLayout(BView* target);
|
||||||
|
|
||||||
IconEditorApp* fApp;
|
IconEditorApp* fApp;
|
||||||
Document* fDocument;
|
Document* fDocument;
|
||||||
Icon* fIcon;
|
Icon* fIcon;
|
||||||
|
|||||||
@@ -260,22 +260,30 @@ ScrollCorner::SetDragging(bool dragging)
|
|||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ScrollView::ScrollView(BView* child, uint32 scrollingFlags, BRect frame,
|
ScrollView::ScrollView(BView* child, uint32 scrollingFlags, BRect frame,
|
||||||
const char *name, uint32 resizingMode, uint32 flags)
|
const char *name, uint32 resizingMode, uint32 viewFlags,
|
||||||
: BView(frame, name, resizingMode, flags | B_FRAME_EVENTS | B_WILL_DRAW
|
uint32 borderStyle, uint32 borderFlags)
|
||||||
| B_FULL_UPDATE_ON_RESIZE),
|
: BView(frame, name, resizingMode, viewFlags | B_FRAME_EVENTS | B_WILL_DRAW
|
||||||
|
| B_FULL_UPDATE_ON_RESIZE),
|
||||||
Scroller(),
|
Scroller(),
|
||||||
fChild(NULL),
|
fChild(NULL),
|
||||||
fScrollingFlags(scrollingFlags),
|
fScrollingFlags(scrollingFlags),
|
||||||
|
|
||||||
fHScrollBar(NULL),
|
fHScrollBar(NULL),
|
||||||
fVScrollBar(NULL),
|
fVScrollBar(NULL),
|
||||||
fScrollCorner(NULL),
|
fScrollCorner(NULL),
|
||||||
|
|
||||||
fHVisible(true),
|
fHVisible(true),
|
||||||
fVVisible(true),
|
fVVisible(true),
|
||||||
fCornerVisible(true),
|
fCornerVisible(true),
|
||||||
|
|
||||||
fWindowActive(false),
|
fWindowActive(false),
|
||||||
fChildFocused(false),
|
fChildFocused(false),
|
||||||
|
|
||||||
fHSmallStep(1),
|
fHSmallStep(1),
|
||||||
fVSmallStep(1)
|
fVSmallStep(1),
|
||||||
|
|
||||||
|
fBorderStyle(borderStyle),
|
||||||
|
fBorderFlags(borderFlags)
|
||||||
{
|
{
|
||||||
// Set transparent view color -- our area is completely covered by
|
// Set transparent view color -- our area is completely covered by
|
||||||
// our children.
|
// our children.
|
||||||
@@ -321,6 +329,9 @@ ScrollView::AllAttached()
|
|||||||
// Draw
|
// Draw
|
||||||
void ScrollView::Draw(BRect updateRect)
|
void ScrollView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
|
if (fBorderStyle == B_NO_BORDER)
|
||||||
|
return;
|
||||||
|
|
||||||
rgb_color keyboardFocus = keyboard_navigation_color();
|
rgb_color keyboardFocus = keyboard_navigation_color();
|
||||||
rgb_color light = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
rgb_color light = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
B_LIGHTEN_MAX_TINT);
|
B_LIGHTEN_MAX_TINT);
|
||||||
@@ -328,50 +339,37 @@ void ScrollView::Draw(BRect updateRect)
|
|||||||
B_DARKEN_1_TINT);
|
B_DARKEN_1_TINT);
|
||||||
rgb_color darkShadow = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
rgb_color darkShadow = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
B_DARKEN_2_TINT);
|
B_DARKEN_2_TINT);
|
||||||
rgb_color darkerShadow = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
|
||||||
B_DARKEN_3_TINT);
|
BRect r = Bounds();
|
||||||
float left = Bounds().left, right = Bounds().right;
|
|
||||||
float top = Bounds().top, bottom = Bounds().bottom;
|
|
||||||
if (fChildFocused && fWindowActive) {
|
if (fChildFocused && fWindowActive) {
|
||||||
BeginLineArray(4);
|
SetHighColor(keyboardFocus);
|
||||||
AddLine(BPoint(left, bottom),
|
StrokeRect(r);
|
||||||
BPoint(left, top), keyboardFocus);
|
|
||||||
AddLine(BPoint(left + 1.0, top),
|
|
||||||
BPoint(right, top), keyboardFocus);
|
|
||||||
AddLine(BPoint(right, top + 1.0),
|
|
||||||
BPoint(right, bottom), keyboardFocus);
|
|
||||||
AddLine(BPoint(right - 1.0, bottom),
|
|
||||||
BPoint(left + 1.0, bottom), keyboardFocus);
|
|
||||||
EndLineArray();
|
|
||||||
} else {
|
} else {
|
||||||
BeginLineArray(4);
|
if (fBorderStyle == B_PLAIN_BORDER) {
|
||||||
AddLine(BPoint(left, bottom),
|
SetHighColor(darkShadow);
|
||||||
BPoint(left, top), shadow);
|
StrokeRect(r);
|
||||||
AddLine(BPoint(left + 1.0, top),
|
} else {
|
||||||
BPoint(right, top), shadow);
|
BeginLineArray(4);
|
||||||
AddLine(BPoint(right, top + 1.0),
|
AddLine(BPoint(r.left, r.bottom),
|
||||||
BPoint(right, bottom), light);
|
BPoint(r.left, r.top), shadow);
|
||||||
AddLine(BPoint(right - 1.0, bottom),
|
AddLine(BPoint(r.left + 1.0, r.top),
|
||||||
BPoint(left + 1.0, bottom), light);
|
BPoint(r.right, r.top), shadow);
|
||||||
EndLineArray();
|
AddLine(BPoint(r.right, r.top + 1.0),
|
||||||
|
BPoint(r.right, r.bottom), light);
|
||||||
|
AddLine(BPoint(r.right - 1.0, r.bottom),
|
||||||
|
BPoint(r.left + 1.0, r.bottom), light);
|
||||||
|
EndLineArray();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (fBorderStyle == B_PLAIN_BORDER)
|
||||||
|
return;
|
||||||
|
|
||||||
// The right and bottom lines will be hidden if the scroll views are
|
// The right and bottom lines will be hidden if the scroll views are
|
||||||
// visible. But that doesn't harm.
|
// visible. But that doesn't harm.
|
||||||
BRect innerRect(_InnerRect());
|
r.InsetBy(1, 1);
|
||||||
left = innerRect.left;
|
SetHighColor(darkShadow);
|
||||||
top = innerRect.top;
|
StrokeRect(r);
|
||||||
right = innerRect.right;
|
|
||||||
bottom = innerRect.bottom;
|
|
||||||
BeginLineArray(4);
|
|
||||||
AddLine(BPoint(left, bottom),
|
|
||||||
BPoint(left, top), darkerShadow);
|
|
||||||
AddLine(BPoint(left + 1.0, top),
|
|
||||||
BPoint(right, top), darkShadow);
|
|
||||||
AddLine(BPoint(right, top + 1.0),
|
|
||||||
BPoint(right, bottom), darkShadow);
|
|
||||||
AddLine(BPoint(right - 1.0, bottom),
|
|
||||||
BPoint(left + 1.0, bottom), darkShadow);
|
|
||||||
EndLineArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FrameResized
|
// FrameResized
|
||||||
@@ -396,36 +394,15 @@ BSize
|
|||||||
ScrollView::MinSize()
|
ScrollView::MinSize()
|
||||||
{
|
{
|
||||||
BSize size = (fChild ? fChild->MinSize() : BSize(-1, -1));
|
BSize size = (fChild ? fChild->MinSize() : BSize(-1, -1));
|
||||||
|
return _Size(size);
|
||||||
if (fVVisible)
|
|
||||||
size.width += B_V_SCROLL_BAR_WIDTH;
|
|
||||||
if (fHVisible)
|
|
||||||
size.height += B_H_SCROLL_BAR_HEIGHT;
|
|
||||||
|
|
||||||
float borderSize = BorderSize();
|
|
||||||
size.width += 2 * borderSize;
|
|
||||||
size.height += 2 * borderSize;
|
|
||||||
|
|
||||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreferredSize
|
// PreferredSize
|
||||||
BSize
|
BSize
|
||||||
ScrollView::PreferredSize()
|
ScrollView::PreferredSize()
|
||||||
{
|
{
|
||||||
// TODO: This is not yet correct.
|
|
||||||
BSize size = (fChild ? fChild->PreferredSize() : BSize(-1, -1));
|
BSize size = (fChild ? fChild->PreferredSize() : BSize(-1, -1));
|
||||||
|
return _Size(size);
|
||||||
if (fVVisible)
|
|
||||||
size.width += B_V_SCROLL_BAR_WIDTH;
|
|
||||||
if (fHVisible)
|
|
||||||
size.height += B_H_SCROLL_BAR_HEIGHT;
|
|
||||||
|
|
||||||
float borderSize = BorderSize();
|
|
||||||
size.width += 2 * borderSize;
|
|
||||||
size.height += 2 * borderSize;
|
|
||||||
|
|
||||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __HAIKU__
|
#endif // __HAIKU__
|
||||||
@@ -501,15 +478,6 @@ ScrollView::HVScrollCorner() const
|
|||||||
return fScrollCorner;
|
return fScrollCorner;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BorderSize
|
|
||||||
float
|
|
||||||
ScrollView::BorderSize() const
|
|
||||||
{
|
|
||||||
if (fScrollingFlags & SCROLL_NO_FRAME)
|
|
||||||
return 0.0;
|
|
||||||
return 2.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
// SetHSmallStep
|
// SetHSmallStep
|
||||||
@@ -659,14 +627,11 @@ ScrollView::_Layout(uint32 flags)
|
|||||||
float innerWidth = childRect.Width();
|
float innerWidth = childRect.Width();
|
||||||
float innerHeight = childRect.Height();
|
float innerHeight = childRect.Height();
|
||||||
BPoint scrollLT(_InnerRect().LeftTop());
|
BPoint scrollLT(_InnerRect().LeftTop());
|
||||||
|
scrollLT.x--;
|
||||||
|
scrollLT.y--;
|
||||||
|
|
||||||
BPoint scrollRB(childRect.RightBottom() + BPoint(1.0f, 1.0f));
|
BPoint scrollRB(childRect.RightBottom() + BPoint(1.0f, 1.0f));
|
||||||
if (fScrollingFlags & SCROLL_NO_FRAME) {
|
|
||||||
// cut off the top line and left line of the
|
|
||||||
// scroll bars, otherwise they are used for the
|
|
||||||
// frame appearance
|
|
||||||
scrollLT.x--;
|
|
||||||
scrollLT.y--;
|
|
||||||
}
|
|
||||||
// layout scroll bars and scroll corner
|
// layout scroll bars and scroll corner
|
||||||
if (corner) {
|
if (corner) {
|
||||||
// In this case the scrollbars overlap one pixel.
|
// In this case the scrollbars overlap one pixel.
|
||||||
@@ -849,9 +814,28 @@ ScrollView::_UpdateScrollBarVisibility()
|
|||||||
BRect
|
BRect
|
||||||
ScrollView::_InnerRect() const
|
ScrollView::_InnerRect() const
|
||||||
{
|
{
|
||||||
if (fScrollingFlags & SCROLL_NO_FRAME)
|
BRect r = Bounds();
|
||||||
return Bounds();
|
float borderWidth = 0;
|
||||||
return Bounds().InsetBySelf(1.0f, 1.0f);
|
switch (fBorderStyle) {
|
||||||
|
case B_NO_BORDER:
|
||||||
|
break;
|
||||||
|
case B_PLAIN_BORDER:
|
||||||
|
borderWidth = 1;
|
||||||
|
break;
|
||||||
|
case B_FANCY_BORDER:
|
||||||
|
default:
|
||||||
|
borderWidth = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (fBorderFlags & BORDER_LEFT)
|
||||||
|
r.left += borderWidth;
|
||||||
|
if (fBorderFlags & BORDER_TOP)
|
||||||
|
r.top += borderWidth;
|
||||||
|
if (fBorderFlags & BORDER_RIGHT)
|
||||||
|
r.right -= borderWidth;
|
||||||
|
if (fBorderFlags & BORDER_BOTTOM)
|
||||||
|
r.bottom -= borderWidth;
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _ChildRect
|
// _ChildRect
|
||||||
@@ -874,18 +858,11 @@ BRect
|
|||||||
ScrollView::_ChildRect(bool hbar, bool vbar) const
|
ScrollView::_ChildRect(bool hbar, bool vbar) const
|
||||||
{
|
{
|
||||||
BRect rect(_InnerRect());
|
BRect rect(_InnerRect());
|
||||||
float frameWidth = (fScrollingFlags & SCROLL_NO_FRAME) ? 0.0 : 1.0;
|
|
||||||
|
|
||||||
if (hbar)
|
|
||||||
rect.bottom -= B_H_SCROLL_BAR_HEIGHT + frameWidth;
|
|
||||||
else
|
|
||||||
rect.bottom -= frameWidth;
|
|
||||||
if (vbar)
|
if (vbar)
|
||||||
rect.right -= B_V_SCROLL_BAR_WIDTH + frameWidth;
|
rect.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
else
|
if (hbar)
|
||||||
rect.right -= frameWidth;
|
rect.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
||||||
rect.top += frameWidth;
|
|
||||||
rect.left += frameWidth;
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -915,4 +892,51 @@ ScrollView::_MaxVisibleRect() const
|
|||||||
return _GuessVisibleRect(true, true);
|
return _GuessVisibleRect(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
BSize
|
||||||
|
ScrollView::_Size(BSize size)
|
||||||
|
{
|
||||||
|
if (fVVisible)
|
||||||
|
size.width += B_V_SCROLL_BAR_WIDTH;
|
||||||
|
if (fHVisible)
|
||||||
|
size.height += B_H_SCROLL_BAR_HEIGHT;
|
||||||
|
|
||||||
|
switch (fBorderStyle) {
|
||||||
|
case B_NO_BORDER:
|
||||||
|
// one line of pixels from scrollbar possibly hidden
|
||||||
|
if (fBorderFlags & BORDER_RIGHT)
|
||||||
|
size.width += fVVisible ? -1 : 0;
|
||||||
|
if (fBorderFlags & BORDER_BOTTOM)
|
||||||
|
size.height += fHVisible ? -1 : 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_PLAIN_BORDER:
|
||||||
|
if (fBorderFlags & BORDER_LEFT)
|
||||||
|
size.width += 1;
|
||||||
|
if (fBorderFlags & BORDER_TOP)
|
||||||
|
size.height += 1;
|
||||||
|
// one line of pixels in frame possibly from scrollbar
|
||||||
|
if (fBorderFlags & BORDER_RIGHT)
|
||||||
|
size.width += fVVisible ? 0 : 1;
|
||||||
|
if (fBorderFlags & BORDER_BOTTOM)
|
||||||
|
size.height += fHVisible ? 0 : 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_FANCY_BORDER:
|
||||||
|
default:
|
||||||
|
if (fBorderFlags & BORDER_LEFT)
|
||||||
|
size.width += 2;
|
||||||
|
if (fBorderFlags & BORDER_TOP)
|
||||||
|
size.height += 2;
|
||||||
|
// one line of pixels in frame possibly from scrollbar
|
||||||
|
if (fBorderFlags & BORDER_RIGHT)
|
||||||
|
size.width += fVVisible ? 1 : 2;
|
||||||
|
if (fBorderFlags & BORDER_BOTTOM)
|
||||||
|
size.height += fHVisible ? 1 : 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
||||||
|
}
|
||||||
|
#endif // __HAIKU__
|
||||||
|
|
||||||
|
|||||||
@@ -23,17 +23,25 @@ enum {
|
|||||||
SCROLL_VERTICAL = 0x02,
|
SCROLL_VERTICAL = 0x02,
|
||||||
SCROLL_HORIZONTAL_MAGIC = 0x04,
|
SCROLL_HORIZONTAL_MAGIC = 0x04,
|
||||||
SCROLL_VERTICAL_MAGIC = 0x08,
|
SCROLL_VERTICAL_MAGIC = 0x08,
|
||||||
SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS = 0x10,
|
SCROLL_VISIBLE_RECT_IS_CHILD_BOUNDS = 0x10
|
||||||
SCROLL_NO_FRAME = 0x20,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
BORDER_LEFT = 0x01,
|
||||||
|
BORDER_TOP = 0x02,
|
||||||
|
BORDER_RIGHT = 0x04,
|
||||||
|
BORDER_BOTTOM = 0x08,
|
||||||
|
BORDER_ALL = BORDER_LEFT | BORDER_TOP | BORDER_RIGHT | BORDER_BOTTOM
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class ScrollView : public BView, public Scroller {
|
class ScrollView : public BView, public Scroller {
|
||||||
public:
|
public:
|
||||||
ScrollView(BView* child,
|
ScrollView(BView* child, uint32 scrollingFlags,
|
||||||
uint32 scrollingFlags,
|
BRect frame, const char *name,
|
||||||
BRect frame,
|
uint32 resizingMode, uint32 viewFlags,
|
||||||
const char *name,
|
uint32 borderStyle = B_FANCY_BORDER,
|
||||||
uint32 resizingMode, uint32 flags);
|
uint32 borderFlags = BORDER_ALL);
|
||||||
virtual ~ScrollView();
|
virtual ~ScrollView();
|
||||||
|
|
||||||
virtual void AllAttached();
|
virtual void AllAttached();
|
||||||
@@ -66,8 +74,6 @@ class ScrollView : public BView, public Scroller {
|
|||||||
float HSmallStep() const;
|
float HSmallStep() const;
|
||||||
float VSmallStep() const;
|
float VSmallStep() const;
|
||||||
|
|
||||||
float BorderSize() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DataRectChanged(BRect oldDataRect,
|
virtual void DataRectChanged(BRect oldDataRect,
|
||||||
BRect newDataRect);
|
BRect newDataRect);
|
||||||
@@ -94,6 +100,9 @@ class ScrollView : public BView, public Scroller {
|
|||||||
float fHSmallStep;
|
float fHSmallStep;
|
||||||
float fVSmallStep;
|
float fVSmallStep;
|
||||||
|
|
||||||
|
uint32 fBorderStyle;
|
||||||
|
uint32 fBorderFlags;
|
||||||
|
|
||||||
void _ScrollValueChanged(
|
void _ScrollValueChanged(
|
||||||
InternalScrollBar* scrollBar,
|
InternalScrollBar* scrollBar,
|
||||||
float value);
|
float value);
|
||||||
@@ -111,6 +120,9 @@ private:
|
|||||||
BRect _ChildRect(bool hbar, bool vbar) const;
|
BRect _ChildRect(bool hbar, bool vbar) const;
|
||||||
BRect _GuessVisibleRect(bool hbar, bool vbar) const;
|
BRect _GuessVisibleRect(bool hbar, bool vbar) const;
|
||||||
BRect _MaxVisibleRect() const;
|
BRect _MaxVisibleRect() const;
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
virtual BSize _Size(BSize childSize);
|
||||||
|
#endif
|
||||||
|
|
||||||
friend class InternalScrollBar;
|
friend class InternalScrollBar;
|
||||||
friend class ScrollCorner;
|
friend class ScrollCorner;
|
||||||
|
|||||||
Reference in New Issue
Block a user