]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/clrpickerg.h
use a GtkAlignment to position m_mainWidget, avoiding need to re-size_allocate it
[wxWidgets.git] / include / wx / generic / clrpickerg.h
CommitLineData
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"
3f26ef31 16#include "wx/cmndata.h"
ec376c8f
VZ
17
18//-----------------------------------------------------------------------------
19// wxGenericColourButton: a button which brings up a wxColourDialog
20//-----------------------------------------------------------------------------
21
ec376c8f
VZ
22class WXDLLIMPEXP_CORE wxGenericColourButton : public wxButton,
23 public wxColourPickerWidgetBase
24{
25public:
26 wxGenericColourButton() {}
27 wxGenericColourButton(wxWindow *parent,
28 wxWindowID id,
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)
35 {
36 Create(parent, id, col, pos, size, style, validator, name);
37 }
38
39 virtual ~wxGenericColourButton() {}
40
41
42public: // API extensions specific for wxGenericColourButton
43
44 // user can override this to init colour data in a different way
45 virtual void InitColourData();
46
47 // returns the colour data shown in wxColourDialog
48 wxColourData *GetColourData() { return &ms_data; }
49
50
51public:
52
53 bool Create(wxWindow *parent,
54 wxWindowID id,
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);
61
62 void OnButtonClick(wxCommandEvent &);
63
64
65protected:
66
e8427971
WS
67 wxSize DoGetBestSize() const;
68
ec376c8f
VZ
69 void UpdateColour();
70
71 // the colour data shown in wxColourPickerCtrlGeneric
72 // controls. This member is static so that all colour pickers
73 // in the program share the same set of custom colours.
74 static wxColourData ms_data;
75
76private:
77 DECLARE_DYNAMIC_CLASS(wxGenericColourButton)
78};
79
80
81#endif // _WX_CLRPICKER_H_