00001 00002 // Name: ax_menu_colour.h 00003 // Purpose: Colour selection menu 00004 // Author: Julian Smart 00005 // Modified by: 00006 // Created: 2009-03-20 00007 // RCS-ID: 00008 // Copyright: (c) Julian Smart 00009 // Licence: New BSD License 00011 00012 #ifndef _AX_MENU_COLOUR_H_ 00013 #define _AX_MENU_COLOUR_H_ 00014 00015 /* 00016 * Includes 00017 */ 00018 00019 #include "ax/ax_menu_choice.h" 00020 00030 class AxColourMenuItem: public AxChoiceMenuItem 00031 { 00032 DECLARE_DYNAMIC_CLASS( AxColourMenuItem ) 00033 00034 public: 00035 // Constructors 00036 00037 AxColourMenuItem(const AxColourMenuItem& item) { Copy(item); } 00038 AxColourMenuItem() {} 00039 AxColourMenuItem(const wxString& label, const wxString& description, 00040 const wxString& id, 00041 const wxColour& colour); 00042 bool Create(const wxString& label, const wxString& description, 00043 const wxString& id, 00044 const wxColour& colour); 00045 00046 void Copy(const AxColourMenuItem& item); 00047 00048 virtual AxMenuItem* Clone() { return new AxColourMenuItem(* this); } 00049 00050 void SetColour(const wxColour& colour); 00051 wxColour GetColour() const { return m_colour; } 00052 00054 virtual void SetSelection(int i); 00055 00056 #if 0 00057 wxString CreateString(const wxString& spec, bool isLabel); 00058 #endif 00059 00060 protected: 00061 00062 wxColour m_colour; 00063 }; 00064 00069 class AxColourValidator: public AxValidator 00070 { 00071 DECLARE_DYNAMIC_CLASS( AxColourValidator ) 00072 00073 public: 00074 // Constructors 00075 00076 AxColourValidator(const AxColourValidator& validator) { Init(); Copy(validator); } 00077 AxColourValidator(wxColour* ptr) { Init(); m_colourPtr = ptr; } 00078 AxColourValidator() { Init(); } 00079 00080 // Operations 00081 00082 void Copy(const AxColourValidator& validator) 00083 { 00084 AxColourValidator::Copy(validator); 00085 00086 m_colourPtr = validator.m_colourPtr; 00087 } 00088 00089 virtual AxValidator* Clone() const { return new AxColourValidator(*this); } 00090 00092 virtual bool TransferDataFromMenu(); 00093 00095 virtual bool TransferDataToMenu(); 00096 00098 void Init() { m_colourPtr = NULL; } 00099 00100 protected: 00101 wxColour* m_colourPtr; 00102 }; 00103 00104 #endif 00105 // _AX_MENU_COLOUR_H_