// wxControlContainerBase: common part used in both native and generic cases
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxControlContainerBase
+class WXDLLIMPEXP_CORE wxControlContainerBase
{
public:
// default ctor, SetContainerWindow() must be called later
// wxListCtrl) and so should get focus for ourselves
bool AcceptsFocusRecursively() const { return true; }
- // call this when the number of children of the window changes
- //
- // note that we have any children, this panel (used just as container for
- // them) shouldn't get focus for itself
+ // this is used to determine whether we can accept focus when Tab or
+ // another navigation key is pressed -- we alsways can, for the same reason
+ // as mentioned above for AcceptsFocusRecursively()
+ bool AcceptsFocusFromKeyboard() const { return true; }
+
+ // Call this when the number of children of the window changes.
+ // If we have any children, this panel (used just as container for
+ // them) shouldn't get focus for itself.
void UpdateCanFocus() { SetCanFocus(!HasAnyFocusableChildren()); }
protected:
public: \
virtual bool AcceptsFocus() const; \
virtual bool AcceptsFocusRecursively() const; \
+ virtual bool AcceptsFocusFromKeyboard() const; \
virtual void AddChild(wxWindowBase *child); \
virtual void RemoveChild(wxWindowBase *child); \
virtual void SetFocus(); \
bool classname::AcceptsFocus() const \
{ \
return m_container.AcceptsFocus(); \
+ } \
+ \
+ bool classname::AcceptsFocusFromKeyboard() const \
+ { \
+ return m_container.AcceptsFocusFromKeyboard(); \
}
-
#ifdef wxHAS_NATIVE_TAB_TRAVERSAL
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// this must be a real class as we forward-declare it elsewhere
-class WXDLLEXPORT wxControlContainer : public wxControlContainerBase
+class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase
{
protected:
// set the focus to the child which had it the last time
\
void classname::SetFocusIgnoringChildren() \
{ \
- basename::SetFocusIgnoringChildren(); \
+ basename::SetFocus(); \
}
#else // !wxHAS_NATIVE_TAB_TRAVERSAL
// wxControlContainer for TAB navigation implemented in wx itself
// ----------------------------------------------------------------------------
-class WXDLLEXPORT wxControlContainer : public wxControlContainerBase
+class WXDLLIMPEXP_CORE wxControlContainer : public wxControlContainerBase
{
public:
// default ctor, SetContainerWindow() must be called later
void classname::OnChildFocus(wxChildFocusEvent& event) \
{ \
m_container.SetLastFocus(event.GetWindow()); \
+ event.Skip(); \
} \
\
void classname::OnFocus(wxFocusEvent& event) \