Merge pull request #2798 from lioncash/search

Debugger: Use wxSearchCtrls instead of wxTextCtrl for address searching.
This commit is contained in:
flacs
2015-10-11 15:29:59 +02:00
3 changed files with 37 additions and 33 deletions

View File

@ -10,6 +10,7 @@
#include <wx/listbox.h>
#include <wx/menu.h>
#include <wx/panel.h>
#include <wx/srchctrl.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/textdlg.h>
@ -83,12 +84,11 @@ CCodeWindow::CCodeWindow(const SConfig& _LocalCoreStartupParameter, CFrame *pare
m_aui_toolbar = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORIZONTAL | wxAUI_TB_PLAIN_BACKGROUND);
wxTextCtrl* const address_textctrl = new wxTextCtrl(m_aui_toolbar, IDM_ADDRBOX);
address_textctrl->Bind(wxEVT_TEXT, &CCodeWindow::OnAddrBoxChange, this);
wxSearchCtrl* const address_searchctrl = new wxSearchCtrl(m_aui_toolbar, IDM_ADDRBOX);
address_searchctrl->Bind(wxEVT_TEXT, &CCodeWindow::OnAddrBoxChange, this);
address_searchctrl->SetDescriptiveText(_("Search Address"));
m_aui_toolbar->AddControl(new wxStaticText(m_aui_toolbar, wxID_ANY, _("Address Search:")));
m_aui_toolbar->AddSpacer(5);
m_aui_toolbar->AddControl(address_textctrl);
m_aui_toolbar->AddControl(address_searchctrl);
m_aui_toolbar->Realize();
m_aui_manager.SetManagedWindow(this);
@ -225,7 +225,7 @@ void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
{
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)m_aui_toolbar->FindControl(IDM_ADDRBOX);
wxSearchCtrl* pAddrCtrl = (wxSearchCtrl*)m_aui_toolbar->FindControl(IDM_ADDRBOX);
// Trim leading and trailing whitespace.
wxString txt = pAddrCtrl->GetValue().Trim().Trim(false);
@ -240,7 +240,7 @@ void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
if (success)
pAddrCtrl->SetBackgroundColour(wxNullColour);
else
else if (!txt.empty())
pAddrCtrl->SetBackgroundColour(*wxRED);
pAddrCtrl->Refresh();