BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / soundrecorder / TrackSlider.h
blob6b7ab5edce3678fa22bcaa6e5e87ed8b138ea2e8
1 /*
2 * Copyright 2005, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Inspired by SoundCapture from Be newsletter (Media Kit Basics: Consumers and Producers)
6 */
7 #ifndef TRACKSLIDER_H
8 #define TRACKSLIDER_H
10 #include <Control.h>
11 #include <Bitmap.h>
12 #include <Font.h>
14 class SliderOffscreenView : public BView {
16 public:
17 SliderOffscreenView(BRect frame, const char *name);
18 virtual ~SliderOffscreenView();
19 virtual void DrawX();
21 BBitmap leftBitmap, rightBitmap;
22 BBitmap leftThumbBitmap, rightThumbBitmap;
23 float fRight;
25 float fLeftX;
26 float fRightX;
27 float fPositionX;
28 float fLastX;
31 class TrackSlider : public BControl
33 public:
34 TrackSlider(BRect rect, const char* title, BMessage *msg, uint32 resizeFlags);
35 ~TrackSlider();
36 void AttachedToWindow();
37 virtual void Draw(BRect);
38 virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
39 virtual void MouseUp(BPoint point);
40 virtual void MouseDown(BPoint point);
41 void SetMainTime(bigtime_t timestamp, bool reset);
42 void SetTotalTime(bigtime_t timestamp, bool reset);
43 bigtime_t * MainTime() { return &fMainTime; };
44 bigtime_t RightTime() { return fRightTime; };
45 bigtime_t LeftTime() { return fLeftTime; };
46 void ResetMainTime();
47 virtual void FrameResized(float width, float height);
48 private:
49 void _DrawCounter(bigtime_t timestamp, float position, bool isTracking);
50 void _DrawMarker(float position);
51 void _TimeToString(bigtime_t timestamp, char *string);
52 void _UpdatePosition(BPoint point);
53 void _InitBitmap();
54 void _RenderBitmap();
57 bigtime_t fLeftTime;
58 bigtime_t fRightTime;
59 bigtime_t fMainTime;
60 bigtime_t fTotalTime;
62 bool fLeftTracking;
63 bool fRightTracking;
64 bool fMainTracking;
66 BFont fFont;
67 BBitmap *fBitmap;
68 SliderOffscreenView *fBitmapView;
73 #endif /* TRACKSLIDER_H */