2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: pickerbase.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxPickerBase
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxPickerBase
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Base abstract class for all pickers which support an auxiliary text control.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This class handles all positioning and sizing of the text control like a
|
2008-04-06 08:52:58 -04:00
|
|
|
an horizontal wxBoxSizer would do, with the text control on the left of the
|
|
|
|
picker button.
|
2008-04-06 12:19:04 -04:00
|
|
|
|
2008-04-06 08:52:58 -04:00
|
|
|
The proportion (see wxSizer documentation for more info about proportion values)
|
|
|
|
of the picker control defaults to 1 when there isn't a text control associated
|
|
|
|
(see @c wxPB_USE_TEXTCTRL style) and to 0 otherwise.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxPB_USE_TEXTCTRL}
|
2008-03-08 08:52:38 -05:00
|
|
|
Creates a text control to the left of the picker which is
|
|
|
|
completely managed by this wxPickerBase class.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
2008-04-06 08:52:58 -04:00
|
|
|
@category{pickers}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxColourPickerCtrl
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxPickerBase : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Returns the margin (in pixel) between the picker and the text control.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function can be used only when HasTextCtrl() returns @true.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetInternalMargin() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the proportion value of the picker.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetPickerCtrlProportion() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a pointer to the text control handled by this window or @NULL if the
|
2008-04-06 08:52:58 -04:00
|
|
|
@c wxPB_USE_TEXTCTRL style was not specified when this control was created.
|
|
|
|
|
|
|
|
@remarks
|
2008-12-07 08:50:12 -05:00
|
|
|
The contents of the text control could be an invalid representation of
|
|
|
|
the entity which can be chosen through the picker
|
|
|
|
(e.g. when the user enters an invalid colour syntax because of a typo).
|
2008-04-06 08:52:58 -04:00
|
|
|
Thus you should never parse the content of the textctrl to get the
|
|
|
|
user's input; rather use the derived-class getter
|
|
|
|
(e.g. wxColourPickerCtrl::GetColour(), wxFilePickerCtrl::GetPath(), etc).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
wxTextCtrl* GetTextCtrl();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-12-07 08:50:12 -05:00
|
|
|
/**
|
|
|
|
Returns the native implementation of the real picker control.
|
|
|
|
|
|
|
|
@note
|
|
|
|
The returned control in the generic implementation of wxFilePickerCtrl,
|
|
|
|
wxDirPickerCtrl, wxFontPickerCtrl and wxColourPickerCtrl is a specialized
|
|
|
|
wxButton class so that you can change its label doing, e.g.:
|
|
|
|
@code
|
|
|
|
#ifdef __WXMSW__
|
|
|
|
// wxMSW is one of the platforms where the generic implementation
|
|
|
|
// of wxFilePickerCtrl is used...
|
|
|
|
|
|
|
|
wxButton *pButt = wx_static_cast(wxButton*, myFilePickerCtrl->GetPickerCtrl());
|
|
|
|
if (pButt)
|
|
|
|
pButt->SetLabel("Custom browse string");
|
|
|
|
#endif
|
|
|
|
@endcode
|
|
|
|
*/
|
|
|
|
wxControl* GetPickerCtrl();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Returns the proportion value of the text control.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function can be used only when HasTextCtrl() returns @true.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetTextCtrlProportion() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-06 08:52:58 -04:00
|
|
|
Returns @true if this window has a valid text control (i.e. if the @c
|
|
|
|
wxPB_USE_TEXTCTRL style was given when creating this control).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool HasTextCtrl() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the picker control is growable.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsPickerCtrlGrowable() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the text control is growable.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function can be used only when HasTextCtrl() returns @true.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsTextCtrlGrowable() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the margin (in pixel) between the picker and the text control.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function can be used only when HasTextCtrl() returns @true.
|
|
|
|
*/
|
|
|
|
void SetInternalMargin(int margin);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the picker control as growable when @c grow is @true.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetPickerCtrlGrowable(bool grow = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the proportion value of the picker.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-04-06 12:19:04 -04:00
|
|
|
Look at the detailed description of wxPickerBase for more info.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetPickerCtrlProportion(int prop);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the text control as growable when @c grow is @true.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function can be used only when HasTextCtrl() returns @true.
|
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
void SetTextCtrlGrowable(bool grow = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the proportion value of the text control.
|
2008-04-06 08:52:58 -04:00
|
|
|
|
2008-04-06 12:19:04 -04:00
|
|
|
Look at the detailed description of wxPickerBase for more info.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function can be used only when HasTextCtrl() returns @true.
|
|
|
|
*/
|
|
|
|
void SetTextCtrlProportion(int prop);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|