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/bmpbuttn.h"
17 #include "wx/cmndata.h"
19 //-----------------------------------------------------------------------------
20 // wxGenericColourButton: a button which brings up a wxColourDialog
21 //-----------------------------------------------------------------------------
23 class WXDLLIMPEXP_CORE wxGenericColourButton
: public wxBitmapButton
,
24 public wxColourPickerWidgetBase
27 wxGenericColourButton() {}
28 wxGenericColourButton(wxWindow
*parent
,
30 const wxColour
& col
= *wxBLACK
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
,
33 long style
= wxCLRBTN_DEFAULT_STYLE
,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxColourPickerWidgetNameStr
)
37 Create(parent
, id
, col
, pos
, size
, style
, validator
, name
);
40 virtual ~wxGenericColourButton() {}
43 public: // API extensions specific for wxGenericColourButton
45 // user can override this to init colour data in a different way
46 virtual void InitColourData();
48 // returns the colour data shown in wxColourDialog
49 wxColourData
*GetColourData() { return &ms_data
; }
54 bool Create(wxWindow
*parent
,
56 const wxColour
& col
= *wxBLACK
,
57 const wxPoint
& pos
= wxDefaultPosition
,
58 const wxSize
& size
= wxDefaultSize
,
59 long style
= wxCLRBTN_DEFAULT_STYLE
,
60 const wxValidator
& validator
= wxDefaultValidator
,
61 const wxString
& name
= wxColourPickerWidgetNameStr
);
63 void OnButtonClick(wxCommandEvent
&);
69 wxSize
DoGetBestSize() const;
73 // the colour data shown in wxColourPickerCtrlGeneric
74 // controls. This member is static so that all colour pickers
75 // in the program share the same set of custom colours.
76 static wxColourData ms_data
;
79 DECLARE_DYNAMIC_CLASS(wxGenericColourButton
)
83 #endif // _WX_CLRPICKER_H_