30 #ifndef _CEGUIColourPickerControls_h_
31 #define _CEGUIColourPickerControls_h_
33 #include "CEGUI/CommonDialogs/Module.h"
34 #include "CEGUI/Window.h"
35 #include "CEGUI/CommonDialogs/ColourPicker/Types.h"
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
54 SliderMode_Lab_A = 1 << 1,
55 SliderMode_Lab_B = 1 << 2,
56 SliderMode_HSV_H = 1 << 3,
57 SliderMode_HSV_S = 1 << 4,
58 SliderMode_HSV_V = 1 << 5
68 static const String EventNamespace;
77 static const String EventClosed;
89 void setColours(
const Colour& newColour);
91 void setPreviousColour(
const Colour& previousColour);
93 void refreshAllElements();
102 void setCallingColourPicker(
ColourPicker* colourPicker);
105 void initialiseComponents();
116 static const String TitleBarName;
117 static const String ColourPickerStaticImageName;
118 static const String ColourPickerImageSliderName;
119 static const String ColourPickerAlphaSliderName;
120 static const String NewColourDescriptionName;
121 static const String OldColourDescriptionName;
122 static const String NewColourRectName;
123 static const String OldColourRectName;
124 static const String ColourEditBoxRDescriptionName;
125 static const String ColourEditBoxGDescriptionName;
126 static const String ColourEditBoxBDescriptionName;
127 static const String ColourEditBoxRName;
128 static const String ColourEditBoxGName;
129 static const String ColourEditBoxBName;
130 static const String HSVRadioButtonHName;
131 static const String HSVRadioButtonSName;
132 static const String HSVRadioButtonVName;
133 static const String HSVEditBoxHName;
134 static const String HSVEditBoxSName;
135 static const String HSVEditBoxVName;
136 static const String LabRadioButtonLName;
137 static const String LabRadioButtonAName;
138 static const String LabRadioButtonBName;
139 static const String LabEditBoxLName;
140 static const String LabEditBoxAName;
141 static const String LabEditBoxBName;
142 static const String AlphaEditBoxName;
143 static const String ColourPickerCursorName;
153 static const float LAB_L_MIN;
154 static const float LAB_L_MAX;
155 static const float LAB_L_DIFF;
156 static const float LAB_A_MIN;
157 static const float LAB_A_MAX;
158 static const float LAB_A_DIFF;
159 static const float LAB_B_MIN;
160 static const float LAB_B_MAX;
161 static const float LAB_B_DIFF;
163 void initColourPickerControlsImageSet();
164 void deinitColourPickerControlsTexture();
165 void refreshColourPickerControlsTextures();
167 void refreshColourSliderImage();
168 void refreshColourPickingImage();
169 void refreshAlphaSliderImage();
171 void reloadColourPickerControlsTexture();
173 Lab_Colour getColourSliderPositionColourLAB(
float value);
174 Lab_Colour getColourPickingPositionColourLAB(
float xAbs,
float yAbs);
176 HSV_Colour getColourSliderPositionColourHSV(
float value);
177 HSV_Colour getColourPickingPositionColourHSV(
float xAbs,
float yAbs);
179 RGB_Colour getAlphaSliderPositionColour(
int x,
int y);
181 Vector2f getColourPickingColourPosition();
182 void getColourPickingColourPositionHSV(
float& x,
float& y);
185 bool handleCancelButtonClicked(
const EventArgs& e);
186 bool handleAcceptButtonClicked(
const EventArgs& e);
187 bool handleEditboxDeactivated(
const EventArgs& args);
188 bool handleRadioButtonModeSelection(
const EventArgs& args);
190 bool handleHexadecimalEditboxTextChanged(
const EventArgs& args);
191 bool handleRGBEditboxTextChanged(
const EventArgs& args);
192 bool handleLABEditboxTextChanged(
const EventArgs& args);
193 bool handleHSVEditboxTextChanged(
const EventArgs& args);
195 bool handleAlphaEditboxTextChanged(
const EventArgs& args);
197 bool handleColourPickerStaticImageMouseLeaves(
const EventArgs& args);
198 bool handleColourPickerStaticImageMouseButtonUp(
const EventArgs& args);
199 bool handleColourPickerStaticImageMouseButtonDown(
const EventArgs& args);
200 bool handleColourPickerStaticImageMouseMove(
const EventArgs& args);
205 void onColourCursorPositionChanged();
206 void onColourSliderChanged();
208 void refreshColourPickerCursorPosition(
const MouseEventArgs& mouseEventArgs);
211 void refreshOnlyColourSliderImage();
212 bool handleColourPickerSliderValueChanged(
const EventArgs& args);
213 bool handleAlphaSliderValueChanged(
const EventArgs& args);
215 void refreshEditboxesAndColourRects();
217 void refreshColourRects();
218 void positionColourPickerCursorAbsolute(
float x,
float y);
219 void positionColourPickerCursorRelative(
float x,
float y);
220 void setColours(
const Lab_Colour& newColourLAB);
221 void setColours(
const RGB_Colour& newColourRGB);
222 void setColours(
const HSV_Colour& newColourHSV);
224 void setColourAlpha(
float alphaValue);
226 void refreshColourPickerCursorPosition();
227 void refreshColourSliderPosition();
229 void initColourPicker();
232 Window* getHexadecimalDescription();
233 Editbox* getHexadecimalEditbox();
235 Slider* getColourPickerImageSlider();
236 Slider* getColourPickerAlphaSlider();
237 Window* getColourPickerStaticImage();
238 Window* getNewColourDescription();
239 Window* getOldColourDescription();
240 Window* getNewColourRect();
241 Window* getOldColourRect();
242 Window* getColourEditBoxRDescription();
243 Window* getColourEditBoxGDescription();
244 Window* getColourEditBoxBDescription();
261 Window* getColourPickerCursorStaticImage();
264 Window* d_colourPickerCursor;
266 SliderMode d_sliderMode;
288 int d_colourPickerImageOffset;
289 int d_colourPickerPickingImageHeight;
290 int d_colourPickerPickingImageWidth;
291 int d_colourPickerColourSliderImageWidth;
292 int d_colourPickerColourSliderImageHeight;
293 int d_colourPickerAlphaSliderImageWidth;
294 int d_colourPickerAlphaSliderImageHeight;
296 int d_colourPickerControlsTextureSize;
298 bool d_draggingColourPickerCursor;
308 #if defined(_MSC_VER)
309 # pragma warning(pop)