]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/containr.h
Move wxMBConv_cf out of strconv.cpp and into strconv_cf.(cpp|h) by forking the files...
[wxWidgets.git] / include / wx / containr.h
index d9aed2f13d14a2dc148a7e4b518bcdf231daa13b..e738d679070cd0f79656d639821b8353ffa7c41f 100644 (file)
@@ -57,12 +57,21 @@ public:
     // returns whether we should accept focus ourselves or not
     bool AcceptsFocus() const { return m_acceptsFocus; }
 
     // returns whether we should accept focus ourselves or not
     bool AcceptsFocus() const { return m_acceptsFocus; }
 
+    // returns whether we or one of our children accepts focus: we always do
+    // because if we don't have any focusable children it probably means that
+    // we're not being used as a container at all (think of wxGrid or generic
+    // wxListCtrl) and so should get focus for ourselves
+    bool AcceptsFocusRecursively() const { return true; }
+
     // call this when the number of children of the window changes
     // call this when the number of children of the window changes
-    void UpdateCanFocus() { SetCanFocus(ShouldAcceptFocus()); }
+    //
+    // note that we have any children, this panel (used just as container for
+    // them) shouldn't get focus for itself
+    void UpdateCanFocus() { SetCanFocus(!HasAnyFocusableChildren()); }
 
 protected:
 
 protected:
-    // return true if we should be focusable
-    bool ShouldAcceptFocus() const;
+    // return true if we have any children accepting focus
+    bool HasAnyFocusableChildren() const;
 
     // the parent window we manage the children for
     wxWindow *m_winParent;
 
     // the parent window we manage the children for
     wxWindow *m_winParent;
@@ -78,6 +87,7 @@ private:
 #define WX_DECLARE_CONTROL_CONTAINER_BASE()                                   \
 public:                                                                       \
     virtual bool AcceptsFocus() const;                                        \
 #define WX_DECLARE_CONTROL_CONTAINER_BASE()                                   \
 public:                                                                       \
     virtual bool AcceptsFocus() const;                                        \
+    virtual bool AcceptsFocusRecursively() const;                             \
     virtual void AddChild(wxWindowBase *child);                               \
     virtual void RemoveChild(wxWindowBase *child);                            \
     void SetFocusIgnoringChildren();                                          \
     virtual void AddChild(wxWindowBase *child);                               \
     virtual void RemoveChild(wxWindowBase *child);                            \
     void SetFocusIgnoringChildren();                                          \
@@ -103,6 +113,11 @@ protected:                                                                    \
         m_container.UpdateCanFocus();                                         \
     }                                                                         \
                                                                               \
         m_container.UpdateCanFocus();                                         \
     }                                                                         \
                                                                               \
+    bool classname::AcceptsFocusRecursively() const                           \
+    {                                                                         \
+        return m_container.AcceptsFocusRecursively();                         \
+    }                                                                         \
+                                                                              \
     bool classname::AcceptsFocus() const                                      \
     {                                                                         \
         return m_container.AcceptsFocus();                                    \
     bool classname::AcceptsFocus() const                                      \
     {                                                                         \
         return m_container.AcceptsFocus();                                    \
@@ -163,9 +178,6 @@ public:
     // the focus and the default processing should take place
     bool DoSetFocus();
 
     // the focus and the default processing should take place
     bool DoSetFocus();
 
-    // can our child get the focus?
-    bool AcceptsFocus() const;
-
     // called from OnChildFocus() handler, i.e. when one of our (grand)
     // children gets the focus
     void SetLastFocus(wxWindow *win);
     // called from OnChildFocus() handler, i.e. when one of our (grand)
     // children gets the focus
     void SetLastFocus(wxWindow *win);
@@ -192,18 +204,14 @@ extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
 // ----------------------------------------------------------------------------
 
 // declare the methods to be forwarded
 // ----------------------------------------------------------------------------
 
 // declare the methods to be forwarded
-#define WX_DECLARE_CONTROL_CONTAINER() \
-public: \
-    void OnNavigationKey(wxNavigationKeyEvent& event); \
-    void OnFocus(wxFocusEvent& event); \
-    void SetFocusIgnoringChildren(); \
-    virtual void OnChildFocus(wxChildFocusEvent& event); \
-    virtual void SetFocus(); \
-    virtual void RemoveChild(wxWindowBase *child); \
-    virtual bool AcceptsFocus() const; \
-\
-protected: \
-    wxControlContainer m_container
+#define WX_DECLARE_CONTROL_CONTAINER()                                        \
+    WX_DECLARE_CONTROL_CONTAINER_BASE();                                      \
+                                                                              \
+public:                                                                       \
+    void OnNavigationKey(wxNavigationKeyEvent& event);                        \
+    void OnFocus(wxFocusEvent& event);                                        \
+    virtual void OnChildFocus(wxChildFocusEvent& event);                      \
+    virtual void SetFocus()
 
 // implement the event table entries for wxControlContainer
 #define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \
 
 // implement the event table entries for wxControlContainer
 #define WX_EVENT_TABLE_CONTROL_CONTAINER(classname) \