1d89b690dSStephan Aßmus /* 2*7f9368caSlooncraz * Copyright 2009-2015, Haiku, Inc. All rights reserved. 389208c77SStephan Aßmus * Distributed under the terms of the MIT License. 4d89b690dSStephan Aßmus */ 5e6753e37SKarsten Heimrich #ifndef _CHANNEL_SLIDER_H 6d734a8ceSbeveloper #define _CHANNEL_SLIDER_H 7d734a8ceSbeveloper 8e6753e37SKarsten Heimrich 9d734a8ceSbeveloper #include <ChannelControl.h> 10d734a8ceSbeveloper 11e6753e37SKarsten Heimrich 122f86ba45SStephan Aßmus class BChannelSlider : public BChannelControl { 13d734a8ceSbeveloper public: 14e6753e37SKarsten Heimrich BChannelSlider(BRect area, const char* name, 15e6753e37SKarsten Heimrich const char* label, BMessage* message, 16d734a8ceSbeveloper int32 channels = 1, 17*7f9368caSlooncraz uint32 resizeMode = B_FOLLOW_LEFT_TOP, 18d734a8ceSbeveloper uint32 flags = B_WILL_DRAW); 19e6753e37SKarsten Heimrich BChannelSlider(BRect area, const char* name, 20e6753e37SKarsten Heimrich const char* label, BMessage* message, 21e724b26fSJohn Scipione orientation orientation, 222f86ba45SStephan Aßmus int32 channels = 1, 23*7f9368caSlooncraz uint32 resizeMode = B_FOLLOW_LEFT_TOP, 242f86ba45SStephan Aßmus uint32 flags = B_WILL_DRAW); 252f86ba45SStephan Aßmus BChannelSlider(const char* name, 262f86ba45SStephan Aßmus const char* label, BMessage* message, 27e724b26fSJohn Scipione orientation orientation, 282f86ba45SStephan Aßmus int32 channels = 1, 29d734a8ceSbeveloper uint32 flags = B_WILL_DRAW); 30e6753e37SKarsten Heimrich BChannelSlider(BMessage* archive); 31d734a8ceSbeveloper virtual ~BChannelSlider(); 32d734a8ceSbeveloper 33d734a8ceSbeveloper static BArchivable* Instantiate(BMessage* from); 34d89b690dSStephan Aßmus virtual status_t Archive(BMessage* into, 35d89b690dSStephan Aßmus bool deep = true) const; 36d734a8ceSbeveloper 37d734a8ceSbeveloper virtual void AttachedToWindow(); 38d734a8ceSbeveloper virtual void AllAttached(); 39d734a8ceSbeveloper virtual void DetachedFromWindow(); 40d734a8ceSbeveloper virtual void AllDetached(); 41d734a8ceSbeveloper 422f86ba45SStephan Aßmus virtual void MessageReceived(BMessage* message); 43d734a8ceSbeveloper 44d89b690dSStephan Aßmus virtual void Draw(BRect updateRect); 45d734a8ceSbeveloper virtual void MouseDown(BPoint where); 462f86ba45SStephan Aßmus virtual void MouseUp(BPoint where); 472f86ba45SStephan Aßmus virtual void MouseMoved(BPoint where, uint32 transit, 482f86ba45SStephan Aßmus const BMessage* dragMessage); 49d734a8ceSbeveloper virtual void WindowActivated(bool state); 50d734a8ceSbeveloper virtual void KeyDown(const char* bytes, int32 numBytes); 51d734a8ceSbeveloper virtual void KeyUp(const char* bytes, int32 numBytes); 52d734a8ceSbeveloper virtual void FrameResized(float width, float height); 53d734a8ceSbeveloper 542f86ba45SStephan Aßmus virtual void SetFont(const BFont* font, 552f86ba45SStephan Aßmus uint32 mask = B_FONT_ALL); 56d734a8ceSbeveloper virtual void MakeFocus(bool focusState = true); 57d734a8ceSbeveloper 582f86ba45SStephan Aßmus virtual void GetPreferredSize(float* _width, float* _height); 59d734a8ceSbeveloper 60d89b690dSStephan Aßmus virtual BHandler* ResolveSpecifier(BMessage* message, 61d89b690dSStephan Aßmus int32 index, BMessage* specifier, 62d89b690dSStephan Aßmus int32 form, const char* property); 63d734a8ceSbeveloper virtual status_t GetSupportedSuites(BMessage* data); 64d734a8ceSbeveloper 65d89b690dSStephan Aßmus virtual void SetEnabled(bool on); 66d734a8ceSbeveloper 67d89b690dSStephan Aßmus virtual orientation Orientation() const; 68e724b26fSJohn Scipione void SetOrientation(orientation orientation); 69d734a8ceSbeveloper 70d89b690dSStephan Aßmus virtual int32 MaxChannelCount() const; 71d89b690dSStephan Aßmus virtual bool SupportsIndividualLimits() const; 72d89b690dSStephan Aßmus 73d89b690dSStephan Aßmus virtual void DrawChannel(BView* into, int32 channel, 74d89b690dSStephan Aßmus BRect area, bool pressed); 75d89b690dSStephan Aßmus 76d89b690dSStephan Aßmus virtual void DrawGroove(BView* into, int32 channel, 77d89b690dSStephan Aßmus BPoint leftTop, BPoint rightBottom); 78d89b690dSStephan Aßmus 79d89b690dSStephan Aßmus virtual void DrawThumb(BView* into, int32 channel, 80d89b690dSStephan Aßmus BPoint where, bool pressed); 81d734a8ceSbeveloper 82d734a8ceSbeveloper virtual const BBitmap* ThumbFor(int32 channel, bool pressed); 83d734a8ceSbeveloper virtual BRect ThumbFrameFor(int32 channel); 84d734a8ceSbeveloper virtual float ThumbDeltaFor(int32 channel); 85d734a8ceSbeveloper virtual float ThumbRangeFor(int32 channel); 86d734a8ceSbeveloper 87d734a8ceSbeveloper private: 88d89b690dSStephan Aßmus // FBC padding 89e6753e37SKarsten Heimrich BChannelSlider(const BChannelSlider&); 90e6753e37SKarsten Heimrich BChannelSlider& operator=(const BChannelSlider&); 91d734a8ceSbeveloper 92d734a8ceSbeveloper 937f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_0(void*, ...); 947f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_1(void*, ...); 957f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_2(void*, ...); 967f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_3(void*, ...); 977f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_4(void*, ...); 987f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_5(void*, ...); 997f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_6(void*, ...); 1007f347940SAxel Dörfler virtual void _Reserved_BChannelSlider_7(void*, ...); 101d734a8ceSbeveloper 102d89b690dSStephan Aßmus private: 103d89b690dSStephan Aßmus void _InitData(); 104d89b690dSStephan Aßmus void _FinishChange(bool update = false); 105d89b690dSStephan Aßmus void _UpdateFontDimens(); 106d89b690dSStephan Aßmus void _DrawThumbs(); 107d89b690dSStephan Aßmus void _DrawGrooveFrame(BView* where, 108d89b690dSStephan Aßmus const BRect& area); 109d89b690dSStephan Aßmus void _MouseMovedCommon(BPoint point, BPoint point2); 110d89b690dSStephan Aßmus 111d89b690dSStephan Aßmus private: 112422c0791SStefano Ceccherini float fBaseLine; 113422c0791SStefano Ceccherini float fLineFeed; 114422c0791SStefano Ceccherini BBitmap* fLeftKnob; 115422c0791SStefano Ceccherini BBitmap* fMidKnob; 116422c0791SStefano Ceccherini BBitmap* fRightKnob; 117422c0791SStefano Ceccherini BBitmap* fBacking; 118422c0791SStefano Ceccherini BView* fBackingView; 119d89b690dSStephan Aßmus bool fIsVertical; 120d89b690dSStephan Aßmus bool _padding_[3]; 121422c0791SStefano Ceccherini BPoint fClickDelta; 122d734a8ceSbeveloper 123d734a8ceSbeveloper int32 fCurrentChannel; 124d734a8ceSbeveloper bool fAllChannels; 125d734a8ceSbeveloper int32* fInitialValues; 126d89b690dSStephan Aßmus float fMinPoint; 127d734a8ceSbeveloper int32 fFocusChannel; 128d734a8ceSbeveloper 129d734a8ceSbeveloper uint32 _reserved_[12]; 130d734a8ceSbeveloper }; 131d734a8ceSbeveloper 132d734a8ceSbeveloper 133d89b690dSStephan Aßmus #endif // _CHANNEL_SLIDER_H 134