X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8366ab05cd8541c272e5132e2482e9cfb20cbf27..3a3349f5189d6cbaa6c9b3f202433cec9a5ee9d5:/src/generic/srchctlg.cpp diff --git a/src/generic/srchctlg.cpp b/src/generic/srchctlg.cpp index 2beebcf613..65259a7227 100644 --- a/src/generic/srchctlg.cpp +++ b/src/generic/srchctlg.cpp @@ -5,7 +5,7 @@ // Created: 2006-02-19 // RCS-ID: $Id$ // Copyright: Vince Harron -// License: wxWindows licence +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". @@ -139,17 +139,17 @@ public: // needs to forward to them void DoSetValue(const wxString& value, int flags) { - m_text->DoSetValue(value, flags); + wxTextCtrl::DoSetValue(value, flags); } bool DoLoadFile(const wxString& file, int fileType) { - return m_text->DoLoadFile(file, fileType); + return wxTextCtrl::DoLoadFile(file, fileType); } bool DoSaveFile(const wxString& file, int fileType) { - return m_text->DoSaveFile(file, fileType); + return wxTextCtrl::DoSaveFile(file, fileType); } protected: @@ -242,6 +242,14 @@ protected: wxCommandEvent event(m_eventType, m_search->GetId()); event.SetEventObject(m_search); + if ( m_eventType == wxEVT_COMMAND_SEARCHCTRL_SEARCH_BTN ) + { + // it's convenient to have the string to search for directly in the + // event instead of having to retrieve it from the control in the + // event handler code later, so provide it here + event.SetString(m_search->GetValue()); + } + GetEventHandler()->ProcessEvent(event); m_search->SetFocus(); @@ -532,6 +540,8 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) y += BORDER; width -= horizontalBorder*2; height -= BORDER*2; + if (width < 0) width = 0; + if (height < 0) height = 0; wxSize sizeSearch(0,0); wxSize sizeCancel(0,0); @@ -558,6 +568,7 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) cancelMargin = 0; } wxCoord textWidth = width - sizeSearch.x - sizeCancel.x - searchMargin - cancelMargin - 1; + if (textWidth < 0) textWidth = 0; // position the subcontrols inside the client area @@ -574,7 +585,7 @@ void wxSearchCtrl::LayoutControls(int x, int y, int width, int height) // accessors // --------- -wxString wxSearchCtrl::GetValue() const +wxString wxSearchCtrl::DoGetValue() const { wxString value = m_text->GetValue(); if (value == m_text->GetDescriptiveText()) @@ -582,11 +593,6 @@ wxString wxSearchCtrl::GetValue() const else return value; } -void wxSearchCtrl::SetValue(const wxString& value) -{ - m_text->SetValue(value); -} - wxString wxSearchCtrl::GetRange(long from, long to) const { return m_text->GetRange(from, to); @@ -808,7 +814,7 @@ long wxSearchCtrl::GetInsertionPoint() const { return m_text->GetInsertionPoint(); } -wxTextPos wxSearchCtrl::GetLastPosition() const +long wxSearchCtrl::GetLastPosition() const { return m_text->GetLastPosition(); } @@ -914,6 +920,21 @@ wxTextCtrl& operator<<(double d); wxTextCtrl& operator<<(const wxChar c); #endif +void wxSearchCtrl::DoSetValue(const wxString& value, int flags) +{ + m_text->DoSetValue(value, flags); +} + +bool wxSearchCtrl::DoLoadFile(const wxString& file, int fileType) +{ + return m_text->DoLoadFile(file, fileType); +} + +bool wxSearchCtrl::DoSaveFile(const wxString& file, int fileType) +{ + return m_text->DoSaveFile(file, fileType); +} + // do the window-specific processing after processing the update event void wxSearchCtrl::DoUpdateWindowUI(wxUpdateUIEvent& event) {