]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/statusbar.cpp
Use Enter and Space for cell editing in generic wxDVC too.
[wxWidgets.git] / src / msw / statusbar.cpp
index 3e374ca695bea798ee182036d70ff6a6f6ea9730..b82db9553bef168a5213b7b2b94a65b53e2f470a 100644 (file)
@@ -89,7 +89,7 @@ WXDWORD wxStatusBar::MSWGetStyle(long style, WXDWORD *exstyle) const
     WXDWORD msStyle = wxStatusBarBase::MSWGetStyle(style, exstyle);
 
     // wxSTB_SIZEGRIP is part of our default style but it doesn't make sense to
-    // show size grip if this is the status bar of a non-resizeable TLW so turn
+    // show size grip if this is the status bar of a non-resizable TLW so turn
     // it off in such case
     wxWindow * const parent = GetParent();
     wxCHECK_MSG( parent, msStyle, wxS("Status bar must have a parent") );
@@ -176,10 +176,6 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths)
     // this is a Windows limitation
     wxASSERT_MSG( (nFields > 0) && (nFields < 255), "too many fields" );
 
-    wxStatusBarBase::SetFieldsCount(nFields, widths);
-
-    MSWUpdateFieldsWidths();
-
     // keep in synch also our m_tooltips array
 
     // reset all current tooltips
@@ -189,7 +185,11 @@ void wxStatusBar::SetFieldsCount(int nFields, const int *widths)
     }
 
     // shrink/expand the array:
-    m_tooltips.resize(m_panes.GetCount(), NULL);
+    m_tooltips.resize(nFields, NULL);
+
+    wxStatusBarBase::SetFieldsCount(nFields, widths);
+
+    MSWUpdateFieldsWidths();
 }
 
 void wxStatusBar::SetStatusWidths(int n, const int widths[])
@@ -233,6 +233,8 @@ void wxStatusBar::MSWUpdateFieldsWidths()
     {
         nCurPos += widthsAbs[i] + extraWidth;
         pWidths[i] = nCurPos;
+
+        DoUpdateStatusText(i);
     }
 
     // The total width of the panes passed to Windows must be equal to the
@@ -246,9 +248,6 @@ void wxStatusBar::MSWUpdateFieldsWidths()
     }
 
     delete [] pWidths;
-
-
-    // FIXME: we may want to call DoUpdateStatusText() here since we may need to (de)ellipsize status texts
 }
 
 void wxStatusBar::DoUpdateStatusText(int nField)
@@ -374,7 +373,7 @@ int wxStatusBar::MSWGetBorderWidth() const
 /* static */
 const wxStatusBar::MSWMetrics& wxStatusBar::MSWGetMetrics()
 {
-    static MSWMetrics s_metrics = { 0 };
+    static MSWMetrics s_metrics = { 0, 0 };
     if ( !s_metrics.textMargin )
     {
         // Grip size should be self explanatory (the only problem with it is
@@ -502,9 +501,6 @@ void wxStatusBar::DoMoveWindow(int x, int y, int width, int height)
                        );
     }
 
-    // adjust fields widths to the new size
-    MSWUpdateFieldsWidths();
-
     // we have to trigger wxSizeEvent if there are children window in status
     // bar because GetFieldRect returned incorrect (not updated) values up to
     // here, which almost certainly resulted in incorrectly redrawn statusbar
@@ -595,15 +591,21 @@ wxStatusBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
     }
 #endif
 
-    bool needsEllipsization = HasFlag(wxSTB_ELLIPSIZE_START) ||
-                              HasFlag(wxSTB_ELLIPSIZE_MIDDLE) ||
-                              HasFlag(wxSTB_ELLIPSIZE_END);
-    if ( nMsg == WM_SIZE && needsEllipsization )
+    if ( nMsg == WM_SIZE )
     {
-        for (int i=0; i<GetFieldsCount(); i++)
-            DoUpdateStatusText(i);
-            // re-set the field text, in case we need to ellipsize
-            // (or de-ellipsize) some parts of it
+        MSWUpdateFieldsWidths();
+
+        if ( HasFlag(wxSTB_ELLIPSIZE_START) ||
+                HasFlag(wxSTB_ELLIPSIZE_MIDDLE) ||
+                    HasFlag(wxSTB_ELLIPSIZE_END) )
+        {
+            for (int i=0; i<GetFieldsCount(); i++)
+            {
+                // re-set the field text, in case we need to ellipsize
+                // (or de-ellipsize) some parts of it
+                DoUpdateStatusText(i);
+            }
+        }
     }
 
     return wxStatusBarBase::MSWWindowProc(nMsg, wParam, lParam);