2 * Copyright 2001-2016 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
12 enum hash_mark_location
{
13 B_HASH_MARKS_NONE
= 0,
15 B_HASH_MARKS_LEFT
= 1,
16 B_HASH_MARKS_BOTTOM
= 2,
17 B_HASH_MARKS_RIGHT
= 2,
27 class BSlider
: public BControl
{
29 BSlider(BRect frame
, const char* name
,
30 const char* label
, BMessage
* message
,
31 int32 minValue
, int32 maxValue
,
32 thumb_style thumbType
= B_BLOCK_THUMB
,
33 uint32 resizingMode
= B_FOLLOW_LEFT_TOP
,
34 uint32 flags
= B_NAVIGABLE
| B_WILL_DRAW
37 BSlider(BRect frame
, const char* name
,
38 const char* label
, BMessage
* message
,
39 int32 minValue
, int32 maxValue
,
41 thumb_style thumbType
= B_BLOCK_THUMB
,
42 uint32 resizingMode
= B_FOLLOW_LEFT_TOP
,
43 uint32 flags
= B_NAVIGABLE
| B_WILL_DRAW
46 BSlider(const char* name
, const char* label
,
47 BMessage
* message
, int32 minValue
,
48 int32 maxValue
, orientation posture
,
49 thumb_style thumbType
= B_BLOCK_THUMB
,
50 uint32 flags
= B_NAVIGABLE
| B_WILL_DRAW
53 BSlider(BMessage
* archive
);
56 static BArchivable
* Instantiate(BMessage
* archive
);
57 virtual status_t
Archive(BMessage
* archive
,
58 bool deep
= true) const;
59 virtual status_t
Perform(perform_code code
, void* data
);
61 virtual void WindowActivated(bool state
);
62 virtual void AttachedToWindow();
63 virtual void AllAttached();
64 virtual void AllDetached();
65 virtual void DetachedFromWindow();
67 virtual void MessageReceived(BMessage
* message
);
68 virtual void FrameMoved(BPoint newPosition
);
69 virtual void FrameResized(float width
, float height
);
70 virtual void KeyDown(const char* bytes
, int32 numBytes
);
71 virtual void KeyUp(const char* bytes
, int32 numBytes
);
72 virtual void MouseDown(BPoint point
);
73 virtual void MouseUp(BPoint point
);
74 virtual void MouseMoved(BPoint point
, uint32 transit
,
75 const BMessage
* dragMessage
);
78 virtual void SetLabel(const char* label
);
79 virtual void SetLimitLabels(const char* minLabel
,
80 const char* maxLabel
);
81 const char* MinLimitLabel() const;
82 const char* MaxLimitLabel() const;
83 virtual void SetValue(int32 value
);
84 virtual int32
ValueForPoint(BPoint point
) const;
85 virtual void SetPosition(float);
86 float Position() const;
87 virtual void SetEnabled(bool on
);
88 void GetLimits(int32
* minimum
, int32
* maximum
) const;
90 virtual void Draw(BRect updateRect
);
91 virtual void DrawSlider();
92 virtual void DrawBar();
93 virtual void DrawHashMarks();
94 virtual void DrawThumb();
95 virtual void DrawFocusMark();
96 virtual void DrawText();
97 virtual const char* UpdateText() const;
98 void UpdateTextChanged();
100 virtual BRect
BarFrame() const;
101 virtual BRect
HashMarksFrame() const;
102 virtual BRect
ThumbFrame() const;
104 virtual void SetFlags(uint32 flags
);
105 virtual void SetResizingMode(uint32 mode
);
107 virtual void GetPreferredSize(float* _width
,
109 virtual void ResizeToPreferred();
111 virtual status_t
Invoke(BMessage
* message
= NULL
);
112 virtual BHandler
* ResolveSpecifier(BMessage
* message
,
113 int32 index
, BMessage
* specifier
,
114 int32 form
, const char* property
);
115 virtual status_t
GetSupportedSuites(BMessage
* data
);
117 virtual void SetModificationMessage(BMessage
* message
);
118 BMessage
* ModificationMessage() const;
120 virtual void SetSnoozeAmount(int32 microSeconds
);
121 int32
SnoozeAmount() const;
123 virtual void SetKeyIncrementValue(int32 value
);
124 int32
KeyIncrementValue() const;
126 virtual void SetHashMarkCount(int32 count
);
127 int32
HashMarkCount() const;
129 virtual void SetHashMarks(hash_mark_location where
);
130 hash_mark_location
HashMarks() const;
132 virtual void SetStyle(thumb_style style
);
133 thumb_style
Style() const;
135 virtual void SetBarColor(rgb_color color
);
136 rgb_color
BarColor() const;
137 virtual void UseFillColor(bool useFill
,
138 const rgb_color
* color
= NULL
);
139 bool FillColor(rgb_color
* color
) const;
141 BView
* OffscreenView() const;
143 orientation
Orientation() const;
144 virtual void SetOrientation(orientation
);
146 float BarThickness() const;
147 virtual void SetBarThickness(float thickness
);
149 virtual void SetFont(const BFont
* font
,
150 uint32 properties
= B_FONT_ALL
);
152 virtual void SetLimits(int32 minimum
, int32 maximum
);
154 virtual float MaxUpdateTextWidth();
156 virtual BSize
MinSize();
157 virtual BSize
MaxSize();
158 virtual BSize
PreferredSize();
160 virtual status_t
SetIcon(const BBitmap
* icon
, uint32 flags
= 0);
163 virtual void LayoutInvalidated(bool descendants
);
166 void _DrawBlockThumb();
167 void _DrawTriangleThumb();
169 BPoint
_Location() const;
170 void _SetLocationForValue(int32 value
);
172 float _MinPosition() const;
173 float _MaxPosition() const;
174 bool _ConstrainPoint(BPoint
& point
,
175 BPoint compare
) const;
177 BSize
_ValidateMinSize();
179 void _InitBarColor();
183 // FBC padding and forbidden methods
184 virtual void _ReservedSlider6();
185 virtual void _ReservedSlider7();
186 virtual void _ReservedSlider8();
187 virtual void _ReservedSlider9();
188 virtual void _ReservedSlider10();
189 virtual void _ReservedSlider11();
190 virtual void _ReservedSlider12();
192 BSlider
& operator=(const BSlider
& other
);
195 BMessage
* fModificationMessage
;
199 rgb_color fFillColor
;
202 char* fMinLimitLabel
;
203 char* fMaxLimitLabel
;
204 const char* fUpdateText
;
208 int32 fKeyIncrementValue
;
210 int32 fHashMarkCount
;
211 hash_mark_location fHashMarks
;
213 BBitmap
* fOffScreenBits
;
214 BView
* fOffScreenView
;
219 BPoint fInitialLocation
;
221 orientation fOrientation
;
226 float fMaxUpdateTextWidth
;