colrdlgg.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/colrdlgg.h
  3. // Purpose: wxGenericColourDialog
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_COLORDLGG_H_
  11. #define _WX_COLORDLGG_H_
  12. #include "wx/gdicmn.h"
  13. #include "wx/dialog.h"
  14. #define wxID_ADD_CUSTOM 3000
  15. #if wxUSE_SLIDER
  16. #define wxID_RED_SLIDER 3001
  17. #define wxID_GREEN_SLIDER 3002
  18. #define wxID_BLUE_SLIDER 3003
  19. class WXDLLIMPEXP_FWD_CORE wxSlider;
  20. #endif // wxUSE_SLIDER
  21. class WXDLLIMPEXP_CORE wxGenericColourDialog : public wxDialog
  22. {
  23. public:
  24. wxGenericColourDialog();
  25. wxGenericColourDialog(wxWindow *parent,
  26. wxColourData *data = NULL);
  27. virtual ~wxGenericColourDialog();
  28. bool Create(wxWindow *parent, wxColourData *data = NULL);
  29. wxColourData &GetColourData() { return m_colourData; }
  30. virtual int ShowModal();
  31. // Internal functions
  32. void OnMouseEvent(wxMouseEvent& event);
  33. void OnPaint(wxPaintEvent& event);
  34. virtual void CalculateMeasurements();
  35. virtual void CreateWidgets();
  36. virtual void InitializeColours();
  37. virtual void PaintBasicColours(wxDC& dc);
  38. virtual void PaintCustomColours(wxDC& dc);
  39. virtual void PaintCustomColour(wxDC& dc);
  40. virtual void PaintHighlight(wxDC& dc, bool draw);
  41. virtual void OnBasicColourClick(int which);
  42. virtual void OnCustomColourClick(int which);
  43. void OnAddCustom(wxCommandEvent& event);
  44. #if wxUSE_SLIDER
  45. void OnRedSlider(wxCommandEvent& event);
  46. void OnGreenSlider(wxCommandEvent& event);
  47. void OnBlueSlider(wxCommandEvent& event);
  48. #endif // wxUSE_SLIDER
  49. void OnCloseWindow(wxCloseEvent& event);
  50. protected:
  51. wxColourData m_colourData;
  52. // Area reserved for grids of colours
  53. wxRect m_standardColoursRect;
  54. wxRect m_customColoursRect;
  55. wxRect m_singleCustomColourRect;
  56. // Size of each colour rectangle
  57. wxPoint m_smallRectangleSize;
  58. // For single customizable colour
  59. wxPoint m_customRectangleSize;
  60. // Grid spacing (between rectangles)
  61. int m_gridSpacing;
  62. // Section spacing (between left and right halves of dialog box)
  63. int m_sectionSpacing;
  64. // 48 'standard' colours
  65. wxColour m_standardColours[48];
  66. // 16 'custom' colours
  67. wxColour m_customColours[16];
  68. // Which colour is selected? An index into one of the two areas.
  69. int m_colourSelection;
  70. int m_whichKind; // 1 for standard colours, 2 for custom colours,
  71. #if wxUSE_SLIDER
  72. wxSlider *m_redSlider;
  73. wxSlider *m_greenSlider;
  74. wxSlider *m_blueSlider;
  75. #endif // wxUSE_SLIDER
  76. int m_buttonY;
  77. int m_okButtonX;
  78. int m_customButtonX;
  79. // static bool colourDialogCancelled;
  80. DECLARE_EVENT_TABLE()
  81. DECLARE_DYNAMIC_CLASS(wxGenericColourDialog)
  82. };
  83. #endif // _WX_COLORDLGG_H_