diff --git a/include/wx/propgrid/manager.h b/include/wx/propgrid/manager.h index c83d421191..bac5e33895 100644 --- a/include/wx/propgrid/manager.h +++ b/include/wx/propgrid/manager.h @@ -543,8 +543,8 @@ protected: #endif void OnResize( wxSizeEvent& event ); void OnPropertyGridSelect( wxPropertyGridEvent& event ); - void OnPGColDrag( wxPropertyGridEvent& event ); void OnPGScrollH(wxPropertyGridEvent& evt); + void OnColWidthsChanged(wxPropertyGridEvent& evt); wxPropertyGrid* m_pPropGrid; diff --git a/include/wx/propgrid/propgrid.h b/include/wx/propgrid/propgrid.h index 068b08cb3f..d705747cee 100644 --- a/include/wx/propgrid/propgrid.h +++ b/include/wx/propgrid/propgrid.h @@ -2030,7 +2030,9 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent ); +// Events used only internally wxDECLARE_EVENT(wxEVT_PG_HSCROLL, wxPropertyGridEvent); +wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent); #else enum { diff --git a/src/propgrid/manager.cpp b/src/propgrid/manager.cpp index 7faa43fc6c..f61125feb0 100644 --- a/src/propgrid/manager.cpp +++ b/src/propgrid/manager.cpp @@ -368,6 +368,7 @@ private: OnSetColumnWidth(col, colWidth); + pg->SendEvent(wxEVT_PG_COLS_RESIZED, NULL); pg->SendEvent(wxEVT_PG_COL_DRAGGING, NULL, NULL, 0, (unsigned int)col); @@ -1933,18 +1934,16 @@ void wxPropertyGridManager::ReconnectEventHandlers(wxWindowID oldId, wxWindowID { Unbind(wxEVT_PG_SELECTED, &wxPropertyGridManager::OnPropertyGridSelect, this, oldId); - Unbind(wxEVT_PG_COL_DRAGGING, &wxPropertyGridManager::OnPGColDrag, this, - oldId); Unbind(wxEVT_PG_HSCROLL, &wxPropertyGridManager::OnPGScrollH, this, oldId); + Unbind(wxEVT_PG_COLS_RESIZED, &wxPropertyGridManager::OnColWidthsChanged, this, oldId); } if (newId != wxID_NONE) { Bind(wxEVT_PG_SELECTED, &wxPropertyGridManager::OnPropertyGridSelect, this, newId); - Bind(wxEVT_PG_COL_DRAGGING, &wxPropertyGridManager::OnPGColDrag, this, - newId); Bind(wxEVT_PG_HSCROLL, &wxPropertyGridManager::OnPGScrollH, this, newId); + Bind(wxEVT_PG_COLS_RESIZED, &wxPropertyGridManager::OnColWidthsChanged, this, newId); } } @@ -1962,15 +1961,6 @@ void wxPropertyGridManager::OnPropertyGridSelect( wxPropertyGridEvent& event ) // ----------------------------------------------------------------------- -void -wxPropertyGridManager::OnPGColDrag( wxPropertyGridEvent& WXUNUSED(event) ) -{ -#if wxUSE_HEADERCTRL - if ( m_pHeaderCtrl && m_pHeaderCtrl->IsShown() ) - m_pHeaderCtrl->OnColumWidthsChanged(); -#endif -} - void wxPropertyGridManager::OnPGScrollH(wxPropertyGridEvent& evt) { #if wxUSE_HEADERCTRL @@ -1981,6 +1971,14 @@ void wxPropertyGridManager::OnPGScrollH(wxPropertyGridEvent& evt) #endif // wxUSE_HEADERCTRL } +void wxPropertyGridManager::OnColWidthsChanged(wxPropertyGridEvent& WXUNUSED(evt)) +{ +#if wxUSE_HEADERCTRL + if ( m_pHeaderCtrl ) + m_pHeaderCtrl->OnColumWidthsChanged(); +#endif +} + // ----------------------------------------------------------------------- void wxPropertyGridManager::OnResize( wxSizeEvent& WXUNUSED(event) ) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 51a7067bef..a8da11c02d 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -4892,6 +4892,7 @@ bool wxPropertyGrid::HandleMouseClick( int x, unsigned int y, wxMouseEvent &even { ResetColumnSizes( true ); + SendEvent(wxEVT_PG_COLS_RESIZED, NULL); SendEvent(wxEVT_PG_COL_DRAGGING, m_propHover, NULL, @@ -5050,6 +5051,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, wxPG_SPLITTER_REFRESH | wxPG_SPLITTER_FROM_EVENT); + SendEvent(wxEVT_PG_COLS_RESIZED, NULL); SendEvent(wxEVT_PG_COL_DRAGGING, m_propHover, NULL, @@ -6315,7 +6317,9 @@ wxDEFINE_EVENT( wxEVT_PG_LABEL_EDIT_ENDING, wxPropertyGridEvent ); wxDEFINE_EVENT( wxEVT_PG_COL_BEGIN_DRAG, wxPropertyGridEvent ); wxDEFINE_EVENT( wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent ); wxDEFINE_EVENT( wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent ); +// Events used only internally wxDEFINE_EVENT( wxEVT_PG_HSCROLL, wxPropertyGridEvent); +wxDEFINE_EVENT( wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent); // ----------------------------------------------------------------------- diff --git a/src/propgrid/propgridpagestate.cpp b/src/propgrid/propgridpagestate.cpp index d53e1ac4de..194be79c0c 100644 --- a/src/propgrid/propgridpagestate.cpp +++ b/src/propgrid/propgridpagestate.cpp @@ -398,6 +398,11 @@ void wxPropertyGridPageState::OnClientWidthChange( int newWidth, int widthChange } } } + + if ( pg->GetState() == this ) + { + pg->SendEvent(wxEVT_PG_COLS_RESIZED, NULL); + } } // -----------------------------------------------------------------------