simplify/cleanup wxTheXXXList and wxGDIObject code (patch 1452023 from Paul Cornett)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38767 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d0914b9d8d
commit
1de8d512b7
@ -898,7 +898,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/gtk/dcscreen.h
|
||||
wx/gtk/dnd.h
|
||||
wx/gtk/font.h
|
||||
wx/gtk/gdiobj.h
|
||||
wx/gtk/icon.h
|
||||
wx/gtk/minifram.h
|
||||
wx/gtk/pen.h
|
||||
@ -1069,7 +1068,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/gtk1/dcscreen.h
|
||||
wx/gtk1/dnd.h
|
||||
wx/gtk1/font.h
|
||||
wx/gtk1/gdiobj.h
|
||||
wx/gtk1/icon.h
|
||||
wx/gtk1/minifram.h
|
||||
wx/gtk1/pen.h
|
||||
@ -1300,7 +1298,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/motif/font.h
|
||||
wx/motif/frame.h
|
||||
wx/motif/gauge.h
|
||||
wx/motif/gdiobj.h
|
||||
wx/motif/icon.h
|
||||
wx/motif/listbox.h
|
||||
wx/motif/mdi.h
|
||||
@ -1385,7 +1382,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/x11/dcscreen.h
|
||||
wx/x11/dnd.h
|
||||
wx/x11/font.h
|
||||
wx/x11/gdiobj.h
|
||||
wx/x11/icon.h
|
||||
wx/x11/minifram.h
|
||||
wx/x11/palette.h
|
||||
@ -1551,7 +1547,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/msw/frame.h
|
||||
wx/msw/gauge95.h
|
||||
wx/msw/gdiimage.h
|
||||
wx/msw/gdiobj.h
|
||||
wx/msw/icon.h
|
||||
wx/msw/imaglist.h
|
||||
wx/msw/iniconf.h
|
||||
@ -1731,7 +1726,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/mgl/dcscreen.h
|
||||
wx/mgl/font.h
|
||||
wx/mgl/fontutil.h
|
||||
wx/mgl/gdiobj.h
|
||||
wx/mgl/icon.h
|
||||
wx/mgl/palette.h
|
||||
wx/mgl/pen.h
|
||||
@ -1874,7 +1868,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/os2/frame.h
|
||||
wx/os2/gauge.h
|
||||
wx/os2/gdiimage.h
|
||||
wx/os2/gdiobj.h
|
||||
wx/os2/helpwin.h
|
||||
wx/os2/icon.h
|
||||
wx/os2/iniconf.h
|
||||
@ -2069,7 +2062,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/mac/fontdlg.h
|
||||
wx/mac/frame.h
|
||||
wx/mac/gauge.h
|
||||
wx/mac/gdiobj.h
|
||||
wx/mac/glcanvas.h
|
||||
wx/mac/gsockmac.h
|
||||
wx/mac/helpxxxx.h
|
||||
@ -2156,7 +2148,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/mac/carbon/fontdlg.h
|
||||
wx/mac/carbon/frame.h
|
||||
wx/mac/carbon/gauge.h
|
||||
wx/mac/carbon/gdiobj.h
|
||||
wx/mac/carbon/gsockmac.h
|
||||
wx/mac/carbon/helpxxxx.h
|
||||
wx/mac/carbon/icon.h
|
||||
@ -2361,7 +2352,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
||||
wx/cocoa/fontdlg.h
|
||||
wx/cocoa/frame.h
|
||||
wx/cocoa/gauge.h
|
||||
wx/cocoa/gdiobj.h
|
||||
wx/cocoa/icon.h
|
||||
wx/cocoa/listbox.h
|
||||
wx/cocoa/log.h
|
||||
|
@ -371,13 +371,6 @@ Constructor. The application should not construct its own brush list:
|
||||
use the object pointer {\bf wxTheBrushList}.
|
||||
|
||||
|
||||
\membersection{wxBrushList::AddBrush}\label{wxbrushlistaddbrush}
|
||||
|
||||
\func{void}{AddBrush}{\param{wxBrush *}{brush}}
|
||||
|
||||
Used internally by wxWidgets to add a brush to the list.
|
||||
|
||||
|
||||
\membersection{wxBrushList::FindOrCreateBrush}\label{wxbrushlistfindorcreatebrush}
|
||||
|
||||
\func{wxBrush *}{FindOrCreateBrush}{\param{const wxColour\& }{colour}, \param{int}{ style = wxSOLID}}
|
||||
@ -392,10 +385,3 @@ to the brush list, and returns it.
|
||||
\docparam{style}{Brush style. See \helpref{wxBrush::SetStyle}{wxbrushsetstyle} for a list of styles.}
|
||||
|
||||
|
||||
\membersection{wxBrushList::RemoveBrush}\label{wxbrushlistremovebrush}
|
||||
|
||||
\func{void}{RemoveBrush}{\param{wxBrush *}{brush}}
|
||||
|
||||
Used by wxWidgets to remove a brush from the list.
|
||||
|
||||
|
||||
|
@ -29,12 +29,6 @@ deleted and their resources freed, eliminating the possibility of `memory leaks'
|
||||
Constructor. The application should not construct its own font list:
|
||||
use the object pointer {\bf wxTheFontList}.
|
||||
|
||||
\membersection{wxFontList::AddFont}\label{wxfontlistaddfont}
|
||||
|
||||
\func{void}{AddFont}{\param{wxFont *}{font}}
|
||||
|
||||
Used by wxWidgets to add a font to the list, called in the font constructor.
|
||||
|
||||
\membersection{wxFontList::FindOrCreateFont}\label{findorcreatefont}
|
||||
|
||||
\func{wxFont *}{FindOrCreateFont}{\param{int}{ point\_size}, \param{int}{ family}, \param{int}{ style}, \param{int}{ weight}, \param{bool}{ underline = false},
|
||||
@ -43,10 +37,3 @@ Used by wxWidgets to add a font to the list, called in the font constructor.
|
||||
Finds a font of the given specification, or creates one and adds it to the list. See the \helpref{wxFont constructor}{wxfontctor} for
|
||||
details of the arguments.
|
||||
|
||||
\membersection{wxFontList::RemoveFont}\label{wxfontlistremovefont}
|
||||
|
||||
\func{void}{RemoveFont}{\param{wxFont *}{font}}
|
||||
|
||||
Used by wxWidgets to remove a font from the list.
|
||||
|
||||
|
||||
|
@ -390,12 +390,6 @@ backward compatibility with earlier versions of wxWidgets.
|
||||
Constructor. The application should not construct its own pen list:
|
||||
use the object pointer {\bf wxThePenList}.
|
||||
|
||||
\membersection{wxPenList::AddPen}\label{wxpenlistaddpen}
|
||||
|
||||
\func{void}{AddPen}{\param{wxPen*}{ pen}}
|
||||
|
||||
Used internally by wxWidgets to add a pen to the list.
|
||||
|
||||
\membersection{wxPenList::FindOrCreatePen}\label{wxpenlistfindorcreatepen}
|
||||
|
||||
\func{wxPen*}{FindOrCreatePen}{\param{const wxColour\& }{colour}, \param{int}{ width}, \param{int}{ style}}
|
||||
@ -417,9 +411,3 @@ to the pen list, and returns it.
|
||||
\docparam{width}{Width of pen.}
|
||||
|
||||
\docparam{style}{Pen style. See \helpref{wxPen::wxPen}{wxpenctor} for a list of styles.}
|
||||
|
||||
\membersection{wxPenList::RemovePen}\label{wxpenlistremovepen}
|
||||
|
||||
\func{void}{RemovePen}{\param{wxPen*}{ pen}}
|
||||
|
||||
Used by wxWidgets to remove a pen from the list.
|
||||
|
@ -452,40 +452,46 @@ public:
|
||||
|
||||
typedef wxInt8 wxDash;
|
||||
|
||||
class WXDLLEXPORT wxPenList : public wxList
|
||||
class WXDLLIMPEXP_CORE wxGDIObjListBase {
|
||||
public:
|
||||
wxGDIObjListBase();
|
||||
~wxGDIObjListBase();
|
||||
|
||||
protected:
|
||||
wxList list;
|
||||
};
|
||||
|
||||
class WXDLLIMPEXP_CORE wxPenList: public wxGDIObjListBase
|
||||
{
|
||||
public:
|
||||
wxPenList() { }
|
||||
~wxPenList();
|
||||
|
||||
void AddPen(wxPen *pen);
|
||||
void RemovePen(wxPen *pen);
|
||||
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
wxDEPRECATED( void AddPen(wxPen*) );
|
||||
wxDEPRECATED( void RemovePen(wxPen*) );
|
||||
#endif
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBrushList : public wxList
|
||||
class WXDLLIMPEXP_CORE wxBrushList: public wxGDIObjListBase
|
||||
{
|
||||
public:
|
||||
wxBrushList() { }
|
||||
~wxBrushList();
|
||||
|
||||
void AddBrush(wxBrush *brush);
|
||||
void RemoveBrush(wxBrush *brush);
|
||||
wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID);
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
wxDEPRECATED( void AddBrush(wxBrush*) );
|
||||
wxDEPRECATED( void RemoveBrush(wxBrush*) );
|
||||
#endif
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxFontList : public wxList
|
||||
class WXDLLIMPEXP_CORE wxFontList: public wxGDIObjListBase
|
||||
{
|
||||
public:
|
||||
wxFontList() { }
|
||||
~wxFontList();
|
||||
|
||||
void AddFont(wxFont *font);
|
||||
void RemoveFont(wxFont *font);
|
||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||
bool underline = false,
|
||||
const wxString& face = wxEmptyString,
|
||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
wxDEPRECATED( void AddFont(wxFont*) );
|
||||
wxDEPRECATED( void RemoveFont(wxFont*) );
|
||||
#endif
|
||||
};
|
||||
|
||||
WX_DECLARE_STRING_HASH_MAP( wxColour *, wxStringToColourHashMap );
|
||||
@ -523,16 +529,6 @@ private:
|
||||
wxStringToColourHashMap *m_map;
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxBitmapList : public wxList
|
||||
{
|
||||
public:
|
||||
wxBitmapList(){}
|
||||
~wxBitmapList();
|
||||
|
||||
void AddBitmap(wxBitmap *bitmap);
|
||||
void RemoveBitmap(wxBitmap *bitmap);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxResourceCache: public wxList
|
||||
{
|
||||
public:
|
||||
@ -551,7 +547,6 @@ public:
|
||||
extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
|
||||
extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
|
||||
extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
|
||||
extern WXDLLEXPORT_DATA(wxBitmapList*) wxTheBitmapList;
|
||||
|
||||
/* Stock objects
|
||||
|
||||
|
@ -12,29 +12,40 @@
|
||||
#ifndef _WX_GDIOBJ_H_BASE_
|
||||
#define _WX_GDIOBJ_H_BASE_
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
|
||||
#if defined(__WXPALMOS__)
|
||||
#include "wx/palmos/gdiobj.h"
|
||||
#elif defined(__WXMSW__)
|
||||
#include "wx/msw/gdiobj.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/gdiobj.h"
|
||||
#elif defined(__WXGTK20__)
|
||||
#include "wx/gtk/gdiobj.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk1/gdiobj.h"
|
||||
#elif defined(__WXX11__)
|
||||
#include "wx/x11/gdiobj.h"
|
||||
#elif defined(__WXMGL__)
|
||||
#include "wx/mgl/gdiobj.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/gdiobj.h"
|
||||
#elif defined(__WXCOCOA__)
|
||||
#include "wx/cocoa/gdiobj.h"
|
||||
#elif defined(__WXPM__)
|
||||
#include "wx/os2/gdiobj.h"
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGDIRefData is the base class for wxXXXData structures which contain the
|
||||
// real data for the GDI object and are shared among all wxWin objects sharing
|
||||
// the same native GDI object
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGDIRefData: public wxObjectRefData { };
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGDIObject
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_CORE wxGDIObject: public wxObject
|
||||
{
|
||||
public:
|
||||
bool IsNull() const { return m_refData == NULL; }
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXOS2__) || defined(__WXPALMOS__)
|
||||
// Creates the resource
|
||||
virtual bool RealizeResource() { return false; }
|
||||
|
||||
// Frees the resource
|
||||
virtual bool FreeResource(bool WXUNUSED(force) = false) { return false; }
|
||||
|
||||
virtual bool IsFree() const { return false; }
|
||||
|
||||
// Returns handle.
|
||||
virtual WXHANDLE GetResourceHandle() const { return 0; }
|
||||
#endif // defined(__WXMSW__) || defined(__WXOS2__)
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxGDIObject)
|
||||
};
|
||||
|
||||
#endif
|
||||
// _WX_GDIOBJ_H_BASE_
|
||||
|
@ -97,8 +97,6 @@ bool wxFont::Create(int pointSize, int family, int style, int weight, bool under
|
||||
|
||||
wxFont::~wxFont()
|
||||
{
|
||||
if (wxTheFontList)
|
||||
wxTheFontList->DeleteObject(this);
|
||||
}
|
||||
|
||||
bool wxFont::RealizeResource()
|
||||
|
@ -48,7 +48,6 @@ int wxPageNumber;
|
||||
wxFontList *wxTheFontList = NULL;
|
||||
wxPenList *wxThePenList = NULL;
|
||||
wxBrushList *wxTheBrushList = NULL;
|
||||
wxBitmapList *wxTheBitmapList = NULL;
|
||||
wxColourDatabase *wxTheColourDatabase = NULL;
|
||||
|
||||
// 'Null' objects
|
||||
|
@ -719,7 +719,6 @@ void wxInitializeStockLists()
|
||||
wxTheBrushList = new wxBrushList;
|
||||
wxThePenList = new wxPenList;
|
||||
wxTheFontList = new wxFontList;
|
||||
wxTheBitmapList = new wxBitmapList;
|
||||
}
|
||||
|
||||
void wxDeleteStockLists()
|
||||
@ -727,57 +726,30 @@ void wxDeleteStockLists()
|
||||
wxDELETE(wxTheBrushList);
|
||||
wxDELETE(wxThePenList);
|
||||
wxDELETE(wxTheFontList);
|
||||
wxDELETE(wxTheBitmapList);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// wxTheXXXList stuff (semi-obsolete)
|
||||
// ============================================================================
|
||||
|
||||
wxBitmapList::~wxBitmapList ()
|
||||
wxGDIObjListBase::wxGDIObjListBase()
|
||||
{
|
||||
wxList::compatibility_iterator node = GetFirst ();
|
||||
while (node)
|
||||
}
|
||||
|
||||
wxGDIObjListBase::~wxGDIObjListBase()
|
||||
{
|
||||
for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
wxBitmap *bitmap = (wxBitmap *) node->GetData ();
|
||||
wxList::compatibility_iterator next = node->GetNext ();
|
||||
if (bitmap->GetVisible())
|
||||
delete bitmap;
|
||||
node = next;
|
||||
delete wx_static_cast(wxObject*, node->GetData());
|
||||
}
|
||||
}
|
||||
|
||||
// Pen and Brush lists
|
||||
wxPenList::~wxPenList ()
|
||||
{
|
||||
wxList::compatibility_iterator node = GetFirst ();
|
||||
while (node)
|
||||
{
|
||||
wxPen *pen = (wxPen *) node->GetData ();
|
||||
wxList::compatibility_iterator next = node->GetNext ();
|
||||
if (pen->GetVisible())
|
||||
delete pen;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxPenList::AddPen (wxPen * pen)
|
||||
{
|
||||
Append (pen);
|
||||
}
|
||||
|
||||
void wxPenList::RemovePen (wxPen * pen)
|
||||
{
|
||||
DeleteObject (pen);
|
||||
}
|
||||
|
||||
wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
|
||||
{
|
||||
for (wxList::compatibility_iterator node = GetFirst (); node; node = node->GetNext ())
|
||||
for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
wxPen *each_pen = (wxPen *) node->GetData ();
|
||||
if (each_pen &&
|
||||
each_pen->GetVisible() &&
|
||||
if (
|
||||
each_pen->GetWidth () == width &&
|
||||
each_pen->GetStyle () == style &&
|
||||
each_pen->GetColour ().Red () == colour.Red () &&
|
||||
@ -786,48 +758,23 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
|
||||
return each_pen;
|
||||
}
|
||||
|
||||
wxPen *pen = new wxPen (colour, width, style);
|
||||
if ( !pen->Ok() )
|
||||
wxPen* pen = NULL;
|
||||
wxPen penTmp(colour, width, style);
|
||||
if (penTmp.Ok())
|
||||
{
|
||||
// don't save the invalid pens in the list
|
||||
delete pen;
|
||||
|
||||
return NULL;
|
||||
pen = new wxPen(penTmp);
|
||||
list.Append(pen);
|
||||
}
|
||||
|
||||
AddPen(pen);
|
||||
|
||||
// we'll delete it ourselves later
|
||||
pen->SetVisible(true);
|
||||
|
||||
return pen;
|
||||
}
|
||||
|
||||
wxBrushList::~wxBrushList ()
|
||||
{
|
||||
wxList::compatibility_iterator node = GetFirst ();
|
||||
while (node)
|
||||
{
|
||||
wxBrush *brush = (wxBrush *) node->GetData ();
|
||||
wxList::compatibility_iterator next = node->GetNext ();
|
||||
if (brush && brush->GetVisible())
|
||||
delete brush;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxBrushList::AddBrush (wxBrush * brush)
|
||||
{
|
||||
Append (brush);
|
||||
}
|
||||
|
||||
wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
|
||||
{
|
||||
for (wxList::compatibility_iterator node = GetFirst (); node; node = node->GetNext ())
|
||||
for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
wxBrush *each_brush = (wxBrush *) node->GetData ();
|
||||
if (each_brush &&
|
||||
each_brush->GetVisible() &&
|
||||
if (
|
||||
each_brush->GetStyle () == style &&
|
||||
each_brush->GetColour ().Red () == colour.Red () &&
|
||||
each_brush->GetColour ().Green () == colour.Green () &&
|
||||
@ -835,56 +782,17 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
|
||||
return each_brush;
|
||||
}
|
||||
|
||||
wxBrush *brush = new wxBrush (colour, style);
|
||||
|
||||
if ( !brush->Ok() )
|
||||
wxBrush* brush = NULL;
|
||||
wxBrush brushTmp(colour, style);
|
||||
if (brushTmp.Ok())
|
||||
{
|
||||
// don't put the brushes we failed to create into the list
|
||||
delete brush;
|
||||
|
||||
return NULL;
|
||||
brush = new wxBrush(brushTmp);
|
||||
list.Append(brush);
|
||||
}
|
||||
|
||||
AddBrush(brush);
|
||||
|
||||
// we'll delete it ourselves later
|
||||
brush->SetVisible(true);
|
||||
|
||||
return brush;
|
||||
}
|
||||
|
||||
void wxBrushList::RemoveBrush (wxBrush * brush)
|
||||
{
|
||||
DeleteObject (brush);
|
||||
}
|
||||
|
||||
wxFontList::~wxFontList ()
|
||||
{
|
||||
wxList::compatibility_iterator node = GetFirst ();
|
||||
while (node)
|
||||
{
|
||||
// Only delete objects that are 'visible', i.e.
|
||||
// that have been created using FindOrCreate...,
|
||||
// where the pointers are expected to be shared
|
||||
// (and therefore not deleted by any one part of an app).
|
||||
wxFont *font = (wxFont *) node->GetData ();
|
||||
wxList::compatibility_iterator next = node->GetNext ();
|
||||
if (font->GetVisible())
|
||||
delete font;
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
void wxFontList::AddFont (wxFont * font)
|
||||
{
|
||||
Append (font);
|
||||
}
|
||||
|
||||
void wxFontList::RemoveFont (wxFont * font)
|
||||
{
|
||||
DeleteObject (font);
|
||||
}
|
||||
|
||||
wxFont *wxFontList::FindOrCreateFont(int pointSize,
|
||||
int family,
|
||||
int style,
|
||||
@ -893,13 +801,12 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
|
||||
const wxString& facename,
|
||||
wxFontEncoding encoding)
|
||||
{
|
||||
wxFont *font = (wxFont *)NULL;
|
||||
wxFont *font;
|
||||
wxList::compatibility_iterator node;
|
||||
for ( node = GetFirst(); node; node = node->GetNext() )
|
||||
for (node = list.GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
font = (wxFont *)node->GetData();
|
||||
if ( font->GetVisible() &&
|
||||
font->Ok() &&
|
||||
if (
|
||||
font->GetPointSize () == pointSize &&
|
||||
font->GetStyle () == style &&
|
||||
font->GetWeight () == weight &&
|
||||
@ -944,30 +851,26 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
|
||||
}
|
||||
}
|
||||
|
||||
if ( !node )
|
||||
// font not found, create the new one
|
||||
font = NULL;
|
||||
wxFont fontTmp(pointSize, family, style, weight, underline, facename, encoding);
|
||||
if (fontTmp.Ok())
|
||||
{
|
||||
// font not found, create the new one
|
||||
font = new wxFont(pointSize, family, style, weight,
|
||||
underline, facename, encoding);
|
||||
|
||||
AddFont(font);
|
||||
|
||||
// and mark it as being cacheable
|
||||
font->SetVisible(true);
|
||||
font = new wxFont(fontTmp);
|
||||
list.Append(font);
|
||||
}
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
void wxBitmapList::AddBitmap(wxBitmap *bitmap)
|
||||
{
|
||||
Append(bitmap);
|
||||
}
|
||||
|
||||
void wxBitmapList::RemoveBitmap(wxBitmap *bitmap)
|
||||
{
|
||||
DeleteObject(bitmap);
|
||||
}
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
void wxBrushList::AddBrush(wxBrush*) { }
|
||||
void wxBrushList::RemoveBrush(wxBrush*) { }
|
||||
void wxFontList::AddFont(wxFont*) { }
|
||||
void wxFontList::RemoveFont(wxFont*) { }
|
||||
void wxPenList::AddPen(wxPen*) { }
|
||||
void wxPenList::RemovePen(wxPen*) { }
|
||||
#endif
|
||||
|
||||
wxSize wxGetDisplaySize()
|
||||
{
|
||||
|
@ -28,6 +28,8 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
|
||||
|
||||
#define M_GDIDATA wx_static_cast(wxGDIRefData*, m_refData)
|
||||
|
||||
/*
|
||||
void wxGDIObject::IncrementResourceUsage(void)
|
||||
{
|
||||
|
@ -54,14 +54,10 @@ wxBrushRefData::~wxBrushRefData()
|
||||
//
|
||||
wxBrush::wxBrush()
|
||||
{
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
} // end of wxBrush::wxBrush
|
||||
|
||||
wxBrush::~wxBrush()
|
||||
{
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->RemoveBrush(this);
|
||||
} // end of wxBrush::~wxBrush
|
||||
|
||||
wxBrush::wxBrush(
|
||||
@ -77,9 +73,6 @@ wxBrush::wxBrush(
|
||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
} // end of wxBrush::wxBrush
|
||||
|
||||
wxBrush::wxBrush(
|
||||
@ -94,9 +87,6 @@ wxBrush::wxBrush(
|
||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxTheBrushList )
|
||||
wxTheBrushList->AddBrush(this);
|
||||
} // end of wxBrush::wxBrush
|
||||
|
||||
bool wxBrush::RealizeResource()
|
||||
|
@ -60,14 +60,10 @@ wxPenRefData::~wxPenRefData()
|
||||
//
|
||||
wxPen::wxPen()
|
||||
{
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
} // end of wxPen::wxPen
|
||||
|
||||
wxPen::~wxPen()
|
||||
{
|
||||
if (wxThePenList)
|
||||
wxThePenList->RemovePen(this);
|
||||
} // end of wxPen::wxPen
|
||||
|
||||
// Should implement Create
|
||||
@ -87,9 +83,6 @@ wxPen::wxPen(
|
||||
M_PENDATA->m_hPen = 0L;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
} // end of wxPen::wxPen
|
||||
|
||||
wxPen::wxPen(
|
||||
@ -107,9 +100,6 @@ wxPen::wxPen(
|
||||
M_PENDATA->m_hPen = 0;
|
||||
|
||||
RealizeResource();
|
||||
|
||||
if ( wxThePenList )
|
||||
wxThePenList->AddPen(this);
|
||||
} // end of wxPen::wxPen
|
||||
|
||||
int wx2os2PenStyle(
|
||||
|
Loading…
Reference in New Issue
Block a user