]> git.saurik.com Git - wxWidgets.git/blame - src/generic/colrdlgg.cpp
Generalised WinCE fix for other platforms
[wxWidgets.git] / src / generic / colrdlgg.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
1e6feb95 2// Name: generic/colrdlgg.cpp
c801d85f
KB
3// Purpose: Choice dialogs
4// Author: Julian Smart
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
6aa89a22 8// Copyright: (c) Julian Smart
65571936 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
14f355c2 12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c801d85f
KB
13#pragma implementation "colrdlgg.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
1e6feb95 20 #pragma hdrstop
c801d85f
KB
21#endif
22
853bbd9e 23#if wxUSE_COLOURDLG && (!defined(__WXGTK20__) || defined(__WXUNIVERSAL__))
1e6feb95 24
c801d85f 25#ifndef WX_PRECOMP
1e6feb95
VZ
26 #include "wx/utils.h"
27 #include "wx/intl.h"
28 #include "wx/dialog.h"
29 #include "wx/listbox.h"
30 #include "wx/button.h"
31 #include "wx/stattext.h"
32 #include "wx/layout.h"
33 #include "wx/dcclient.h"
1e6feb95 34 #include "wx/sizer.h"
4130b487
RR
35#endif
36
37#if wxUSE_STATLINE
38 #include "wx/statline.h"
c801d85f
KB
39#endif
40
6bb44116
WS
41#if wxUSE_SLIDER
42 #include "wx/slider.h"
43#endif
44
c801d85f
KB
45#include "wx/generic/colrdlgg.h"
46
c801d85f
KB
47IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog)
48
49BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
c35414db 50 EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
6bb44116 51#if wxUSE_SLIDER
c35414db
VZ
52 EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
53 EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
54 EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
6bb44116 55#endif
c35414db
VZ
56 EVT_PAINT(wxGenericColourDialog::OnPaint)
57 EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
58 EVT_CLOSE(wxGenericColourDialog::OnCloseWindow)
c801d85f
KB
59END_EVENT_TABLE()
60
c801d85f
KB
61
62/*
63 * Generic wxColourDialog
64 */
65
61138de0
VZ
66// don't change the number of elements (48) in this array, the code below is
67// hardcoded to use it
68static const wxChar *wxColourDialogNames[] =
69{
70 wxT("ORANGE"),
71 wxT("GOLDENROD"),
72 wxT("WHEAT"),
73 wxT("SPRING GREEN"),
74 wxT("SKY BLUE"),
75 wxT("SLATE BLUE"),
76 wxT("MEDIUM VIOLET RED"),
77 wxT("PURPLE"),
78
79 wxT("RED"),
80 wxT("YELLOW"),
81 wxT("MEDIUM SPRING GREEN"),
82 wxT("PALE GREEN"),
83 wxT("CYAN"),
84 wxT("LIGHT STEEL BLUE"),
85 wxT("ORCHID"),
86 wxT("LIGHT MAGENTA"),
87
88 wxT("BROWN"),
89 wxT("YELLOW"),
90 wxT("GREEN"),
91 wxT("CADET BLUE"),
92 wxT("MEDIUM BLUE"),
93 wxT("MAGENTA"),
94 wxT("MAROON"),
95 wxT("ORANGE RED"),
96
97 wxT("FIREBRICK"),
98 wxT("CORAL"),
99 wxT("FOREST GREEN"),
100 wxT("AQUAMARINE"),
101 wxT("BLUE"),
102 wxT("NAVY"),
103 wxT("THISTLE"),
104 wxT("MEDIUM VIOLET RED"),
105
106 wxT("INDIAN RED"),
107 wxT("GOLD"),
108 wxT("MEDIUM SEA GREEN"),
109 wxT("MEDIUM BLUE"),
110 wxT("MIDNIGHT BLUE"),
111 wxT("GREY"),
112 wxT("PURPLE"),
113 wxT("KHAKI"),
114
115 wxT("BLACK"),
116 wxT("MEDIUM FOREST GREEN"),
117 wxT("KHAKI"),
118 wxT("DARK GREY"),
119 wxT("SEA GREEN"),
120 wxT("LIGHT GREY"),
121 wxT("MEDIUM SLATE BLUE"),
122 wxT("WHITE")
123};
c801d85f 124
4130b487 125wxGenericColourDialog::wxGenericColourDialog()
c801d85f
KB
126{
127 dialogParent = NULL;
128 whichKind = 1;
ea8a9699 129 colourSelection = -1;
c801d85f
KB
130}
131
f6bcfd97
BP
132wxGenericColourDialog::wxGenericColourDialog(wxWindow *parent,
133 wxColourData *data)
c801d85f
KB
134{
135 whichKind = 1;
ea8a9699 136 colourSelection = -1;
c801d85f
KB
137 Create(parent, data);
138}
139
4130b487 140wxGenericColourDialog::~wxGenericColourDialog()
c801d85f
KB
141{
142}
143
74e3313b 144void wxGenericColourDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
c801d85f 145{
e3065973 146 EndModal(wxID_CANCEL);
c801d85f
KB
147}
148
149bool wxGenericColourDialog::Create(wxWindow *parent, wxColourData *data)
150{
ca65c044 151 if ( !wxDialog::Create(parent, wxID_ANY, _("Choose colour"),
c47addef 152 wxPoint(0,0), wxSize(900, 900)) )
ca65c044 153 return false;
c35414db 154
f6bcfd97 155 dialogParent = parent;
c801d85f 156
f6bcfd97
BP
157 if (data)
158 colourData = *data;
c35414db 159
f6bcfd97
BP
160 InitializeColours();
161 CalculateMeasurements();
162 CreateWidgets();
163
ca65c044 164 return true;
c801d85f
KB
165}
166
4130b487 167int wxGenericColourDialog::ShowModal()
c801d85f 168{
984b0d8b 169 return wxDialog::ShowModal();
c801d85f
KB
170}
171
172
173// Internal functions
174void wxGenericColourDialog::OnMouseEvent(wxMouseEvent& event)
175{
176 if (event.ButtonDown(1))
177 {
178 int x = (int)event.GetX();
179 int y = (int)event.GetY();
180
b1f9d7bf
DW
181#ifdef __WXPM__
182 // Handle OS/2's reverse coordinate system and account for the dialog title
183 int nClientHeight;
184
185 GetClientSize(NULL, &nClientHeight);
186 y = (nClientHeight - y) + 20;
187#endif
c801d85f
KB
188 if ((x >= standardColoursRect.x && x <= (standardColoursRect.x + standardColoursRect.width)) &&
189 (y >= standardColoursRect.y && y <= (standardColoursRect.y + standardColoursRect.height)))
190 {
191 int selX = (int)(x - standardColoursRect.x)/(smallRectangleSize.x + gridSpacing);
192 int selY = (int)(y - standardColoursRect.y)/(smallRectangleSize.y + gridSpacing);
193 int ptr = (int)(selX + selY*8);
194 OnBasicColourClick(ptr);
195 }
196 else if ((x >= customColoursRect.x && x <= (customColoursRect.x + customColoursRect.width)) &&
197 (y >= customColoursRect.y && y <= (customColoursRect.y + customColoursRect.height)))
198 {
199 int selX = (int)(x - customColoursRect.x)/(smallRectangleSize.x + gridSpacing);
200 int selY = (int)(y - customColoursRect.y)/(smallRectangleSize.y + gridSpacing);
201 int ptr = (int)(selX + selY*8);
202 OnCustomColourClick(ptr);
203 }
c10920de
VS
204 else
205 event.Skip();
c801d85f 206 }
c10920de
VS
207 else
208 event.Skip();
c801d85f
KB
209}
210
211void wxGenericColourDialog::OnPaint(wxPaintEvent& event)
212{
1bf38b0e 213#if !defined(__WXMOTIF__) && !defined(__WXPM__) && !defined(__WXCOCOA__)
c801d85f 214 wxDialog::OnPaint(event);
d75638f8 215#endif
c801d85f
KB
216
217 wxPaintDC dc(this);
218
219 PaintBasicColours(dc);
220 PaintCustomColours(dc);
221 PaintCustomColour(dc);
ca65c044 222 PaintHighlight(dc, true);
c801d85f
KB
223}
224
4130b487 225void wxGenericColourDialog::CalculateMeasurements()
c801d85f
KB
226{
227 smallRectangleSize.x = 18;
228 smallRectangleSize.y = 14;
229 customRectangleSize.x = 40;
230 customRectangleSize.y = 40;
231
232 gridSpacing = 6;
233 sectionSpacing = 15;
234
235 standardColoursRect.x = 10;
b1f9d7bf
DW
236#ifdef __WXPM__
237 standardColoursRect.y = 15 + 20; /* OS/2 needs to account for dialog titlebar */
238#else
c801d85f 239 standardColoursRect.y = 15;
b1f9d7bf 240#endif
c801d85f
KB
241 standardColoursRect.width = (8*smallRectangleSize.x) + (7*gridSpacing);
242 standardColoursRect.height = (6*smallRectangleSize.y) + (5*gridSpacing);
243
244 customColoursRect.x = standardColoursRect.x;
245 customColoursRect.y = standardColoursRect.y + standardColoursRect.height + 20;
246 customColoursRect.width = (8*smallRectangleSize.x) + (7*gridSpacing);
247 customColoursRect.height = (2*smallRectangleSize.y) + (1*gridSpacing);
248
249 singleCustomColourRect.x = customColoursRect.width + customColoursRect.x + sectionSpacing;
250 singleCustomColourRect.y = 80;
251 singleCustomColourRect.width = customRectangleSize.x;
252 singleCustomColourRect.height = customRectangleSize.y;
253
254 okButtonX = 10;
255 customButtonX = singleCustomColourRect.x ;
256 buttonY = customColoursRect.y + customColoursRect.height + 10;
257}
258
4130b487 259void wxGenericColourDialog::CreateWidgets()
c801d85f 260{
4130b487 261 wxBeginBusyCursor();
c801d85f 262
6bb44116
WS
263 wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
264
f79a46f8 265 const int sliderHeight = 160;
4130b487 266
6bb44116
WS
267#if wxUSE_SLIDER
268 const int sliderX = singleCustomColourRect.x + singleCustomColourRect.width + sectionSpacing;
269
984b0d8b 270 redSlider = new wxSlider(this, wxID_RED_SLIDER, colourData.m_dataColour.Red(), 0, 255,
a3b8b891 271 wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE);
984b0d8b 272 greenSlider = new wxSlider(this, wxID_GREEN_SLIDER, colourData.m_dataColour.Green(), 0, 255,
a3b8b891 273 wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE);
984b0d8b 274 blueSlider = new wxSlider(this, wxID_BLUE_SLIDER, colourData.m_dataColour.Blue(), 0, 255,
a3b8b891 275 wxDefaultPosition, wxSize(wxDefaultCoord, sliderHeight), wxSL_VERTICAL|wxSL_LABELS|wxSL_INVERSE);
f79a46f8
WS
276
277 wxBoxSizer *sliderSizer = new wxBoxSizer( wxHORIZONTAL );
278
279 // 1) space for sliders
280 sliderSizer->Add( sliderX, sliderHeight );
281 sliderSizer->Add( redSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 );
282 sliderSizer->Add( greenSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 );
283 sliderSizer->Add( blueSlider, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 10 );
4130b487 284
f79a46f8 285 topSizer->Add( sliderSizer, 0, wxCENTRE | wxALL, 10 );
6bb44116
WS
286#else
287 topSizer->Add( 1, sliderHeight, 0, wxCENTRE | wxALL, 15 );
288#endif // wxUSE_SLIDER
6c34d0ed 289
4130b487
RR
290#if wxUSE_STATLINE
291 // 2) static line
f79a46f8 292 topSizer->Add( new wxStaticLine( this, wxID_ANY ), 0, wxEXPAND | wxLEFT|wxRIGHT|wxTOP, 10 );
c801d85f 293#endif
c35414db 294
4130b487
RR
295 // 3) buttons
296 wxSizer *buttonsizer = CreateButtonSizer( wxOK|wxCANCEL );
297 buttonsizer->Add( new wxButton(this, wxID_ADD_CUSTOM, _("Add to custom colours") ), 0, wxLEFT|wxRIGHT, 10 );
acf2ac37 298 topSizer->Add( buttonsizer, 0, wxEXPAND | wxALL, 10 );
c801d85f 299
ca65c044 300 SetAutoLayout( true );
f79a46f8 301 SetSizer( topSizer );
6c34d0ed 302
f79a46f8
WS
303 topSizer->SetSizeHints( this );
304 topSizer->Fit( this );
c801d85f 305
4130b487 306 Centre( wxBOTH );
c801d85f 307
4130b487 308 wxEndBusyCursor();
c801d85f
KB
309}
310
311void wxGenericColourDialog::InitializeColours(void)
312{
a4ba2eec 313 size_t i;
ea8a9699 314
61138de0 315 for (i = 0; i < WXSIZEOF(wxColourDialogNames); i++)
ea8a9699 316 {
564a150b
VZ
317 wxColour col = wxTheColourDatabase->Find(wxColourDialogNames[i]);
318 if (col.Ok())
319 standardColours[i].Set(col.Red(), col.Green(), col.Blue());
ea8a9699
VZ
320 else
321 standardColours[i].Set(0, 0, 0);
322 }
c801d85f 323
564a150b 324 for (i = 0; i < WXSIZEOF(customColours); i++)
ea8a9699 325 {
a2b99ff5
VS
326 wxColour c = colourData.GetCustomColour(i);
327 if (c.Ok())
328 customColours[i] = colourData.GetCustomColour(i);
329 else
330 customColours[i] = wxColour(255, 255, 255);
ea8a9699 331 }
c801d85f 332
ea8a9699
VZ
333 wxColour curr = colourData.GetColour();
334 if ( curr.Ok() )
335 {
ca65c044 336 bool initColourFound = false;
ea8a9699 337
61138de0 338 for (i = 0; i < WXSIZEOF(wxColourDialogNames); i++)
ea8a9699
VZ
339 {
340 if ( standardColours[i] == curr && !initColourFound )
341 {
342 whichKind = 1;
343 colourSelection = i;
ca65c044 344 initColourFound = true;
ea8a9699
VZ
345 break;
346 }
347 }
348 if ( !initColourFound )
349 {
564a150b 350 for ( i = 0; i < WXSIZEOF(customColours); i++ )
ea8a9699
VZ
351 {
352 if ( customColours[i] == curr )
353 {
354 whichKind = 2;
355 colourSelection = i;
ea8a9699
VZ
356 break;
357 }
358 }
359 }
984b0d8b 360 colourData.m_dataColour.Set( curr.Red(), curr.Green(), curr.Blue() );
ea8a9699
VZ
361 }
362 else
363 {
364 whichKind = 1;
365 colourSelection = 0;
984b0d8b 366 colourData.m_dataColour.Set( 0, 0, 0 );
ea8a9699 367 }
c801d85f
KB
368}
369
370void wxGenericColourDialog::PaintBasicColours(wxDC& dc)
371{
372 dc.BeginDrawing();
373
374 int i;
375 for (i = 0; i < 6; i++)
376 {
377 int j;
378 for (j = 0; j < 8; j++)
379 {
380 int ptr = i*8 + j;
c35414db 381
c801d85f
KB
382 int x = (j*(smallRectangleSize.x+gridSpacing) + standardColoursRect.x);
383 int y = (i*(smallRectangleSize.y+gridSpacing) + standardColoursRect.y);
384
385 dc.SetPen(*wxBLACK_PEN);
386 wxBrush brush(standardColours[ptr], wxSOLID);
387 dc.SetBrush(brush);
388
389 dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
390 }
391 }
392 dc.EndDrawing();
393}
394
395void wxGenericColourDialog::PaintCustomColours(wxDC& dc)
396{
397 dc.BeginDrawing();
398
399 int i;
400 for (i = 0; i < 2; i++)
401 {
402 int j;
403 for (j = 0; j < 8; j++)
404 {
405 int ptr = i*8 + j;
c35414db 406
c801d85f
KB
407 int x = (j*(smallRectangleSize.x+gridSpacing)) + customColoursRect.x;
408 int y = (i*(smallRectangleSize.y+gridSpacing)) + customColoursRect.y;
409
410 dc.SetPen(*wxBLACK_PEN);
411
412 wxBrush brush(customColours[ptr], wxSOLID);
413 dc.SetBrush(brush);
414
415 dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y);
416 }
417 }
418 dc.EndDrawing();
419}
420
421void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw)
422{
ea8a9699
VZ
423 if ( colourSelection < 0 )
424 return;
425
c801d85f
KB
426 dc.BeginDrawing();
427
428 // Number of pixels bigger than the standard rectangle size
429 // for drawing a highlight
430 int deltaX = 2;
431 int deltaY = 2;
432
433 if (whichKind == 1)
434 {
435 // Standard colours
436 int y = (int)(colourSelection / 8);
437 int x = (int)(colourSelection - (y*8));
438
439 x = (x*(smallRectangleSize.x + gridSpacing) + standardColoursRect.x) - deltaX;
440 y = (y*(smallRectangleSize.y + gridSpacing) + standardColoursRect.y) - deltaY;
441
442 if (draw)
443 dc.SetPen(*wxBLACK_PEN);
444 else
445 dc.SetPen(*wxLIGHT_GREY_PEN);
446
447 dc.SetBrush(*wxTRANSPARENT_BRUSH);
448 dc.DrawRectangle( x, y, (smallRectangleSize.x + (2*deltaX)), (smallRectangleSize.y + (2*deltaY)));
449 }
450 else
451 {
452 // User-defined colours
453 int y = (int)(colourSelection / 8);
454 int x = (int)(colourSelection - (y*8));
455
456 x = (x*(smallRectangleSize.x + gridSpacing) + customColoursRect.x) - deltaX;
457 y = (y*(smallRectangleSize.y + gridSpacing) + customColoursRect.y) - deltaY;
458
459 if (draw)
460 dc.SetPen(*wxBLACK_PEN);
461 else
462 dc.SetPen(*wxLIGHT_GREY_PEN);
c35414db 463
c801d85f
KB
464 dc.SetBrush(*wxTRANSPARENT_BRUSH);
465 dc.DrawRectangle( x, y, (smallRectangleSize.x + (2*deltaX)), (smallRectangleSize.y + (2*deltaY)));
466 }
c35414db 467
c801d85f
KB
468 dc.EndDrawing();
469}
470
471void wxGenericColourDialog::PaintCustomColour(wxDC& dc)
472{
473 dc.BeginDrawing();
c35414db 474
c801d85f
KB
475 dc.SetPen(*wxBLACK_PEN);
476
984b0d8b 477 wxBrush *brush = new wxBrush(colourData.m_dataColour, wxSOLID);
c801d85f
KB
478 dc.SetBrush(*brush);
479
480 dc.DrawRectangle( singleCustomColourRect.x, singleCustomColourRect.y,
481 customRectangleSize.x, customRectangleSize.y);
482
483 dc.SetBrush(wxNullBrush);
484 delete brush;
485
486 dc.EndDrawing();
487}
488
489void wxGenericColourDialog::OnBasicColourClick(int which)
490{
ca65c044 491 wxClientDC dc(this);
c801d85f 492
ca65c044
WS
493 PaintHighlight(dc, false);
494 whichKind = 1;
495 colourSelection = which;
2997ca30 496
6bb44116 497#if wxUSE_SLIDER
ca65c044 498 redSlider->SetValue( standardColours[colourSelection].Red() );
ea8a9699
VZ
499 greenSlider->SetValue( standardColours[colourSelection].Green() );
500 blueSlider->SetValue( standardColours[colourSelection].Blue() );
6bb44116 501#endif // wxUSE_SLIDER
2997ca30
WS
502
503 colourData.m_dataColour.Set(standardColours[colourSelection].Red(),
504 standardColours[colourSelection].Green(),
984b0d8b 505 standardColours[colourSelection].Blue());
c801d85f 506
ca65c044
WS
507 PaintCustomColour(dc);
508 PaintHighlight(dc, true);
c801d85f
KB
509}
510
511void wxGenericColourDialog::OnCustomColourClick(int which)
512{
ca65c044
WS
513 wxClientDC dc(this);
514 PaintHighlight(dc, false);
515 whichKind = 2;
516 colourSelection = which;
2997ca30 517
6bb44116 518#if wxUSE_SLIDER
ca65c044 519 redSlider->SetValue( customColours[colourSelection].Red() );
ea8a9699
VZ
520 greenSlider->SetValue( customColours[colourSelection].Green() );
521 blueSlider->SetValue( customColours[colourSelection].Blue() );
6bb44116 522#endif // wxUSE_SLIDER
2997ca30
WS
523
524 colourData.m_dataColour.Set(customColours[colourSelection].Red(),
525 customColours[colourSelection].Green(),
984b0d8b 526 customColours[colourSelection].Blue());
2997ca30 527
ca65c044
WS
528 PaintCustomColour(dc);
529 PaintHighlight(dc, true);
c801d85f
KB
530}
531
532/*
533void wxGenericColourDialog::OnOk(void)
534{
ca65c044 535 Show(false);
c801d85f
KB
536}
537
538void wxGenericColourDialog::OnCancel(void)
539{
ca65c044
WS
540 colourDialogCancelled = true;
541 Show(false);
c801d85f
KB
542}
543*/
544
545void wxGenericColourDialog::OnAddCustom(wxCommandEvent& WXUNUSED(event))
546{
547 wxClientDC dc(this);
548 if (whichKind != 2)
549 {
ca65c044 550 PaintHighlight(dc, false);
c801d85f
KB
551 whichKind = 2;
552 colourSelection = 0;
ca65c044 553 PaintHighlight(dc, true);
c801d85f
KB
554 }
555
2997ca30
WS
556 customColours[colourSelection].Set(colourData.m_dataColour.Red(),
557 colourData.m_dataColour.Green(),
984b0d8b 558 colourData.m_dataColour.Blue());
2997ca30 559
c801d85f 560 colourData.SetCustomColour(colourSelection, customColours[colourSelection]);
c35414db 561
c801d85f
KB
562 PaintCustomColours(dc);
563}
564
6bb44116
WS
565#if wxUSE_SLIDER
566
c801d85f
KB
567void wxGenericColourDialog::OnRedSlider(wxCommandEvent& WXUNUSED(event))
568{
569 if (!redSlider)
570 return;
c35414db 571
c801d85f 572 wxClientDC dc(this);
984b0d8b 573 colourData.m_dataColour.Set((unsigned char)redSlider->GetValue(), colourData.m_dataColour.Green(), colourData.m_dataColour.Blue());
c801d85f
KB
574 PaintCustomColour(dc);
575}
576
577void wxGenericColourDialog::OnGreenSlider(wxCommandEvent& WXUNUSED(event))
578{
579 if (!greenSlider)
580 return;
581
582 wxClientDC dc(this);
984b0d8b 583 colourData.m_dataColour.Set(colourData.m_dataColour.Red(), (unsigned char)greenSlider->GetValue(), colourData.m_dataColour.Blue());
c801d85f
KB
584 PaintCustomColour(dc);
585}
586
587void wxGenericColourDialog::OnBlueSlider(wxCommandEvent& WXUNUSED(event))
588{
589 if (!blueSlider)
590 return;
591
592 wxClientDC dc(this);
984b0d8b 593 colourData.m_dataColour.Set(colourData.m_dataColour.Red(), colourData.m_dataColour.Green(), (unsigned char)blueSlider->GetValue());
c801d85f
KB
594 PaintCustomColour(dc);
595}
596
6bb44116
WS
597#endif // wxUSE_SLIDER
598
a2b99ff5 599#endif // wxUSE_COLOURDLG && !defined(__WXGTK20__)
c801d85f 600