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:
@@ -728,7 +728,11 @@ public:
|
|||||||
// can this window be given focus by keyboard navigation? if not, the
|
// 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
|
// only way to give it focus (provided it accepts it at all) is to
|
||||||
// click it
|
// 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
|
// Can this window be focused right now, in its current state? This
|
||||||
@@ -1733,6 +1737,9 @@ protected:
|
|||||||
bool m_inheritFgCol:1;
|
bool m_inheritFgCol:1;
|
||||||
bool m_inheritFont:1;
|
bool m_inheritFont:1;
|
||||||
|
|
||||||
|
// flag disabling accepting focus from keyboard
|
||||||
|
bool m_disableFocusFromKbd:1;
|
||||||
|
|
||||||
// window attributes
|
// window attributes
|
||||||
long m_windowStyle,
|
long m_windowStyle,
|
||||||
m_exStyle;
|
m_exStyle;
|
||||||
@@ -1929,7 +1936,6 @@ private:
|
|||||||
// (i.e. not being updated) if it is positive
|
// (i.e. not being updated) if it is positive
|
||||||
unsigned int m_freezeCount;
|
unsigned int m_freezeCount;
|
||||||
|
|
||||||
|
|
||||||
wxDECLARE_ABSTRACT_CLASS(wxWindowBase);
|
wxDECLARE_ABSTRACT_CLASS(wxWindowBase);
|
||||||
wxDECLARE_NO_COPY_CLASS(wxWindowBase);
|
wxDECLARE_NO_COPY_CLASS(wxWindowBase);
|
||||||
wxDECLARE_EVENT_TABLE();
|
wxDECLARE_EVENT_TABLE();
|
||||||
|
@@ -487,6 +487,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual bool AcceptsFocusRecursively() const;
|
virtual bool AcceptsFocusRecursively() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Disable giving focus to this window using the keyboard navigation keys.
|
||||||
|
|
||||||
|
Pressing @c TAB key will skip this window if this function was called
|
||||||
|
on it, but it will still be possible to focus it by clicking on it with
|
||||||
|
a pointing device.
|
||||||
|
|
||||||
|
@since 3.1.4
|
||||||
|
*/
|
||||||
|
void DisableFocusFromKeyboard();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Can this window itself have focus?
|
Can this window itself have focus?
|
||||||
*/
|
*/
|
||||||
|
@@ -320,6 +320,8 @@ wxWindowBase::wxWindowBase()
|
|||||||
m_containingSizer = NULL;
|
m_containingSizer = NULL;
|
||||||
m_autoLayout = false;
|
m_autoLayout = false;
|
||||||
|
|
||||||
|
m_disableFocusFromKbd = true;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
m_dropTarget = NULL;
|
m_dropTarget = NULL;
|
||||||
#endif // wxUSE_DRAG_AND_DROP
|
#endif // wxUSE_DRAG_AND_DROP
|
||||||
|
Reference in New Issue
Block a user