Use dedicated event type to notify header about column width changes
Notification about changes of column widths needs to be sent locally from wxPropertyGrid to wxPropertyGridManager (to update the header) so it would be good to use a dedicated non-public event type for these purposes.
This commit is contained in:
parent
fa35fdc600
commit
f39e70be15
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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) )
|
||||
|
@ -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);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
|
@ -398,6 +398,11 @@ void wxPropertyGridPageState::OnClientWidthChange( int newWidth, int widthChange
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( pg->GetState() == this )
|
||||
{
|
||||
pg->SendEvent(wxEVT_PG_COLS_RESIZED, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user