Add wxWindow::DisableFocusFromKeyboard()

This allows to easily exclude a window from the TAB chain.

Closes https://github.com/wxWidgets/wxWidgets/pull/1516
This commit is contained in:
Tomay
2019-08-29 01:47:37 +01:00
committed by Vadim Zeitlin
parent e5fb5a290c
commit bbdd5b4984
3 changed files with 21 additions and 2 deletions

View File

@@ -728,7 +728,11 @@ public:
// can this window be given focus by keyboard navigation? if not, the
// only way to give it focus (provided it accepts it at all) is to
// click it
virtual bool AcceptsFocusFromKeyboard() const { return AcceptsFocus(); }
virtual bool AcceptsFocusFromKeyboard() const
{ return !m_disableFocusFromKbd && AcceptsFocus(); }
// Disable any input focus from the keyboard
void DisableFocusFromKeyboard() { m_disableFocusFromKbd = true; }
// Can this window be focused right now, in its current state? This
@@ -1733,6 +1737,9 @@ protected:
bool m_inheritFgCol:1;
bool m_inheritFont:1;
// flag disabling accepting focus from keyboard
bool m_disableFocusFromKbd:1;
// window attributes
long m_windowStyle,
m_exStyle;
@@ -1929,7 +1936,6 @@ private:
// (i.e. not being updated) if it is positive
unsigned int m_freezeCount;
wxDECLARE_ABSTRACT_CLASS(wxWindowBase);
wxDECLARE_NO_COPY_CLASS(wxWindowBase);
wxDECLARE_EVENT_TABLE();