2003-08-06 08:32:14 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: renddll.cpp
|
|
|
|
// Purpose: Example of a renderer implemented in a DLL
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 04.08.03
|
2004-05-25 07:20:37 -04:00
|
|
|
// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
|
2003-08-06 08:32:14 -04:00
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
2003-08-06 11:37:32 -04:00
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
2003-08-06 08:32:14 -04:00
|
|
|
#include "wx/renderer.h"
|
|
|
|
|
2003-08-07 04:34:28 -04:00
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/dc.h"
|
|
|
|
#endif
|
|
|
|
|
2006-04-27 09:50:20 -04:00
|
|
|
// 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
|
2003-08-06 08:32:14 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// draw the header control button (used by wxListCtrl)
|
2009-07-05 09:32:32 -04:00
|
|
|
virtual int DrawHeaderButton(wxWindow * WXUNUSED(win),
|
|
|
|
wxDC& dc,
|
|
|
|
const wxRect& rect,
|
|
|
|
int WXUNUSED(flags) = 0,
|
|
|
|
wxHeaderSortIconType WXUNUSED(sortArrow) = wxHDR_SORT_ICON_NONE,
|
2014-03-29 20:02:23 -04:00
|
|
|
wxHeaderButtonParams* WXUNUSED(params) = NULL) wxOVERRIDE
|
2003-08-06 08:32:14 -04:00
|
|
|
{
|
|
|
|
dc.SetBrush(*wxCYAN_BRUSH);
|
|
|
|
dc.SetTextForeground(*wxRED);
|
|
|
|
dc.DrawRoundedRectangle(rect, 10);
|
2009-07-05 09:32:32 -04:00
|
|
|
dc.DrawLabel("MyDllRenderer", wxNullBitmap, rect, wxALIGN_CENTER);
|
|
|
|
|
|
|
|
return dc.GetTextExtent("MyDllRenderer").x;
|
2003-08-06 08:32:14 -04:00
|
|
|
}
|
|
|
|
|
2014-03-29 20:02:23 -04:00
|
|
|
virtual wxRendererVersion GetVersion() const wxOVERRIDE
|
2003-08-10 11:51:30 -04:00
|
|
|
{
|
|
|
|
return wxRendererVersion(wxRendererVersion::Current_Version,
|
|
|
|
wxRendererVersion::Current_Age);
|
|
|
|
}
|
|
|
|
|
2003-08-06 08:32:14 -04:00
|
|
|
#if 0 // just for debugging
|
|
|
|
MyDllRenderer()
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxMessageBox(wxT("Creating MyDllRenderer"), wxT("Renderer Sample"));
|
2003-08-06 08:32:14 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~MyDllRenderer()
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxMessageBox(wxT("Deleting MyDllRenderer"), wxT("Renderer Sample"));
|
2003-08-06 08:32:14 -04:00
|
|
|
}
|
|
|
|
#endif // 0
|
|
|
|
};
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
WXEXPORT wxRendererNative *wxCreateRenderer()
|
|
|
|
{
|
|
|
|
return new MyDllRenderer;
|
|
|
|
}
|