MenuField layouts the menu bar better with respect to fDivider, it aligns better with other controls. fDivider in TextControl is an integer number now, small fix and small cleanup in Menu, Window::InitData takes an optional BBitmap token to construct an offscreen window, fixed PrivateScreen IndexForColor, View prevents being located at fractional coordinates as in R5, BBitmap unlocks its offscreen window since it is never Show()n and needs manual unlocking, fixed Slider offscreen window mode and improved triange thumb drawing, ScrollView would not crash when passing a NULL target just for kicks, the private MenuBar class now implements Draw to draw itself a little differently inside the BMenuField (dark right and bottom side) - though how it currently sets the clipping region prevents the text controls to draw in Playground, needs fixing

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13450 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-07-05 16:30:53 +00:00
parent b2086a9ba0
commit 2e6a5805ba
14 changed files with 227 additions and 108 deletions
+44 -20
View File
@@ -3,6 +3,7 @@
* Distributed under the terms of the MIT License.
*/
#include <stdio.h>
#include <ScrollView.h>
#include <Message.h>
@@ -23,35 +24,58 @@ BScrollView::BScrollView(const char *name, BView *target, uint32 resizingMode,
fBorder(border),
fHighlighted(false)
{
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (border != B_NO_BORDER)
fTarget->MoveBy(BorderSize(border), BorderSize(border));
AddChild(fTarget);
BRect frame = fTarget->Frame();
if (horizontal) {
BRect rect = frame;
rect.top = rect.bottom + 1;
rect.bottom += B_H_SCROLL_BAR_HEIGHT + 1;
if (border != B_NO_BORDER || vertical)
rect.right++;
BRect targetFrame;
if (fTarget) {
// layout target and add it
fTarget->TargetedByScrollView(this);
fTarget->MoveTo(B_ORIGIN);
if (border != B_NO_BORDER)
fTarget->MoveBy(BorderSize(border), BorderSize(border));
AddChild(fTarget);
targetFrame = fTarget->Frame();
} else {
// no target specified
targetFrame = Bounds();
if (horizontal)
targetFrame.bottom -= B_H_SCROLL_BAR_HEIGHT + 1;
if (vertical)
targetFrame.right -= B_V_SCROLL_BAR_WIDTH + 1;
if (border == B_FANCY_BORDER) {
targetFrame.bottom--;
targetFrame.right--;
}
}
if (horizontal) {
BRect rect = targetFrame;
rect.top = rect.bottom + 1;
rect.bottom = rect.top + B_H_SCROLL_BAR_HEIGHT;
if (border != B_NO_BORDER || vertical) {
// extend scrollbar so that it overlaps one pixel with vertical scrollbar
rect.right++;
}
if (border != B_NO_BORDER) {
// the scrollbar draws part of the surrounding frame on the left
rect.left--;
}
fHorizontalScrollBar = new BScrollBar(rect, "_HSB_", fTarget, 0, 1000, B_HORIZONTAL);
AddChild(fHorizontalScrollBar);
}
if (vertical) {
BRect rect = frame;
BRect rect = targetFrame;
rect.left = rect.right + 1;
rect.right += B_V_SCROLL_BAR_WIDTH + 1;
if (border != B_NO_BORDER || horizontal)
rect.right = rect.left + B_V_SCROLL_BAR_WIDTH;
if (border != B_NO_BORDER || horizontal) {
// extend scrollbar so that it overlaps one pixel with vertical scrollbar
rect.bottom++;
if (border != B_NO_BORDER)
}
if (border != B_NO_BORDER) {
// the scrollbar draws part of the surrounding frame on the left
rect.top--;
}
fVerticalScrollBar = new BScrollBar(rect, "_VSB_", fTarget, 0, 1000, B_VERTICAL);
AddChild(fVerticalScrollBar);
}
@@ -486,7 +510,7 @@ BScrollView::GetPreferredSize(float *_width, float *_height)
BRect
BScrollView::CalcFrame(BView *target, bool horizontal, bool vertical, border_style border)
{
BRect frame = target != NULL ? frame = target->Frame() : BRect(0, 0, 80, 80);
BRect frame = target != NULL ? target->Frame() : BRect(0, 0, 80, 80);
if (vertical)
frame.right += B_V_SCROLL_BAR_WIDTH;