#if wxUSE_COLOURPICKERCTRL
-#include "wx/control.h"
#include "wx/pickerbase.h"
-class WXDLLIMPEXP_CORE wxColourPickerEvent;
+class WXDLLIMPEXP_FWD_CORE wxColourPickerEvent;
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerWidgetNameStr[];
+extern WXDLLIMPEXP_DATA_CORE(const char) wxColourPickerCtrlNameStr[];
+
+// show the colour in HTML form (#AABBCC) as colour button label
+#define wxCLRBTN_SHOW_LABEL 100
+
+// the default style
+#define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
-extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerWidgetNameStr[];
-extern WXDLLEXPORT_DATA(const wxChar) wxColourPickerCtrlNameStr[];
// ----------------------------------------------------------------------------
// fact that all classes being mapped as wxColourPickerWidget have the
// same prototype for their contructor (and also explains why we use
// define instead of a typedef)
-#if defined(__WXGTK24__) // since GTK > 2.4, there is GtkColorButton
+// since GTK > 2.4, there is GtkColorButton
+#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/clrpicker.h"
#define wxColourPickerWidget wxColourButton
#else
// used, a textctrl next to it.
// ----------------------------------------------------------------------------
-#define wxCLRP_USE_TEXTCTRL wxPB_USE_TEXTCTRL
+#define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
#define wxCLRP_DEFAULT_STYLE 0
class WXDLLIMPEXP_CORE wxColourPickerCtrl : public wxPickerBase
{
public:
- wxColourPickerCtrl() : m_bIgnoreNextTextCtrlUpdate(false) {}
+ wxColourPickerCtrl() {}
virtual ~wxColourPickerCtrl() {}
const wxSize& size = wxDefaultSize, long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxColourPickerCtrlNameStr)
- : m_bIgnoreNextTextCtrlUpdate(false)
{ Create(parent, id, col, pos, size, style, validator, name); }
bool Create(wxWindow *parent, wxWindowID id,
// event handler for our picker
void OnColourChange(wxColourPickerEvent &);
+protected:
virtual long GetPickerStyle(long style) const
{ return (style & wxCLRP_SHOW_LABEL); }
-protected:
-
- // true if the next UpdateTextCtrl() call is to ignore
- bool m_bIgnoreNextTextCtrlUpdate;
-
private:
DECLARE_DYNAMIC_CLASS(wxColourPickerCtrl)
};
// wxColourPickerEvent: used by wxColourPickerCtrl only
// ----------------------------------------------------------------------------
-BEGIN_DECLARE_EVENT_TYPES()
- DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, 1102)
-END_DECLARE_EVENT_TYPES()
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_COLOURPICKER_CHANGED, wxColourPickerEvent );
class WXDLLIMPEXP_CORE wxColourPickerEvent : public wxCommandEvent
{
wxColour GetColour() const { return m_colour; }
void SetColour(const wxColour &c) { m_colour = c; }
+
+ // default copy ctor, assignment operator and dtor are ok
+ virtual wxEvent *Clone() const { return new wxColourPickerEvent(*this); }
+
private:
wxColour m_colour;
- DECLARE_DYNAMIC_CLASS_NO_COPY(wxColourPickerEvent)
+ DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxColourPickerEvent)
};
// ----------------------------------------------------------------------------
typedef void (wxEvtHandler::*wxColourPickerEventFunction)(wxColourPickerEvent&);
#define wxColourPickerEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxColourPickerEventFunction, &func)
+ wxEVENT_HANDLER_CAST(wxColourPickerEventFunction, func)
#define EVT_COLOURPICKER_CHANGED(id, fn) \
wx__DECLARE_EVT1(wxEVT_COMMAND_COLOURPICKER_CHANGED, id, wxColourPickerEventHandler(fn))
-#ifdef _WX_DEFINE_DATE_EVENTS_
- DEFINE_EVENT_TYPE(wxEVT_COMMAND_COLOURPICKER_CHANGED)
-
- IMPLEMENT_DYNAMIC_CLASS(wxColourPickerEvent, wxCommandEvent)
-#endif
-
-
#endif // wxUSE_COLOURPICKERCTRL