]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/clrpickerg.h
Last part from weak ref patch for event sink disconnection
[wxWidgets.git] / include / wx / generic / clrpickerg.h
... / ...
CommitLineData
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/bmpbuttn.h"
17#include "wx/cmndata.h"
18
19//-----------------------------------------------------------------------------
20// wxGenericColourButton: a button which brings up a wxColourDialog
21//-----------------------------------------------------------------------------
22
23class WXDLLIMPEXP_CORE wxGenericColourButton : public wxBitmapButton,
24 public wxColourPickerWidgetBase
25{
26public:
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
43public: // 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
52public:
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
66protected:
67 wxBitmap m_bitmap;
68
69 wxSize DoGetBestSize() const;
70
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
78private:
79 DECLARE_DYNAMIC_CLASS(wxGenericColourButton)
80};
81
82
83#endif // _WX_CLRPICKER_H_