* Update header indentation.
* Added BScrollBar::SetOrientation(). * Improved _DrawArrowButton() to have a good visual result even when the scroll bar does not have the standard width or height. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27494 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,7 +35,7 @@ public:
|
|||||||
float min, float max, orientation direction);
|
float min, float max, orientation direction);
|
||||||
BScrollBar(BMessage* data);
|
BScrollBar(BMessage* data);
|
||||||
virtual ~BScrollBar();
|
virtual ~BScrollBar();
|
||||||
static BArchivable *Instantiate(BMessage* data);
|
static BArchivable* Instantiate(BMessage* data);
|
||||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
@@ -46,49 +46,53 @@ public:
|
|||||||
virtual void ValueChanged(float newValue);
|
virtual void ValueChanged(float newValue);
|
||||||
|
|
||||||
void SetRange(float min, float max);
|
void SetRange(float min, float max);
|
||||||
void GetRange(float *min, float *max) const;
|
void GetRange(float* _min, float* _max) const;
|
||||||
void SetSteps(float smallStep, float largeStep);
|
void SetSteps(float smallStep, float largeStep);
|
||||||
void GetSteps(float *smallStep, float *largeStep) const;
|
void GetSteps(float* _smallStep,
|
||||||
|
float* _largeStep) const;
|
||||||
void SetTarget(BView *target);
|
void SetTarget(BView *target);
|
||||||
void SetTarget(const char *targetName);
|
void SetTarget(const char* targetName);
|
||||||
BView *Target() const;
|
BView* Target() const;
|
||||||
|
void SetOrientation(enum orientation orientation);
|
||||||
orientation Orientation() const;
|
orientation Orientation() const;
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *msg);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void MouseDown(BPoint pt);
|
virtual void MouseDown(BPoint pt);
|
||||||
virtual void MouseUp(BPoint pt);
|
virtual void MouseUp(BPoint pt);
|
||||||
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
|
virtual void MouseMoved(BPoint pt, uint32 code,
|
||||||
|
const BMessage* dragMessage);
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void FrameMoved(BPoint new_position);
|
virtual void FrameMoved(BPoint new_position);
|
||||||
virtual void FrameResized(float new_width, float new_height);
|
virtual void FrameResized(float newWidth, float newHeight);
|
||||||
|
|
||||||
virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
|
virtual BHandler* ResolveSpecifier(BMessage* message,
|
||||||
BMessage *specifier, int32 form,
|
int32 index, BMessage* specifier,
|
||||||
const char *property);
|
int32 form, const char* property);
|
||||||
|
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual void GetPreferredSize(float *width, float *height);
|
virtual void GetPreferredSize(float* _width, float* _height);
|
||||||
virtual void MakeFocus(bool state = true);
|
virtual void MakeFocus(bool state = true);
|
||||||
virtual void AllAttached();
|
virtual void AllAttached();
|
||||||
virtual void AllDetached();
|
virtual void AllDetached();
|
||||||
virtual status_t GetSupportedSuites(BMessage *data);
|
virtual status_t GetSupportedSuites(BMessage* data);
|
||||||
|
|
||||||
virtual BSize MinSize();
|
virtual BSize MinSize();
|
||||||
virtual BSize MaxSize();
|
virtual BSize MaxSize();
|
||||||
virtual BSize PreferredSize();
|
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
|
||||||
virtual void WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
class Private;
|
||||||
friend class Private;
|
friend class Private;
|
||||||
|
|
||||||
friend status_t control_scrollbar(scroll_bar_info *info, BScrollBar *bar);
|
friend status_t control_scrollbar(scroll_bar_info* info,
|
||||||
|
BScrollBar *bar);
|
||||||
// for use within the preflet
|
// for use within the preflet
|
||||||
|
|
||||||
virtual void _ReservedScrollBar1();
|
virtual void _ReservedScrollBar1();
|
||||||
@@ -96,7 +100,8 @@ public:
|
|||||||
virtual void _ReservedScrollBar3();
|
virtual void _ReservedScrollBar3();
|
||||||
virtual void _ReservedScrollBar4();
|
virtual void _ReservedScrollBar4();
|
||||||
|
|
||||||
BScrollBar &operator=(const BScrollBar &);
|
// disabled
|
||||||
|
BScrollBar& operator=(const BScrollBar& other);
|
||||||
|
|
||||||
bool _DoubleArrows() const;
|
bool _DoubleArrows() const;
|
||||||
void _UpdateThumbFrame();
|
void _UpdateThumbFrame();
|
||||||
@@ -106,7 +111,8 @@ public:
|
|||||||
void _UpdateTargetValue(BPoint where);
|
void _UpdateTargetValue(BPoint where);
|
||||||
void _UpdateArrowButtons();
|
void _UpdateArrowButtons();
|
||||||
void _DrawDisabledBackground(BRect area,
|
void _DrawDisabledBackground(BRect area,
|
||||||
const rgb_color& light, const rgb_color& dark,
|
const rgb_color& light,
|
||||||
|
const rgb_color& dark,
|
||||||
const rgb_color& fill);
|
const rgb_color& fill);
|
||||||
void _DrawArrowButton(int32 direction,
|
void _DrawArrowButton(int32 direction,
|
||||||
bool doubleArrows, BRect frame,
|
bool doubleArrows, BRect frame,
|
||||||
|
|||||||
@@ -563,6 +563,18 @@ BScrollBar::Target() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BScrollBar::SetOrientation(enum orientation orientation)
|
||||||
|
{
|
||||||
|
if (fOrientation == orientation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fOrientation = orientation;
|
||||||
|
InvalidateLayout();
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
orientation
|
orientation
|
||||||
BScrollBar::Orientation() const
|
BScrollBar::Orientation() const
|
||||||
{
|
{
|
||||||
@@ -1610,27 +1622,29 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
|||||||
}
|
}
|
||||||
|
|
||||||
BPoint tri1, tri2, tri3;
|
BPoint tri1, tri2, tri3;
|
||||||
r.InsetBy(4, 4);
|
float hInset = r.Width() / 3;
|
||||||
|
float vInset = r.Height() / 3;
|
||||||
|
r.InsetBy(hInset, vInset);
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case ARROW_LEFT:
|
case ARROW_LEFT:
|
||||||
tri1.Set(r.right, r.top);
|
tri1.Set(r.right, r.top);
|
||||||
tri2.Set(r.left + 1, (r.top + r.bottom + 1) /2 );
|
tri2.Set(r.right - r.Width() / 1.33, (r.top + r.bottom + 1) /2 );
|
||||||
tri3.Set(r.right, r.bottom + 1);
|
tri3.Set(r.right, r.bottom + 1);
|
||||||
break;
|
break;
|
||||||
case ARROW_RIGHT:
|
case ARROW_RIGHT:
|
||||||
tri1.Set(r.left, r.bottom + 1);
|
tri1.Set(r.left, r.bottom + 1);
|
||||||
tri2.Set(r.right - 1, (r.top + r.bottom + 1) / 2);
|
tri2.Set(r.left + r.Width() / 1.33, (r.top + r.bottom + 1) / 2);
|
||||||
tri3.Set(r.left, r.top);
|
tri3.Set(r.left, r.top);
|
||||||
break;
|
break;
|
||||||
case ARROW_UP:
|
case ARROW_UP:
|
||||||
tri1.Set(r.left, r.bottom);
|
tri1.Set(r.left, r.bottom);
|
||||||
tri2.Set((r.left + r.right + 1) / 2, r.top + 1);
|
tri2.Set((r.left + r.right + 1) / 2, r.bottom - r.Height() / 1.33);
|
||||||
tri3.Set(r.right + 1, r.bottom);
|
tri3.Set(r.right + 1, r.bottom);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tri1.Set(r.left, r.top);
|
tri1.Set(r.left, r.top);
|
||||||
tri2.Set((r.left + r.right + 1) / 2, r.bottom - 1);
|
tri2.Set((r.left + r.right + 1) / 2, r.top + r.Height() / 1.33);
|
||||||
tri3.Set(r.right + 1, r.top);
|
tri3.Set(r.right + 1, r.top);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1642,7 +1656,7 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
|||||||
tri3 = tri3 + offset;
|
tri3 = tri3 + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
r.InsetBy(-3, -3);
|
r.InsetBy(-(hInset - 1), -(vInset - 1));
|
||||||
SetHighColor(normal);
|
SetHighColor(normal);
|
||||||
FillRect(r);
|
FillRect(r);
|
||||||
|
|
||||||
@@ -1652,7 +1666,7 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
|||||||
arrowShape.LineTo(tri3);
|
arrowShape.LineTo(tri3);
|
||||||
|
|
||||||
SetHighColor(arrow);
|
SetHighColor(arrow);
|
||||||
SetPenSize(2.0);
|
SetPenSize(ceilf(hInset / 2.0));
|
||||||
StrokeShape(&arrowShape);
|
StrokeShape(&arrowShape);
|
||||||
SetPenSize(1.0);
|
SetPenSize(1.0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user