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:
@@ -898,7 +898,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
|
|||||||
wx/gtk/dcscreen.h
|
wx/gtk/dcscreen.h
|
||||||
wx/gtk/dnd.h
|
wx/gtk/dnd.h
|
||||||
wx/gtk/font.h
|
wx/gtk/font.h
|
||||||
wx/gtk/gdiobj.h
|
|
||||||
wx/gtk/icon.h
|
wx/gtk/icon.h
|
||||||
wx/gtk/minifram.h
|
wx/gtk/minifram.h
|
||||||
wx/gtk/pen.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/dcscreen.h
|
||||||
wx/gtk1/dnd.h
|
wx/gtk1/dnd.h
|
||||||
wx/gtk1/font.h
|
wx/gtk1/font.h
|
||||||
wx/gtk1/gdiobj.h
|
|
||||||
wx/gtk1/icon.h
|
wx/gtk1/icon.h
|
||||||
wx/gtk1/minifram.h
|
wx/gtk1/minifram.h
|
||||||
wx/gtk1/pen.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/font.h
|
||||||
wx/motif/frame.h
|
wx/motif/frame.h
|
||||||
wx/motif/gauge.h
|
wx/motif/gauge.h
|
||||||
wx/motif/gdiobj.h
|
|
||||||
wx/motif/icon.h
|
wx/motif/icon.h
|
||||||
wx/motif/listbox.h
|
wx/motif/listbox.h
|
||||||
wx/motif/mdi.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/dcscreen.h
|
||||||
wx/x11/dnd.h
|
wx/x11/dnd.h
|
||||||
wx/x11/font.h
|
wx/x11/font.h
|
||||||
wx/x11/gdiobj.h
|
|
||||||
wx/x11/icon.h
|
wx/x11/icon.h
|
||||||
wx/x11/minifram.h
|
wx/x11/minifram.h
|
||||||
wx/x11/palette.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/frame.h
|
||||||
wx/msw/gauge95.h
|
wx/msw/gauge95.h
|
||||||
wx/msw/gdiimage.h
|
wx/msw/gdiimage.h
|
||||||
wx/msw/gdiobj.h
|
|
||||||
wx/msw/icon.h
|
wx/msw/icon.h
|
||||||
wx/msw/imaglist.h
|
wx/msw/imaglist.h
|
||||||
wx/msw/iniconf.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/dcscreen.h
|
||||||
wx/mgl/font.h
|
wx/mgl/font.h
|
||||||
wx/mgl/fontutil.h
|
wx/mgl/fontutil.h
|
||||||
wx/mgl/gdiobj.h
|
|
||||||
wx/mgl/icon.h
|
wx/mgl/icon.h
|
||||||
wx/mgl/palette.h
|
wx/mgl/palette.h
|
||||||
wx/mgl/pen.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/frame.h
|
||||||
wx/os2/gauge.h
|
wx/os2/gauge.h
|
||||||
wx/os2/gdiimage.h
|
wx/os2/gdiimage.h
|
||||||
wx/os2/gdiobj.h
|
|
||||||
wx/os2/helpwin.h
|
wx/os2/helpwin.h
|
||||||
wx/os2/icon.h
|
wx/os2/icon.h
|
||||||
wx/os2/iniconf.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/fontdlg.h
|
||||||
wx/mac/frame.h
|
wx/mac/frame.h
|
||||||
wx/mac/gauge.h
|
wx/mac/gauge.h
|
||||||
wx/mac/gdiobj.h
|
|
||||||
wx/mac/glcanvas.h
|
wx/mac/glcanvas.h
|
||||||
wx/mac/gsockmac.h
|
wx/mac/gsockmac.h
|
||||||
wx/mac/helpxxxx.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/fontdlg.h
|
||||||
wx/mac/carbon/frame.h
|
wx/mac/carbon/frame.h
|
||||||
wx/mac/carbon/gauge.h
|
wx/mac/carbon/gauge.h
|
||||||
wx/mac/carbon/gdiobj.h
|
|
||||||
wx/mac/carbon/gsockmac.h
|
wx/mac/carbon/gsockmac.h
|
||||||
wx/mac/carbon/helpxxxx.h
|
wx/mac/carbon/helpxxxx.h
|
||||||
wx/mac/carbon/icon.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/fontdlg.h
|
||||||
wx/cocoa/frame.h
|
wx/cocoa/frame.h
|
||||||
wx/cocoa/gauge.h
|
wx/cocoa/gauge.h
|
||||||
wx/cocoa/gdiobj.h
|
|
||||||
wx/cocoa/icon.h
|
wx/cocoa/icon.h
|
||||||
wx/cocoa/listbox.h
|
wx/cocoa/listbox.h
|
||||||
wx/cocoa/log.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}.
|
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}
|
\membersection{wxBrushList::FindOrCreateBrush}\label{wxbrushlistfindorcreatebrush}
|
||||||
|
|
||||||
\func{wxBrush *}{FindOrCreateBrush}{\param{const wxColour\& }{colour}, \param{int}{ style = wxSOLID}}
|
\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.}
|
\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:
|
Constructor. The application should not construct its own font list:
|
||||||
use the object pointer {\bf wxTheFontList}.
|
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}
|
\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},
|
\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
|
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.
|
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:
|
Constructor. The application should not construct its own pen list:
|
||||||
use the object pointer {\bf wxThePenList}.
|
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}
|
\membersection{wxPenList::FindOrCreatePen}\label{wxpenlistfindorcreatepen}
|
||||||
|
|
||||||
\func{wxPen*}{FindOrCreatePen}{\param{const wxColour\& }{colour}, \param{int}{ width}, \param{int}{ style}}
|
\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{width}{Width of pen.}
|
||||||
|
|
||||||
\docparam{style}{Pen style. See \helpref{wxPen::wxPen}{wxpenctor} for a list of styles.}
|
\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;
|
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:
|
public:
|
||||||
wxPenList() { }
|
|
||||||
~wxPenList();
|
|
||||||
|
|
||||||
void AddPen(wxPen *pen);
|
|
||||||
void RemovePen(wxPen *pen);
|
|
||||||
wxPen *FindOrCreatePen(const wxColour& colour, int width, int style);
|
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:
|
public:
|
||||||
wxBrushList() { }
|
|
||||||
~wxBrushList();
|
|
||||||
|
|
||||||
void AddBrush(wxBrush *brush);
|
|
||||||
void RemoveBrush(wxBrush *brush);
|
|
||||||
wxBrush *FindOrCreateBrush(const wxColour& colour, int style = wxSOLID);
|
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:
|
public:
|
||||||
wxFontList() { }
|
|
||||||
~wxFontList();
|
|
||||||
|
|
||||||
void AddFont(wxFont *font);
|
|
||||||
void RemoveFont(wxFont *font);
|
|
||||||
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
wxFont *FindOrCreateFont(int pointSize, int family, int style, int weight,
|
||||||
bool underline = false,
|
bool underline = false,
|
||||||
const wxString& face = wxEmptyString,
|
const wxString& face = wxEmptyString,
|
||||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
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 );
|
WX_DECLARE_STRING_HASH_MAP( wxColour *, wxStringToColourHashMap );
|
||||||
@@ -523,16 +529,6 @@ private:
|
|||||||
wxStringToColourHashMap *m_map;
|
wxStringToColourHashMap *m_map;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxBitmapList : public wxList
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxBitmapList(){}
|
|
||||||
~wxBitmapList();
|
|
||||||
|
|
||||||
void AddBitmap(wxBitmap *bitmap);
|
|
||||||
void RemoveBitmap(wxBitmap *bitmap);
|
|
||||||
};
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxResourceCache: public wxList
|
class WXDLLEXPORT wxResourceCache: public wxList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -551,7 +547,6 @@ public:
|
|||||||
extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
|
extern WXDLLEXPORT_DATA(wxPenList*) wxThePenList;
|
||||||
extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
|
extern WXDLLEXPORT_DATA(wxBrushList*) wxTheBrushList;
|
||||||
extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
|
extern WXDLLEXPORT_DATA(wxFontList*) wxTheFontList;
|
||||||
extern WXDLLEXPORT_DATA(wxBitmapList*) wxTheBitmapList;
|
|
||||||
|
|
||||||
/* Stock objects
|
/* Stock objects
|
||||||
|
|
||||||
|
|||||||
@@ -12,29 +12,40 @@
|
|||||||
#ifndef _WX_GDIOBJ_H_BASE_
|
#ifndef _WX_GDIOBJ_H_BASE_
|
||||||
#define _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"
|
// wxGDIRefData is the base class for wxXXXData structures which contain the
|
||||||
#elif defined(__WXMSW__)
|
// real data for the GDI object and are shared among all wxWin objects sharing
|
||||||
#include "wx/msw/gdiobj.h"
|
// the same native GDI object
|
||||||
#elif defined(__WXMOTIF__)
|
// ----------------------------------------------------------------------------
|
||||||
#include "wx/motif/gdiobj.h"
|
|
||||||
#elif defined(__WXGTK20__)
|
class WXDLLIMPEXP_CORE wxGDIRefData: public wxObjectRefData { };
|
||||||
#include "wx/gtk/gdiobj.h"
|
|
||||||
#elif defined(__WXGTK__)
|
// ----------------------------------------------------------------------------
|
||||||
#include "wx/gtk1/gdiobj.h"
|
// wxGDIObject
|
||||||
#elif defined(__WXX11__)
|
// ----------------------------------------------------------------------------
|
||||||
#include "wx/x11/gdiobj.h"
|
|
||||||
#elif defined(__WXMGL__)
|
class WXDLLIMPEXP_CORE wxGDIObject: public wxObject
|
||||||
#include "wx/mgl/gdiobj.h"
|
{
|
||||||
#elif defined(__WXMAC__)
|
public:
|
||||||
#include "wx/mac/gdiobj.h"
|
bool IsNull() const { return m_refData == NULL; }
|
||||||
#elif defined(__WXCOCOA__)
|
|
||||||
#include "wx/cocoa/gdiobj.h"
|
#if defined(__WXMSW__) || defined(__WXOS2__) || defined(__WXPALMOS__)
|
||||||
#elif defined(__WXPM__)
|
// Creates the resource
|
||||||
#include "wx/os2/gdiobj.h"
|
virtual bool RealizeResource() { return false; }
|
||||||
#endif
|
|
||||||
|
// 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
|
#endif
|
||||||
// _WX_GDIOBJ_H_BASE_
|
// _WX_GDIOBJ_H_BASE_
|
||||||
|
|||||||
@@ -97,8 +97,6 @@ bool wxFont::Create(int pointSize, int family, int style, int weight, bool under
|
|||||||
|
|
||||||
wxFont::~wxFont()
|
wxFont::~wxFont()
|
||||||
{
|
{
|
||||||
if (wxTheFontList)
|
|
||||||
wxTheFontList->DeleteObject(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::RealizeResource()
|
bool wxFont::RealizeResource()
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ int wxPageNumber;
|
|||||||
wxFontList *wxTheFontList = NULL;
|
wxFontList *wxTheFontList = NULL;
|
||||||
wxPenList *wxThePenList = NULL;
|
wxPenList *wxThePenList = NULL;
|
||||||
wxBrushList *wxTheBrushList = NULL;
|
wxBrushList *wxTheBrushList = NULL;
|
||||||
wxBitmapList *wxTheBitmapList = NULL;
|
|
||||||
wxColourDatabase *wxTheColourDatabase = NULL;
|
wxColourDatabase *wxTheColourDatabase = NULL;
|
||||||
|
|
||||||
// 'Null' objects
|
// 'Null' objects
|
||||||
|
|||||||
@@ -719,7 +719,6 @@ void wxInitializeStockLists()
|
|||||||
wxTheBrushList = new wxBrushList;
|
wxTheBrushList = new wxBrushList;
|
||||||
wxThePenList = new wxPenList;
|
wxThePenList = new wxPenList;
|
||||||
wxTheFontList = new wxFontList;
|
wxTheFontList = new wxFontList;
|
||||||
wxTheBitmapList = new wxBitmapList;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDeleteStockLists()
|
void wxDeleteStockLists()
|
||||||
@@ -727,57 +726,30 @@ void wxDeleteStockLists()
|
|||||||
wxDELETE(wxTheBrushList);
|
wxDELETE(wxTheBrushList);
|
||||||
wxDELETE(wxThePenList);
|
wxDELETE(wxThePenList);
|
||||||
wxDELETE(wxTheFontList);
|
wxDELETE(wxTheFontList);
|
||||||
wxDELETE(wxTheBitmapList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxTheXXXList stuff (semi-obsolete)
|
// 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 ();
|
delete wx_static_cast(wxObject*, node->GetData());
|
||||||
wxList::compatibility_iterator next = node->GetNext ();
|
|
||||||
if (bitmap->GetVisible())
|
|
||||||
delete bitmap;
|
|
||||||
node = next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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)
|
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 ();
|
wxPen *each_pen = (wxPen *) node->GetData ();
|
||||||
if (each_pen &&
|
if (
|
||||||
each_pen->GetVisible() &&
|
|
||||||
each_pen->GetWidth () == width &&
|
each_pen->GetWidth () == width &&
|
||||||
each_pen->GetStyle () == style &&
|
each_pen->GetStyle () == style &&
|
||||||
each_pen->GetColour ().Red () == colour.Red () &&
|
each_pen->GetColour ().Red () == colour.Red () &&
|
||||||
@@ -786,48 +758,23 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
|
|||||||
return each_pen;
|
return each_pen;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPen *pen = new wxPen (colour, width, style);
|
wxPen* pen = NULL;
|
||||||
if ( !pen->Ok() )
|
wxPen penTmp(colour, width, style);
|
||||||
|
if (penTmp.Ok())
|
||||||
{
|
{
|
||||||
// don't save the invalid pens in the list
|
pen = new wxPen(penTmp);
|
||||||
delete pen;
|
list.Append(pen);
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddPen(pen);
|
|
||||||
|
|
||||||
// we'll delete it ourselves later
|
|
||||||
pen->SetVisible(true);
|
|
||||||
|
|
||||||
return pen;
|
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)
|
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 ();
|
wxBrush *each_brush = (wxBrush *) node->GetData ();
|
||||||
if (each_brush &&
|
if (
|
||||||
each_brush->GetVisible() &&
|
|
||||||
each_brush->GetStyle () == style &&
|
each_brush->GetStyle () == style &&
|
||||||
each_brush->GetColour ().Red () == colour.Red () &&
|
each_brush->GetColour ().Red () == colour.Red () &&
|
||||||
each_brush->GetColour ().Green () == colour.Green () &&
|
each_brush->GetColour ().Green () == colour.Green () &&
|
||||||
@@ -835,56 +782,17 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
|
|||||||
return each_brush;
|
return each_brush;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBrush *brush = new wxBrush (colour, style);
|
wxBrush* brush = NULL;
|
||||||
|
wxBrush brushTmp(colour, style);
|
||||||
if ( !brush->Ok() )
|
if (brushTmp.Ok())
|
||||||
{
|
{
|
||||||
// don't put the brushes we failed to create into the list
|
brush = new wxBrush(brushTmp);
|
||||||
delete brush;
|
list.Append(brush);
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AddBrush(brush);
|
|
||||||
|
|
||||||
// we'll delete it ourselves later
|
|
||||||
brush->SetVisible(true);
|
|
||||||
|
|
||||||
return brush;
|
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,
|
wxFont *wxFontList::FindOrCreateFont(int pointSize,
|
||||||
int family,
|
int family,
|
||||||
int style,
|
int style,
|
||||||
@@ -893,13 +801,12 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
|
|||||||
const wxString& facename,
|
const wxString& facename,
|
||||||
wxFontEncoding encoding)
|
wxFontEncoding encoding)
|
||||||
{
|
{
|
||||||
wxFont *font = (wxFont *)NULL;
|
wxFont *font;
|
||||||
wxList::compatibility_iterator node;
|
wxList::compatibility_iterator node;
|
||||||
for ( node = GetFirst(); node; node = node->GetNext() )
|
for (node = list.GetFirst(); node; node = node->GetNext())
|
||||||
{
|
{
|
||||||
font = (wxFont *)node->GetData();
|
font = (wxFont *)node->GetData();
|
||||||
if ( font->GetVisible() &&
|
if (
|
||||||
font->Ok() &&
|
|
||||||
font->GetPointSize () == pointSize &&
|
font->GetPointSize () == pointSize &&
|
||||||
font->GetStyle () == style &&
|
font->GetStyle () == style &&
|
||||||
font->GetWeight () == weight &&
|
font->GetWeight () == weight &&
|
||||||
@@ -944,30 +851,26 @@ wxFont *wxFontList::FindOrCreateFont(int pointSize,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !node )
|
|
||||||
{
|
|
||||||
// font not found, create the new one
|
// font not found, create the new one
|
||||||
font = new wxFont(pointSize, family, style, weight,
|
font = NULL;
|
||||||
underline, facename, encoding);
|
wxFont fontTmp(pointSize, family, style, weight, underline, facename, encoding);
|
||||||
|
if (fontTmp.Ok())
|
||||||
AddFont(font);
|
{
|
||||||
|
font = new wxFont(fontTmp);
|
||||||
// and mark it as being cacheable
|
list.Append(font);
|
||||||
font->SetVisible(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapList::AddBitmap(wxBitmap *bitmap)
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
{
|
void wxBrushList::AddBrush(wxBrush*) { }
|
||||||
Append(bitmap);
|
void wxBrushList::RemoveBrush(wxBrush*) { }
|
||||||
}
|
void wxFontList::AddFont(wxFont*) { }
|
||||||
|
void wxFontList::RemoveFont(wxFont*) { }
|
||||||
void wxBitmapList::RemoveBitmap(wxBitmap *bitmap)
|
void wxPenList::AddPen(wxPen*) { }
|
||||||
{
|
void wxPenList::RemovePen(wxPen*) { }
|
||||||
DeleteObject(bitmap);
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxGetDisplaySize()
|
wxSize wxGetDisplaySize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
|
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
|
||||||
|
|
||||||
|
#define M_GDIDATA wx_static_cast(wxGDIRefData*, m_refData)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void wxGDIObject::IncrementResourceUsage(void)
|
void wxGDIObject::IncrementResourceUsage(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,14 +54,10 @@ wxBrushRefData::~wxBrushRefData()
|
|||||||
//
|
//
|
||||||
wxBrush::wxBrush()
|
wxBrush::wxBrush()
|
||||||
{
|
{
|
||||||
if ( wxTheBrushList )
|
|
||||||
wxTheBrushList->AddBrush(this);
|
|
||||||
} // end of wxBrush::wxBrush
|
} // end of wxBrush::wxBrush
|
||||||
|
|
||||||
wxBrush::~wxBrush()
|
wxBrush::~wxBrush()
|
||||||
{
|
{
|
||||||
if ( wxTheBrushList )
|
|
||||||
wxTheBrushList->RemoveBrush(this);
|
|
||||||
} // end of wxBrush::~wxBrush
|
} // end of wxBrush::~wxBrush
|
||||||
|
|
||||||
wxBrush::wxBrush(
|
wxBrush::wxBrush(
|
||||||
@@ -77,9 +73,6 @@ wxBrush::wxBrush(
|
|||||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
|
|
||||||
if ( wxTheBrushList )
|
|
||||||
wxTheBrushList->AddBrush(this);
|
|
||||||
} // end of wxBrush::wxBrush
|
} // end of wxBrush::wxBrush
|
||||||
|
|
||||||
wxBrush::wxBrush(
|
wxBrush::wxBrush(
|
||||||
@@ -94,9 +87,6 @@ wxBrush::wxBrush(
|
|||||||
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
memset(&M_BRUSHDATA->m_vBundle, '\0', sizeof(AREABUNDLE));
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
|
|
||||||
if ( wxTheBrushList )
|
|
||||||
wxTheBrushList->AddBrush(this);
|
|
||||||
} // end of wxBrush::wxBrush
|
} // end of wxBrush::wxBrush
|
||||||
|
|
||||||
bool wxBrush::RealizeResource()
|
bool wxBrush::RealizeResource()
|
||||||
|
|||||||
@@ -60,14 +60,10 @@ wxPenRefData::~wxPenRefData()
|
|||||||
//
|
//
|
||||||
wxPen::wxPen()
|
wxPen::wxPen()
|
||||||
{
|
{
|
||||||
if ( wxThePenList )
|
|
||||||
wxThePenList->AddPen(this);
|
|
||||||
} // end of wxPen::wxPen
|
} // end of wxPen::wxPen
|
||||||
|
|
||||||
wxPen::~wxPen()
|
wxPen::~wxPen()
|
||||||
{
|
{
|
||||||
if (wxThePenList)
|
|
||||||
wxThePenList->RemovePen(this);
|
|
||||||
} // end of wxPen::wxPen
|
} // end of wxPen::wxPen
|
||||||
|
|
||||||
// Should implement Create
|
// Should implement Create
|
||||||
@@ -87,9 +83,6 @@ wxPen::wxPen(
|
|||||||
M_PENDATA->m_hPen = 0L;
|
M_PENDATA->m_hPen = 0L;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
|
|
||||||
if ( wxThePenList )
|
|
||||||
wxThePenList->AddPen(this);
|
|
||||||
} // end of wxPen::wxPen
|
} // end of wxPen::wxPen
|
||||||
|
|
||||||
wxPen::wxPen(
|
wxPen::wxPen(
|
||||||
@@ -107,9 +100,6 @@ wxPen::wxPen(
|
|||||||
M_PENDATA->m_hPen = 0;
|
M_PENDATA->m_hPen = 0;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
|
|
||||||
if ( wxThePenList )
|
|
||||||
wxThePenList->AddPen(this);
|
|
||||||
} // end of wxPen::wxPen
|
} // end of wxPen::wxPen
|
||||||
|
|
||||||
int wx2os2PenStyle(
|
int wx2os2PenStyle(
|
||||||
|
|||||||
Reference in New Issue
Block a user