Get rid of m_searchButtonVisible and m_cancelButtonVisible

There doesn't seem to be any reason to have these flags, which duplicate
the visibility state of m_searchButton and m_cancelButton respectively.

Also update the buttons visibility immediately in ShowSearchButton() and
ShowCancelButton() instead of doing it in LayoutControls() as before,
which was confusing as laying out is not supposed to show/hide anything.

Finally, return true, not false, from IsSearchButtonVisible() if the
button is actually visible because there is an associated menu, even if
ShowSearchButton(false) had been called. This seems more logical and
makes the code simpler, but we need to check whether the native Mac
version also behaves like this or not.

No other changes in behaviour.
This commit is contained in:
Vadim Zeitlin
2018-07-09 17:12:02 +02:00
parent ed8ac7059c
commit 67bceedfda
2 changed files with 38 additions and 26 deletions

View File

@@ -237,9 +237,6 @@ private:
wxMenu *m_menu;
#endif // wxUSE_MENUS
bool m_searchButtonVisible;
bool m_cancelButtonVisible;
bool m_searchBitmapUser;
bool m_cancelBitmapUser;
#if wxUSE_MENUS