]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/pickerbase.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPickerBase
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 #define wxPB_USE_TEXTCTRL 0x0002
10 #define wxPB_SMALL 0x8000
16 Base abstract class for all pickers which support an auxiliary text control.
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
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.
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.
35 @see wxColourPickerCtrl
37 class wxPickerBase
: public wxControl
41 virtual ~wxPickerBase();
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
,
47 const wxString
& text
= wxEmptyString
,
48 const wxPoint
& pos
= wxDefaultPosition
,
49 const wxSize
& size
= wxDefaultSize
,
51 const wxValidator
& validator
= wxDefaultValidator
,
52 const wxString
& name
= wxButtonNameStr
);
55 Returns the margin (in pixel) between the picker and the text control.
57 This function can be used only when HasTextCtrl() returns @true.
59 int GetInternalMargin() const;
62 Returns the proportion value of the picker.
64 int GetPickerCtrlProportion() const;
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.
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).
78 wxTextCtrl
* GetTextCtrl();
81 Returns the native implementation of the real picker control.
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.:
89 // wxMSW is one of the platforms where the generic implementation
90 // of wxFilePickerCtrl is used...
92 wxButton *pButt = wx_static_cast(wxButton*, myFilePickerCtrl->GetPickerCtrl());
94 pButt->SetLabel("Custom browse string");
98 wxControl
* GetPickerCtrl();
101 Returns the proportion value of the text control.
103 This function can be used only when HasTextCtrl() returns @true.
105 int GetTextCtrlProportion() const;
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).
111 bool HasTextCtrl() const;
114 Returns @true if the picker control is growable.
116 bool IsPickerCtrlGrowable() const;
119 Returns @true if the text control is growable.
121 This function can be used only when HasTextCtrl() returns @true.
123 bool IsTextCtrlGrowable() const;
126 Sets the margin (in pixel) between the picker and the text control.
128 This function can be used only when HasTextCtrl() returns @true.
130 void SetInternalMargin(int margin
);
133 Sets the picker control as growable when @c grow is @true.
135 void SetPickerCtrlGrowable(bool grow
= true);
138 Sets the proportion value of the picker.
140 Look at the detailed description of wxPickerBase for more info.
142 void SetPickerCtrlProportion(int prop
);
145 Sets the text control as growable when @c grow is @true.
147 This function can be used only when HasTextCtrl() returns @true.
149 void SetTextCtrlGrowable(bool grow
= true);
152 Sets the proportion value of the text control.
154 Look at the detailed description of wxPickerBase for more info.
156 This function can be used only when HasTextCtrl() returns @true.
158 void SetTextCtrlProportion(int prop
);
161 void SetTextCtrl(wxTextCtrl
* text
);
162 void SetPickerCtrl(wxControl
* picker
);
164 virtual void UpdatePickerFromTextCtrl() = 0;
165 virtual void UpdateTextCtrlFromPicker() = 0;
168 virtual long GetTextCtrlStyle(long style
) const;
169 virtual long GetPickerStyle(long style
) const;