friend class WXDLLEXPORT wxBrush;
public:
wxBrushRefData(void);
+ wxBrushRefData(const wxBrushRefData& data);
~wxBrushRefData(void);
protected:
wxBrush(const wxString& col, int style);
wxBrush(const wxBitmap& stipple);
inline wxBrush(const wxBrush& brush) { Ref(brush); }
- inline wxBrush(const wxBrush* brush) { /* UnRef(); */ if (brush) Ref(*brush); }
+ inline wxBrush(const wxBrush* brush) { if (brush) Ref(*brush); }
~wxBrush(void);
virtual void SetColour(const wxColour& col) ;
bool RealizeResource(void);
WXHANDLE GetResourceHandle(void) ;
bool FreeResource(bool force = FALSE);
-/*
- bool UseResource(void);
- bool ReleaseResource(void);
-*/
-
bool IsFree(void);
+ void Unshare();
};
#endif
void WXDLLEXPORT wxInitClipboard(void);
/* The clipboard */
-extern wxClipboard* WXDLLEXPORT wxTheClipboard;
+WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
#endif // USE_CLIPBOARD
#endif
}
virtual void CrossHair(long x, long y) ;
- virtual void CrossHair(const wxPoint& pt)
+ inline void CrossHair(const wxPoint& pt)
{
CrossHair(pt.x, pt.y);
}
friend class WXDLLEXPORT wxFont;
public:
wxFontRefData(void);
+ wxFontRefData(const wxFontRefData& data);
~wxFontRefData(void);
protected:
bool m_temporary; // If TRUE, the pointer to the actual font
wxFont(void);
wxFont(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
inline wxFont(const wxFont& font) { Ref(font); }
- inline wxFont(const wxFont* font) { /* UnRef(); */ if (font) Ref(*font); }
+ inline wxFont(const wxFont* font) { if (font) Ref(*font); }
~wxFont(void);
inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
inline bool operator == (const wxFont& font) { return m_refData == font.m_refData; }
inline bool operator != (const wxFont& font) { return m_refData != font.m_refData; }
+
+protected:
+ void Unshare();
};
#endif
friend class WXDLLEXPORT wxPen;
public:
wxPenRefData(void);
+ wxPenRefData(const wxPenRefData& data);
~wxPenRefData(void);
protected:
wxPen(const wxString& col, int width, int style);
wxPen(const wxBitmap& stipple, int width);
inline wxPen(const wxPen& pen) { Ref(pen); }
- inline wxPen(const wxPen* pen) { /* UnRef(); */ if (pen) Ref(*pen); }
+ inline wxPen(const wxPen* pen) { if (pen) Ref(*pen); }
~wxPen(void);
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
bool FreeResource(bool force = FALSE);
WXHANDLE GetResourceHandle(void) ;
bool IsFree(void);
+ void Unshare();
};
int wx2msPenStyle(int wx_style);
protected:
bool m_isRich; // Are we using rich text edit to implement this?
- wxString fileName;
+ wxString m_fileName;
DECLARE_EVENT_TABLE()
};
class WXDLLEXPORT wxValidator;
#if USE_DRAG_AND_DROP
-class wxDropTarget;
+class WXDLLEXPORT wxDropTarget;
#endif
#if USE_WX_RESOURCES
#elif defined(__WXGTK__)
# include "wx/gtk/tbargtk.h"
#elif defined(__WXQT__)
-# include "wx/qt/tbargtk.h"
+# include "wx/qt/tbarqt.h"
#endif
#endif
void wxBitmap::SetWidth(int w)
{
if (!M_BITMAPDATA)
- m_refData = new wxBitmapRefData;
+ m_refData = new wxBitmapRefData;
M_BITMAPDATA->m_width = w;
}
wxBrushRefData::wxBrushRefData(void)
{
m_style = wxSOLID;
-// m_stipple = NULL ;
+ m_hBrush = 0;
+}
+
+wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
+{
+ m_style = data.m_style;
+ m_stipple = data.m_stipple;
+ m_colour = data.m_colour;
m_hBrush = 0;
}
else return FALSE;
}
-/*
-bool wxBrush::UseResource(void)
+bool wxBrush::IsFree(void)
{
- IncrementResourceUsage();
- return TRUE;
+ return (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0));
}
-bool wxBrush::ReleaseResource(void)
+void wxBrush::Unshare()
{
- DecrementResourceUsage();
- return TRUE;
+ // Don't change shared data
+ if (!m_refData)
+ {
+ m_refData = new wxBrushRefData();
+ }
+ else
+ {
+ wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
+ UnRef();
+ m_refData = ref;
+ }
}
-*/
-bool wxBrush::IsFree(void)
-{
- return (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0));
-}
void wxBrush::SetColour(const wxColour& col)
{
- if ( !M_BRUSHDATA )
- m_refData = new wxBrushRefData;
+ Unshare();
- M_BRUSHDATA->m_colour = col;
+ M_BRUSHDATA->m_colour = col;
- if (FreeResource())
RealizeResource();
}
void wxBrush::SetColour(const wxString& col)
{
- if ( !M_BRUSHDATA )
- m_refData = new wxBrushRefData;
+ Unshare();
- M_BRUSHDATA->m_colour = col;
+ M_BRUSHDATA->m_colour = col;
- if (FreeResource())
RealizeResource();
}
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
{
- if ( !M_BRUSHDATA )
- m_refData = new wxBrushRefData;
+ Unshare();
- M_BRUSHDATA->m_colour.Set(r, g, b);
+ M_BRUSHDATA->m_colour.Set(r, g, b);
- if (FreeResource())
RealizeResource();
}
void wxBrush::SetStyle(int Style)
{
- if ( !M_BRUSHDATA )
- m_refData = new wxBrushRefData;
+ Unshare();
- M_BRUSHDATA->m_style = Style;
+ M_BRUSHDATA->m_style = Style;
- if (FreeResource())
RealizeResource();
}
void wxBrush::SetStipple(const wxBitmap& Stipple)
{
- if ( !M_BRUSHDATA )
- m_refData = new wxBrushRefData;
+ Unshare();
- M_BRUSHDATA->m_stipple = Stipple;
+ M_BRUSHDATA->m_stipple = Stipple;
- if (FreeResource())
RealizeResource();
}
m_hFont = 0;
}
+wxFontRefData::wxFontRefData(const wxFontRefData& data)
+{
+ m_style = data.m_style;
+ m_temporary = FALSE;
+ m_pointSize = data.m_pointSize;
+ m_family = data.m_family;
+ m_fontId = data.m_fontId;
+ m_style = data.m_style;
+ m_weight = data.m_weight;
+ m_underlined = data.m_underlined;
+ m_faceName = data.m_faceName;
+ m_hFont = 0;
+}
+
wxFontRefData::~wxFontRefData(void)
{
if ( m_hFont )
/* Constructor for a font. Note that the real construction is done
* in wxDC::SetFont, when information is available about scaling etc.
*/
-wxFont::wxFont(int PointSize, int Family, int Style, int Weight, bool Underlined, const wxString& Face)
+wxFont::wxFont(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName)
{
- Create(PointSize, Family, Style, Weight, Underlined, Face);
+ Create(pointSize, family, style, weight, underlined, faceName);
if ( wxTheFontList )
wxTheFontList->Append(this);
}
-bool wxFont::Create(int PointSize, int Family, int Style, int Weight, bool Underlined, const wxString& Face)
+bool wxFont::Create(int pointSize, int family, int style, int weight, bool underlined, const wxString& faceName)
{
UnRef();
m_refData = new wxFontRefData;
- M_FONTDATA->m_family = Family;
- M_FONTDATA->m_style = Style;
- M_FONTDATA->m_weight = Weight;
- M_FONTDATA->m_pointSize = PointSize;
- M_FONTDATA->m_underlined = Underlined;
- M_FONTDATA->m_faceName = Face;
- M_FONTDATA->m_temporary = FALSE;
- M_FONTDATA->m_hFont = 0;
+ M_FONTDATA->m_family = family;
+ M_FONTDATA->m_style = style;
+ M_FONTDATA->m_weight = weight;
+ M_FONTDATA->m_pointSize = pointSize;
+ M_FONTDATA->m_underlined = underlined;
+ M_FONTDATA->m_faceName = faceName;
RealizeResource();
return FALSE;
}
-/*
-bool wxFont::UseResource(void)
-{
- IncrementResourceUsage();
- return TRUE;
-}
-
-bool wxFont::ReleaseResource(void)
-{
- DecrementResourceUsage();
- return TRUE;
-}
-*/
-
-WXHANDLE wxFont::GetResourceHandle(void)
+WXHANDLE wxFont::GetResourceHandle()
{
if ( !M_FONTDATA )
return 0;
return (WXHANDLE)M_FONTDATA->m_hFont ;
}
-bool wxFont::IsFree(void)
+bool wxFont::IsFree()
{
return (M_FONTDATA && (M_FONTDATA->m_hFont == 0));
}
+void wxFont::Unshare()
+{
+ // Don't change shared data
+ if (!m_refData)
+ {
+ m_refData = new wxFontRefData();
+ }
+ else
+ {
+ wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
+ UnRef();
+ m_refData = ref;
+ }
+}
+
void wxFont::SetPointSize(int pointSize)
{
- if ( !m_refData )
- m_refData = new wxFontRefData;
+ Unshare();
+
M_FONTDATA->m_pointSize = pointSize;
+
+ RealizeResource();
}
void wxFont::SetFamily(int family)
{
- if ( !m_refData )
- m_refData = new wxFontRefData;
+ Unshare();
+
M_FONTDATA->m_family = family;
+
+ RealizeResource();
}
void wxFont::SetStyle(int style)
{
- if ( !m_refData )
- m_refData = new wxFontRefData;
+ Unshare();
+
M_FONTDATA->m_style = style;
+
+ RealizeResource();
}
void wxFont::SetWeight(int weight)
{
- if ( !m_refData )
- m_refData = new wxFontRefData;
+ Unshare();
+
M_FONTDATA->m_weight = weight;
+
+ RealizeResource();
}
void wxFont::SetFaceName(const wxString& faceName)
{
- if ( !m_refData )
- m_refData = new wxFontRefData;
+ Unshare();
+
M_FONTDATA->m_faceName = faceName;
+
+ RealizeResource();
}
void wxFont::SetUnderlined(bool underlined)
{
- if ( !m_refData )
- m_refData = new wxFontRefData;
+ Unshare();
+
M_FONTDATA->m_underlined = underlined;
+
+ RealizeResource();
}
wxString wxFont::GetFamilyString(void) const
return fam;
}
-/* New font system */
wxString wxFont::GetFaceName(void) const
{
wxString str("");
#include <string.h>
#if !USE_SHARED_LIBRARY
-IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow)
-IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
+IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
+IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
#endif
// ============================================================================
wxPenRefData::wxPenRefData(void)
{
-// m_stipple = NULL ;
m_style = wxSOLID;
m_width = 1;
m_join = wxJOIN_ROUND ;
m_hPen = 0;
}
+wxPenRefData::wxPenRefData(const wxPenRefData& data)
+{
+ m_style = data.m_style;
+ m_width = data.m_width;
+ m_join = data.m_join;
+ m_cap = data.m_cap;
+ m_nbDash = data.m_nbDash;
+ m_dash = data.m_dash;
+ m_colour = data.m_colour;
+ m_hPen = 0;
+}
+
wxPenRefData::~wxPenRefData(void)
{
if ( m_hPen )
else return FALSE;
}
-/*
-bool wxPen::UseResource(void)
-{
- IncrementResourceUsage();
- return TRUE;
-}
-
-bool wxPen::ReleaseResource(void)
+bool wxPen::IsFree(void)
{
- DecrementResourceUsage();
- return TRUE;
+ return (M_PENDATA && M_PENDATA->m_hPen == 0);
}
-*/
-bool wxPen::IsFree(void)
+void wxPen::Unshare()
{
- return (M_PENDATA && M_PENDATA->m_hPen == 0);
+ // Don't change shared data
+ if (!m_refData)
+ {
+ m_refData = new wxPenRefData();
+ }
+ else
+ {
+ wxPenRefData* ref = new wxPenRefData(*(wxPenRefData*)m_refData);
+ UnRef();
+ m_refData = ref;
+ }
}
void wxPen::SetColour(const wxColour& col)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_colour = col;
+ M_PENDATA->m_colour = col;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetColour(const wxString& col)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_colour = col;
+ M_PENDATA->m_colour = col;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_colour.Set(r, g, b);
+ M_PENDATA->m_colour.Set(r, g, b);
- if (FreeResource())
RealizeResource();
}
void wxPen::SetWidth(int Width)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_width = Width;
+ M_PENDATA->m_width = Width;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetStyle(int Style)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_style = Style;
+ M_PENDATA->m_style = Style;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetStipple(const wxBitmap& Stipple)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_stipple = Stipple;
- M_PENDATA->m_style = wxSTIPPLE;
+ M_PENDATA->m_stipple = Stipple;
+ M_PENDATA->m_style = wxSTIPPLE;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_nbDash = nb_dashes;
- M_PENDATA->m_dash = (wxDash *)Dash;
+ M_PENDATA->m_nbDash = nb_dashes;
+ M_PENDATA->m_dash = (wxDash *)Dash;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetJoin(int Join)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_join = Join;
+ M_PENDATA->m_join = Join;
- if (FreeResource())
RealizeResource();
}
void wxPen::SetCap(int Cap)
{
- if ( !M_PENDATA )
- m_refData = new wxPenRefData;
+ Unshare();
- M_PENDATA->m_cap = Cap;
+ M_PENDATA->m_cap = Cap;
- if (FreeResource())
RealizeResource();
}
public:
wxRegionRefData(void)
{
+ m_region = 0;
}
wxRegionRefData(const wxRegionRefData& data)
:streambuf()
#endif
{
- fileName = "";
+ m_fileName = "";
m_isRich = FALSE;
}
const wxValidator& validator,
const wxString& name)
{
- fileName = "";
+ m_fileName = "";
SetName(name);
SetValidator(validator);
if (parent) parent->AddChild(this);
if (!FileExists(WXSTRINGCAST file))
return FALSE;
- fileName = file;
+ m_fileName = file;
Clear();
// Returns TRUE if succeeds.
bool wxTextCtrl::SaveFile(const wxString& file)
{
- wxString theFile;
- if (file == "")
- theFile = fileName;
- if (file == "")
+ wxString theFile(file);
+ if (theFile == "")
+ theFile = m_fileName;
+ if (theFile == "")
return FALSE;
- fileName = theFile;
+ m_fileName = theFile;
- ofstream output(WXSTRINGCAST file);
+ ofstream output((char*) (const char*) theFile);
if (output.bad())
return FALSE;
wxTextCtrl& wxTextCtrl::operator<<(float f)
{
- static char buf[100];
- sprintf(buf, "%.2f", f);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%.2f", f);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(double d)
{
- static char buf[100];
- sprintf(buf, "%.2f", d);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%.2f", d);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(int i)
{
- static char buf[100];
- sprintf(buf, "%i", i);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%d", i);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(long i)
{
- static char buf[100];
- sprintf(buf, "%ld", i);
- WriteText(buf);
- return *this;
+ wxString str;
+ str.Printf("%ld", i);
+ WriteText(str);
+ return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const char c)
{
- char buf[2];
+ char buf[2];
- buf[0] = c;
- buf[1] = 0;
- WriteText(buf);
- return *this;
+ buf[0] = c;
+ buf[1] = 0;
+ WriteText(buf);
+ return *this;
}
-
WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
-/*
- * File: TreeCtrl.cpp
- * Purpose: Tree control
- * Author: Julian Smart
- * Created: 1997
- * Updated:
- * Copyright:
- */
-
-/* static const char sccsid[] = "%W% %G%"; */
+/////////////////////////////////////////////////////////////////////////////
+// Name: treectrl.cpp
+// Purpose: wxTreeCtrl
+// Author: Julian Smart
+// Modified by:
+// Created: 1997
+// RCS-ID: $Id$
+// Copyright: (c) Julian Smart
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "treectrl.h"
void wxWindow::OnIdle(wxIdleEvent& event)
{
-#if 0
// Check if we need to send a LEAVE event
if (m_mouseInWindow)
{
}
}
UpdateWindowUI();
-#endif
}
// Raise the window to the top of the Z order