1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/clrpickerg.h
3 // Purpose: wxGenericColourButton header
4 // Author: Francesco Montorsi (based on Vadim Zeitlin's code)
7 // Copyright: (c) Vadim Zeitlin, Francesco Montorsi
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CLRPICKER_H_
13 #define _WX_CLRPICKER_H_
15 #include "wx/button.h"
16 #include "wx/cmndata.h"
18 //-----------------------------------------------------------------------------
19 // wxGenericColourButton: a button which brings up a wxColourDialog
20 //-----------------------------------------------------------------------------
22 // show the colour in HTML form (#AABBCC) as colour button label
23 #define wxCLRBTN_SHOW_LABEL 100
26 #define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
29 class WXDLLIMPEXP_CORE wxGenericColourButton
: public wxButton
,
30 public wxColourPickerWidgetBase
33 wxGenericColourButton() {}
34 wxGenericColourButton(wxWindow
*parent
,
36 const wxColour
& col
= *wxBLACK
,
37 const wxPoint
& pos
= wxDefaultPosition
,
38 const wxSize
& size
= wxDefaultSize
,
39 long style
= wxCLRBTN_DEFAULT_STYLE
,
40 const wxValidator
& validator
= wxDefaultValidator
,
41 const wxString
& name
= wxColourPickerWidgetNameStr
)
43 Create(parent
, id
, col
, pos
, size
, style
, validator
, name
);
46 virtual ~wxGenericColourButton() {}
49 public: // API extensions specific for wxGenericColourButton
51 // user can override this to init colour data in a different way
52 virtual void InitColourData();
54 // returns the colour data shown in wxColourDialog
55 wxColourData
*GetColourData() { return &ms_data
; }
60 bool Create(wxWindow
*parent
,
62 const wxColour
& col
= *wxBLACK
,
63 const wxPoint
& pos
= wxDefaultPosition
,
64 const wxSize
& size
= wxDefaultSize
,
65 long style
= wxCLRBTN_DEFAULT_STYLE
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxColourPickerWidgetNameStr
);
69 void OnButtonClick(wxCommandEvent
&);
76 // the colour data shown in wxColourPickerCtrlGeneric
77 // controls. This member is static so that all colour pickers
78 // in the program share the same set of custom colours.
79 static wxColourData ms_data
;
82 DECLARE_DYNAMIC_CLASS(wxGenericColourButton
)
86 #endif // _WX_CLRPICKER_H_