Merge branch 'search-desctext'
wxSearchCtrl fixes for wxMSW and add "hint" property to its XRC handler. See https://github.com/wxWidgets/wxWidgets/pull/691
This commit is contained in:
@@ -176,6 +176,7 @@ All (GUI):
|
||||
- Add wxFontPickerCtrl::SetMinPointSize() (Andreas Falkenhahn).
|
||||
- Add Set/GetFooter/Text/Icon() to wxRichMessageDialog (Tobias Taschner)
|
||||
- Add wxFloatingPointValidator::SetFactor().
|
||||
- Add "hint" property to wxSearchCtrl XRC handler.
|
||||
|
||||
wxGTK:
|
||||
|
||||
|
@@ -1950,6 +1950,9 @@ child and the second one for right/bottom child window.
|
||||
@hdr3col{property, type, description}
|
||||
@row3col{value, @ref overview_xrcformat_type_text,
|
||||
Initial value of the control (default: empty).}
|
||||
@row3col{hint, @ref overview_xrcformat_type_text,
|
||||
Descriptive text shown in the empty control (default: "Search"). This
|
||||
property is new since wxWidgets 3.1.1.}
|
||||
@endTable
|
||||
|
||||
|
||||
|
@@ -61,9 +61,8 @@ public:
|
||||
virtual void ShowCancelButton( bool show ) wxOVERRIDE;
|
||||
virtual bool IsCancelButtonVisible() const wxOVERRIDE;
|
||||
|
||||
// TODO: In 2.9 these should probably be virtual, and declared in the base class...
|
||||
void SetDescriptiveText(const wxString& text);
|
||||
wxString GetDescriptiveText() const;
|
||||
virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE;
|
||||
virtual wxString GetDescriptiveText() const wxOVERRIDE;
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
@@ -54,9 +54,8 @@ public:
|
||||
virtual void ShowCancelButton( bool show ) wxOVERRIDE;
|
||||
virtual bool IsCancelButtonVisible() const wxOVERRIDE;
|
||||
|
||||
// TODO: In 2.9 these should probably be virtual, and declared in the base class...
|
||||
void SetDescriptiveText(const wxString& text);
|
||||
wxString GetDescriptiveText() const;
|
||||
virtual void SetDescriptiveText(const wxString& text) wxOVERRIDE;
|
||||
virtual wxString GetDescriptiveText() const wxOVERRIDE;
|
||||
|
||||
virtual bool HandleSearchFieldSearchHit() ;
|
||||
virtual bool HandleSearchFieldCancelHit() ;
|
||||
|
@@ -68,6 +68,9 @@ public:
|
||||
virtual void ShowCancelButton( bool show ) = 0;
|
||||
virtual bool IsCancelButtonVisible() const = 0;
|
||||
|
||||
virtual void SetDescriptiveText(const wxString& text) = 0;
|
||||
virtual wxString GetDescriptiveText() const = 0;
|
||||
|
||||
private:
|
||||
// implement wxTextEntry pure virtual method
|
||||
virtual wxWindow *GetEditableWindow() wxOVERRIDE { return this; }
|
||||
|
@@ -49,7 +49,7 @@ class wxSearchTextCtrl : public wxTextCtrl
|
||||
public:
|
||||
wxSearchTextCtrl(wxSearchCtrl *search, const wxString& value, int style)
|
||||
: wxTextCtrl(search, wxID_ANY, value, wxDefaultPosition, wxDefaultSize,
|
||||
(style & ~wxBORDER_MASK) | wxNO_BORDER)
|
||||
(style & ~wxBORDER_MASK) | wxNO_BORDER | wxTE_PROCESS_ENTER)
|
||||
{
|
||||
m_search = search;
|
||||
|
||||
|
@@ -2078,7 +2078,7 @@ void wxTextCtrl::OnChar(wxKeyEvent& event)
|
||||
// forces at the moment unfortunately
|
||||
if ( !(m_windowStyle & wxTE_PROCESS_TAB))
|
||||
{
|
||||
if ( FindFocus() == this )
|
||||
if ( ::GetFocus() == GetHwnd() )
|
||||
{
|
||||
int flags = 0;
|
||||
if (!event.ShiftDown())
|
||||
|
@@ -49,6 +49,10 @@ wxObject *wxSearchCtrlXmlHandler::DoCreateResource()
|
||||
|
||||
SetupWindow(ctrl);
|
||||
|
||||
const wxString& hint = GetText(wxS("hint"));
|
||||
if ( !hint.empty() )
|
||||
ctrl->SetDescriptiveText(hint);
|
||||
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user