2 * Copyright 2005-2015, Haiku Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Stefano Ceccherini (stefano.ceccherini@gmail.com)
7 * Stephan Aßmus <superstippi@gmx.de>
10 #include <ChannelSlider.h>
15 #include <ControlLook.h>
17 #include <PropertyInfo.h>
22 const static unsigned char
23 kVerticalKnobData
[] = {
24 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
25 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
26 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff,
27 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff,
28 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
29 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
30 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
31 0xff, 0x00, 0x3f, 0x3f, 0xcb, 0xcb, 0xcb, 0xcb, 0x3f, 0x3f, 0x00, 0x12,
32 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
33 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
34 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
35 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
36 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12,
37 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12,
38 0xff, 0xff, 0xff, 0xff, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0xff
42 const static unsigned char
43 kHorizontalKnobData
[] = {
44 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
46 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0xff, 0xff, 0x00, 0x3f, 0x3f,
47 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0xff, 0xff,
48 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f,
49 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb,
50 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f,
51 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff,
52 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0xcb, 0x3f, 0x3f, 0x3f, 0x3f,
53 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
54 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff, 0xff, 0x00, 0x3f, 0x3f,
55 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x12, 0xff,
56 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x0c, 0x12, 0xff, 0xff, 0xff, 0xff, 0xff, 0x12, 0x12, 0x12, 0x12,
58 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
59 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
66 { B_GET_PROPERTY
, B_SET_PROPERTY
, 0 },
67 { B_DIRECT_SPECIFIER
, 0 }, NULL
, 0, { B_INT32_TYPE
}
74 const static float kPadding
= 3.0;
77 BChannelSlider::BChannelSlider(BRect area
, const char* name
, const char* label
,
78 BMessage
* model
, int32 channels
, uint32 resizeMode
, uint32 flags
)
79 : BChannelControl(area
, name
, label
, model
, channels
, resizeMode
, flags
)
85 BChannelSlider::BChannelSlider(BRect area
, const char* name
, const char* label
,
86 BMessage
* model
, orientation orientation
, int32 channels
,
87 uint32 resizeMode
, uint32 flags
)
88 : BChannelControl(area
, name
, label
, model
, channels
, resizeMode
, flags
)
92 SetOrientation(orientation
);
96 BChannelSlider::BChannelSlider(const char* name
, const char* label
,
97 BMessage
* model
, orientation orientation
, int32 channels
,
99 : BChannelControl(name
, label
, model
, channels
, flags
)
103 SetOrientation(orientation
);
107 BChannelSlider::BChannelSlider(BMessage
* archive
)
108 : BChannelControl(archive
)
113 if (archive
->FindInt32("_orient", (int32
*)&orient
) == B_OK
)
114 SetOrientation(orient
);
118 BChannelSlider::~BChannelSlider()
124 delete[] fInitialValues
;
129 BChannelSlider::Instantiate(BMessage
* archive
)
131 if (validate_instantiation(archive
, "BChannelSlider"))
132 return new (std::nothrow
) BChannelSlider(archive
);
139 BChannelSlider::Archive(BMessage
* into
, bool deep
) const
141 status_t status
= BChannelControl::Archive(into
, deep
);
143 status
= into
->AddInt32("_orient", (int32
)Orientation());
150 BChannelSlider::AttachedToWindow()
153 BChannelControl::AttachedToWindow();
158 BChannelSlider::AllAttached()
160 BChannelControl::AllAttached();
165 BChannelSlider::DetachedFromWindow()
167 BChannelControl::DetachedFromWindow();
172 BChannelSlider::AllDetached()
174 BChannelControl::AllDetached();
179 BChannelSlider::MessageReceived(BMessage
* message
)
181 if (message
->what
== B_COLORS_UPDATED
182 && fBacking
!= NULL
&& fBackingView
!= NULL
) {
184 if (message
->FindColor(ui_color_name(B_PANEL_BACKGROUND_COLOR
), &color
)
186 && fBacking
->Lock()) {
188 if (fBackingView
->LockLooper()) {
189 fBackingView
->SetLowColor(color
);
190 fBackingView
->UnlockLooper();
196 switch (message
->what
) {
197 case B_SET_PROPERTY
: {
199 BMessage
reply(B_REPLY
);
203 const char* property
= NULL
;
204 bool handled
= false;
205 status_t status
= message
->GetCurrentSpecifier(&index
, &specifier
,
207 BPropertyInfo
propInfo(sPropertyInfo
);
209 && propInfo
.FindMatch(message
, index
, &specifier
, what
,
212 if (message
->what
== B_SET_PROPERTY
) {
214 if (specifier
.FindInt32("data", (int32
*)&orient
) == B_OK
) {
215 SetOrientation(orient
);
216 Invalidate(Bounds());
218 } else if (message
->what
== B_GET_PROPERTY
)
219 reply
.AddInt32("result", (int32
)Orientation());
221 status
= B_BAD_SCRIPT_SYNTAX
;
225 reply
.AddInt32("error", status
);
226 message
->SendReply(&reply
);
228 BChannelControl::MessageReceived(message
);
233 BChannelControl::MessageReceived(message
);
240 BChannelSlider::Draw(BRect updateRect
)
245 SetHighColor(ui_color(B_PANEL_TEXT_COLOR
));
246 BRect
bounds(Bounds());
248 float labelWidth
= StringWidth(Label());
249 DrawString(Label(), BPoint((bounds
.Width() - labelWidth
) / 2.0,
253 if (MinLimitLabel()) {
255 if (MinLimitLabel()) {
256 float x
= (bounds
.Width() - StringWidth(MinLimitLabel()))
258 DrawString(MinLimitLabel(), BPoint(x
, bounds
.bottom
262 if (MinLimitLabel()) {
263 DrawString(MinLimitLabel(), BPoint(kPadding
, bounds
.bottom
269 if (MaxLimitLabel()) {
271 if (MaxLimitLabel()) {
272 float x
= (bounds
.Width() - StringWidth(MaxLimitLabel()))
274 DrawString(MaxLimitLabel(), BPoint(x
, 2 * fLineFeed
));
277 if (MaxLimitLabel()) {
278 DrawString(MaxLimitLabel(), BPoint(bounds
.right
- kPadding
279 - StringWidth(MaxLimitLabel()), bounds
.bottom
- kPadding
));
287 BChannelSlider::MouseDown(BPoint where
)
290 BControl::MouseDown(where
);
292 fCurrentChannel
= -1;
295 // Search the channel on which the mouse was over
296 int32 numChannels
= CountChannels();
297 for (int32 channel
= 0; channel
< numChannels
; channel
++) {
298 BRect frame
= ThumbFrameFor(channel
);
299 frame
.OffsetBy(fClickDelta
);
301 float range
= ThumbRangeFor(channel
);
303 fMinPoint
= frame
.top
+ frame
.Height() / 2;
304 frame
.bottom
+= range
;
306 // TODO: Fix this, the clickzone isn't perfect
307 frame
.right
+= range
;
308 fMinPoint
= frame
.Width();
311 // Click was on a slider.
312 if (frame
.Contains(where
)) {
313 fCurrentChannel
= channel
;
314 SetCurrentChannel(channel
);
319 // Click wasn't on a slider. Bail out.
320 if (fCurrentChannel
== -1)
324 BMessage
* currentMessage
= Window()->CurrentMessage();
325 if (currentMessage
!= NULL
)
326 currentMessage
->FindInt32("buttons", (int32
*)&buttons
);
328 fAllChannels
= (buttons
& B_SECONDARY_MOUSE_BUTTON
) == 0;
330 if (fInitialValues
!= NULL
&& fAllChannels
) {
331 delete[] fInitialValues
;
332 fInitialValues
= NULL
;
335 if (fInitialValues
== NULL
)
336 fInitialValues
= new (std::nothrow
) int32
[numChannels
];
338 if (fInitialValues
) {
340 for (int32 i
= 0; i
< numChannels
; i
++)
341 fInitialValues
[i
] = ValueFor(i
);
343 fInitialValues
[fCurrentChannel
] = ValueFor(fCurrentChannel
);
347 if (Window()->Flags() & B_ASYNCHRONOUS_CONTROLS
) {
354 _MouseMovedCommon(where
, B_ORIGIN
);
355 SetMouseEventMask(B_POINTER_EVENTS
, B_LOCK_WINDOW_FOCUS
|
356 B_NO_POINTER_HISTORY
);
360 GetMouse(&where
, &buttons
);
361 _MouseMovedCommon(where
, B_ORIGIN
);
362 } while (buttons
!= 0);
364 fCurrentChannel
= -1;
365 fAllChannels
= false;
372 BChannelSlider::MouseUp(BPoint where
)
374 if (IsEnabled() && IsTracking()) {
377 fAllChannels
= false;
378 fCurrentChannel
= -1;
381 BChannelControl::MouseUp(where
);
387 BChannelSlider::MouseMoved(BPoint where
, uint32 code
, const BMessage
* message
)
389 if (IsEnabled() && IsTracking())
390 _MouseMovedCommon(where
, B_ORIGIN
);
392 BChannelControl::MouseMoved(where
, code
, message
);
397 BChannelSlider::WindowActivated(bool state
)
399 BChannelControl::WindowActivated(state
);
404 BChannelSlider::KeyDown(const char* bytes
, int32 numBytes
)
406 BControl::KeyDown(bytes
, numBytes
);
411 BChannelSlider::KeyUp(const char* bytes
, int32 numBytes
)
413 BView::KeyUp(bytes
, numBytes
);
418 BChannelSlider::FrameResized(float newWidth
, float newHeight
)
420 BChannelControl::FrameResized(newWidth
, newHeight
);
425 Invalidate(Bounds());
430 BChannelSlider::SetFont(const BFont
* font
, uint32 mask
)
432 BChannelControl::SetFont(font
, mask
);
437 BChannelSlider::MakeFocus(bool focusState
)
439 if (focusState
&& !IsFocus())
441 BChannelControl::MakeFocus(focusState
);
446 BChannelSlider::GetPreferredSize(float* width
, float* height
)
451 *width
= 11.0 * CountChannels();
452 *width
= max_c(*width
, ceilf(StringWidth(Label())));
453 *width
= max_c(*width
, ceilf(StringWidth(MinLimitLabel())));
454 *width
= max_c(*width
, ceilf(StringWidth(MaxLimitLabel())));
455 *width
+= kPadding
* 2.0;
457 *height
= (fLineFeed
* 3.0) + (kPadding
* 2.0) + 147.0;
459 *width
= max_c(64.0, ceilf(StringWidth(Label())));
460 *width
= max_c(*width
, ceilf(StringWidth(MinLimitLabel()))
461 + ceilf(StringWidth(MaxLimitLabel())) + 10.0);
462 *width
+= kPadding
* 2.0;
464 *height
= 11.0 * CountChannels() + (fLineFeed
* 2.0)
471 BChannelSlider::ResolveSpecifier(BMessage
* message
, int32 index
,
472 BMessage
* specifier
, int32 form
, const char* property
)
474 BHandler
* target
= this;
475 BPropertyInfo
propertyInfo(sPropertyInfo
);
476 if (propertyInfo
.FindMatch(message
, index
, specifier
, form
,
478 target
= BChannelControl::ResolveSpecifier(message
, index
, specifier
,
486 BChannelSlider::GetSupportedSuites(BMessage
* data
)
491 status_t err
= data
->AddString("suites", "suite/vnd.Be-channel-slider");
493 BPropertyInfo
propInfo(sPropertyInfo
);
495 err
= data
->AddFlat("messages", &propInfo
);
498 return BChannelControl::GetSupportedSuites(data
);
504 BChannelSlider::SetEnabled(bool on
)
506 BChannelControl::SetEnabled(on
);
511 BChannelSlider::Orientation() const
513 return fIsVertical
? B_VERTICAL
: B_HORIZONTAL
;
518 BChannelSlider::SetOrientation(orientation orientation
)
520 bool isVertical
= orientation
== B_VERTICAL
;
521 if (isVertical
!= fIsVertical
) {
522 fIsVertical
= isVertical
;
524 Invalidate(Bounds());
530 BChannelSlider::MaxChannelCount() const
537 BChannelSlider::SupportsIndividualLimits() const
544 BChannelSlider::DrawChannel(BView
* into
, int32 channel
, BRect area
,
547 float hCenter
= area
.Width() / 2;
548 float vCenter
= area
.Height() / 2;
553 leftTop
.Set(area
.left
+ hCenter
, area
.top
+ vCenter
);
554 bottomRight
.Set(leftTop
.x
, leftTop
.y
+ ThumbRangeFor(channel
));
556 leftTop
.Set(area
.left
, area
.top
+ vCenter
);
557 bottomRight
.Set(area
.left
+ ThumbRangeFor(channel
), leftTop
.y
);
560 DrawGroove(into
, channel
, leftTop
, bottomRight
);
562 BPoint thumbLocation
= leftTop
;
564 thumbLocation
.y
+= ThumbDeltaFor(channel
);
566 thumbLocation
.x
+= ThumbDeltaFor(channel
);
568 DrawThumb(into
, channel
, thumbLocation
, pressed
);
573 BChannelSlider::DrawGroove(BView
* into
, int32 channel
, BPoint leftTop
,
576 ASSERT(into
!= NULL
);
577 BRect
rect(leftTop
, bottomRight
);
579 rect
.InsetBy(-2.5, -2.5);
580 rect
.left
= floorf(rect
.left
);
581 rect
.top
= floorf(rect
.top
);
582 rect
.right
= floorf(rect
.right
);
583 rect
.bottom
= floorf(rect
.bottom
);
584 rgb_color base
= ui_color(B_PANEL_BACKGROUND_COLOR
);
585 rgb_color barColor
= be_control_look
->SliderBarColor(base
);
587 be_control_look
->DrawSliderBar(into
, rect
, rect
, base
,
588 barColor
, flags
, Orientation());
593 BChannelSlider::DrawThumb(BView
* into
, int32 channel
, BPoint where
,
596 ASSERT(into
!= NULL
);
598 const BBitmap
* thumb
= ThumbFor(channel
, pressed
);
602 BRect
bitmapBounds(thumb
->Bounds());
603 where
.x
-= bitmapBounds
.right
/ 2.0;
604 where
.y
-= bitmapBounds
.bottom
/ 2.0;
606 BRect
rect(bitmapBounds
.OffsetToCopy(where
));
608 rect
.left
= floorf(rect
.left
);
609 rect
.top
= floorf(rect
.top
);
610 rect
.right
= ceilf(rect
.right
+ 0.5);
611 rect
.bottom
= ceilf(rect
.bottom
+ 0.5);
612 rgb_color base
= ui_color(B_PANEL_BACKGROUND_COLOR
);
614 be_control_look
->DrawSliderThumb(into
, rect
, rect
, base
,
615 flags
, Orientation());
620 BChannelSlider::ThumbFor(int32 channel
, bool pressed
)
622 if (fLeftKnob
!= NULL
)
626 fLeftKnob
= new (std::nothrow
) BBitmap(BRect(0, 0, 11, 14),
628 if (fLeftKnob
!= NULL
) {
629 fLeftKnob
->SetBits(kVerticalKnobData
,
630 sizeof(kVerticalKnobData
), 0, B_CMAP8
);
633 fLeftKnob
= new (std::nothrow
) BBitmap(BRect(0, 0, 14, 11),
635 if (fLeftKnob
!= NULL
) {
636 fLeftKnob
->SetBits(kHorizontalKnobData
,
637 sizeof(kHorizontalKnobData
), 0, B_CMAP8
);
646 BChannelSlider::ThumbFrameFor(int32 channel
)
650 BRect
frame(0.0, 0.0, 0.0, 0.0);
651 const BBitmap
* thumb
= ThumbFor(channel
, false);
653 frame
= thumb
->Bounds();
655 frame
.OffsetBy(channel
* frame
.Width(), (frame
.Height() / 2.0) -
656 (kPadding
* 2.0) - 1.0);
658 frame
.OffsetBy(frame
.Width() / 2.0, channel
* frame
.Height()
667 BChannelSlider::ThumbDeltaFor(int32 channel
)
670 if (channel
>= 0 && channel
< MaxChannelCount()) {
671 float range
= ThumbRangeFor(channel
);
672 int32 limitRange
= MaxLimitList()[channel
] - MinLimitList()[channel
];
673 delta
= (ValueList()[channel
] - MinLimitList()[channel
]) * range
677 delta
= range
- delta
;
685 BChannelSlider::ThumbRangeFor(int32 channel
)
690 BRect bounds
= Bounds();
691 BRect frame
= ThumbFrameFor(channel
);
693 // *height = (fLineFeed * 3.0) + (kPadding * 2.0) + 100.0;
694 range
= bounds
.Height() - frame
.Height() - (fLineFeed
* 3.0) -
697 // *width = some width + kPadding * 2.0;
698 range
= bounds
.Width() - frame
.Width() - (kPadding
* 2.0);
708 BChannelSlider::_InitData()
717 fIsVertical
= Bounds().Width() / Bounds().Height() < 1;
718 fClickDelta
= B_ORIGIN
;
720 fCurrentChannel
= -1;
721 fAllChannels
= false;
722 fInitialValues
= NULL
;
729 BChannelSlider::_FinishChange(bool update
)
731 if (fInitialValues
!= NULL
) {
733 int32 numChannels
= CountChannels();
735 inMask
= new (std::nothrow
) bool[CountChannels()];
737 for (int i
= 0; i
< numChannels
; i
++)
739 inMask
[fCurrentChannel
] = true;
742 InvokeChannel(update
? ModificationMessage() : NULL
, 0, numChannels
,
756 BChannelSlider::_UpdateFontDimens()
759 GetFontHeight(&height
);
760 fBaseLine
= height
.ascent
+ height
.leading
;
761 fLineFeed
= fBaseLine
+ height
.descent
;
766 BChannelSlider::_DrawThumbs()
768 if (fBacking
== NULL
) {
769 // This is the idea: we build a bitmap by taking the coordinates
770 // of the first and last thumb frames (top/left and bottom/right)
771 BRect first
= ThumbFrameFor(0);
772 BRect last
= ThumbFrameFor(CountChannels() - 1);
773 BRect
rect(first
.LeftTop(), last
.RightBottom());
776 rect
.top
-= ThumbRangeFor(0);
778 rect
.right
+= ThumbRangeFor(0);
780 rect
.OffsetTo(B_ORIGIN
);
781 fBacking
= new (std::nothrow
) BBitmap(rect
, B_RGB32
, true);
783 fBackingView
= new (std::nothrow
) BView(rect
, "", 0, B_WILL_DRAW
);
785 if (fBacking
->Lock()) {
786 fBacking
->AddChild(fBackingView
);
787 fBackingView
->SetFontSize(10.0);
788 fBackingView
->SetLowColor(
789 ui_color(B_PANEL_BACKGROUND_COLOR
));
790 fBackingView
->SetViewColor(
791 ui_color(B_PANEL_BACKGROUND_COLOR
));
801 if (fBacking
&& fBackingView
) {
804 BRect
bounds(fBacking
->Bounds());
805 drawHere
.x
= (Bounds().Width() - bounds
.Width()) / 2.0;
806 drawHere
.y
= (Bounds().Height() - bounds
.Height()) - kPadding
809 if (fBacking
->Lock()) {
810 // Clear the view's background
811 fBackingView
->FillRect(fBackingView
->Bounds(), B_SOLID_LOW
);
814 // draw the entire control
815 for (int32 channel
= 0; channel
< CountChannels(); channel
++) {
816 channelArea
= ThumbFrameFor(channel
);
817 bool pressed
= IsTracking()
818 && (channel
== fCurrentChannel
|| fAllChannels
);
819 DrawChannel(fBackingView
, channel
, channelArea
, pressed
);
822 // draw some kind of current value tool tip
823 if (fCurrentChannel
!= -1 && fMinPoint
!= 0) {
824 char valueString
[32];
825 snprintf(valueString
, 32, "%" B_PRId32
,
826 ValueFor(fCurrentChannel
));
827 SetToolTip(valueString
);
828 ShowToolTip(ToolTip());
833 fBackingView
->Sync();
837 DrawBitmapAsync(fBacking
, drawHere
);
839 // fClickDelta is used in MouseMoved()
840 fClickDelta
= drawHere
;
846 BChannelSlider::_DrawGrooveFrame(BView
* into
, const BRect
& area
)
849 rgb_color oldColor
= into
->HighColor();
851 into
->SetHighColor(255, 255, 255);
852 into
->StrokeRect(area
);
853 into
->SetHighColor(tint_color(into
->ViewColor(), B_DARKEN_1_TINT
));
854 into
->StrokeLine(area
.LeftTop(), BPoint(area
.right
, area
.top
));
855 into
->StrokeLine(area
.LeftTop(), BPoint(area
.left
, area
.bottom
- 1));
856 into
->SetHighColor(tint_color(into
->ViewColor(), B_DARKEN_2_TINT
));
857 into
->StrokeLine(BPoint(area
.left
+ 1, area
.top
+ 1),
858 BPoint(area
.right
- 1, area
.top
+ 1));
859 into
->StrokeLine(BPoint(area
.left
+ 1, area
.top
+ 1),
860 BPoint(area
.left
+ 1, area
.bottom
- 2));
862 into
->SetHighColor(oldColor
);
868 BChannelSlider::_MouseMovedCommon(BPoint point
, BPoint point2
)
870 float floatValue
= 0;
871 int32 limitRange
= MaxLimitList()[fCurrentChannel
] -
872 MinLimitList()[fCurrentChannel
];
873 float range
= ThumbRangeFor(fCurrentChannel
);
875 floatValue
= range
- (point
.y
- fMinPoint
);
877 floatValue
= range
+ (point
.x
- fMinPoint
);
879 int32 value
= (int32
)(floatValue
/ range
* limitRange
) +
880 MinLimitList()[fCurrentChannel
];
884 SetValueFor(fCurrentChannel
, value
);
886 if (ModificationMessage())
893 // #pragma mark - FBC padding
896 void BChannelSlider::_Reserved_BChannelSlider_0(void*, ...) {}
897 void BChannelSlider::_Reserved_BChannelSlider_1(void*, ...) {}
898 void BChannelSlider::_Reserved_BChannelSlider_2(void*, ...) {}
899 void BChannelSlider::_Reserved_BChannelSlider_3(void*, ...) {}
900 void BChannelSlider::_Reserved_BChannelSlider_4(void*, ...) {}
901 void BChannelSlider::_Reserved_BChannelSlider_5(void*, ...) {}
902 void BChannelSlider::_Reserved_BChannelSlider_6(void*, ...) {}
903 void BChannelSlider::_Reserved_BChannelSlider_7(void*, ...) {}