]>
Commit | Line | Data |
---|---|---|
ec376c8f VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/generic/clrpickerg.h | |
3 | // Purpose: wxGenericColourButton header | |
4 | // Author: Francesco Montorsi (based on Vadim Zeitlin's code) | |
5 | // Modified by: | |
6 | // Created: 14/4/2006 | |
7 | // Copyright: (c) Vadim Zeitlin, Francesco Montorsi | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows Licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CLRPICKER_H_ | |
13 | #define _WX_CLRPICKER_H_ | |
14 | ||
45f9b662 | 15 | #include "wx/button.h" |
8f782954 | 16 | #include "wx/bmpbuttn.h" |
081d8d96 | 17 | #include "wx/colourdata.h" |
ec376c8f VZ |
18 | |
19 | //----------------------------------------------------------------------------- | |
20 | // wxGenericColourButton: a button which brings up a wxColourDialog | |
21 | //----------------------------------------------------------------------------- | |
22 | ||
480be76a | 23 | class WXDLLIMPEXP_CORE wxGenericColourButton : public wxBitmapButton, |
ec376c8f VZ |
24 | public wxColourPickerWidgetBase |
25 | { | |
26 | public: | |
27 | wxGenericColourButton() {} | |
28 | wxGenericColourButton(wxWindow *parent, | |
29 | wxWindowID id, | |
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) | |
36 | { | |
37 | Create(parent, id, col, pos, size, style, validator, name); | |
38 | } | |
39 | ||
40 | virtual ~wxGenericColourButton() {} | |
41 | ||
42 | ||
43 | public: // API extensions specific for wxGenericColourButton | |
44 | ||
45 | // user can override this to init colour data in a different way | |
46 | virtual void InitColourData(); | |
47 | ||
48 | // returns the colour data shown in wxColourDialog | |
49 | wxColourData *GetColourData() { return &ms_data; } | |
50 | ||
51 | ||
52 | public: | |
53 | ||
54 | bool Create(wxWindow *parent, | |
55 | wxWindowID id, | |
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); | |
62 | ||
63 | void OnButtonClick(wxCommandEvent &); | |
64 | ||
65 | ||
66 | protected: | |
480be76a | 67 | wxBitmap m_bitmap; |
ec376c8f | 68 | |
e8427971 WS |
69 | wxSize DoGetBestSize() const; |
70 | ||
ec376c8f VZ |
71 | void UpdateColour(); |
72 | ||
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; | |
77 | ||
78 | private: | |
79 | DECLARE_DYNAMIC_CLASS(wxGenericColourButton) | |
80 | }; | |
81 | ||
82 | ||
83 | #endif // _WX_CLRPICKER_H_ |