colourdata.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: colourdata.h
  3. // Purpose: interface of wxColourData
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @class wxColourData
  9. This class holds a variety of information related to colour dialogs.
  10. @library{wxcore}
  11. @category{cmndlg,data}
  12. @see wxColour, wxColourDialog, @ref overview_cmndlg_colour
  13. */
  14. class wxColourData : public wxObject
  15. {
  16. public:
  17. /// number of custom colours we store
  18. enum
  19. {
  20. NUM_CUSTOM = 16
  21. };
  22. /**
  23. Constructor. Initializes the custom colours to @c wxNullColour, the
  24. @e data colour setting to black, and the @e choose full setting to
  25. @true.
  26. */
  27. wxColourData();
  28. /**
  29. Destructor.
  30. */
  31. virtual ~wxColourData();
  32. /**
  33. Under Windows, determines whether the Windows colour dialog will
  34. display the full dialog with custom colour selection controls.
  35. Has no meaning under other platforms.
  36. The default value is @true.
  37. */
  38. bool GetChooseFull() const;
  39. /**
  40. Gets the current colour associated with the colour dialog.
  41. The default colour is black.
  42. */
  43. wxColour& GetColour();
  44. /**
  45. Returns custom colours associated with the colour dialog.
  46. @param i
  47. An integer between 0 and 15, being any of the 15 custom colours
  48. that the user has saved. The default custom colours are invalid
  49. colours.
  50. */
  51. wxColour GetCustomColour(int i) const;
  52. /**
  53. Under Windows, tells the Windows colour dialog to display the full
  54. dialog with custom colour selection controls. Under other platforms,
  55. has no effect.
  56. The default value is @true.
  57. */
  58. void SetChooseFull(bool flag);
  59. /**
  60. Sets the default colour for the colour dialog.
  61. The default colour is black.
  62. */
  63. void SetColour(const wxColour& colour);
  64. /**
  65. Sets custom colours for the colour dialog.
  66. @param i
  67. An integer between 0 and 15 for whatever custom colour you want to
  68. set. The default custom colours are invalid colours.
  69. @param colour
  70. The colour to set
  71. */
  72. void SetCustomColour(int i, const wxColour& colour);
  73. /**
  74. Converts the colours saved in this class in a string form, separating
  75. the various colours with a comma.
  76. */
  77. wxString ToString() const;
  78. /**
  79. Decodes the given string, which should be in the same format returned
  80. by ToString(), and sets the internal colours.
  81. */
  82. bool FromString(const wxString& str);
  83. /**
  84. Assignment operator for the colour data.
  85. */
  86. wxColourData& operator =(const wxColourData& data);
  87. };