1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        wx/generic/colrdlgg.h 
   3 // Purpose:     wxGenericColourDialog 
   4 // Author:      Julian Smart 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 #ifndef __COLORDLGH_G__ 
  13 #define __COLORDLGH_G__ 
  15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) 
  16 #pragma interface "colrdlgg.h" 
  20 #include "wx/gdicmn.h" 
  21 #include "wx/dialog.h" 
  22 #include "wx/cmndata.h" 
  24 #define wxID_ADD_CUSTOM     3000 
  25 #define wxID_RED_SLIDER     3001 
  26 #define wxID_GREEN_SLIDER   3002 
  27 #define wxID_BLUE_SLIDER    3003 
  29 class WXDLLEXPORT wxSlider
; 
  30 class WXDLLEXPORT wxGenericColourDialog 
: public wxDialog
 
  33     wxGenericColourDialog(); 
  34     wxGenericColourDialog(wxWindow 
*parent
, 
  35                           wxColourData 
*data 
= (wxColourData 
*) NULL
); 
  36     virtual ~wxGenericColourDialog(); 
  38     bool Create(wxWindow 
*parent
, wxColourData 
*data 
= (wxColourData 
*) NULL
); 
  40     wxColourData 
&GetColourData() { return colourData
; } 
  42     virtual int ShowModal(); 
  45     void OnMouseEvent(wxMouseEvent
& event
); 
  46     void OnPaint(wxPaintEvent
& event
); 
  48     virtual void CalculateMeasurements(); 
  49     virtual void CreateWidgets(); 
  50     virtual void InitializeColours(); 
  52     virtual void PaintBasicColours(wxDC
& dc
); 
  53     virtual void PaintCustomColours(wxDC
& dc
); 
  54     virtual void PaintCustomColour(wxDC
& dc
); 
  55     virtual void PaintHighlight(wxDC
& dc
, bool draw
); 
  57     virtual void OnBasicColourClick(int which
); 
  58     virtual void OnCustomColourClick(int which
); 
  60     void OnAddCustom(wxCommandEvent
& event
); 
  62     void OnRedSlider(wxCommandEvent
& event
); 
  63     void OnGreenSlider(wxCommandEvent
& event
); 
  64     void OnBlueSlider(wxCommandEvent
& event
); 
  66     void OnCloseWindow(wxCloseEvent
& event
); 
  69     wxColourData colourData
; 
  70     wxWindow 
*dialogParent
; 
  72     // Area reserved for grids of colours 
  73     wxRect standardColoursRect
; 
  74     wxRect customColoursRect
; 
  75     wxRect singleCustomColourRect
; 
  77     // Size of each colour rectangle 
  78     wxPoint smallRectangleSize
; 
  80     // For single customizable colour 
  81     wxPoint customRectangleSize
; 
  83     // Grid spacing (between rectangles) 
  86     // Section spacing (between left and right halves of dialog box) 
  89     // 48 'standard' colours 
  90     wxColour standardColours
[48]; 
  92     // 16 'custom' colours 
  93     wxColour customColours
[16]; 
  95     // One single custom colour (use sliders) 
  96     wxColour singleCustomColour
; 
  98     // Which colour is selected? An index into one of the two areas. 
 100     int whichKind
; // 1 for standard colours, 2 for custom colours, 
 103     wxSlider 
*greenSlider
; 
 104     wxSlider 
*blueSlider
; 
 111     //  static bool colourDialogCancelled; 
 113     DECLARE_EVENT_TABLE() 
 114     DECLARE_DYNAMIC_CLASS(wxGenericColourDialog
) 
 117 /* This shouldn't be necessary, we have a #define in wx/colordlg.h. 
 119 typedef wxGenericColourDialog wxColourDialog;