This is a combination of running clang-tidy with modernize-use-nullptr check for some ports (GTK, X11, OSX) and manual changes to the ports for which it couldn't be used easily (MSW, DFB) and also manually updating the docs. Also replace NULL with null or nullptr in the comments as this is more consistent with the use of nullptr in the code and makes it simpler to grep for the remaining occurrences of NULL itself. And also use null in the assert messages. Only a few occurrences of "NULL" are still left in non-C files, mostly corresponding to unclear comments or string output which it might not be safe to change.
64 lines
2 KiB
C++
64 lines
2 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: renddll.cpp
|
|
// Purpose: Example of a renderer implemented in a DLL
|
|
// Author: Vadim Zeitlin
|
|
// Modified by:
|
|
// Created: 04.08.03
|
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
// Licence: wxWindows licence
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
#include "wx/renderer.h"
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include "wx/dc.h"
|
|
#endif
|
|
|
|
// derive from wxDelegateRendererNative and not wxRendererNative itself to be
|
|
// able to only reimplement the methods we want to show and not all of them
|
|
class MyDllRenderer : public wxDelegateRendererNative
|
|
{
|
|
public:
|
|
// draw the header control button (used by wxListCtrl)
|
|
virtual int DrawHeaderButton(wxWindow * WXUNUSED(win),
|
|
wxDC& dc,
|
|
const wxRect& rect,
|
|
int WXUNUSED(flags) = 0,
|
|
wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE,
|
|
wxHeaderButtonParams* WXUNUSED(params) = nullptr) override
|
|
{
|
|
dc.SetBrush(*wxCYAN_BRUSH);
|
|
dc.SetTextForeground(*wxRED);
|
|
dc.DrawRoundedRectangle(rect, 10);
|
|
dc.DrawLabel("MyDllRenderer", wxNullBitmap, rect, wxALIGN_CENTER);
|
|
|
|
return dc.GetTextExtent("MyDllRenderer").x;
|
|
}
|
|
|
|
virtual wxRendererVersion GetVersion() const override
|
|
{
|
|
return wxRendererVersion(wxRendererVersion::Current_Version,
|
|
wxRendererVersion::Current_Age);
|
|
}
|
|
|
|
#if 0 // just for debugging
|
|
MyDllRenderer()
|
|
{
|
|
wxMessageBox("Creating MyDllRenderer", "Renderer Sample");
|
|
}
|
|
|
|
virtual ~MyDllRenderer()
|
|
{
|
|
wxMessageBox("Deleting MyDllRenderer", "Renderer Sample");
|
|
}
|
|
#endif // 0
|
|
};
|
|
|
|
extern "C"
|
|
WXEXPORT wxRendererNative *wxCreateRenderer()
|
|
{
|
|
return new MyDllRenderer;
|
|
}
|