]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/pickerbase.h
Add wxEVT_DIRCTRL_FILEACTIVATED wxDirCtrl event.
[wxWidgets.git] / interface / wx / pickerbase.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: pickerbase.h
3 // Purpose: interface of wxPickerBase
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 #define wxPB_USE_TEXTCTRL 0x0002
11 #define wxPB_SMALL 0x8000
12
13
14 /**
15 @class wxPickerBase
16
17 Base abstract class for all pickers which support an auxiliary text control.
18
19 This class handles all positioning and sizing of the text control like a
20 an horizontal wxBoxSizer would do, with the text control on the left of the
21 picker button.
22
23 The proportion (see wxSizer documentation for more info about proportion values)
24 of the picker control defaults to 1 when there isn't a text control associated
25 (see @c wxPB_USE_TEXTCTRL style) and to 0 otherwise.
26
27 @beginStyleTable
28 @style{wxPB_USE_TEXTCTRL}
29 Creates a text control to the left of the picker which is
30 completely managed by this wxPickerBase class.
31 @endStyleTable
32
33 @library{wxcore}
34 @category{pickers}
35
36 @see wxColourPickerCtrl
37 */
38 class wxPickerBase : public wxControl
39 {
40 public:
41 wxPickerBase();
42 virtual ~wxPickerBase();
43
44 // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control
45 // The 3rd argument is the initial wxString to display in the text control
46 bool CreateBase(wxWindow *parent,
47 wxWindowID id,
48 const wxString& text = wxEmptyString,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxButtonNameStr);
54
55 /**
56 Returns the margin (in pixel) between the picker and the text control.
57
58 This function can be used only when HasTextCtrl() returns @true.
59 */
60 int GetInternalMargin() const;
61
62 /**
63 Returns the proportion value of the picker.
64 */
65 int GetPickerCtrlProportion() const;
66
67 /**
68 Returns a pointer to the text control handled by this window or @NULL if the
69 @c wxPB_USE_TEXTCTRL style was not specified when this control was created.
70
71 @remarks
72 The contents of the text control could be an invalid representation of
73 the entity which can be chosen through the picker
74 (e.g. when the user enters an invalid colour syntax because of a typo).
75 Thus you should never parse the content of the textctrl to get the
76 user's input; rather use the derived-class getter
77 (e.g. wxColourPickerCtrl::GetColour(), wxFilePickerCtrl::GetPath(), etc).
78 */
79 wxTextCtrl* GetTextCtrl();
80
81 /**
82 Returns the native implementation of the real picker control.
83
84 @note
85 The returned control in the generic implementation of wxFilePickerCtrl,
86 wxDirPickerCtrl, wxFontPickerCtrl and wxColourPickerCtrl is a specialized
87 wxButton class so that you can change its label doing, e.g.:
88 @code
89 #ifdef __WXMSW__
90 // wxMSW is one of the platforms where the generic implementation
91 // of wxFilePickerCtrl is used...
92
93 wxButton *pButt = wx_static_cast(wxButton*, myFilePickerCtrl->GetPickerCtrl());
94 if (pButt)
95 pButt->SetLabel("Custom browse string");
96 #endif
97 @endcode
98 */
99 wxControl* GetPickerCtrl();
100
101 /**
102 Returns the proportion value of the text control.
103
104 This function can be used only when HasTextCtrl() returns @true.
105 */
106 int GetTextCtrlProportion() const;
107
108 /**
109 Returns @true if this window has a valid text control (i.e.\ if the @c
110 wxPB_USE_TEXTCTRL style was given when creating this control).
111 */
112 bool HasTextCtrl() const;
113
114 /**
115 Returns @true if the picker control is growable.
116 */
117 bool IsPickerCtrlGrowable() const;
118
119 /**
120 Returns @true if the text control is growable.
121
122 This function can be used only when HasTextCtrl() returns @true.
123 */
124 bool IsTextCtrlGrowable() const;
125
126 /**
127 Sets the margin (in pixel) between the picker and the text control.
128
129 This function can be used only when HasTextCtrl() returns @true.
130 */
131 void SetInternalMargin(int margin);
132
133 /**
134 Sets the picker control as growable when @c grow is @true.
135 */
136 void SetPickerCtrlGrowable(bool grow = true);
137
138 /**
139 Sets the proportion value of the picker.
140
141 Look at the detailed description of wxPickerBase for more info.
142 */
143 void SetPickerCtrlProportion(int prop);
144
145 /**
146 Sets the text control as growable when @c grow is @true.
147
148 This function can be used only when HasTextCtrl() returns @true.
149 */
150 void SetTextCtrlGrowable(bool grow = true);
151
152 /**
153 Sets the proportion value of the text control.
154
155 Look at the detailed description of wxPickerBase for more info.
156
157 This function can be used only when HasTextCtrl() returns @true.
158 */
159 void SetTextCtrlProportion(int prop);
160
161
162 void SetTextCtrl(wxTextCtrl* text);
163 void SetPickerCtrl(wxControl* picker);
164
165 virtual void UpdatePickerFromTextCtrl() = 0;
166 virtual void UpdateTextCtrlFromPicker() = 0;
167
168 protected:
169 virtual long GetTextCtrlStyle(long style) const;
170 virtual long GetPickerStyle(long style) const;
171 void PostCreation();
172 };
173