X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..9e9574fe45b176ee74bba8fad7574cf9906145d1:/interface/wx/pickerbase.h diff --git a/interface/wx/pickerbase.h b/interface/wx/pickerbase.h index 8fca81bdd4..160cfaa04e 100644 --- a/interface/wx/pickerbase.h +++ b/interface/wx/pickerbase.h @@ -2,13 +2,16 @@ // Name: pickerbase.h // Purpose: interface of wxPickerBase // Author: wxWidgets team -// RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// + +#define wxPB_USE_TEXTCTRL 0x0002 +#define wxPB_SMALL 0x8000 + + /** @class wxPickerBase - @wxheader{pickerbase.h} Base abstract class for all pickers which support an auxiliary text control. @@ -34,6 +37,20 @@ class wxPickerBase : public wxControl { public: + wxPickerBase(); + virtual ~wxPickerBase(); + + // if present, intercepts wxPB_USE_TEXTCTRL style and creates the text control + // The 3rd argument is the initial wxString to display in the text control + bool CreateBase(wxWindow *parent, + wxWindowID id, + const wxString& text = wxEmptyString, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxButtonNameStr); + /** Returns the margin (in pixel) between the picker and the text control. @@ -51,15 +68,35 @@ public: @c wxPB_USE_TEXTCTRL style was not specified when this control was created. @remarks - The contents of the text control could be containing an invalid - representation of the entity which can be chosen through the picker - (e.g. the user entered an invalid colour syntax because of a typo). + 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). 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). */ wxTextCtrl* GetTextCtrl(); + /** + 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(); + /** Returns the proportion value of the text control. @@ -68,7 +105,7 @@ public: int GetTextCtrlProportion() const; /** - Returns @true if this window has a valid text control (i.e. if the @c + 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). */ bool HasTextCtrl() const; @@ -119,5 +156,17 @@ public: This function can be used only when HasTextCtrl() returns @true. */ void SetTextCtrlProportion(int prop); + + + void SetTextCtrl(wxTextCtrl* text); + void SetPickerCtrl(wxControl* picker); + + virtual void UpdatePickerFromTextCtrl() = 0; + virtual void UpdateTextCtrlFromPicker() = 0; + +protected: + virtual long GetTextCtrlStyle(long style) const; + virtual long GetPickerStyle(long style) const; + void PostCreation(); };