]> git.saurik.com Git - wxWidgets.git/commitdiff
change grow box implementation - was incorrectly getting the focus in panels before
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Apr 2010 11:59:47 +0000 (11:59 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Apr 2010 11:59:47 +0000 (11:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/osx/window.h
src/osx/window_osx.cpp

index bdf48d8f74778af2baba84040fb1c0b421934cd2..51f34e91d776d732d281162f9e153ce24574afd5 100644 (file)
@@ -228,7 +228,7 @@ public:
     { return ((wxWindow*)m_hScrollBar == sb || (wxWindow*)m_vScrollBar == sb) ; }
     virtual bool IsClientAreaChild(const wxWindow *child) const
     {
-        return !MacIsWindowScrollbar(child) &&
+        return !MacIsWindowScrollbar(child) && !((wxWindow*)m_growBox==child) &&
                wxWindowBase::IsClientAreaChild(child);
     }
 
@@ -295,7 +295,7 @@ protected:
     wxScrollBar*        m_vScrollBar ;
     bool                m_hScrollBarAlwaysShown;
     bool                m_vScrollBarAlwaysShown;
-    wxPanel*            m_growBox ;
+    wxWindow*           m_growBox ;
     wxString            m_label ;
 
     // set to true if we do a sharp clip at the content area of this window
index 7fe1edcc410552e7991e532e9b74b1acf1ffbee5..89afdc7171e623a5862699ac4010435a387d8234 100644 (file)
@@ -93,6 +93,81 @@ END_EVENT_TABLE()
 // implementation
 // ===========================================================================
 
+// the grow box has to be implemented as an inactive window, so that nothing can direct
+// the focus to it
+
+class WXDLLIMPEXP_CORE wxBlindPlateWindow : public wxWindow
+{
+public:
+    wxBlindPlateWindow() { Init(); }
+    
+    // Old-style constructor (no default values for coordinates to avoid
+    // ambiguity with the new one)
+    wxBlindPlateWindow(wxWindow *parent,
+            int x, int y, int width, int height,
+            long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+            const wxString& name = wxPanelNameStr)
+    {
+        Init();
+        
+        Create(parent, wxID_ANY, wxPoint(x, y), wxSize(width, height), style, name);
+    }
+    
+    // Constructor
+    wxBlindPlateWindow(wxWindow *parent,
+            wxWindowID winid = wxID_ANY,
+            const wxPoint& pos = wxDefaultPosition,
+            const wxSize& size = wxDefaultSize,
+            long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+            const wxString& name = wxPanelNameStr)
+    {
+        Init();
+        
+        Create(parent, winid, pos, size, style, name);
+    }
+    
+    // Pseudo ctor
+    bool Create(wxWindow *parent,
+                wxWindowID winid = wxID_ANY,
+                const wxPoint& pos = wxDefaultPosition,
+                const wxSize& size = wxDefaultSize,
+                long style = wxTAB_TRAVERSAL | wxNO_BORDER,
+                const wxString& name = wxPanelNameStr)
+    {
+        if ( !wxWindow::Create(parent, winid, pos, size, style, name) )
+            return false;
+        
+        // so that non-solid background renders correctly under GTK+:
+        SetThemeEnabled(true);
+    }
+    
+    virtual ~wxBlindPlateWindow();
+    
+    virtual bool AcceptsFocus() const
+    {
+        return false;
+    }
+    
+protected:
+    // common part of all ctors
+    void Init()
+    {
+    }
+        
+    DECLARE_DYNAMIC_CLASS_NO_COPY(wxBlindPlateWindow)
+    DECLARE_EVENT_TABLE()
+};
+
+wxBlindPlateWindow::~wxBlindPlateWindow()
+{
+}
+
+IMPLEMENT_DYNAMIC_CLASS(wxBlindPlateWindow, wxWindow)
+
+BEGIN_EVENT_TABLE(wxBlindPlateWindow, wxWindow)
+END_EVENT_TABLE()
+
+
 // ----------------------------------------------------------------------------
  // constructors and such
 // ----------------------------------------------------------------------------
@@ -398,6 +473,14 @@ bool wxWindowMac::SetForegroundColour(const wxColour& col )
 
 bool wxWindowMac::SetBackgroundColour(const wxColour& col )
 {
+    if (m_growBox)
+    {
+        if ( m_backgroundColour.Ok() )
+            m_growBox->SetBackgroundColour(m_backgroundColour);
+        else
+            m_growBox->SetBackgroundColour(*wxWHITE);
+    }
+
     if ( !wxWindowBase::SetBackgroundColour(col) && m_hasBgCol )
         return false ;
 
@@ -1531,16 +1614,12 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
         child = node->GetData();
         if (child == NULL)
             continue;
-#if wxUSE_SCROLLBAR
-        if (child == m_vScrollBar)
-            continue;
-        if (child == m_hScrollBar)
-            continue;
-        if (child == m_growBox)
-            continue;
-#endif
+
         if (child->IsTopLevel())
             continue;
+        
+        if ( !IsClientAreaChild(child) )
+            continue;
 
         child->GetPosition( &x, &y );
         child->GetSize( &w, &h );
@@ -1890,7 +1969,8 @@ bool wxWindowMac::MacDoRedraw( long time )
             wxFAIL_MSG( "unsupported background style" );
     }
 
-    MacPaintGrowBox();
+    // as this is a full window, shouldn't be necessary anymore
+    // MacPaintGrowBox();
 
     // calculate a client-origin version of the update rgn and set
     // m_updateRegion to that
@@ -2069,7 +2149,7 @@ void wxWindowMac::MacCreateScrollBars( long style )
 
         wxPoint gPoint(width - scrlsize, height - scrlsize);
         wxSize gSize(scrlsize, scrlsize);
-        m_growBox = new wxPanel((wxWindow *)this, wxID_ANY, gPoint, gSize, 0);
+        m_growBox = new wxBlindPlateWindow((wxWindow *)this, wxID_ANY, gPoint, gSize, 0);
     }
 
     // because the create does not take into account the client area origin