]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/clrpickerg.h
Patch from Bo for recent API changes
[wxWidgets.git] / include / wx / generic / clrpickerg.h
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
15 #include "wx/button.h"
16 #include "wx/cmndata.h"
17
18 //-----------------------------------------------------------------------------
19 // wxGenericColourButton: a button which brings up a wxColourDialog
20 //-----------------------------------------------------------------------------
21
22 // show the colour in HTML form (#AABBCC) as colour button label
23 #define wxCLRBTN_SHOW_LABEL 100
24
25 // the default style
26 #define wxCLRBTN_DEFAULT_STYLE (wxCLRBTN_SHOW_LABEL)
27
28
29 class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton,
30 public wxColourPickerWidgetBase
31 {
32 public:
33 wxGenericColourButton() {}
34 wxGenericColourButton(wxWindow *parent,
35 wxWindowID id,
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)
42 {
43 Create(parent, id, col, pos, size, style, validator, name);
44 }
45
46 virtual ~wxGenericColourButton() {}
47
48
49 public: // API extensions specific for wxGenericColourButton
50
51 // user can override this to init colour data in a different way
52 virtual void InitColourData();
53
54 // returns the colour data shown in wxColourDialog
55 wxColourData *GetColourData() { return &ms_data; }
56
57
58 public:
59
60 bool Create(wxWindow *parent,
61 wxWindowID id,
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);
68
69 void OnButtonClick(wxCommandEvent &);
70
71
72 protected:
73
74 wxSize DoGetBestSize() const;
75
76 void UpdateColour();
77
78 // the colour data shown in wxColourPickerCtrlGeneric
79 // controls. This member is static so that all colour pickers
80 // in the program share the same set of custom colours.
81 static wxColourData ms_data;
82
83 private:
84 DECLARE_DYNAMIC_CLASS(wxGenericColourButton)
85 };
86
87
88 #endif // _WX_CLRPICKER_H_