1/* 2 * Copyright 2001 Werner Freytag - please read to the LICENSE file 3 * 4 * Copyright 2002-2006, Stephan Aßmus <superstippi@gmx.de> 5 * All rights reserved. 6 * 7 */ 8 9#ifndef _COLOR_PREVIEW_H 10#define _COLOR_PREVIEW_H 11 12#include <Control.h> 13 14#define MSG_COLOR_PREVIEW 'ColP' 15#define MSG_MESSAGERUNNER 'MsgR' 16 17class BMessageRunner; 18 19class ColorPreview : public BControl { 20public: 21 22 ColorPreview(BRect frame, rgb_color color); 23 ColorPreview(rgb_color color); 24 25 // BControl interface 26 virtual BSize MinSize(); 27 virtual BSize PreferredSize(); 28 virtual BSize MaxSize(); 29 30 virtual void AttachedToWindow(); 31 virtual void Draw(BRect updateRect); 32 33 virtual void MessageReceived(BMessage* message); 34 35 virtual void MouseDown(BPoint where); 36 virtual void MouseUp(BPoint where); 37 virtual void MouseMoved(BPoint where, uint32 transit, 38 const BMessage* message); 39 40 virtual status_t Invoke(BMessage* message = NULL); 41 42 // ColorPreview 43 void SetColor(rgb_color color); 44 // changes the displayed color 45 void SetNewColor(rgb_color color); 46 // changes also the old color 47 48private: 49 void _DragColor(BPoint where); 50 51private: 52 rgb_color fColor; 53 rgb_color fOldColor; 54 bool fMouseDown; 55 56 BMessageRunner* fMessageRunner; 57 58 border_style fBorderStyle; 59}; 60 61#endif // _COLOR_PREVIEW_H 62 63