-
Notifications
You must be signed in to change notification settings - Fork 2
/
ColorPickerView.h
93 lines (69 loc) · 2.04 KB
/
ColorPickerView.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
* Copyright 2009-2012 Haiku, Inc. All Rights Reserved.
* Copyright 2001-2008 Werner Freytag.
* Distributed under the terms of the MIT License.
*/
#ifndef COLORPICKER_VIEW_H
#define COLORPICKER_VIEW_H
#include <View.h>
#include "color_mode.h"
#define MSG_RADIOBUTTON 'Rad0'
#define MSG_TEXTCONTROL 'Txt0'
#define MSG_HEXTEXTCONTROL 'HTxt'
class ColorField;
class ColorSlider;
class ColorPreview;
class EyeDropper;
class OutOfGamutSelector;
class WebSafeSelector;
class BRadioButton;
class BTextControl;
class ColorPickerView : public BView {
public:
ColorPickerView();
virtual ~ColorPickerView();
virtual void AttachedToWindow();
virtual void Draw(BRect updateRect);
virtual void MessageReceived(BMessage* message);
virtual void MouseDown(BPoint where);
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* message);
virtual void MouseUp(BPoint where);
virtual void Pulse();
rgb_color Color();
void SetColor(rgb_color color);
color_mode ColorMode() const { return fColorMode; }
void SetColorMode(color_mode mode);
void SaveSettings();
private:
void _GrabColor();
void _SetText(BTextControl* control,
const char* text,
bool* requiresUpdate);
void _UpdateColor(float value, float value1,
float value2);
void _UpdateTextControls();
color_mode fColorMode;
float fHue;
float fSat;
float fVal;
float fRed;
float fGreen;
float fBlue;
float* fPointer0;
float* fPointer1;
float* fPointer2;
bool fMouseDown;
BPoint fMouseOffset;
bool fRequiresUpdate;
ColorField* fColorField;
ColorSlider* fColorSlider;
ColorPreview* fColorPreview;
WebSafeSelector* fWebSafeSelector;
OutOfGamutSelector* fOutOfGamutSelector;
EyeDropper* fEyeDropper;
BRadioButton* fRadioButton[6];
BTextControl* fTextControl[6];
BTextControl* fHexTextControl;
};
#endif // COLORPICKER_VIEW_H