2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
8 #ifndef GRADIENT_CONTROL_H
9 #define GRADIENT_CONTROL_H
18 #include "IconBuild.h"
27 MSG_GRADIENT_CONTROL_FOCUS_CHANGED
= 'gcfc',
30 class GradientControl
:
37 GradientControl(BMessage
* message
= NULL
,
38 BHandler
* target
= NULL
);
39 virtual ~GradientControl();
43 virtual minimax
layoutprefs();
44 virtual BRect
layout(BRect frame
);
48 virtual void WindowActivated(bool active
);
49 virtual void MakeFocus(bool focus
);
51 virtual void MouseDown(BPoint where
);
52 virtual void MouseUp(BPoint where
);
53 virtual void MouseMoved(BPoint where
, uint32 transit
,
54 const BMessage
* dragMessage
);
56 virtual void MessageReceived(BMessage
* message
);
57 virtual void KeyDown(const char* bytes
, int32 numBytes
);
59 virtual void Draw(BRect updateRect
);
60 virtual void FrameResized(float width
, float height
);
63 void SetGradient(const _ICON_NAMESPACE Gradient
*
65 _ICON_NAMESPACE Gradient
* Gradient() const
68 void SetCurrentStop(const rgb_color
& color
);
69 bool GetCurrentStop(rgb_color
* color
) const;
71 void SetEnabled(bool enabled
);
72 bool IsEnabled() const
77 void _AllocBitmap(int32 width
, int32 height
);
78 BRect
_GradientBitmapRect() const;
79 int32
_StepIndexFor(BPoint where
) const;
80 float _OffsetFor(BPoint where
) const;
81 void _UpdateCurrentColor() const;
83 _ICON_NAMESPACE Gradient
* fGradient
;
84 BBitmap
* fGradientBitmap
;
85 int32 fDraggingStepIndex
;
86 int32 fCurrentStepIndex
;
97 #endif // GRADIENT_CONTROL_H