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