GuiColorPickerCtrl
Engine/source/gui/controls/guiColorPicker.h
Core Variables
Color that has been picked from control.
Colour we display (in case of pallet and blend mode)
Current color display mode of the selector.
Current position of the selector.
bool
Current position has changed since last render?
bool
Mouse is over?
bool
Mouse button down?
bool
Perform onAction() when position has changed?
bool
The half-way "gap" between the selector pos and where the selector is allowed to draw.
mColorRange [7]
Color range for pHorizColorRange and pVertColorRange.
Core Rendering functions
renderColorBox(RectI & bounds)
Function that draws the actual color box.
drawSelector(RectI & bounds, Point2I & selectorPos, SelectorMode mode)
drawBlendBox(RectI & bounds, LinearColorF & c1, LinearColorF & c2, LinearColorF & c3, LinearColorF & c4)
< Function that draws the selection indicator
drawBlendRangeBox(RectI & bounds, bool vertical, U8 numColors, ColorI * colors)
Function to draw a set of boxes blending throughout an array of colors.
Color Value Functions
NOTE: setValue only sets baseColor, since setting pickColor wouldn't be useful
setValue(LinearColorF & value)
getValue()
NOTE: getValue() returns baseColor if pallet (since pallet controls can't "pick" colours themselves)
const char *
Returns the value of the variable bound to this object.
setScriptValue(const char * value)
Sets the value of the variable bound to this object.
Selector Functions
setSelectorPos(const Point2I & pos)
Set new pos (in local coords)
setSelectorPos(const LinearColorF & color)
Input Events
onMouseDown(const GuiEvent & )
onMouseMove(const GuiEvent & event)
onMouseDragged(const GuiEvent & event)
Public Types
PickMode { pPallet = 0 pHorizColorRange pVertColorRange pHorizColorBrightnessRange pVertColorBrightnessRange pBlendColorRange pHorizAlphaRange pVertAlphaRange pDropperBackground }
SelectorMode { sHorizontal = 0 sVertical }
Private Types
Parent
Public Attributes
bool
Show reticle on render.
Public Functions
DECLARE_CATEGORY("Gui Editor" )
Public Static Functions
Detailed Description
This control draws a box containing a color specified by mPickColor, in a way according to one of the PickMode enum's, stored as mDisplayMode.
The color the box represents is stored as mBaseColour (for pPallete, pBlendColorRange), whilst the color chosen by the box is stored as mPickColor.
Whenever the control is clicked, it will do one of many things :
If its in pPallete mode, execute the regular "command"
If its in pBlendColorRange mode, update the selector position. The position will be re-read upon the next render. In addition, a cross will be drawn where the color has been selected from. As with 1, "command" will be executed.
If its in pHorizColorRange or pVertColorRange mode, it will function in a similar manner to 2, but the selector will resemble a horizontal or vertical bar.
If its in pHorizAlphaRange or pVertAlphaRange mode, it will also function the same way as 3
If its in pDropperBackground mode, nothing will happen
Colours are drawn in different ways according to mDisplayMode:
With pPallete, a box with a blank color, mBaseColor is drawn.
With pHorizColorRange, a horizontal box with colors blending in the range, mColorRange.
With pVertColorRange, a vertical box with colors blending in the range, mColorRange.
With pBlendColorRange, a box, the bottom colors being black, but the top left being white, and the top right being mBaseColor.
With pHorizAlphaRange, a horizontal box with black blending with an alpha from 0 to 255
With pVertAlphaRange, a vertical box with black blending with an apha from 0 to 255
With pDropperBackground, nothing is drawn
Core Variables
findColor(const LinearColorF & color, const Point2I & offset, const Point2I & resolution, GBitmap & bmp)
LinearColorF mPickColor
Color that has been picked from control.
LinearColorF mBaseColor
Colour we display (in case of pallet and blend mode)
PickMode mDisplayMode
Current color display mode of the selector.
Point2I mSelectorPos
Current position of the selector.
bool mPositionChanged
Current position has changed since last render?
bool mMouseOver
Mouse is over?
bool mMouseDown
Mouse button down?
bool mActionOnMove
Perform onAction() when position has changed?
bool mSelectColor
LinearColorF mSetColor
GBitmap * mBitmap
S32 mSelectorGap
The half-way "gap" between the selector pos and where the selector is allowed to draw.
GFXStateBlockRef mStateBlock
ColorI mColorRange [7]
Color range for pHorizColorRange and pVertColorRange.
Core Rendering functions
renderColorBox(RectI & bounds)
Function that draws the actual color box.
Function to invoke calls to draw the picker box and selector.
drawSelector(RectI & bounds, Point2I & selectorPos, SelectorMode mode)
drawBlendBox(RectI & bounds, LinearColorF & c1, LinearColorF & c2, LinearColorF & c3, LinearColorF & c4)
< Function that draws the selection indicator
drawBlendRangeBox(RectI & bounds, bool vertical, U8 numColors, ColorI * colors)
Function to draw a set of boxes blending throughout an array of colors.
Color Value Functions
NOTE: setValue only sets baseColor, since setting pickColor wouldn't be useful
setValue(LinearColorF & value)
getValue()
NOTE: getValue() returns baseColor if pallet (since pallet controls can't "pick" colours themselves)
getScriptValue()
Reimplemented from: GuiControl
setScriptValue(const char * value)
Reimplemented from: GuiControl
updateColor()
Selector Functions
setSelectorPos(const Point2I & pos)
Set new pos (in local coords)
setSelectorPos(const LinearColorF & color)
getSelectorPos()
Input Events
onMouseDown(const GuiEvent & )
Reimplemented from: GuiControl
onMouseUp(const GuiEvent & )
Reimplemented from: GuiControl
onMouseMove(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseDragged(const GuiEvent & event)
Reimplemented from: GuiControl
onMouseEnter(const GuiEvent & )
Reimplemented from: GuiControl
onMouseLeave(const GuiEvent & )
Reimplemented from: GuiControl
Public Types
PickMode
Enumerator
- pPallet = 0
We just have a solid color; We just act like a pallet.
- pHorizColorRange
We have a range of base colors going horizontally.
- pVertColorRange
We have a range of base colors going vertically.
- pHorizColorBrightnessRange
HorizColorRange with brightness.
- pVertColorBrightnessRange
VertColorRange with brightness.
- pBlendColorRange
We have a box which shows a range in brightness of the color.
- pHorizAlphaRange
We have a box which shows a range in alpha going horizontally.
- pVertAlphaRange
We have a box which shows a range in alpha going vertically.
- pDropperBackground
The control does not draw anything; Only does something when you click, or move the mouse (when active)
SelectorMode
Enumerator
- sHorizontal = 0
Horizontal selector with small gap.
- sVertical
Vertical selector with small gap.
Private Types
typedef GuiControl Parent
Public Attributes
bool mShowReticle
Show reticle on render.
Public Functions
GuiColorPickerCtrl()
~GuiColorPickerCtrl()
DECLARE_CATEGORY("Gui Editor" )
DECLARE_CONOBJECT(GuiColorPickerCtrl )
onRender(Point2I offset, const RectI & updateRect)
Reimplemented from: GuiControl