I’ve been trying a bit to draw scrollbars and have hit a bit of a wall, my code doesn’t draw anything… and I am not sure why, I suppose I am doing something wrong : )
maybe someone could take a look?
void
DHMOControlLook::DrawScrollBarThumb(BView* view, BRect& rect,
const BRect& updateRect, const rgb_color& base, uint32 flags,
orientation orientation, uint32 knobStyle)
{
if (!rect.IsValid() || !rect.Intersects(updateRect))
return;
BPoint points[3];
float cornerInset = 2.0f;
BShape shape;
shape.MoveTo(BPoint(rect.RightTop().x - cornerInset, rect.RightTop().y));
points[0].x = rect.top - cornerInset / 2;
points[0].y = rect.right;
points[1].x = rect.top;
points[1].y = rect.right + cornerInset / 2;
points[2].x = rect.top;
points[2].y = rect.right + cornerInset;
shape.BezierTo(points);
shape.LineTo(BPoint(rect.RightBottom().x + cornerInset, rect.RightBottom().y));
points[0].x = rect.bottom + cornerInset / 2;
points[0].y = rect.right;
points[1].x = rect.bottom;
points[1].y = rect.right - cornerInset / 2;
points[2].x = rect.bottom;
points[2].y = rect.right - cornerInset;
shape.BezierTo(points);
shape.Close();
view->SetHighColor(ui_color(B_SCROLL_BAR_THUMB_COLOR));
view->MovePenTo(B_ORIGIN);
view->FillShape(&shape);
}
I expect it to draw the right part of the scrollbar segment, but instead nothing is drawn at all. the area keeps the color of whatever was on screen before.
edit: this is my current understanding of the drawing system, and what i think my code should draw. perhaps it is wrong entirely