-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathColorSlider.h
73 lines (50 loc) · 1.65 KB
/
ColorSlider.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Copyright 2009-2012 Haiku, Inc. All Rights Reserved.
* Copyright 2001-2008 Werner Freytag.
* Distributed under the terms of the MIT License.
*/
#ifndef COLOR_SLIDER_H
#define COLOR_SLIDER_H
#include <Control.h>
#include "color_mode.h"
#define MSG_UPDATE 'Updt'
#define MSG_COLOR_SLIDER 'ColS'
class BBitmap;
class ColorSlider : public BControl {
public:
ColorSlider(color_mode mode,
float value1, float value2);
virtual ~ColorSlider();
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
virtual status_t Invoke(BMessage* message = NULL);
virtual void FrameResized(float width, float height);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* message);
virtual void MouseUp(BPoint where);
void SetValue(int32 value);
bool IsTracking() const { return fMouseDown; }
void OtherValues(float* value1,
float* value2) const;
void SetOtherValues(float value1,
float value2);
void SetMarkerToColor(rgb_color color);
void SetModeAndValues(color_mode mode,
float value1, float value2);
void Update(int depth);
private:
static inline void _DrawColorLine(BView *view, float y,
int r, int g, int b);
void _TrackMouse(BPoint where);
static int32 _UpdateThread(void *data);
color_mode fColorMode;
float fFixedValue1;
float fFixedValue2;
bool fMouseDown;
BBitmap* fBgBitmap;
BView* fBgView;
thread_id fUpdateThread;
port_id fUpdatePort;
};
#endif // COLOR_SLIDER_H