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:
@@ -684,8 +684,7 @@ void wxWindowDFB::PaintWindow(const wxRect& rect)
|
||||
// only send wxNcPaintEvent if drawing at least part of nonclient area:
|
||||
if ( !clientRect.Contains(rect) )
|
||||
{
|
||||
wxNcPaintEvent eventNc(GetId());
|
||||
eventNc.SetEventObject(this);
|
||||
wxNcPaintEvent eventNc(this);
|
||||
HandleWindowEvent(eventNc);
|
||||
}
|
||||
else
|
||||
@@ -697,8 +696,7 @@ void wxWindowDFB::PaintWindow(const wxRect& rect)
|
||||
// only send wxPaintEvent if drawing at least part of client area:
|
||||
if ( rect.Intersects(clientRect) )
|
||||
{
|
||||
wxPaintEvent eventPt(GetId());
|
||||
eventPt.SetEventObject(this);
|
||||
wxPaintEvent eventPt(this);
|
||||
HandleWindowEvent(eventPt);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user