From 52cbfcf009d9f2ac995280bd6f5dcf584295b67d Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 17 Aug 1998 14:29:53 +0000 Subject: [PATCH] Turned wxIcon inline constructors to real constructors Removed warning from dcclient Added wxTheFontList->Add(this) somewhere in wxFont CleanUp() now printfs the number of members in wxTheBitmapList git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/icon.h | 8 +++----- include/wx/gtk1/icon.h | 8 +++----- samples/mdi/mdi.cpp | 4 ++-- src/common/gdicmn.cpp | 2 ++ src/gtk/bitmap.cpp | 1 + src/gtk/dcclient.cpp | 3 --- src/gtk/font.cpp | 4 ++++ src/gtk/icon.cpp | 25 +++++++++++++++++++++++-- src/gtk/pen.cpp | 3 +++ src/gtk1/bitmap.cpp | 1 + src/gtk1/dcclient.cpp | 3 --- src/gtk1/font.cpp | 4 ++++ src/gtk1/icon.cpp | 25 +++++++++++++++++++++++-- src/gtk1/pen.cpp | 3 +++ 14 files changed, 72 insertions(+), 22 deletions(-) diff --git a/include/wx/gtk/icon.h b/include/wx/gtk/icon.h index a79e4906ef..1611ffe6dd 100644 --- a/include/wx/gtk/icon.h +++ b/include/wx/gtk/icon.h @@ -36,13 +36,11 @@ class wxIcon: public wxBitmap public: - wxIcon(void) {}; - - inline wxIcon(const wxIcon& icon) { Ref(icon); } - inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); } + wxIcon(void); + wxIcon(const wxIcon& icon); + wxIcon(const wxIcon* icon); wxIcon( char **bits, int width=-1, int height=-1 ); - inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } }; diff --git a/include/wx/gtk1/icon.h b/include/wx/gtk1/icon.h index a79e4906ef..1611ffe6dd 100644 --- a/include/wx/gtk1/icon.h +++ b/include/wx/gtk1/icon.h @@ -36,13 +36,11 @@ class wxIcon: public wxBitmap public: - wxIcon(void) {}; - - inline wxIcon(const wxIcon& icon) { Ref(icon); } - inline wxIcon(const wxIcon* icon) { if (icon) Ref(*icon); } + wxIcon(void); + wxIcon(const wxIcon& icon); + wxIcon(const wxIcon* icon); wxIcon( char **bits, int width=-1, int height=-1 ); - inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; } inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; } inline bool operator != (const wxIcon& icon) { return m_refData != icon.m_refData; } }; diff --git a/samples/mdi/mdi.cpp b/samples/mdi/mdi.cpp index aaa465707d..56f3a75047 100644 --- a/samples/mdi/mdi.cpp +++ b/samples/mdi/mdi.cpp @@ -60,6 +60,8 @@ bool MyApp::OnInit(void) // Give it an icon (this is ignored in MDI mode: uses resources) #ifdef __WXMSW__ frame->SetIcon(wxIcon("mdi_icn")); +#else + frame->SetIcon(wxIcon( mondrian_xpm )); #endif // Make a menubar @@ -142,8 +144,6 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) ) // Give it an icon (this is ignored in MDI mode: uses resources) #ifdef __WXMSW__ subframe->SetIcon(wxIcon("chrt_icn")); -#else - subframe->SetIcon(wxIcon(mondrian_xpm)); #endif // Give it a status line diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 1045d4c0ab..e343293045 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -437,6 +437,8 @@ wxBitmapList::wxBitmapList () wxBitmapList::~wxBitmapList () { + printf( "Count: %d.\n", Number() ); + wxNode *node = First (); while (node) { diff --git a/src/gtk/bitmap.cpp b/src/gtk/bitmap.cpp index 2180a0cf92..e715481f32 100644 --- a/src/gtk/bitmap.cpp +++ b/src/gtk/bitmap.cpp @@ -13,6 +13,7 @@ #endif #include "wx/bitmap.h" +#include "wx/icon.h" #include "gdk/gdkprivate.h" #ifdef USE_GDK_IMLIB diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 37e2ebbf25..2b2cc3d3a3 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -115,9 +115,6 @@ wxPaintDC::wxPaintDC( wxWindow *window ) m_isDrawable = TRUE; SetUpDC(); - - long x = 0; - long y = 0; } wxPaintDC::~wxPaintDC(void) diff --git a/src/gtk/font.cpp b/src/gtk/font.cpp index db97e5010e..e64a84e999 100644 --- a/src/gtk/font.cpp +++ b/src/gtk/font.cpp @@ -153,12 +153,16 @@ wxFont::wxFont(int PointSize, const char *Face, int Family, int Style, wxFont::wxFont( const wxFont& font ) { Ref( font ); + + if (wxTheFontList) wxTheFontList->Append( this ); } wxFont::wxFont( const wxFont* font ) { UnRef(); if (font) Ref( *font ); + + if (wxTheFontList) wxTheFontList->Append( this ); } wxFont::~wxFont(void) diff --git a/src/gtk/icon.cpp b/src/gtk/icon.cpp index 4788409a40..33d85df2ac 100644 --- a/src/gtk/icon.cpp +++ b/src/gtk/icon.cpp @@ -20,8 +20,29 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) -wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : - wxBitmap( bits ) +wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : + wxBitmap( bits ) { } +wxIcon::wxIcon() : wxBitmap() +{ +} + +wxIcon::wxIcon(const wxIcon& icon) : wxBitmap() +{ + Ref(icon); +} + +wxIcon::wxIcon(const wxIcon* icon) : wxBitmap() +{ + if (icon) Ref(*icon); +} + +wxIcon& wxIcon::operator = (const wxIcon& icon) +{ + if (*this == icon) return (*this); + Ref(icon); + return *this; +} + diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index b01208d5e7..b50ec2063e 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -57,6 +57,7 @@ wxPen::wxPen( const wxColour &colour, int width, int style ) M_PENDATA->m_width = width; M_PENDATA->m_style = style; M_PENDATA->m_colour = colour; + if (wxThePenList) wxThePenList->AddPen( this ); } @@ -66,6 +67,7 @@ wxPen::wxPen( const wxString &colourName, int width, int style ) M_PENDATA->m_width = width; M_PENDATA->m_style = style; M_PENDATA->m_colour = colourName; + if (wxThePenList) wxThePenList->AddPen( this ); } @@ -79,6 +81,7 @@ wxPen::wxPen( const wxPen* pen ) { UnRef(); if (pen) Ref( *pen ); + if (wxThePenList) wxThePenList->AddPen( this ); } diff --git a/src/gtk1/bitmap.cpp b/src/gtk1/bitmap.cpp index 2180a0cf92..e715481f32 100644 --- a/src/gtk1/bitmap.cpp +++ b/src/gtk1/bitmap.cpp @@ -13,6 +13,7 @@ #endif #include "wx/bitmap.h" +#include "wx/icon.h" #include "gdk/gdkprivate.h" #ifdef USE_GDK_IMLIB diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 37e2ebbf25..2b2cc3d3a3 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -115,9 +115,6 @@ wxPaintDC::wxPaintDC( wxWindow *window ) m_isDrawable = TRUE; SetUpDC(); - - long x = 0; - long y = 0; } wxPaintDC::~wxPaintDC(void) diff --git a/src/gtk1/font.cpp b/src/gtk1/font.cpp index db97e5010e..e64a84e999 100644 --- a/src/gtk1/font.cpp +++ b/src/gtk1/font.cpp @@ -153,12 +153,16 @@ wxFont::wxFont(int PointSize, const char *Face, int Family, int Style, wxFont::wxFont( const wxFont& font ) { Ref( font ); + + if (wxTheFontList) wxTheFontList->Append( this ); } wxFont::wxFont( const wxFont* font ) { UnRef(); if (font) Ref( *font ); + + if (wxTheFontList) wxTheFontList->Append( this ); } wxFont::~wxFont(void) diff --git a/src/gtk1/icon.cpp b/src/gtk1/icon.cpp index 4788409a40..33d85df2ac 100644 --- a/src/gtk1/icon.cpp +++ b/src/gtk1/icon.cpp @@ -20,8 +20,29 @@ IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) -wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : - wxBitmap( bits ) +wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : + wxBitmap( bits ) { } +wxIcon::wxIcon() : wxBitmap() +{ +} + +wxIcon::wxIcon(const wxIcon& icon) : wxBitmap() +{ + Ref(icon); +} + +wxIcon::wxIcon(const wxIcon* icon) : wxBitmap() +{ + if (icon) Ref(*icon); +} + +wxIcon& wxIcon::operator = (const wxIcon& icon) +{ + if (*this == icon) return (*this); + Ref(icon); + return *this; +} + diff --git a/src/gtk1/pen.cpp b/src/gtk1/pen.cpp index b01208d5e7..b50ec2063e 100644 --- a/src/gtk1/pen.cpp +++ b/src/gtk1/pen.cpp @@ -57,6 +57,7 @@ wxPen::wxPen( const wxColour &colour, int width, int style ) M_PENDATA->m_width = width; M_PENDATA->m_style = style; M_PENDATA->m_colour = colour; + if (wxThePenList) wxThePenList->AddPen( this ); } @@ -66,6 +67,7 @@ wxPen::wxPen( const wxString &colourName, int width, int style ) M_PENDATA->m_width = width; M_PENDATA->m_style = style; M_PENDATA->m_colour = colourName; + if (wxThePenList) wxThePenList->AddPen( this ); } @@ -79,6 +81,7 @@ wxPen::wxPen( const wxPen* pen ) { UnRef(); if (pen) Ref( *pen ); + if (wxThePenList) wxThePenList->AddPen( this ); } -- 2.45.2