]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/clrpicker.h
Add wxFileName::SetPermissions().
[wxWidgets.git] / interface / wx / clrpicker.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: clrpicker.h
3 // Purpose: interface of wxColourPickerCtrl
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 #define wxCLRP_USE_TEXTCTRL (wxPB_USE_TEXTCTRL)
9 #define wxCLRP_DEFAULT_STYLE 0
10 #define wxCLRP_SHOW_LABEL 0x0008
11
12 wxEventType wxEVT_COLOURPICKER_CHANGED;
13
14
15 /**
16 @class wxColourPickerCtrl
17
18 This control allows the user to select a colour. The generic implementation
19 is a button which brings up a wxColourDialog when clicked. Native
20 implementation may differ but this is usually a (small) widget which give
21 access to the colour-chooser dialog. It is only available if
22 @c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
23
24 @beginStyleTable
25 @style{wxCLRP_DEFAULT_STYLE}
26 The default style: 0.
27 @style{wxCLRP_USE_TEXTCTRL}
28 Creates a text control to the left of the picker button which is
29 completely managed by the wxColourPickerCtrl and which can be used
30 by the user to specify a colour (see SetColour). The text control
31 is automatically synchronized with button's value. Use functions
32 defined in wxPickerBase to modify the text control.
33 @style{wxCLRP_SHOW_LABEL}
34 Shows the colour in HTML form (AABBCC) as colour button label
35 (instead of no label at all).
36 @endStyleTable
37
38 @beginEventEmissionTable{wxColourPickerEvent}
39 @event{EVT_COLOURPICKER_CHANGED(id, func)}
40 The user changed the colour selected in the control either using the
41 button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
42 in this case the event is fired only if the user’s input is valid,
43 i.e. recognizable).
44 @endEventTable
45
46 @library{wxcore}
47 @category{pickers}
48 @appearance{colourpickerctrl}
49
50 @see wxColourDialog, wxColourPickerEvent
51 */
52 class wxColourPickerCtrl : public wxPickerBase
53 {
54 public:
55 wxColourPickerCtrl();
56
57 /**
58 Initializes the object and calls Create() with all the parameters.
59 */
60 wxColourPickerCtrl(wxWindow* parent, wxWindowID id,
61 const wxColour& colour = *wxBLACK,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style = wxCLRP_DEFAULT_STYLE,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxColourPickerCtrlNameStr);
67
68 /**
69 Creates a colour picker with the given arguments.
70
71 @param parent
72 Parent window, must not be non-@NULL.
73 @param id
74 The identifier for the control.
75 @param colour
76 The initial colour shown in the control.
77 @param pos
78 Initial position.
79 @param size
80 Initial size.
81 @param style
82 The window style, see wxCRLP_* flags.
83 @param validator
84 Validator which can be used for additional date checks.
85 @param name
86 Control name.
87
88 @return @true if the control was successfully created or @false if
89 creation failed.
90 */
91 bool Create(wxWindow* parent, wxWindowID id,
92 const wxColour& colour = *wxBLACK,
93 const wxPoint& pos = wxDefaultPosition,
94 const wxSize& size = wxDefaultSize,
95 long style = wxCLRP_DEFAULT_STYLE,
96 const wxValidator& validator = wxDefaultValidator,
97 const wxString& name = wxColourPickerCtrlNameStr);
98
99 /**
100 Returns the currently selected colour.
101 */
102 wxColour GetColour() const;
103
104 //@{
105 /**
106 Sets the currently selected colour. See wxColour::Set().
107 */
108 void SetColour(const wxColour& col);
109 void SetColour(const wxString& colname);
110 //@}
111 };
112
113
114
115 /**
116 @class wxColourPickerEvent
117
118 This event class is used for the events generated by wxColourPickerCtrl.
119
120 @beginEventTable{wxColourPickerEvent}
121 @event{EVT_COLOURPICKER_CHANGED(id, func)}
122 Generated whenever the selected colour changes.
123 @endEventTable
124
125 @library{wxcore}
126 @category{events}
127
128 @see wxColourPickerCtrl
129 */
130 class wxColourPickerEvent : public wxCommandEvent
131 {
132 public:
133 wxColourPickerEvent();
134
135 /**
136 The constructor is not normally used by the user code.
137 */
138 wxColourPickerEvent(wxObject* generator, int id,
139 const wxColour& colour);
140
141 /**
142 Retrieve the colour the user has just selected.
143 */
144 wxColour GetColour() const;
145
146 /**
147 Set the colour associated with the event.
148 */
149 void SetColour(const wxColour& pos);
150 };
151