Miscellaneous, mostly cosmetic changes. wxPen/wxFont/wxBrush altered so Set...
functions don't change shared objects. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -27,6 +27,7 @@ class WXDLLEXPORT wxBrushRefData: public wxGDIRefData
|
|||||||
friend class WXDLLEXPORT wxBrush;
|
friend class WXDLLEXPORT wxBrush;
|
||||||
public:
|
public:
|
||||||
wxBrushRefData(void);
|
wxBrushRefData(void);
|
||||||
|
wxBrushRefData(const wxBrushRefData& data);
|
||||||
~wxBrushRefData(void);
|
~wxBrushRefData(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -49,7 +50,7 @@ public:
|
|||||||
wxBrush(const wxString& col, int style);
|
wxBrush(const wxString& col, int style);
|
||||||
wxBrush(const wxBitmap& stipple);
|
wxBrush(const wxBitmap& stipple);
|
||||||
inline wxBrush(const wxBrush& brush) { Ref(brush); }
|
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);
|
~wxBrush(void);
|
||||||
|
|
||||||
virtual void SetColour(const wxColour& col) ;
|
virtual void SetColour(const wxColour& col) ;
|
||||||
@@ -72,12 +73,8 @@ public:
|
|||||||
bool RealizeResource(void);
|
bool RealizeResource(void);
|
||||||
WXHANDLE GetResourceHandle(void) ;
|
WXHANDLE GetResourceHandle(void) ;
|
||||||
bool FreeResource(bool force = FALSE);
|
bool FreeResource(bool force = FALSE);
|
||||||
/*
|
|
||||||
bool UseResource(void);
|
|
||||||
bool ReleaseResource(void);
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool IsFree(void);
|
bool IsFree(void);
|
||||||
|
void Unshare();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -104,7 +104,7 @@ class WXDLLEXPORT wxClipboard : public wxObject
|
|||||||
void WXDLLEXPORT wxInitClipboard(void);
|
void WXDLLEXPORT wxInitClipboard(void);
|
||||||
|
|
||||||
/* The clipboard */
|
/* The clipboard */
|
||||||
extern wxClipboard* WXDLLEXPORT wxTheClipboard;
|
WXDLLEXPORT_DATA(extern wxClipboard*) wxTheClipboard;
|
||||||
|
|
||||||
#endif // USE_CLIPBOARD
|
#endif // USE_CLIPBOARD
|
||||||
#endif
|
#endif
|
||||||
|
@@ -52,7 +52,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void CrossHair(long x, long y) ;
|
virtual void CrossHair(long x, long y) ;
|
||||||
virtual void CrossHair(const wxPoint& pt)
|
inline void CrossHair(const wxPoint& pt)
|
||||||
{
|
{
|
||||||
CrossHair(pt.x, pt.y);
|
CrossHair(pt.x, pt.y);
|
||||||
}
|
}
|
||||||
|
@@ -25,6 +25,7 @@ class WXDLLEXPORT wxFontRefData: public wxGDIRefData
|
|||||||
friend class WXDLLEXPORT wxFont;
|
friend class WXDLLEXPORT wxFont;
|
||||||
public:
|
public:
|
||||||
wxFontRefData(void);
|
wxFontRefData(void);
|
||||||
|
wxFontRefData(const wxFontRefData& data);
|
||||||
~wxFontRefData(void);
|
~wxFontRefData(void);
|
||||||
protected:
|
protected:
|
||||||
bool m_temporary; // If TRUE, the pointer to the actual font
|
bool m_temporary; // If TRUE, the pointer to the actual font
|
||||||
@@ -53,7 +54,7 @@ public:
|
|||||||
wxFont(void);
|
wxFont(void);
|
||||||
wxFont(int PointSize, int Family, int Style, int Weight, bool underlined = FALSE, const wxString& Face = wxEmptyString);
|
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) { Ref(font); }
|
||||||
inline wxFont(const wxFont* font) { /* UnRef(); */ if (font) Ref(*font); }
|
inline wxFont(const wxFont* font) { if (font) Ref(*font); }
|
||||||
|
|
||||||
~wxFont(void);
|
~wxFont(void);
|
||||||
|
|
||||||
@@ -92,6 +93,9 @@ public:
|
|||||||
inline wxFont& operator = (const wxFont& font) { if (*this == font) return (*this); Ref(font); return *this; }
|
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; }
|
||||||
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
|
#endif
|
||||||
|
@@ -27,6 +27,7 @@ class WXDLLEXPORT wxPenRefData: public wxGDIRefData
|
|||||||
friend class WXDLLEXPORT wxPen;
|
friend class WXDLLEXPORT wxPen;
|
||||||
public:
|
public:
|
||||||
wxPenRefData(void);
|
wxPenRefData(void);
|
||||||
|
wxPenRefData(const wxPenRefData& data);
|
||||||
~wxPenRefData(void);
|
~wxPenRefData(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -53,7 +54,7 @@ public:
|
|||||||
wxPen(const wxString& col, int width, int style);
|
wxPen(const wxString& col, int width, int style);
|
||||||
wxPen(const wxBitmap& stipple, int width);
|
wxPen(const wxBitmap& stipple, int width);
|
||||||
inline wxPen(const wxPen& pen) { Ref(pen); }
|
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);
|
~wxPen(void);
|
||||||
|
|
||||||
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
|
inline wxPen& operator = (const wxPen& pen) { if (*this == pen) return (*this); Ref(pen); return *this; }
|
||||||
@@ -90,6 +91,7 @@ public:
|
|||||||
bool FreeResource(bool force = FALSE);
|
bool FreeResource(bool force = FALSE);
|
||||||
WXHANDLE GetResourceHandle(void) ;
|
WXHANDLE GetResourceHandle(void) ;
|
||||||
bool IsFree(void);
|
bool IsFree(void);
|
||||||
|
void Unshare();
|
||||||
};
|
};
|
||||||
|
|
||||||
int wx2msPenStyle(int wx_style);
|
int wx2msPenStyle(int wx_style);
|
||||||
|
@@ -147,7 +147,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_isRich; // Are we using rich text edit to implement this?
|
bool m_isRich; // Are we using rich text edit to implement this?
|
||||||
wxString fileName;
|
wxString m_fileName;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -67,7 +67,7 @@ class WXDLLEXPORT wxDC;
|
|||||||
class WXDLLEXPORT wxValidator;
|
class WXDLLEXPORT wxValidator;
|
||||||
|
|
||||||
#if USE_DRAG_AND_DROP
|
#if USE_DRAG_AND_DROP
|
||||||
class wxDropTarget;
|
class WXDLLEXPORT wxDropTarget;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_WX_RESOURCES
|
#if USE_WX_RESOURCES
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
# include "wx/gtk/tbargtk.h"
|
# include "wx/gtk/tbargtk.h"
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
# include "wx/qt/tbargtk.h"
|
# include "wx/qt/tbarqt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -40,7 +40,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
|||||||
wxBrushRefData::wxBrushRefData(void)
|
wxBrushRefData::wxBrushRefData(void)
|
||||||
{
|
{
|
||||||
m_style = wxSOLID;
|
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;
|
m_hBrush = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,77 +193,69 @@ bool wxBrush::FreeResource(bool force)
|
|||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
bool wxBrush::UseResource(void)
|
|
||||||
{
|
|
||||||
IncrementResourceUsage();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxBrush::ReleaseResource(void)
|
|
||||||
{
|
|
||||||
DecrementResourceUsage();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool wxBrush::IsFree(void)
|
bool wxBrush::IsFree(void)
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0));
|
return (M_BRUSHDATA && (M_BRUSHDATA->m_hBrush == 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxBrush::Unshare()
|
||||||
|
{
|
||||||
|
// Don't change shared data
|
||||||
|
if (!m_refData)
|
||||||
|
{
|
||||||
|
m_refData = new wxBrushRefData();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
||||||
|
UnRef();
|
||||||
|
m_refData = ref;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxBrush::SetColour(const wxColour& col)
|
void wxBrush::SetColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
if ( !M_BRUSHDATA )
|
Unshare();
|
||||||
m_refData = new wxBrushRefData;
|
|
||||||
|
|
||||||
M_BRUSHDATA->m_colour = col;
|
M_BRUSHDATA->m_colour = col;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetColour(const wxString& col)
|
void wxBrush::SetColour(const wxString& col)
|
||||||
{
|
{
|
||||||
if ( !M_BRUSHDATA )
|
Unshare();
|
||||||
m_refData = new wxBrushRefData;
|
|
||||||
|
|
||||||
M_BRUSHDATA->m_colour = col;
|
M_BRUSHDATA->m_colour = col;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
void wxBrush::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
||||||
{
|
{
|
||||||
if ( !M_BRUSHDATA )
|
Unshare();
|
||||||
m_refData = new wxBrushRefData;
|
|
||||||
|
|
||||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetStyle(int Style)
|
void wxBrush::SetStyle(int Style)
|
||||||
{
|
{
|
||||||
if ( !M_BRUSHDATA )
|
Unshare();
|
||||||
m_refData = new wxBrushRefData;
|
|
||||||
|
|
||||||
M_BRUSHDATA->m_style = Style;
|
M_BRUSHDATA->m_style = Style;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
void wxBrush::SetStipple(const wxBitmap& Stipple)
|
||||||
{
|
{
|
||||||
if ( !M_BRUSHDATA )
|
Unshare();
|
||||||
m_refData = new wxBrushRefData;
|
|
||||||
|
|
||||||
M_BRUSHDATA->m_stipple = Stipple;
|
M_BRUSHDATA->m_stipple = Stipple;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
104
src/msw/font.cpp
104
src/msw/font.cpp
@@ -55,6 +55,20 @@ wxFontRefData::wxFontRefData(void)
|
|||||||
m_hFont = 0;
|
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)
|
wxFontRefData::~wxFontRefData(void)
|
||||||
{
|
{
|
||||||
if ( m_hFont )
|
if ( m_hFont )
|
||||||
@@ -70,27 +84,25 @@ wxFont::wxFont(void)
|
|||||||
/* Constructor for a font. Note that the real construction is done
|
/* Constructor for a font. Note that the real construction is done
|
||||||
* in wxDC::SetFont, when information is available about scaling etc.
|
* 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 )
|
if ( wxTheFontList )
|
||||||
wxTheFontList->Append(this);
|
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();
|
UnRef();
|
||||||
m_refData = new wxFontRefData;
|
m_refData = new wxFontRefData;
|
||||||
|
|
||||||
M_FONTDATA->m_family = Family;
|
M_FONTDATA->m_family = family;
|
||||||
M_FONTDATA->m_style = Style;
|
M_FONTDATA->m_style = style;
|
||||||
M_FONTDATA->m_weight = Weight;
|
M_FONTDATA->m_weight = weight;
|
||||||
M_FONTDATA->m_pointSize = PointSize;
|
M_FONTDATA->m_pointSize = pointSize;
|
||||||
M_FONTDATA->m_underlined = Underlined;
|
M_FONTDATA->m_underlined = underlined;
|
||||||
M_FONTDATA->m_faceName = Face;
|
M_FONTDATA->m_faceName = faceName;
|
||||||
M_FONTDATA->m_temporary = FALSE;
|
|
||||||
M_FONTDATA->m_hFont = 0;
|
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
|
|
||||||
@@ -216,21 +228,7 @@ bool wxFont::FreeResource(bool force)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
WXHANDLE wxFont::GetResourceHandle()
|
||||||
bool wxFont::UseResource(void)
|
|
||||||
{
|
|
||||||
IncrementResourceUsage();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxFont::ReleaseResource(void)
|
|
||||||
{
|
|
||||||
DecrementResourceUsage();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
WXHANDLE wxFont::GetResourceHandle(void)
|
|
||||||
{
|
{
|
||||||
if ( !M_FONTDATA )
|
if ( !M_FONTDATA )
|
||||||
return 0;
|
return 0;
|
||||||
@@ -238,51 +236,78 @@ WXHANDLE wxFont::GetResourceHandle(void)
|
|||||||
return (WXHANDLE)M_FONTDATA->m_hFont ;
|
return (WXHANDLE)M_FONTDATA->m_hFont ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFont::IsFree(void)
|
bool wxFont::IsFree()
|
||||||
{
|
{
|
||||||
return (M_FONTDATA && (M_FONTDATA->m_hFont == 0));
|
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)
|
void wxFont::SetPointSize(int pointSize)
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
Unshare();
|
||||||
m_refData = new wxFontRefData;
|
|
||||||
M_FONTDATA->m_pointSize = pointSize;
|
M_FONTDATA->m_pointSize = pointSize;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetFamily(int family)
|
void wxFont::SetFamily(int family)
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
Unshare();
|
||||||
m_refData = new wxFontRefData;
|
|
||||||
M_FONTDATA->m_family = family;
|
M_FONTDATA->m_family = family;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetStyle(int style)
|
void wxFont::SetStyle(int style)
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
Unshare();
|
||||||
m_refData = new wxFontRefData;
|
|
||||||
M_FONTDATA->m_style = style;
|
M_FONTDATA->m_style = style;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetWeight(int weight)
|
void wxFont::SetWeight(int weight)
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
Unshare();
|
||||||
m_refData = new wxFontRefData;
|
|
||||||
M_FONTDATA->m_weight = weight;
|
M_FONTDATA->m_weight = weight;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetFaceName(const wxString& faceName)
|
void wxFont::SetFaceName(const wxString& faceName)
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
Unshare();
|
||||||
m_refData = new wxFontRefData;
|
|
||||||
M_FONTDATA->m_faceName = faceName;
|
M_FONTDATA->m_faceName = faceName;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetUnderlined(bool underlined)
|
void wxFont::SetUnderlined(bool underlined)
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
Unshare();
|
||||||
m_refData = new wxFontRefData;
|
|
||||||
M_FONTDATA->m_underlined = underlined;
|
M_FONTDATA->m_underlined = underlined;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxFont::GetFamilyString(void) const
|
wxString wxFont::GetFamilyString(void) const
|
||||||
@@ -315,7 +340,6 @@ wxString wxFont::GetFamilyString(void) const
|
|||||||
return fam;
|
return fam;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* New font system */
|
|
||||||
wxString wxFont::GetFaceName(void) const
|
wxString wxFont::GetFaceName(void) const
|
||||||
{
|
{
|
||||||
wxString str("");
|
wxString str("");
|
||||||
|
@@ -49,8 +49,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxEvtHandler)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
@@ -38,7 +38,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
|
|||||||
|
|
||||||
wxPenRefData::wxPenRefData(void)
|
wxPenRefData::wxPenRefData(void)
|
||||||
{
|
{
|
||||||
// m_stipple = NULL ;
|
|
||||||
m_style = wxSOLID;
|
m_style = wxSOLID;
|
||||||
m_width = 1;
|
m_width = 1;
|
||||||
m_join = wxJOIN_ROUND ;
|
m_join = wxJOIN_ROUND ;
|
||||||
@@ -48,6 +47,18 @@ wxPenRefData::wxPenRefData(void)
|
|||||||
m_hPen = 0;
|
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)
|
wxPenRefData::~wxPenRefData(void)
|
||||||
{
|
{
|
||||||
if ( m_hPen )
|
if ( m_hPen )
|
||||||
@@ -288,123 +299,106 @@ bool wxPen::FreeResource(bool force)
|
|||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
bool wxPen::UseResource(void)
|
|
||||||
{
|
|
||||||
IncrementResourceUsage();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxPen::ReleaseResource(void)
|
|
||||||
{
|
|
||||||
DecrementResourceUsage();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool wxPen::IsFree(void)
|
bool wxPen::IsFree(void)
|
||||||
{
|
{
|
||||||
return (M_PENDATA && M_PENDATA->m_hPen == 0);
|
return (M_PENDATA && M_PENDATA->m_hPen == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxPen::Unshare()
|
||||||
|
{
|
||||||
|
// 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)
|
void wxPen::SetColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_colour = col;
|
M_PENDATA->m_colour = col;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetColour(const wxString& col)
|
void wxPen::SetColour(const wxString& col)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_colour = col;
|
M_PENDATA->m_colour = col;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
void wxPen::SetColour(const unsigned char r, const unsigned char g, const unsigned char b)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_colour.Set(r, g, b);
|
M_PENDATA->m_colour.Set(r, g, b);
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetWidth(int Width)
|
void wxPen::SetWidth(int Width)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_width = Width;
|
M_PENDATA->m_width = Width;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetStyle(int Style)
|
void wxPen::SetStyle(int Style)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_style = Style;
|
M_PENDATA->m_style = Style;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetStipple(const wxBitmap& Stipple)
|
void wxPen::SetStipple(const wxBitmap& Stipple)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_stipple = Stipple;
|
M_PENDATA->m_stipple = Stipple;
|
||||||
M_PENDATA->m_style = wxSTIPPLE;
|
M_PENDATA->m_style = wxSTIPPLE;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
|
void wxPen::SetDashes(int nb_dashes, const wxDash *Dash)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_nbDash = nb_dashes;
|
M_PENDATA->m_nbDash = nb_dashes;
|
||||||
M_PENDATA->m_dash = (wxDash *)Dash;
|
M_PENDATA->m_dash = (wxDash *)Dash;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetJoin(int Join)
|
void wxPen::SetJoin(int Join)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_join = Join;
|
M_PENDATA->m_join = Join;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPen::SetCap(int Cap)
|
void wxPen::SetCap(int Cap)
|
||||||
{
|
{
|
||||||
if ( !M_PENDATA )
|
Unshare();
|
||||||
m_refData = new wxPenRefData;
|
|
||||||
|
|
||||||
M_PENDATA->m_cap = Cap;
|
M_PENDATA->m_cap = Cap;
|
||||||
|
|
||||||
if (FreeResource())
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@ class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
|
|||||||
public:
|
public:
|
||||||
wxRegionRefData(void)
|
wxRegionRefData(void)
|
||||||
{
|
{
|
||||||
|
m_region = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegionRefData(const wxRegionRefData& data)
|
wxRegionRefData(const wxRegionRefData& data)
|
||||||
|
@@ -72,7 +72,7 @@ wxTextCtrl::wxTextCtrl(void)
|
|||||||
:streambuf()
|
:streambuf()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
fileName = "";
|
m_fileName = "";
|
||||||
m_isRich = FALSE;
|
m_isRich = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
fileName = "";
|
m_fileName = "";
|
||||||
SetName(name);
|
SetName(name);
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
@@ -504,7 +504,7 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
|||||||
if (!FileExists(WXSTRINGCAST file))
|
if (!FileExists(WXSTRINGCAST file))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
fileName = file;
|
m_fileName = file;
|
||||||
|
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
@@ -553,14 +553,14 @@ bool wxTextCtrl::LoadFile(const wxString& file)
|
|||||||
// Returns TRUE if succeeds.
|
// Returns TRUE if succeeds.
|
||||||
bool wxTextCtrl::SaveFile(const wxString& file)
|
bool wxTextCtrl::SaveFile(const wxString& file)
|
||||||
{
|
{
|
||||||
wxString theFile;
|
wxString theFile(file);
|
||||||
if (file == "")
|
if (theFile == "")
|
||||||
theFile = fileName;
|
theFile = m_fileName;
|
||||||
if (file == "")
|
if (theFile == "")
|
||||||
return FALSE;
|
return FALSE;
|
||||||
fileName = theFile;
|
m_fileName = theFile;
|
||||||
|
|
||||||
ofstream output(WXSTRINGCAST file);
|
ofstream output((char*) (const char*) theFile);
|
||||||
if (output.bad())
|
if (output.bad())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -848,33 +848,33 @@ wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
|
|||||||
|
|
||||||
wxTextCtrl& wxTextCtrl::operator<<(float f)
|
wxTextCtrl& wxTextCtrl::operator<<(float f)
|
||||||
{
|
{
|
||||||
static char buf[100];
|
wxString str;
|
||||||
sprintf(buf, "%.2f", f);
|
str.Printf("%.2f", f);
|
||||||
WriteText(buf);
|
WriteText(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextCtrl& wxTextCtrl::operator<<(double d)
|
wxTextCtrl& wxTextCtrl::operator<<(double d)
|
||||||
{
|
{
|
||||||
static char buf[100];
|
wxString str;
|
||||||
sprintf(buf, "%.2f", d);
|
str.Printf("%.2f", d);
|
||||||
WriteText(buf);
|
WriteText(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextCtrl& wxTextCtrl::operator<<(int i)
|
wxTextCtrl& wxTextCtrl::operator<<(int i)
|
||||||
{
|
{
|
||||||
static char buf[100];
|
wxString str;
|
||||||
sprintf(buf, "%i", i);
|
str.Printf("%d", i);
|
||||||
WriteText(buf);
|
WriteText(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextCtrl& wxTextCtrl::operator<<(long i)
|
wxTextCtrl& wxTextCtrl::operator<<(long i)
|
||||||
{
|
{
|
||||||
static char buf[100];
|
wxString str;
|
||||||
sprintf(buf, "%ld", i);
|
str.Printf("%ld", i);
|
||||||
WriteText(buf);
|
WriteText(str);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,7 +888,6 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
WXHBRUSH wxTextCtrl::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
* File: TreeCtrl.cpp
|
// Name: treectrl.cpp
|
||||||
* Purpose: Tree control
|
// Purpose: wxTreeCtrl
|
||||||
* Author: Julian Smart
|
// Author: Julian Smart
|
||||||
* Created: 1997
|
// Modified by:
|
||||||
* Updated:
|
// Created: 1997
|
||||||
* Copyright:
|
// RCS-ID: $Id$
|
||||||
*/
|
// Copyright: (c) Julian Smart
|
||||||
|
// Licence: wxWindows licence
|
||||||
/* static const char sccsid[] = "%W% %G%"; */
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "treectrl.h"
|
#pragma implementation "treectrl.h"
|
||||||
|
@@ -4362,7 +4362,6 @@ void wxWindow::SetupColours(void)
|
|||||||
|
|
||||||
void wxWindow::OnIdle(wxIdleEvent& event)
|
void wxWindow::OnIdle(wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// Check if we need to send a LEAVE event
|
// Check if we need to send a LEAVE event
|
||||||
if (m_mouseInWindow)
|
if (m_mouseInWindow)
|
||||||
{
|
{
|
||||||
@@ -4376,7 +4375,6 @@ void wxWindow::OnIdle(wxIdleEvent& event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateWindowUI();
|
UpdateWindowUI();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Raise the window to the top of the Z order
|
// Raise the window to the top of the Z order
|
||||||
|
Reference in New Issue
Block a user