FIX: [STUDIO-2438] inline search line in popup on Linux
Change-Id: Idcf7c4eca52438aab4129163b90314631b7f7492
This commit is contained in:
parent
2003bbd768
commit
5468573e27
|
@ -366,7 +366,11 @@ void OptionsSearcher::show_dialog(Preset::Type type, wxWindow *parent, TextInput
|
||||||
if (parent == nullptr || input == nullptr) return;
|
if (parent == nullptr || input == nullptr) return;
|
||||||
auto search_dialog = new SearchDialog(this, type, parent, input, ssearch_btn);
|
auto search_dialog = new SearchDialog(this, type, parent, input, ssearch_btn);
|
||||||
wxPoint pos = input->GetParent()->ClientToScreen(wxPoint(0, 0));
|
wxPoint pos = input->GetParent()->ClientToScreen(wxPoint(0, 0));
|
||||||
|
#ifndef __WXGTK__
|
||||||
pos.y += input->GetParent()->GetRect().height;
|
pos.y += input->GetParent()->GetRect().height;
|
||||||
|
#else
|
||||||
|
input->GetParent()->Hide();
|
||||||
|
#endif
|
||||||
search_dialog->SetPosition(pos);
|
search_dialog->SetPosition(pos);
|
||||||
search_dialog->Popup();
|
search_dialog->Popup();
|
||||||
}
|
}
|
||||||
|
@ -558,11 +562,18 @@ SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindo
|
||||||
|
|
||||||
// search line
|
// search line
|
||||||
//search_line = new wxTextCtrl(m_client_panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
//search_line = new wxTextCtrl(m_client_panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
||||||
|
#ifdef __WXGTK__
|
||||||
|
search_line = new TextInput(m_client_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
search_line->SetBackgroundColour(wxColour(238, 238, 238));
|
||||||
|
search_line->SetForegroundColour(wxColour(43, 52, 54));
|
||||||
|
search_line->SetFont(GUI::wxGetApp().bold_font());
|
||||||
|
#endif
|
||||||
|
|
||||||
// default_string = _L("Enter a search term");
|
// default_string = _L("Enter a search term");
|
||||||
search_line->Bind(wxEVT_TEXT, &SearchDialog::OnInputText, this);
|
search_line->Bind(wxEVT_TEXT, &SearchDialog::OnInputText, this);
|
||||||
search_line->Bind(wxEVT_LEFT_UP, &SearchDialog::OnLeftUpInTextCtrl, this);
|
search_line->Bind(wxEVT_LEFT_UP, &SearchDialog::OnLeftUpInTextCtrl, this);
|
||||||
search_line->Bind(wxEVT_KEY_DOWN, &SearchDialog::OnKeyDown, this);
|
search_line->Bind(wxEVT_KEY_DOWN, &SearchDialog::OnKeyDown, this);
|
||||||
|
search_line2 = search_line->GetTextCtrl();
|
||||||
|
|
||||||
// scroll window
|
// scroll window
|
||||||
m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em /2), POPUP_HEIGHT * em), wxVSCROLL, 6, 6);
|
m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em /2), POPUP_HEIGHT * em), wxVSCROLL, 6, 6);
|
||||||
|
@ -579,7 +590,10 @@ SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindo
|
||||||
m_listPanel->Fit();
|
m_listPanel->Fit();
|
||||||
m_scrolledWindow->SetScrollbars(1, 1, 0, m_listPanel->GetSize().GetHeight());
|
m_scrolledWindow->SetScrollbars(1, 1, 0, m_listPanel->GetSize().GetHeight());
|
||||||
|
|
||||||
//m_sizer_body->Add(search_line, 0, wxEXPAND | wxTOP, em + em / 2);
|
#ifdef __WXGTK__
|
||||||
|
m_sizer_body->Add(search_line, 0, wxEXPAND | wxALL, em / 2);
|
||||||
|
search_line = input;
|
||||||
|
#endif
|
||||||
m_sizer_body->Add(m_scrolledWindow, 0, wxEXPAND | wxALL, em);
|
m_sizer_body->Add(m_scrolledWindow, 0, wxEXPAND | wxALL, em);
|
||||||
|
|
||||||
m_client_panel->SetSizer(m_sizer_body);
|
m_client_panel->SetSizer(m_sizer_body);
|
||||||
|
@ -589,7 +603,7 @@ SearchDialog::SearchDialog(OptionsSearcher *searcher, Preset::Type type, wxWindo
|
||||||
|
|
||||||
m_border_panel->SetSizer(m_sizer_main);
|
m_border_panel->SetSizer(m_sizer_main);
|
||||||
m_border_panel->Layout();
|
m_border_panel->Layout();
|
||||||
m_sizer_border->Add(m_border_panel, 0, wxEXPAND | wxALL, 1);
|
m_sizer_border->Add(m_border_panel, 1, wxEXPAND | wxALL, 1);
|
||||||
|
|
||||||
SetSizer(m_sizer_border);
|
SetSizer(m_sizer_border);
|
||||||
Layout();
|
Layout();
|
||||||
|
@ -619,11 +633,11 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/)
|
||||||
|
|
||||||
//const std::string &line = searcher->search_string();
|
//const std::string &line = searcher->search_string();
|
||||||
//search_line->SetValue(line.empty() ? default_string : from_u8(line));
|
//search_line->SetValue(line.empty() ? default_string : from_u8(line));
|
||||||
search_line->GetTextCtrl()->SetValue(wxString(""));
|
search_line2->SetValue(wxString(""));
|
||||||
//const std::string &line = searcher->search_string();
|
//const std::string &line = searcher->search_string();
|
||||||
//searcher->search(into_u8(line), true);
|
//searcher->search(into_u8(line), true);
|
||||||
PopupWindow::Popup();
|
PopupWindow::Popup();
|
||||||
search_line->SetFocus();
|
search_line2->SetFocus();
|
||||||
update_list();
|
update_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,8 +685,8 @@ void SearchDialog::ProcessSelection(wxDataViewItem selection)
|
||||||
|
|
||||||
void SearchDialog::OnInputText(wxCommandEvent &)
|
void SearchDialog::OnInputText(wxCommandEvent &)
|
||||||
{
|
{
|
||||||
search_line->GetTextCtrl()->SetInsertionPointEnd();
|
search_line2->SetInsertionPointEnd();
|
||||||
wxString input_string = search_line->GetTextCtrl()->GetValue();
|
wxString input_string = search_line2->GetValue();
|
||||||
if (input_string == default_string) input_string.Clear();
|
if (input_string == default_string) input_string.Clear();
|
||||||
searcher->search(into_u8(input_string), true, search_type);
|
searcher->search(into_u8(input_string), true, search_type);
|
||||||
update_list();
|
update_list();
|
||||||
|
@ -680,7 +694,7 @@ void SearchDialog::OnInputText(wxCommandEvent &)
|
||||||
|
|
||||||
void SearchDialog::OnLeftUpInTextCtrl(wxEvent &event)
|
void SearchDialog::OnLeftUpInTextCtrl(wxEvent &event)
|
||||||
{
|
{
|
||||||
if (search_line->GetTextCtrl()->GetValue() == default_string) search_line->GetTextCtrl()->SetValue("");
|
if (search_line2->GetValue() == default_string) search_line2->SetValue("");
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +740,9 @@ void SearchDialog::OnSelect(wxDataViewEvent &event)
|
||||||
|
|
||||||
void SearchDialog::update_list()
|
void SearchDialog::update_list()
|
||||||
{
|
{
|
||||||
|
#ifndef __WXGTK__
|
||||||
Freeze();
|
Freeze();
|
||||||
|
#endif
|
||||||
m_scrolledWindow->Destroy();
|
m_scrolledWindow->Destroy();
|
||||||
|
|
||||||
m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em / 2), POPUP_HEIGHT * em - em), wxVSCROLL, 6, 6);
|
m_scrolledWindow = new ScrolledWindow(m_client_panel, wxID_ANY, wxDefaultPosition, wxSize(POPUP_WIDTH * em - (em + em / 2), POPUP_HEIGHT * em - em), wxVSCROLL, 6, 6);
|
||||||
|
@ -755,7 +771,9 @@ void SearchDialog::update_list()
|
||||||
m_sizer_body->Add(m_scrolledWindow, 0, wxEXPAND | wxALL, em);
|
m_sizer_body->Add(m_scrolledWindow, 0, wxEXPAND | wxALL, em);
|
||||||
m_sizer_body->Fit(m_client_panel);
|
m_sizer_body->Fit(m_client_panel);
|
||||||
m_sizer_body->Layout();
|
m_sizer_body->Layout();
|
||||||
|
#ifndef __WXGTK__
|
||||||
Thaw();
|
Thaw();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Under OSX model->Clear invoke wxEVT_DATAVIEW_SELECTION_CHANGED, so
|
// Under OSX model->Clear invoke wxEVT_DATAVIEW_SELECTION_CHANGED, so
|
||||||
// set prevent_list_events to true already here
|
// set prevent_list_events to true already here
|
||||||
|
|
|
@ -206,7 +206,8 @@ public:
|
||||||
const int POPUP_WIDTH = 38;
|
const int POPUP_WIDTH = 38;
|
||||||
const int POPUP_HEIGHT = 40;
|
const int POPUP_HEIGHT = 40;
|
||||||
|
|
||||||
TextInput * search_line{nullptr};
|
TextInput * search_line{nullptr};
|
||||||
|
wxTextCtrl * search_line2{nullptr};
|
||||||
Preset::Type search_type = Preset::TYPE_INVALID;
|
Preset::Type search_type = Preset::TYPE_INVALID;
|
||||||
|
|
||||||
wxDataViewCtrl * search_list{nullptr};
|
wxDataViewCtrl * search_list{nullptr};
|
||||||
|
|
Loading…
Reference in New Issue