Forbid creation of wxPaintEvent objects from user code
This doesn't work anyhow, so it's better to prevent the code doing this from compiling instead of getting run-time asserts or worse. Also simplify construction of these events inside wxWidgets by passing the window itself to the ctor instead of passing just its ID and calling SetEventObject() separately later. For consistency, do the same thing for wxNcPaintEvent too.
This commit is contained in:
@@ -458,6 +458,22 @@ wxString wxCommandEvent::GetString() const
|
||||
return m_cmdString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPaintEvent and wxNcPaintEvent
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxPaintEvent::wxPaintEvent(wxWindowBase* window)
|
||||
: wxEvent(window ? window->GetId() : 0, wxEVT_PAINT)
|
||||
{
|
||||
SetEventObject(window);
|
||||
}
|
||||
|
||||
wxNcPaintEvent::wxNcPaintEvent(wxWindowBase* window)
|
||||
: wxEvent(window ? window->GetId() : 0, wxEVT_NC_PAINT)
|
||||
{
|
||||
SetEventObject(window);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxUpdateUIEvent
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user