+int wxHeaderCtrl::ConstrainByMinWidth(unsigned int col, int& xPhysical)
+{
+ const int xStart = GetColStart(col);
+
+ // notice that GetMinWidth() returns 0 if there is no minimal width so it
+ // still makes sense to use it even in this case
+ const int xMinEnd = xStart + GetColumn(col).GetMinWidth();
+
+ if ( xPhysical < xMinEnd )
+ xPhysical = xMinEnd;
+
+ return xPhysical - xStart;
+}
+
+void wxHeaderCtrl::StartOrContinueResizing(unsigned int col, int xPhysical)
+{
+ wxHeaderCtrlEvent event(IsResizing() ? wxEVT_COMMAND_HEADER_RESIZING
+ : wxEVT_COMMAND_HEADER_BEGIN_RESIZE,
+ GetId());
+ event.SetEventObject(this);
+ event.SetColumn(col);
+
+ event.SetWidth(ConstrainByMinWidth(col, xPhysical));
+
+ if ( GetEventHandler()->ProcessEvent(event) && !event.IsAllowed() )
+ {
+ if ( IsResizing() )
+ {
+ ReleaseMouse();
+ EndResizing(-1);
+ }
+ //else: nothing to do -- we just don't start to resize
+ }
+ else // go ahead with resizing
+ {
+ if ( !IsResizing() )
+ {
+ m_colBeingResized = col;
+ SetCursor(wxCursor(wxCURSOR_SIZEWE));
+ CaptureMouse();
+ }
+ //else: we had already done the above when we started
+
+ UpdateResizingMarker(xPhysical);
+ }
+}
+
+void wxHeaderCtrl::EndResizing(int xPhysical)