]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/containr.h
doing WakeUp in osx_carbon differently for the main event as well
[wxWidgets.git] / include / wx / containr.h
index 2d4cd3d0993b15ea50c390d3e9a87bbb871ad186..594af01367b3466c2261a8fb0f46ce759a17051e 100644 (file)
@@ -31,7 +31,7 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase;
 // 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
@@ -49,7 +49,7 @@ public:
 
     void SetContainerWindow(wxWindow *winParent)
     {
-        wxASSERT_MSG( !m_winParent, _T("shouldn't be called twice") );
+        wxASSERT_MSG( !m_winParent, wxT("shouldn't be called twice") );
 
         m_winParent = winParent;
     }
@@ -70,10 +70,14 @@ public:
     // 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:
@@ -86,6 +90,9 @@ protected:
     // the parent window we manage the children for
     wxWindow *m_winParent;
 
+    // the child which had the focus last time this panel was activated
+    wxWindow *m_winLastFocused;
+
 private:
     // value returned by AcceptsFocus(), should be changed using SetCanFocus()
     // only
@@ -93,10 +100,6 @@ private:
 
     // a guard against infinite recursion
     bool m_inSetFocus;
-
-    // the child which had the focus last time this panel was activated
-    wxWindow *m_winLastFocused;
-
 };
 
 // common part of WX_DECLARE_CONTROL_CONTAINER in the native and generic cases,
@@ -105,6 +108,7 @@ private:
 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();                                                  \
@@ -145,9 +149,13 @@ protected:                                                                    \
     bool classname::AcceptsFocus() const                                      \
     {                                                                         \
         return m_container.AcceptsFocus();                                    \
+    }                                                                         \
+                                                                              \
+    bool classname::AcceptsFocusFromKeyboard() const                          \
+    {                                                                         \
+        return m_container.AcceptsFocusFromKeyboard();                        \
     }
 
-
 #ifdef wxHAS_NATIVE_TAB_TRAVERSAL
 
 // ----------------------------------------------------------------------------
@@ -155,7 +163,7 @@ protected:                                                                    \
 // ----------------------------------------------------------------------------
 
 // 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
@@ -178,7 +186,7 @@ protected:
                                                                               \
     void classname::SetFocusIgnoringChildren()                                \
     {                                                                         \
-        SetFocus();                                                           \
+        basename::SetFocus();                                                 \
     }
 
 #else // !wxHAS_NATIVE_TAB_TRAVERSAL
@@ -190,7 +198,7 @@ class WXDLLIMPEXP_FWD_CORE wxNavigationKeyEvent;
 // 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
@@ -207,7 +215,7 @@ public:
 
 protected:
 
-    DECLARE_NO_COPY_CLASS(wxControlContainer)
+    wxDECLARE_NO_COPY_CLASS(wxControlContainer);
 };
 
 // ----------------------------------------------------------------------------
@@ -256,12 +264,13 @@ public:                                                                       \
     void classname::OnChildFocus(wxChildFocusEvent& event)                    \
     {                                                                         \
         m_container.SetLastFocus(event.GetWindow());                          \
+        event.Skip();                                                         \
     }                                                                         \
                                                                               \
     void classname::OnFocus(wxFocusEvent& event)                              \
     {                                                                         \
         m_container.HandleOnFocus(event);                                     \
-    } 
+    }
 
 #endif // wxHAS_NATIVE_TAB_TRAVERSAL/!wxHAS_NATIVE_TAB_TRAVERSAL