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"
17 class WXDLLIMPEXP_CORE wxColourData
;
19 //-----------------------------------------------------------------------------
20 // wxGenericColourButton: a button which brings up a wxColourDialog
21 //-----------------------------------------------------------------------------
23 // show the colour in HTML form (#AABBCC) as colour button label
24 #define wxCLRBTN_SHOW_LABEL 100
27 #define wxCLRBTN_DEFAULT_STYLE wxCLRBTN_SHOW_LABEL
30 class WXDLLIMPEXP_CORE wxGenericColourButton
: public wxButton
,
31 public wxColourPickerWidgetBase
34 wxGenericColourButton() {}
35 wxGenericColourButton(wxWindow
*parent
,
37 const wxColour
& col
= *wxBLACK
,
38 const wxPoint
& pos
= wxDefaultPosition
,
39 const wxSize
& size
= wxDefaultSize
,
40 long style
= wxCLRBTN_DEFAULT_STYLE
,
41 const wxValidator
& validator
= wxDefaultValidator
,
42 const wxString
& name
= wxColourPickerWidgetNameStr
)
44 Create(parent
, id
, col
, pos
, size
, style
, validator
, name
);
47 virtual ~wxGenericColourButton() {}
50 public: // API extensions specific for wxGenericColourButton
52 // user can override this to init colour data in a different way
53 virtual void InitColourData();
55 // returns the colour data shown in wxColourDialog
56 wxColourData
*GetColourData() { return &ms_data
; }
61 bool Create(wxWindow
*parent
,
63 const wxColour
& col
= *wxBLACK
,
64 const wxPoint
& pos
= wxDefaultPosition
,
65 const wxSize
& size
= wxDefaultSize
,
66 long style
= wxCLRBTN_DEFAULT_STYLE
,
67 const wxValidator
& validator
= wxDefaultValidator
,
68 const wxString
& name
= wxColourPickerWidgetNameStr
);
70 void OnButtonClick(wxCommandEvent
&);
77 // the colour data shown in wxColourPickerCtrlGeneric
78 // controls. This member is static so that all colour pickers
79 // in the program share the same set of custom colours.
80 static wxColourData ms_data
;
83 DECLARE_DYNAMIC_CLASS(wxGenericColourButton
)
87 #endif // _WX_CLRPICKER_H_