1 /* 2 * Copyright 2002-2013 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 <View.h> 14 #include <Message.h> 15 #include <Invoker.h> 16 17 18 class ColorPreview : public BView 19 { 20 public: 21 ColorPreview(BRect frame, BMessage *msg, 22 uint32 resizingMode = B_FOLLOW_LEFT 23 | B_FOLLOW_TOP, 24 uint32 flags = B_WILL_DRAW); 25 ~ColorPreview(void); 26 27 virtual void Draw(BRect update); 28 virtual void MessageReceived(BMessage* message); 29 virtual void SetTarget(BHandler* target); 30 virtual void SetEnabled(bool value); 31 32 rgb_color Color(void) const; 33 void SetColor(rgb_color col); 34 void SetColor(uint8 r,uint8 g, uint8 b); 35 36 void SetMode(bool is_rectangle); 37 38 protected: 39 BInvoker* invoker; 40 41 bool is_enabled; 42 bool is_rect; 43 rgb_color disabledcol; 44 rgb_color currentcol; 45 }; 46 47 #endif // COLOR_PREVIEW_H_ 48