mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Fix #50
This commit is contained in:
@@ -39,8 +39,11 @@ FilterCtrl::FilterCtrl(wxWindow* parent, int id, String const& placeholder, Stri
|
|||||||
, help_text(help_text)
|
, help_text(help_text)
|
||||||
{
|
{
|
||||||
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
wxColour bg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||||
clear_button = new HoverButton(this, wxID_ANY, _("btn_clear_filter"), bg, false);
|
#if !defined(__WXGTK__)
|
||||||
clear_button->SetCursor(*wxSTANDARD_CURSOR);
|
// Note: in wxGTK, it is not possible to add child windows to standard controls
|
||||||
|
clear_button = new HoverButton(this, wxID_ANY, _("btn_clear_filter"), bg, false);
|
||||||
|
clear_button->SetCursor(*wxSTANDARD_CURSOR);
|
||||||
|
#endif
|
||||||
onSize();
|
onSize();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -84,7 +87,9 @@ void FilterCtrl::update() {
|
|||||||
font.SetStyle(wxFONTSTYLE_ITALIC);
|
font.SetStyle(wxFONTSTYLE_ITALIC);
|
||||||
SetFont(font);
|
SetFont(font);
|
||||||
}
|
}
|
||||||
clear_button->Show(!value.empty());
|
#if !defined(__WXGTK__)
|
||||||
|
clear_button->Show(!value.empty());
|
||||||
|
#endif
|
||||||
changing = false;
|
changing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,10 +115,12 @@ void FilterCtrl::onSizeEvent(wxSizeEvent&) {
|
|||||||
onSize();
|
onSize();
|
||||||
}
|
}
|
||||||
void FilterCtrl::onSize() {
|
void FilterCtrl::onSize() {
|
||||||
wxSize s = GetClientSize();
|
#if !defined(__WXGTK__)
|
||||||
wxSize cs = clear_button->GetBestSize();
|
wxSize s = GetClientSize();
|
||||||
int margin = 2;
|
wxSize cs = clear_button->GetBestSize();
|
||||||
clear_button->SetSize(s.x - cs.x - margin, (s.y-cs.y)/2, cs.x, cs.y);
|
int margin = 2;
|
||||||
|
clear_button->SetSize(s.x - cs.x - margin, (s.y-cs.y)/2, cs.x, cs.y);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterCtrl::onSetFocus(wxFocusEvent& ev) {
|
void FilterCtrl::onSetFocus(wxFocusEvent& ev) {
|
||||||
@@ -134,7 +141,11 @@ void FilterCtrl::onMouseLeave(wxMouseEvent& ev) {
|
|||||||
|
|
||||||
bool FilterCtrl::hasFocus() {
|
bool FilterCtrl::hasFocus() {
|
||||||
wxWindow* focus = wxWindow::FindFocus();
|
wxWindow* focus = wxWindow::FindFocus();
|
||||||
return focus == this || focus == clear_button;
|
#if !defined(__WXGTK__)
|
||||||
|
return focus == this || focus == clear_button;
|
||||||
|
#else
|
||||||
|
return focus == this;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterCtrl::showHelp(bool show) {
|
void FilterCtrl::showHelp(bool show) {
|
||||||
|
|||||||
Reference in New Issue
Block a user