29 #ifndef _CEGUIColourPickerControls_h_
30 #define _CEGUIColourPickerControls_h_
32 #include "CEGUI/CommonDialogs/Module.h"
33 #include "CEGUI/Window.h"
34 #include "CEGUI/CommonDialogs/ColourPicker/Types.h"
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
53 SliderMode_Lab_A = 1 << 1,
54 SliderMode_Lab_B = 1 << 2,
55 SliderMode_HSV_H = 1 << 3,
56 SliderMode_HSV_S = 1 << 4,
57 SliderMode_HSV_V = 1 << 5
67 static const String EventNamespace;
76 static const String EventClosed;
88 void setColours(
const Colour& newColour);
90 void setPreviousColour(
const Colour& previousColour);
92 void refreshAllElements();
101 void setCallingColourPicker(
ColourPicker* colourPicker);
104 void initialiseComponents();
115 static const String TitleBarName;
116 static const String ColourPickerStaticImageName;
117 static const String ColourPickerImageSliderName;
118 static const String ColourPickerAlphaSliderName;
119 static const String NewColourDescriptionName;
120 static const String OldColourDescriptionName;
121 static const String NewColourRectName;
122 static const String OldColourRectName;
123 static const String ColourEditBoxRDescriptionName;
124 static const String ColourEditBoxGDescriptionName;
125 static const String ColourEditBoxBDescriptionName;
126 static const String ColourEditBoxRName;
127 static const String ColourEditBoxGName;
128 static const String ColourEditBoxBName;
129 static const String HSVRadioButtonHName;
130 static const String HSVRadioButtonSName;
131 static const String HSVRadioButtonVName;
132 static const String HSVEditBoxHName;
133 static const String HSVEditBoxSName;
134 static const String HSVEditBoxVName;
135 static const String LabRadioButtonLName;
136 static const String LabRadioButtonAName;
137 static const String LabRadioButtonBName;
138 static const String LabEditBoxLName;
139 static const String LabEditBoxAName;
140 static const String LabEditBoxBName;
141 static const String AlphaEditBoxName;
142 static const String ColourPickerCursorName;
152 static const float LAB_L_MIN;
153 static const float LAB_L_MAX;
154 static const float LAB_L_DIFF;
155 static const float LAB_A_MIN;
156 static const float LAB_A_MAX;
157 static const float LAB_A_DIFF;
158 static const float LAB_B_MIN;
159 static const float LAB_B_MAX;
160 static const float LAB_B_DIFF;
162 void initColourPickerControlsImageSet();
163 void deinitColourPickerControlsTexture();
164 void refreshColourPickerControlsTextures();
166 void refreshColourSliderImage();
167 void refreshColourPickingImage();
168 void refreshAlphaSliderImage();
170 void reloadColourPickerControlsTexture();
172 Lab_Colour getColourSliderPositionColourLAB(
float value);
173 Lab_Colour getColourPickingPositionColourLAB(
float xAbs,
float yAbs);
175 HSV_Colour getColourSliderPositionColourHSV(
float value);
176 HSV_Colour getColourPickingPositionColourHSV(
float xAbs,
float yAbs);
178 RGB_Colour getAlphaSliderPositionColour(
int x,
int y);
180 Vector2f getColourPickingColourPosition();
181 void getColourPickingColourPositionHSV(
float& x,
float& y);
184 bool handleCancelButtonClicked(
const EventArgs& e);
185 bool handleAcceptButtonClicked(
const EventArgs& e);
186 bool handleEditboxDeactivated(
const EventArgs& args);
187 bool handleRadioButtonModeSelection(
const EventArgs& args);
189 bool handleHexadecimalEditboxTextChanged(
const EventArgs& args);
190 bool handleRGBEditboxTextChanged(
const EventArgs& args);
191 bool handleLABEditboxTextChanged(
const EventArgs& args);
192 bool handleHSVEditboxTextChanged(
const EventArgs& args);
194 bool handleAlphaEditboxTextChanged(
const EventArgs& args);
196 bool handleColourPickerStaticImageMouseLeaves(
const EventArgs& args);
197 bool handleColourPickerStaticImageMouseButtonUp(
const EventArgs& args);
198 bool handleColourPickerStaticImageMouseButtonDown(
const EventArgs& args);
199 bool handleColourPickerStaticImageMouseMove(
const EventArgs& args);
204 void onColourCursorPositionChanged();
205 void onColourSliderChanged();
207 void refreshColourPickerCursorPosition(
const MouseEventArgs& mouseEventArgs);
210 void refreshOnlyColourSliderImage();
211 bool handleColourPickerSliderValueChanged(
const EventArgs& args);
212 bool handleAlphaSliderValueChanged(
const EventArgs& args);
214 void refreshEditboxesAndColourRects();
216 void refreshColourRects();
217 void positionColourPickerCursorAbsolute(
float x,
float y);
218 void positionColourPickerCursorRelative(
float x,
float y);
219 void setColours(
const Lab_Colour& newColourLAB);
220 void setColours(
const RGB_Colour& newColourRGB);
221 void setColours(
const HSV_Colour& newColourHSV);
223 void setColourAlpha(
float alphaValue);
225 void refreshColourPickerCursorPosition();
226 void refreshColourSliderPosition();
228 void initColourPicker();
231 Window* getHexadecimalDescription();
232 Editbox* getHexadecimalEditbox();
234 Slider* getColourPickerImageSlider();
235 Slider* getColourPickerAlphaSlider();
236 Window* getColourPickerStaticImage();
237 Window* getNewColourDescription();
238 Window* getOldColourDescription();
239 Window* getNewColourRect();
240 Window* getOldColourRect();
241 Window* getColourEditBoxRDescription();
242 Window* getColourEditBoxGDescription();
243 Window* getColourEditBoxBDescription();
260 Window* getColourPickerCursorStaticImage();
263 Window* d_colourPickerCursor;
265 SliderMode d_sliderMode;
287 int d_colourPickerImageOffset;
288 int d_colourPickerPickingImageHeight;
289 int d_colourPickerPickingImageWidth;
290 int d_colourPickerColourSliderImageWidth;
291 int d_colourPickerColourSliderImageHeight;
292 int d_colourPickerAlphaSliderImageWidth;
293 int d_colourPickerAlphaSliderImageHeight;
295 int d_colourPickerControlsTextureSize;
297 bool d_draggingColourPickerCursor;
307 #if defined(_MSC_VER)
308 # pragma warning(pop)