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
8 // Licence: wxWindows Licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_CLRPICKER_H_
12 #define _WX_CLRPICKER_H_
14 #include "wx/button.h"
15 #include "wx/bmpbuttn.h"
16 #include "wx/colourdata.h"
18 //-----------------------------------------------------------------------------
19 // wxGenericColourButton: a button which brings up a wxColourDialog
20 //-----------------------------------------------------------------------------
22 class WXDLLIMPEXP_CORE wxGenericColourButton
: public wxBitmapButton
,
23 public wxColourPickerWidgetBase
26 wxGenericColourButton() {}
27 wxGenericColourButton(wxWindow
*parent
,
29 const wxColour
& col
= *wxBLACK
,
30 const wxPoint
& pos
= wxDefaultPosition
,
31 const wxSize
& size
= wxDefaultSize
,
32 long style
= wxCLRBTN_DEFAULT_STYLE
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxColourPickerWidgetNameStr
)
36 Create(parent
, id
, col
, pos
, size
, style
, validator
, name
);
39 virtual ~wxGenericColourButton() {}
42 public: // API extensions specific for wxGenericColourButton
44 // user can override this to init colour data in a different way
45 virtual void InitColourData();
47 // returns the colour data shown in wxColourDialog
48 wxColourData
*GetColourData() { return &ms_data
; }
53 bool Create(wxWindow
*parent
,
55 const wxColour
& col
= *wxBLACK
,
56 const wxPoint
& pos
= wxDefaultPosition
,
57 const wxSize
& size
= wxDefaultSize
,
58 long style
= wxCLRBTN_DEFAULT_STYLE
,
59 const wxValidator
& validator
= wxDefaultValidator
,
60 const wxString
& name
= wxColourPickerWidgetNameStr
);
62 void OnButtonClick(wxCommandEvent
&);
68 wxSize
DoGetBestSize() const;
72 // the colour data shown in wxColourPickerCtrlGeneric
73 // controls. This member is static so that all colour pickers
74 // in the program share the same set of custom colours.
75 static wxColourData ms_data
;
78 DECLARE_DYNAMIC_CLASS(wxGenericColourButton
)
82 #endif // _WX_CLRPICKER_H_