xref: /haiku/src/preferences/appearance/ColorPreview.h (revision 4bd0c1066b227cec4b79883bdef697c7a27f2e90)
1 /*
2  * Copyright 2002-2016 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		DarkWyrm, darkwyrm@earthlink.net
7  *		John Scipione, jscipione@gmail.com
8  */
9 #ifndef COLOR_PREVIEW_H_
10 #define COLOR_PREVIEW_H_
11 
12 
13 #include <Control.h>
14 
15 
16 class BMessage;
17 class BMessageRunner;
18 
19 
20 class ColorPreview : public BControl
21 {
22 public:
23 							ColorPreview(BRect frame, BMessage *msg,
24 								uint32 resizingMode = B_FOLLOW_LEFT
25 									| B_FOLLOW_TOP,
26 								uint32 flags = B_WILL_DRAW);
27 							~ColorPreview(void);
28 
29 	virtual	void			Draw(BRect updateRect);
30 	virtual	void			MessageReceived(BMessage* message);
31 	virtual	void			MouseDown(BPoint where);
32 	virtual	void			MouseMoved(BPoint where, uint32 transit,
33 								const BMessage* message);
34 	virtual	void			MouseUp(BPoint where);
35 
36 			rgb_color		Color(void) const;
37 			void			SetColor(rgb_color color);
38 			void			SetColor(uint8 r, uint8 g, uint8 b);
39 
40 			void			SetMode(bool rectangle);
41 
42 private:
43 			void			_DragColor(BPoint where);
44 
45 			rgb_color		fColor;
46 			rgb_color		fDisabledColor;
47 
48 			BMessageRunner*	fMessageRunner;
49 
50 			bool			fIsRectangle;
51 };
52 
53 #endif	// COLOR_PREVIEW_H_
54