]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/headerctrlg.cpp
Correct sorting in wxDataViewTreeStore, fixes #11436, part II
[wxWidgets.git] / src / generic / headerctrlg.cpp
index 90afc8de8fb6be9bbf62b7d5d99981624ab8d6ca..88f63ed867ab36cd1520215e019a6bd29f976df5 100644 (file)
@@ -133,11 +133,14 @@ void wxHeaderCtrl::DoScrollHorz(int dx)
 
 wxSize wxHeaderCtrl::DoGetBestSize() const
 {
+    wxWindow *win = GetParent();
+    int height = wxRendererNative::Get().GetHeaderButtonHeight( win );
+
     // the vertical size is rather arbitrary but it looks better if we leave
     // some space around the text
     const wxSize size(IsEmpty() ? wxHeaderCtrlBase::DoGetBestSize().x
                                 : GetColEnd(GetColumnCount() - 1),
-                      (7*GetCharHeight())/4);
+                                height ); // (7*GetCharHeight())/4);
     CacheBestSize(size);
     return size;
 }
@@ -255,26 +258,14 @@ void wxHeaderCtrl::ClearMarkers()
     dcover.Clear();
 }
 
-void wxHeaderCtrl::UpdateResizingMarker(int xPhysical)
-{
-    wxClientDC dc(this);
-
-    wxDCOverlay dcover(m_overlay, &dc);
-    dcover.Clear();
-
-    // unfortunately drawing the marker over the parent window doesn't work as
-    // it's usually covered by another window (the main control view) so just
-    // draw the marker over the header itself, even if it makes it not very
-    // useful
-    dc.SetPen(*wxLIGHT_GREY_PEN);
-    dc.DrawLine(xPhysical, 0, xPhysical, GetClientSize().y);
-}
-
 void wxHeaderCtrl::EndDragging()
 {
-    ClearMarkers();
-
-    m_overlay.Reset();
+    // We currently only use markers for reordering, not for resizing
+    if (IsReordering())
+    {
+        ClearMarkers();
+        m_overlay.Reset();
+    }
 
     // don't use the special dragging cursor any more
     SetCursor(wxNullCursor);
@@ -341,7 +332,6 @@ void wxHeaderCtrl::StartOrContinueResizing(unsigned int col, int xPhysical)
         }
         //else: we had already done the above when we started
 
-        UpdateResizingMarker(xPhysical);
     }
 }
 
@@ -493,6 +483,11 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
     int w, h;
     GetClientSize(&w, &h);
 
+#ifdef __WXGTK__
+//    int vw;
+//    GetVirtualSize(&vw, NULL);
+#endif
+
     wxAutoBufferedPaintDC dc(this);
 
     dc.SetBackground(GetBackgroundColour());
@@ -510,7 +505,7 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
         if ( col.IsHidden() )
             continue;
 
-        const int colWidth = col.GetWidth();
+        int colWidth = col.GetWidth();
 
         wxHeaderSortIconType sortArrow;
         if ( col.IsSortKey() )
@@ -534,11 +529,22 @@ void wxHeaderCtrl::OnPaint(wxPaintEvent& WXUNUSED(event))
             state = wxCONTROL_DISABLED;
         }
 
+        if (i == 0)
+           state |= wxCONTROL_SPECIAL;
+
         wxHeaderButtonParams params;
         params.m_labelText = col.GetTitle();
         params.m_labelBitmap = col.GetBitmap();
         params.m_labelAlignment = col.GetAlignment();
 
+#ifdef __WXGTK__
+        if (i == count-1)
+        {
+//            colWidth = wxMax( colWidth, vw - xpos );
+            state |= wxCONTROL_DIRTY;
+        }
+#endif
+
         wxRendererNative::Get().DrawHeaderButton
                                 (
                                     this,