diff --git a/include/wx/headerctrl.h b/include/wx/headerctrl.h index f491fcbc7a..f2270bf78e 100644 --- a/include/wx/headerctrl.h +++ b/include/wx/headerctrl.h @@ -345,6 +345,8 @@ protected: return -1; } + void OnHeaderResizing(wxHeaderCtrlEvent& evt); + private: // functions implementing our public API void DoInsert(const wxHeaderColumnSimple& col, unsigned int idx); @@ -371,6 +373,7 @@ private: wxDECLARE_NO_COPY_CLASS(wxHeaderCtrlSimple); + wxDECLARE_EVENT_TABLE(); }; // ---------------------------------------------------------------------------- diff --git a/src/common/headerctrlcmn.cpp b/src/common/headerctrlcmn.cpp index 54bb90119e..2f5eeff7a7 100644 --- a/src/common/headerctrlcmn.cpp +++ b/src/common/headerctrlcmn.cpp @@ -386,6 +386,10 @@ bool wxHeaderCtrlBase::ShowCustomizeDialog() // wxHeaderCtrlSimple implementation // ============================================================================ +wxBEGIN_EVENT_TABLE(wxHeaderCtrlSimple, wxHeaderCtrl) + EVT_HEADER_RESIZING(wxID_ANY, wxHeaderCtrlSimple::OnHeaderResizing) +wxEND_EVENT_TABLE() + void wxHeaderCtrlSimple::Init() { m_sortKey = wxNO_COLUMN; @@ -466,6 +470,12 @@ wxHeaderCtrlSimple::UpdateColumnWidthToFit(unsigned int idx, int widthTitle) return true; } +void wxHeaderCtrlSimple::OnHeaderResizing(wxHeaderCtrlEvent& evt) +{ + m_cols[evt.GetColumn()].SetWidth(evt.GetWidth()); + Refresh(); +} + // ============================================================================ // wxHeaderCtrlEvent implementation // ============================================================================