]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/pickerbase.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPickerBase
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
10 #define wxPB_USE_TEXTCTRL 0x0002
11 #define wxPB_SMALL 0x8000
17 Base abstract class for all pickers which support an auxiliary text control.
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
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.
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.
36 @see wxColourPickerCtrl
38 class wxPickerBase
: public wxControl
42 virtual ~wxPickerBase();
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
,
48 const wxString
& text
= wxEmptyString
,
49 const wxPoint
& pos
= wxDefaultPosition
,
50 const wxSize
& size
= wxDefaultSize
,
52 const wxValidator
& validator
= wxDefaultValidator
,
53 const wxString
& name
= wxButtonNameStr
);
56 Returns the margin (in pixel) between the picker and the text control.
58 This function can be used only when HasTextCtrl() returns @true.
60 int GetInternalMargin() const;
63 Returns the proportion value of the picker.
65 int GetPickerCtrlProportion() const;
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.
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).
79 wxTextCtrl
* GetTextCtrl();
82 Returns the native implementation of the real picker control.
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.:
90 // wxMSW is one of the platforms where the generic implementation
91 // of wxFilePickerCtrl is used...
93 wxButton *pButt = wx_static_cast(wxButton*, myFilePickerCtrl->GetPickerCtrl());
95 pButt->SetLabel("Custom browse string");
99 wxControl
* GetPickerCtrl();
102 Returns the proportion value of the text control.
104 This function can be used only when HasTextCtrl() returns @true.
106 int GetTextCtrlProportion() const;
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).
112 bool HasTextCtrl() const;
115 Returns @true if the picker control is growable.
117 bool IsPickerCtrlGrowable() const;
120 Returns @true if the text control is growable.
122 This function can be used only when HasTextCtrl() returns @true.
124 bool IsTextCtrlGrowable() const;
127 Sets the margin (in pixel) between the picker and the text control.
129 This function can be used only when HasTextCtrl() returns @true.
131 void SetInternalMargin(int margin
);
134 Sets the picker control as growable when @c grow is @true.
136 void SetPickerCtrlGrowable(bool grow
= true);
139 Sets the proportion value of the picker.
141 Look at the detailed description of wxPickerBase for more info.
143 void SetPickerCtrlProportion(int prop
);
146 Sets the text control as growable when @c grow is @true.
148 This function can be used only when HasTextCtrl() returns @true.
150 void SetTextCtrlGrowable(bool grow
= true);
153 Sets the proportion value of the text control.
155 Look at the detailed description of wxPickerBase for more info.
157 This function can be used only when HasTextCtrl() returns @true.
159 void SetTextCtrlProportion(int prop
);
162 void SetTextCtrl(wxTextCtrl
* text
);
163 void SetPickerCtrl(wxControl
* picker
);
165 virtual void UpdatePickerFromTextCtrl() = 0;
166 virtual void UpdateTextCtrlFromPicker() = 0;
169 virtual long GetTextCtrlStyle(long style
) const;
170 virtual long GetPickerStyle(long style
) const;