added wxAppTraits::CreateRenderer() which may be used to customize the renderer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-28 10:59:42 +00:00
parent 029b47ad2c
commit f0244295e3
12 changed files with 150 additions and 17 deletions

View File

@@ -19,6 +19,7 @@ class WXDLLEXPORT wxAppTraits;
#endif // wxUSE_FONTMAP
class WXDLLEXPORT wxLog;
class WXDLLEXPORT wxMessageOutput;
class WXDLLEXPORT wxRendererNative;
class WXDLLEXPORT wxString;
// ----------------------------------------------------------------------------
@@ -44,6 +45,13 @@ public:
virtual wxFontMapper *CreateFontMapper() = 0;
#endif // wxUSE_FONTMAP
// get the renderer to use for drawing the generic controls (return value
// may be NULL in which case the default renderer for the current platform
// is used); this is used in GUI only and always returns NULL in console
//
// NB: returned pointer will be deleted by the caller
virtual wxRendererNative *CreateRenderer() = 0;
// functions abstracting differences between GUI and console modes
// ------------------------------------------------------------------------
@@ -123,6 +131,7 @@ public:
#if wxUSE_FONTMAP
virtual wxFontMapper *CreateFontMapper();
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer();
#ifdef __WXDEBUG__
virtual bool ShowAssertDialog(const wxString& msg);
@@ -149,6 +158,7 @@ public:
#if wxUSE_FONTMAP
virtual wxFontMapper *CreateFontMapper();
#endif // wxUSE_FONTMAP
virtual wxRendererNative *CreateRenderer();
#ifdef __WXDEBUG__
virtual bool ShowAssertDialog(const wxString& msg);

View File

@@ -30,6 +30,13 @@ class WXDLLEXPORT wxWindow;
#include "wx/gdicmn.h" // for wxPoint
// some platforms have their own renderers, others use the generic one
#if defined(__WXMSW__) || defined(__WXMAC__) || defined(__WXGTK__)
#define wxHAS_NATIVE_RENDERER
#else
#undef wxHAS_NATIVE_RENDERER
#endif
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@@ -109,6 +116,9 @@ public:
// return the generic implementation of the renderer
static wxRendererNative& GetGeneric();
// return the default (native) implementation for this platform
static wxRendererNative& GetDefault();
};
// ----------------------------------------------------------------------------
@@ -159,5 +169,20 @@ protected:
DECLARE_NO_COPY_CLASS(wxDelegateRendererNative)
};
// ----------------------------------------------------------------------------
// inline functions implementation
// ----------------------------------------------------------------------------
#ifndef wxHAS_NATIVE_RENDERER
// default native renderer is the generic one then
/* static */ inline
wxRendererNative& wxRendererNative::GetDefault()
{
return GetGeneric();
}
#endif // !wxHAS_NATIVE_RENDERER
#endif // _WX_RENDERER_H_

View File

@@ -831,7 +831,17 @@ public:
wxSizer *GetSizer() const { return m_windowSizer; }
// Track if this window is a member of a sizer
void SetContainingSizer(wxSizer* sizer) { m_containingSizer = sizer; }
void SetContainingSizer(wxSizer* sizer)
{
// adding a window to a sizer twice is going to result in fatal and
// hard to debug problems later because when deleting the second
// associated wxSizerItem we're going to dereference a dangling
// pointer; so try to detect this as early as possible
wxASSERT_MSG( !sizer || m_containingSizer != sizer,
_T("Adding a window to the same sizer twice?") );
m_containingSizer = sizer;
}
wxSizer *GetContainingSizer() const { return m_containingSizer; }
// accessibility