1 /* 2 * Copyright 2002-2022 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(BMessage* message, 24 uint32 flags = B_WILL_DRAW); 25 ~ColorPreview(void); 26 27 virtual void Draw(BRect updateRect); 28 virtual void MessageReceived(BMessage* message); 29 virtual void MouseDown(BPoint where); 30 virtual void MouseMoved(BPoint where, uint32 transit, 31 const BMessage* message); 32 virtual void MouseUp(BPoint where); 33 34 rgb_color Color(void) const; 35 void SetColor(rgb_color color); 36 void SetColor(uint8 r, uint8 g, uint8 b); 37 38 void SetMode(bool rectangle); 39 40 private: 41 void _DragColor(BPoint where); 42 43 rgb_color fColor; 44 rgb_color fDisabledColor; 45 46 BMessageRunner* fMessageRunner; 47 48 bool fIsRectangle; 49 }; 50 51 #endif // COLOR_PREVIEW_H_ 52