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:
@@ -2337,12 +2337,14 @@ private:
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
|
||||
{
|
||||
// This ctor is only intended to be used by wxWidgets itself, so it's
|
||||
// intentionally declared as private when not building the library itself.
|
||||
#ifdef WXBUILDING
|
||||
public:
|
||||
wxPaintEvent(int Id = 0)
|
||||
: wxEvent(Id, wxEVT_PAINT)
|
||||
{
|
||||
}
|
||||
#endif // WXBUILDING
|
||||
explicit wxPaintEvent(wxWindowBase* window = NULL);
|
||||
|
||||
public:
|
||||
// default copy ctor and dtor are fine
|
||||
|
||||
virtual wxEvent *Clone() const wxOVERRIDE { return new wxPaintEvent(*this); }
|
||||
@@ -2353,11 +2355,14 @@ private:
|
||||
|
||||
class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
|
||||
{
|
||||
// This ctor is only intended to be used by wxWidgets itself, so it's
|
||||
// intentionally declared as private when not building the library itself.
|
||||
#ifdef WXBUILDING
|
||||
public:
|
||||
wxNcPaintEvent(int winid = 0)
|
||||
: wxEvent(winid, wxEVT_NC_PAINT)
|
||||
{ }
|
||||
#endif // WXBUILDING
|
||||
explicit wxNcPaintEvent(wxWindowBase* window = NULL);
|
||||
|
||||
public:
|
||||
virtual wxEvent *Clone() const wxOVERRIDE { return new wxNcPaintEvent(*this); }
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user