*** wxWindows 2.3.3 ***
+Implemented new ref-counting for GDI classes.
+
+New implemenation of wxCondition.
+
+Implemented actual comparisons between GDI classes instead of
+comparing just the ref-count.
+
+Fixed wxMiniFrame again.
+
+Added wxCursor creation from wxImage.
+
+Added inlined wxHashMap class.
+
+Redone thread wake-up code for immediate wake-up instead
+of 50 ms pause. This gives apps 100% CPU time for background
+tasks.
+
New behaviour for wxWindow::Refresh() as it now produces a
delayed refresh. Call the new wxWindow::Update() to force
an immediate update.
-Support for more SGI hardware (12-bit mode among others).
+Support for more SGI hardware (12-bit mode among others) and
+corrections to wxImage code for special SGI visuals.
Changed wxDC::Blit() to honour source DC's logical coordinates.
Various updates to wxHTML.
-Some wxFont changes for better mixing of native fonts
-and wxFont's accessors.
-
-Corrections to wxImage code for special SGI visuals.
+Some wxFont changes for better mixing of native fonts and
+wxFont's accessors.
Added IFF image handler.
Added ICO, CUR and ANI image handler.
-wxFrame::SetMenuBar() works again.
+wxFrame::SetMenuBar() corrected.
wxButton honours wxBU_EXACTFIT.
class wxBrush: public wxGDIObject
{
public:
- wxBrush();
+ wxBrush() { }
+
wxBrush( const wxColour &colour, int style );
wxBrush( const wxBitmap &stippleBitmap );
- wxBrush( const wxBrush &brush );
~wxBrush();
- wxBrush& operator = ( const wxBrush& brush );
+
+ wxBrush( const wxBrush &brush ) { Ref(brush); }
+ wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
+
+ bool Ok() const { return m_refData != NULL; }
+
bool operator == ( const wxBrush& brush ) const;
- bool operator != ( const wxBrush& brush ) const;
- bool Ok() const;
+ bool operator != (const wxBrush& brush) const { return !(*this == brush); }
int GetStyle() const;
wxColour &GetColour() const;
void SetStyle( int style );
void SetStipple( const wxBitmap& stipple );
- void Unshare();
-
private:
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
DECLARE_DYNAMIC_CLASS(wxBrush)
};
class wxColour: public wxGDIObject
{
public:
- // ctors
- // default
- wxColour();
- // from RGB
- wxColour( unsigned char red, unsigned char green, unsigned char blue );
- wxColour( unsigned long colRGB ) { Set(colRGB); }
-
- // implicit conversion from the colour name
- wxColour( const wxString &colourName ) { InitFromName(colourName); }
- wxColour( const char *colourName ) { InitFromName(colourName); }
-
- // copy ctors and assignment operators
- wxColour( const wxColour& col );
- wxColour& operator = ( const wxColour& col );
-
- // dtor
- ~wxColour();
-
- // comparison
- bool operator == ( const wxColour& col ) const;
- bool operator != ( const wxColour& col ) const;
-
- // accessors
- void Set( unsigned char red, unsigned char green, unsigned char blue );
- void Set( unsigned long colRGB )
- {
- // we don't need to know sizeof(long) here because we assume that the three
- // least significant bytes contain the R, G and B values
- Set((unsigned char)colRGB,
- (unsigned char)(colRGB >> 8),
- (unsigned char)(colRGB >> 16));
- }
-
- unsigned char Red() const;
- unsigned char Green() const;
- unsigned char Blue() const;
- bool Ok() const;
-
- // implementation
- void CalcPixel( GdkColormap *cmap );
- int GetPixel() const;
- GdkColor *GetColor() const;
+ wxColour() { }
+
+ // Construct from RGB
+ wxColour( unsigned char red, unsigned char green, unsigned char blue );
+ wxColour( unsigned long colRGB ) { Set(colRGB); }
+
+ // Implicit conversion from the colour name
+ wxColour( const wxString &colourName ) { InitFromName(colourName); }
+ wxColour( const char *colourName ) { InitFromName(colourName); }
+
+ wxColour( const wxColour& col ) { Ref(col); }
+ wxColour& operator = ( const wxColour& col ) { Ref(col); return *this; }
+
+ ~wxColour();
+
+ bool Ok() const { return m_refData != NULL; }
+
+ bool operator == ( const wxColour& col ) const;
+ bool operator != ( const wxColour& col ) const { return !(*this == col); }
+
+ void Set( unsigned char red, unsigned char green, unsigned char blue );
+ void Set( unsigned long colRGB )
+ {
+ // We don't need to know sizeof(long) here because we assume that the three
+ // least significant bytes contain the R, G and B values
+ Set((unsigned char)colRGB,
+ (unsigned char)(colRGB >> 8),
+ (unsigned char)(colRGB >> 16));
+ }
+
+ unsigned char Red() const;
+ unsigned char Green() const;
+ unsigned char Blue() const;
+
+
+ // Implementation part
+ void CalcPixel( GdkColormap *cmap );
+ int GetPixel() const;
+ GdkColor *GetColor() const;
protected:
- // helper functions
- void InitFromName(const wxString& colourName);
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
+ // Helper functions
+ void InitFromName(const wxString& colourName);
private:
- DECLARE_DYNAMIC_CLASS(wxColour)
+ DECLARE_DYNAMIC_CLASS(wxColour)
};
#endif // __GTKCOLOURH__
class wxPen: public wxGDIObject
{
public:
- wxPen();
+ wxPen() { }
+
wxPen( const wxColour &colour, int width, int style );
- wxPen( const wxPen& pen );
~wxPen();
- wxPen& operator = ( const wxPen& pen );
+
+ wxPen( const wxPen& pen ) { Ref(pen); }
+ wxPen& operator = ( const wxPen& pen ) { Ref(pen); return *this; }
+
+ bool Ok() const { return m_refData != NULL; }
+
bool operator == ( const wxPen& pen ) const;
- bool operator != ( const wxPen& pen ) const;
+ bool operator != (const wxPen& pen) const { return !(*this == pen); }
void SetColour( const wxColour &colour );
void SetColour( int red, int green, int blue );
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;
wxDash* GetDash() const;
-
- bool Ok() const;
-
- void Unshare();
private:
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
DECLARE_DYNAMIC_CLASS(wxPen)
};
}
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
- virtual ~wxRegion();
+ ~wxRegion();
- wxRegion( const wxRegion& r ) { Ref(r); }
- wxRegion& operator = ( const wxRegion& r ) { Ref(r); return *this; }
+ wxRegion( const wxRegion& region ) { Ref(region); }
+ wxRegion& operator = ( const wxRegion& region ) { Ref(region); return *this; }
+
+ bool Ok() const { return m_refData != NULL; }
bool operator == ( const wxRegion& region );
- bool operator != ( const wxRegion& region );
+ bool operator != ( const wxRegion& region ) { return !(*this == region); }
void Clear();
class wxBrush: public wxGDIObject
{
public:
- wxBrush();
+ wxBrush() { }
+
wxBrush( const wxColour &colour, int style );
wxBrush( const wxBitmap &stippleBitmap );
- wxBrush( const wxBrush &brush );
~wxBrush();
- wxBrush& operator = ( const wxBrush& brush );
+
+ wxBrush( const wxBrush &brush ) { Ref(brush); }
+ wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
+
+ bool Ok() const { return m_refData != NULL; }
+
bool operator == ( const wxBrush& brush ) const;
- bool operator != ( const wxBrush& brush ) const;
- bool Ok() const;
+ bool operator != (const wxBrush& brush) const { return !(*this == brush); }
int GetStyle() const;
wxColour &GetColour() const;
void SetStyle( int style );
void SetStipple( const wxBitmap& stipple );
- void Unshare();
-
private:
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
DECLARE_DYNAMIC_CLASS(wxBrush)
};
class wxColour: public wxGDIObject
{
public:
- // ctors
- // default
- wxColour();
- // from RGB
- wxColour( unsigned char red, unsigned char green, unsigned char blue );
- wxColour( unsigned long colRGB ) { Set(colRGB); }
-
- // implicit conversion from the colour name
- wxColour( const wxString &colourName ) { InitFromName(colourName); }
- wxColour( const char *colourName ) { InitFromName(colourName); }
-
- // copy ctors and assignment operators
- wxColour( const wxColour& col );
- wxColour& operator = ( const wxColour& col );
-
- // dtor
- ~wxColour();
-
- // comparison
- bool operator == ( const wxColour& col ) const;
- bool operator != ( const wxColour& col ) const;
-
- // accessors
- void Set( unsigned char red, unsigned char green, unsigned char blue );
- void Set( unsigned long colRGB )
- {
- // we don't need to know sizeof(long) here because we assume that the three
- // least significant bytes contain the R, G and B values
- Set((unsigned char)colRGB,
- (unsigned char)(colRGB >> 8),
- (unsigned char)(colRGB >> 16));
- }
-
- unsigned char Red() const;
- unsigned char Green() const;
- unsigned char Blue() const;
- bool Ok() const;
-
- // implementation
- void CalcPixel( GdkColormap *cmap );
- int GetPixel() const;
- GdkColor *GetColor() const;
+ wxColour() { }
+
+ // Construct from RGB
+ wxColour( unsigned char red, unsigned char green, unsigned char blue );
+ wxColour( unsigned long colRGB ) { Set(colRGB); }
+
+ // Implicit conversion from the colour name
+ wxColour( const wxString &colourName ) { InitFromName(colourName); }
+ wxColour( const char *colourName ) { InitFromName(colourName); }
+
+ wxColour( const wxColour& col ) { Ref(col); }
+ wxColour& operator = ( const wxColour& col ) { Ref(col); return *this; }
+
+ ~wxColour();
+
+ bool Ok() const { return m_refData != NULL; }
+
+ bool operator == ( const wxColour& col ) const;
+ bool operator != ( const wxColour& col ) const { return !(*this == col); }
+
+ void Set( unsigned char red, unsigned char green, unsigned char blue );
+ void Set( unsigned long colRGB )
+ {
+ // We don't need to know sizeof(long) here because we assume that the three
+ // least significant bytes contain the R, G and B values
+ Set((unsigned char)colRGB,
+ (unsigned char)(colRGB >> 8),
+ (unsigned char)(colRGB >> 16));
+ }
+
+ unsigned char Red() const;
+ unsigned char Green() const;
+ unsigned char Blue() const;
+
+
+ // Implementation part
+ void CalcPixel( GdkColormap *cmap );
+ int GetPixel() const;
+ GdkColor *GetColor() const;
protected:
- // helper functions
- void InitFromName(const wxString& colourName);
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
+ // Helper functions
+ void InitFromName(const wxString& colourName);
private:
- DECLARE_DYNAMIC_CLASS(wxColour)
+ DECLARE_DYNAMIC_CLASS(wxColour)
};
#endif // __GTKCOLOURH__
class wxPen: public wxGDIObject
{
public:
- wxPen();
+ wxPen() { }
+
wxPen( const wxColour &colour, int width, int style );
- wxPen( const wxPen& pen );
~wxPen();
- wxPen& operator = ( const wxPen& pen );
+
+ wxPen( const wxPen& pen ) { Ref(pen); }
+ wxPen& operator = ( const wxPen& pen ) { Ref(pen); return *this; }
+
+ bool Ok() const { return m_refData != NULL; }
+
bool operator == ( const wxPen& pen ) const;
- bool operator != ( const wxPen& pen ) const;
+ bool operator != (const wxPen& pen) const { return !(*this == pen); }
void SetColour( const wxColour &colour );
void SetColour( int red, int green, int blue );
int GetDashes(wxDash **ptr) const;
int GetDashCount() const;
wxDash* GetDash() const;
-
- bool Ok() const;
-
- void Unshare();
private:
+ // ref counting code
+ virtual wxObjectRefData *CreateRefData() const;
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
DECLARE_DYNAMIC_CLASS(wxPen)
};
}
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
- virtual ~wxRegion();
+ ~wxRegion();
- wxRegion( const wxRegion& r ) { Ref(r); }
- wxRegion& operator = ( const wxRegion& r ) { Ref(r); return *this; }
+ wxRegion( const wxRegion& region ) { Ref(region); }
+ wxRegion& operator = ( const wxRegion& region ) { Ref(region); return *this; }
+
+ bool Ok() const { return m_refData != NULL; }
bool operator == ( const wxRegion& region );
- bool operator != ( const wxRegion& region );
+ bool operator != ( const wxRegion& region ) { return !(*this == region); }
void Clear();
DEBUG_PRINTF(wxObject::Ref)
#endif
+ // nothing to be done
+ if (m_refData == clone.m_refData)
+ return;
+
// delete reference to old data
UnRef();
class wxBrushRefData: public wxObjectRefData
{
public:
- wxBrushRefData();
- wxBrushRefData( const wxBrushRefData& data );
-
- int m_style;
- wxBitmap m_stipple;
- wxColour m_colour;
+ wxBrushRefData()
+ {
+ m_style = 0;
+ }
+
+ wxBrushRefData( const wxBrushRefData& data )
+ {
+ m_style = data.m_style;
+ m_stipple = data.m_stipple;
+ m_colour = data.m_colour;
+ }
+
+ bool operator == (const wxBrushRefData& data) const
+ {
+ return (m_style == data.m_style &&
+ m_stipple == data.m_stipple &&
+ m_colour == data.m_colour);
+ }
+
+ int m_style;
+ wxColour m_colour;
+ wxBitmap m_stipple;
};
-wxBrushRefData::wxBrushRefData()
-{
- m_style = 0;
-}
-
-wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
-{
- m_style = data.m_style;
- m_stipple = data.m_stipple;
- m_colour = data.m_colour;
-}
-
//-----------------------------------------------------------------------------
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
-wxBrush::wxBrush()
-{
-}
-
wxBrush::wxBrush( const wxColour &colour, int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = wxSTIPPLE;
}
-wxBrush::wxBrush( const wxBrush &brush )
-{
- Ref( brush );
-}
-
wxBrush::~wxBrush()
{
+ // m_refData unrefed in ~wxObject
}
-wxBrush& wxBrush::operator = ( const wxBrush& brush )
-{
- if ( m_refData != brush.m_refData )
- Ref( brush );
-
- return *this;
-}
-
-bool wxBrush::operator == ( const wxBrush& brush ) const
+wxObjectRefData *wxBrush::CreateRefData() const
{
- return m_refData == brush.m_refData;
+ return new wxBrushRefData;
}
-bool wxBrush::operator != ( const wxBrush& brush ) const
+wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
{
- return m_refData != brush.m_refData;
+ return new wxBrushRefData(*(wxBrushRefData *)data);
}
-bool wxBrush::Ok() const
+bool wxBrush::operator == ( const wxBrush& brush ) const
{
- return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
+ if (m_refData == brush.m_refData) return TRUE;
+
+ if (!m_refData || !brush.m_refData) return FALSE;
+
+ return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData );
}
int wxBrush::GetStyle() const
void wxBrush::SetColour( const wxColour& col )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_colour.Set( r, g, b );
}
void wxBrush::SetStyle( int style )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_style = style;
}
void wxBrush::SetStipple( const wxBitmap& stipple )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_stipple = stipple;
if (M_BRUSHDATA->m_stipple.GetMask())
{
}
}
-void wxBrush::Unshare()
-{
- if (!m_refData)
- {
- m_refData = new wxBrushRefData();
- }
- else
- {
- wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData );
- UnRef();
- m_refData = ref;
- }
-}
-
class wxColourRefData: public wxObjectRefData
{
public:
- wxColourRefData();
- ~wxColourRefData();
+ wxColourRefData()
+ {
+ m_color.red = 0;
+ m_color.green = 0;
+ m_color.blue = 0;
+ m_color.pixel = 0;
+ m_colormap = (GdkColormap *) NULL;
+ m_hasPixel = FALSE;
+ }
+
+ ~wxColourRefData()
+ {
+ FreeColour();
+ }
+ bool operator == (const wxColourRefData& data) const
+ {
+ return (m_colormap == data.m_colormap &&
+ m_hasPixel == data.m_hasPixel &&
+ m_color.red == data.m_color.red &&
+ m_color.green == data.m_color.green &&
+ m_color.blue == data.m_color.blue &&
+ m_color.pixel == data.m_color.pixel);
+ }
+
void FreeColour();
void AllocColour( GdkColormap* cmap );
-public:
GdkColor m_color;
GdkColormap *m_colormap;
bool m_hasPixel;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-wxColourRefData::wxColourRefData()
-{
- m_color.red = 0;
- m_color.green = 0;
- m_color.blue = 0;
- m_color.pixel = 0;
- m_colormap = (GdkColormap *) NULL;
- m_hasPixel = FALSE;
-}
-
-wxColourRefData::~wxColourRefData()
-{
- FreeColour();
-}
-
void wxColourRefData::FreeColour()
{
if (m_colormap)
IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
-wxColour::wxColour()
-{
-}
-
wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{
m_refData = new wxColourRefData();
}
}
-wxColour::wxColour( const wxColour& col )
-{
- Ref( col );
-}
-
wxColour::~wxColour()
{
}
-wxColour& wxColour::operator = ( const wxColour& col )
-{
- if (*this == col) return (*this);
- Ref( col );
- return *this;
-}
-
bool wxColour::operator == ( const wxColour& col ) const
{
if (m_refData == col.m_refData) return TRUE;
- if (!m_refData) return FALSE;
- if (!col.m_refData) return FALSE;
+ if (!m_refData || !col.m_refData) return FALSE;
GdkColor *own = &(((wxColourRefData*)m_refData)->m_color);
GdkColor *other = &(((wxColourRefData*)col.m_refData)->m_color);
return TRUE;
}
-bool wxColour::operator != ( const wxColour& col) const
+wxObjectRefData *wxColour::CreateRefData() const
+{
+ return new wxColourRefData;
+}
+
+wxObjectRefData *wxColour::CloneRefData(const wxObjectRefData *data) const
{
- return !(*this == col);
+ return new wxColourRefData(*(wxColourRefData *)data);
}
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
{
- UnRef();
+ AllocExclusive();
+
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
}
-bool wxColour::Ok() const
-{
- return (m_refData != NULL);
-}
-
void wxColour::CalcPixel( GdkColormap *cmap )
{
if (!Ok()) return;
class wxPenRefData: public wxObjectRefData
{
public:
-
- wxPenRefData();
- wxPenRefData( const wxPenRefData& data );
-
- int m_width;
- int m_style;
- int m_joinStyle;
- int m_capStyle;
- wxColour m_colour;
- int m_countDashes;
- wxGTKDash *m_dash;
-};
-
-wxPenRefData::wxPenRefData()
-{
- m_width = 1;
- m_style = wxSOLID;
- m_joinStyle = wxJOIN_ROUND;
- m_capStyle = wxCAP_ROUND;
- m_dash = (wxGTKDash*) NULL;
- m_countDashes = 0;
-}
-
-wxPenRefData::wxPenRefData( const wxPenRefData& data )
-{
- m_style = data.m_style;
- m_width = data.m_width;
- m_joinStyle = data.m_joinStyle;
- m_capStyle = data.m_capStyle;
- m_colour = data.m_colour;
- m_countDashes = data.m_countDashes;
+ wxPenRefData()
+ {
+ m_width = 1;
+ m_style = wxSOLID;
+ m_joinStyle = wxJOIN_ROUND;
+ m_capStyle = wxCAP_ROUND;
+ m_dash = (wxGTKDash*) NULL;
+ m_countDashes = 0;
+ }
+
+ wxPenRefData( const wxPenRefData& data )
+ {
+ m_style = data.m_style;
+ m_width = data.m_width;
+ m_joinStyle = data.m_joinStyle;
+ m_capStyle = data.m_capStyle;
+ m_colour = data.m_colour;
+ m_countDashes = data.m_countDashes;
/*
- if (data.m_dash) TODO
- m_dash = new
+ if (data.m_dash) TODO
+ m_dash = new
*/
- m_dash = data.m_dash;
-}
+ m_dash = data.m_dash;
+ }
+
+ bool operator == (const wxPenRefData& data) const
+ {
+ return (m_style == data.m_style &&
+ m_width == data.m_width &&
+ m_joinStyle == data.m_joinStyle &&
+ m_capStyle == data.m_capStyle &&
+ m_colour == data.m_colour);
+ }
+
+ int m_width;
+ int m_style;
+ int m_joinStyle;
+ int m_capStyle;
+ wxColour m_colour;
+ int m_countDashes;
+ wxGTKDash *m_dash;
+};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
-wxPen::wxPen()
-{
-}
-
wxPen::wxPen( const wxColour &colour, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_colour = colour;
}
-wxPen::wxPen( const wxPen& pen )
-{
- Ref( pen );
-}
-
wxPen::~wxPen()
{
+ // m_refData unrefed in ~wxObject
}
-wxPen& wxPen::operator = ( const wxPen& pen )
+wxObjectRefData *wxPen::CreateRefData() const
{
- if ( m_refData != pen.m_refData )
- Ref( pen );
-
- return *this;
+ return new wxPenRefData;
}
-bool wxPen::operator == ( const wxPen& pen ) const
+wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const
{
- return m_refData == pen.m_refData;
+ return new wxPenRefData(*(wxPenRefData *)data);
}
-bool wxPen::operator != ( const wxPen& pen ) const
+bool wxPen::operator == ( const wxPen& pen ) const
{
- return m_refData != pen.m_refData;
+ if (m_refData == pen.m_refData) return TRUE;
+
+ if (!m_refData || !pen.m_refData) return FALSE;
+
+ return ( *(wxPenRefData*)m_refData == *(wxPenRefData*)pen.m_refData );
}
void wxPen::SetColour( const wxColour &colour )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_colour = colour;
}
void wxPen::SetDashes( int number_of_dashes, const wxDash *dash )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_countDashes = number_of_dashes;
M_PENDATA->m_dash = (wxGTKDash *)dash; /* TODO */
}
void wxPen::SetColour( int red, int green, int blue )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_colour.Set( red, green, blue );
}
void wxPen::SetCap( int capStyle )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin( int joinStyle )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_joinStyle = joinStyle;
}
void wxPen::SetStyle( int style )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_style = style;
}
void wxPen::SetWidth( int width )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_width = width;
}
return M_PENDATA->m_colour;
}
-bool wxPen::Ok() const
-{
- return (m_refData != NULL);
-}
-
-void wxPen::Unshare()
-{
- if (!m_refData)
- {
- m_refData = new wxPenRefData();
- }
- else
- {
- wxPenRefData* ref = new wxPenRefData( *(wxPenRefData*)m_refData );
- UnRef();
- m_refData = ref;
- }
-}
-
{
return new wxRegionRefData(*(wxRegionRefData *)data);
}
+
// ----------------------------------------------------------------------------
// wxRegion comparison
// ----------------------------------------------------------------------------
bool wxRegion::operator==( const wxRegion& region )
{
+ if (m_refData == region.m_refData) return TRUE;
+
+ if (!m_refData || !region.m_refData) return FALSE;
+
// compare the regions themselves, not the pointers to ref data!
return gdk_region_equal(M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region);
}
-bool wxRegion::operator != ( const wxRegion& region )
-{
- return !(*this == region);
-}
-
// ----------------------------------------------------------------------------
// wxRegion operations
// ----------------------------------------------------------------------------
if (gdk_event->count == 0)
win->GtkSendPaintEvents();
- // The following code will result in all window-less widgets
- // being redrawn if the wxWindows class is given a chance to
- // paint *anything* because it will then be allowed to paint
- // over the window-less widgets.
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
-
- GdkEventExpose child_event = *gdk_event;
-
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- GTK_WIDGET_DRAWABLE (child->widget) /* &&
- gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
- {
- child_event.area.x = child->widget->allocation.x;
- child_event.area.y = child->widget->allocation.y;
- child_event.area.width = child->widget->allocation.width;
- child_event.area.height = child->widget->allocation.height;
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
- }
-
return TRUE;
}
paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event );
- m_updateRegion.Clear();
-
m_clipPaintRegion = FALSE;
+
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+ if (g_list_length(pizza->children) > 0)
+ {
+ // The following code will result in all window-less widgets
+ // being redrawn because the wxWindows class is allowed to
+ // paint over the window-less widgets.
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget))
+ {
+ // Get intersection of widget area and update region
+ wxRegion region( m_updateRegion );
+ region.Intersect( child->widget->allocation.x,
+ child->widget->allocation.y,
+ child->widget->allocation.width,
+ child->widget->allocation.height );
+
+ // Redraw the whole widget anyway
+ if (!region.IsEmpty())
+ gtk_widget_draw( child->widget, NULL );
+ }
+ }
+ }
+
+ m_updateRegion.Clear();
}
void wxWindowGTK::Clear()
class wxBrushRefData: public wxObjectRefData
{
public:
- wxBrushRefData();
- wxBrushRefData( const wxBrushRefData& data );
-
- int m_style;
- wxBitmap m_stipple;
- wxColour m_colour;
+ wxBrushRefData()
+ {
+ m_style = 0;
+ }
+
+ wxBrushRefData( const wxBrushRefData& data )
+ {
+ m_style = data.m_style;
+ m_stipple = data.m_stipple;
+ m_colour = data.m_colour;
+ }
+
+ bool operator == (const wxBrushRefData& data) const
+ {
+ return (m_style == data.m_style &&
+ m_stipple == data.m_stipple &&
+ m_colour == data.m_colour);
+ }
+
+ int m_style;
+ wxColour m_colour;
+ wxBitmap m_stipple;
};
-wxBrushRefData::wxBrushRefData()
-{
- m_style = 0;
-}
-
-wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
-{
- m_style = data.m_style;
- m_stipple = data.m_stipple;
- m_colour = data.m_colour;
-}
-
//-----------------------------------------------------------------------------
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
-wxBrush::wxBrush()
-{
-}
-
wxBrush::wxBrush( const wxColour &colour, int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = wxSTIPPLE;
}
-wxBrush::wxBrush( const wxBrush &brush )
-{
- Ref( brush );
-}
-
wxBrush::~wxBrush()
{
+ // m_refData unrefed in ~wxObject
}
-wxBrush& wxBrush::operator = ( const wxBrush& brush )
-{
- if ( m_refData != brush.m_refData )
- Ref( brush );
-
- return *this;
-}
-
-bool wxBrush::operator == ( const wxBrush& brush ) const
+wxObjectRefData *wxBrush::CreateRefData() const
{
- return m_refData == brush.m_refData;
+ return new wxBrushRefData;
}
-bool wxBrush::operator != ( const wxBrush& brush ) const
+wxObjectRefData *wxBrush::CloneRefData(const wxObjectRefData *data) const
{
- return m_refData != brush.m_refData;
+ return new wxBrushRefData(*(wxBrushRefData *)data);
}
-bool wxBrush::Ok() const
+bool wxBrush::operator == ( const wxBrush& brush ) const
{
- return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
+ if (m_refData == brush.m_refData) return TRUE;
+
+ if (!m_refData || !brush.m_refData) return FALSE;
+
+ return ( *(wxBrushRefData*)m_refData == *(wxBrushRefData*)brush.m_refData );
}
int wxBrush::GetStyle() const
void wxBrush::SetColour( const wxColour& col )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_colour = col;
}
void wxBrush::SetColour( unsigned char r, unsigned char g, unsigned char b )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_colour.Set( r, g, b );
}
void wxBrush::SetStyle( int style )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_style = style;
}
void wxBrush::SetStipple( const wxBitmap& stipple )
{
- Unshare();
+ AllocExclusive();
+
M_BRUSHDATA->m_stipple = stipple;
if (M_BRUSHDATA->m_stipple.GetMask())
{
}
}
-void wxBrush::Unshare()
-{
- if (!m_refData)
- {
- m_refData = new wxBrushRefData();
- }
- else
- {
- wxBrushRefData* ref = new wxBrushRefData( *(wxBrushRefData*)m_refData );
- UnRef();
- m_refData = ref;
- }
-}
-
class wxColourRefData: public wxObjectRefData
{
public:
- wxColourRefData();
- ~wxColourRefData();
+ wxColourRefData()
+ {
+ m_color.red = 0;
+ m_color.green = 0;
+ m_color.blue = 0;
+ m_color.pixel = 0;
+ m_colormap = (GdkColormap *) NULL;
+ m_hasPixel = FALSE;
+ }
+
+ ~wxColourRefData()
+ {
+ FreeColour();
+ }
+ bool operator == (const wxColourRefData& data) const
+ {
+ return (m_colormap == data.m_colormap &&
+ m_hasPixel == data.m_hasPixel &&
+ m_color.red == data.m_color.red &&
+ m_color.green == data.m_color.green &&
+ m_color.blue == data.m_color.blue &&
+ m_color.pixel == data.m_color.pixel);
+ }
+
void FreeColour();
void AllocColour( GdkColormap* cmap );
-public:
GdkColor m_color;
GdkColormap *m_colormap;
bool m_hasPixel;
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-wxColourRefData::wxColourRefData()
-{
- m_color.red = 0;
- m_color.green = 0;
- m_color.blue = 0;
- m_color.pixel = 0;
- m_colormap = (GdkColormap *) NULL;
- m_hasPixel = FALSE;
-}
-
-wxColourRefData::~wxColourRefData()
-{
- FreeColour();
-}
-
void wxColourRefData::FreeColour()
{
if (m_colormap)
IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
-wxColour::wxColour()
-{
-}
-
wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
{
m_refData = new wxColourRefData();
}
}
-wxColour::wxColour( const wxColour& col )
-{
- Ref( col );
-}
-
wxColour::~wxColour()
{
}
-wxColour& wxColour::operator = ( const wxColour& col )
-{
- if (*this == col) return (*this);
- Ref( col );
- return *this;
-}
-
bool wxColour::operator == ( const wxColour& col ) const
{
if (m_refData == col.m_refData) return TRUE;
- if (!m_refData) return FALSE;
- if (!col.m_refData) return FALSE;
+ if (!m_refData || !col.m_refData) return FALSE;
GdkColor *own = &(((wxColourRefData*)m_refData)->m_color);
GdkColor *other = &(((wxColourRefData*)col.m_refData)->m_color);
return TRUE;
}
-bool wxColour::operator != ( const wxColour& col) const
+wxObjectRefData *wxColour::CreateRefData() const
+{
+ return new wxColourRefData;
+}
+
+wxObjectRefData *wxColour::CloneRefData(const wxObjectRefData *data) const
{
- return !(*this == col);
+ return new wxColourRefData(*(wxColourRefData *)data);
}
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
{
- UnRef();
+ AllocExclusive();
+
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
}
-bool wxColour::Ok() const
-{
- return (m_refData != NULL);
-}
-
void wxColour::CalcPixel( GdkColormap *cmap )
{
if (!Ok()) return;
class wxPenRefData: public wxObjectRefData
{
public:
-
- wxPenRefData();
- wxPenRefData( const wxPenRefData& data );
-
- int m_width;
- int m_style;
- int m_joinStyle;
- int m_capStyle;
- wxColour m_colour;
- int m_countDashes;
- wxGTKDash *m_dash;
-};
-
-wxPenRefData::wxPenRefData()
-{
- m_width = 1;
- m_style = wxSOLID;
- m_joinStyle = wxJOIN_ROUND;
- m_capStyle = wxCAP_ROUND;
- m_dash = (wxGTKDash*) NULL;
- m_countDashes = 0;
-}
-
-wxPenRefData::wxPenRefData( const wxPenRefData& data )
-{
- m_style = data.m_style;
- m_width = data.m_width;
- m_joinStyle = data.m_joinStyle;
- m_capStyle = data.m_capStyle;
- m_colour = data.m_colour;
- m_countDashes = data.m_countDashes;
+ wxPenRefData()
+ {
+ m_width = 1;
+ m_style = wxSOLID;
+ m_joinStyle = wxJOIN_ROUND;
+ m_capStyle = wxCAP_ROUND;
+ m_dash = (wxGTKDash*) NULL;
+ m_countDashes = 0;
+ }
+
+ wxPenRefData( const wxPenRefData& data )
+ {
+ m_style = data.m_style;
+ m_width = data.m_width;
+ m_joinStyle = data.m_joinStyle;
+ m_capStyle = data.m_capStyle;
+ m_colour = data.m_colour;
+ m_countDashes = data.m_countDashes;
/*
- if (data.m_dash) TODO
- m_dash = new
+ if (data.m_dash) TODO
+ m_dash = new
*/
- m_dash = data.m_dash;
-}
+ m_dash = data.m_dash;
+ }
+
+ bool operator == (const wxPenRefData& data) const
+ {
+ return (m_style == data.m_style &&
+ m_width == data.m_width &&
+ m_joinStyle == data.m_joinStyle &&
+ m_capStyle == data.m_capStyle &&
+ m_colour == data.m_colour);
+ }
+
+ int m_width;
+ int m_style;
+ int m_joinStyle;
+ int m_capStyle;
+ wxColour m_colour;
+ int m_countDashes;
+ wxGTKDash *m_dash;
+};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
-wxPen::wxPen()
-{
-}
-
wxPen::wxPen( const wxColour &colour, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_colour = colour;
}
-wxPen::wxPen( const wxPen& pen )
-{
- Ref( pen );
-}
-
wxPen::~wxPen()
{
+ // m_refData unrefed in ~wxObject
}
-wxPen& wxPen::operator = ( const wxPen& pen )
+wxObjectRefData *wxPen::CreateRefData() const
{
- if ( m_refData != pen.m_refData )
- Ref( pen );
-
- return *this;
+ return new wxPenRefData;
}
-bool wxPen::operator == ( const wxPen& pen ) const
+wxObjectRefData *wxPen::CloneRefData(const wxObjectRefData *data) const
{
- return m_refData == pen.m_refData;
+ return new wxPenRefData(*(wxPenRefData *)data);
}
-bool wxPen::operator != ( const wxPen& pen ) const
+bool wxPen::operator == ( const wxPen& pen ) const
{
- return m_refData != pen.m_refData;
+ if (m_refData == pen.m_refData) return TRUE;
+
+ if (!m_refData || !pen.m_refData) return FALSE;
+
+ return ( *(wxPenRefData*)m_refData == *(wxPenRefData*)pen.m_refData );
}
void wxPen::SetColour( const wxColour &colour )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_colour = colour;
}
void wxPen::SetDashes( int number_of_dashes, const wxDash *dash )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_countDashes = number_of_dashes;
M_PENDATA->m_dash = (wxGTKDash *)dash; /* TODO */
}
void wxPen::SetColour( int red, int green, int blue )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_colour.Set( red, green, blue );
}
void wxPen::SetCap( int capStyle )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_capStyle = capStyle;
}
void wxPen::SetJoin( int joinStyle )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_joinStyle = joinStyle;
}
void wxPen::SetStyle( int style )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_style = style;
}
void wxPen::SetWidth( int width )
{
- Unshare();
+ AllocExclusive();
+
M_PENDATA->m_width = width;
}
return M_PENDATA->m_colour;
}
-bool wxPen::Ok() const
-{
- return (m_refData != NULL);
-}
-
-void wxPen::Unshare()
-{
- if (!m_refData)
- {
- m_refData = new wxPenRefData();
- }
- else
- {
- wxPenRefData* ref = new wxPenRefData( *(wxPenRefData*)m_refData );
- UnRef();
- m_refData = ref;
- }
-}
-
{
return new wxRegionRefData(*(wxRegionRefData *)data);
}
+
// ----------------------------------------------------------------------------
// wxRegion comparison
// ----------------------------------------------------------------------------
bool wxRegion::operator==( const wxRegion& region )
{
+ if (m_refData == region.m_refData) return TRUE;
+
+ if (!m_refData || !region.m_refData) return FALSE;
+
// compare the regions themselves, not the pointers to ref data!
return gdk_region_equal(M_REGIONDATA->m_region,
M_REGIONDATA_OF(region)->m_region);
}
-bool wxRegion::operator != ( const wxRegion& region )
-{
- return !(*this == region);
-}
-
// ----------------------------------------------------------------------------
// wxRegion operations
// ----------------------------------------------------------------------------
if (gdk_event->count == 0)
win->GtkSendPaintEvents();
- // The following code will result in all window-less widgets
- // being redrawn if the wxWindows class is given a chance to
- // paint *anything* because it will then be allowed to paint
- // over the window-less widgets.
- GList *children = pizza->children;
- while (children)
- {
- GtkPizzaChild *child = (GtkPizzaChild*) children->data;
- children = children->next;
-
- GdkEventExpose child_event = *gdk_event;
-
- if (GTK_WIDGET_NO_WINDOW (child->widget) &&
- GTK_WIDGET_DRAWABLE (child->widget) /* &&
- gtk_widget_intersect (child->widget, &gdk_event->area, &child_event.area)*/ )
- {
- child_event.area.x = child->widget->allocation.x;
- child_event.area.y = child->widget->allocation.y;
- child_event.area.width = child->widget->allocation.width;
- child_event.area.height = child->widget->allocation.height;
- gtk_widget_event (child->widget, (GdkEvent*) &child_event);
- }
- }
-
return TRUE;
}
paint_event.SetEventObject( this );
GetEventHandler()->ProcessEvent( paint_event );
- m_updateRegion.Clear();
-
m_clipPaintRegion = FALSE;
+
+ GtkPizza *pizza = GTK_PIZZA(m_wxwindow);
+ if (g_list_length(pizza->children) > 0)
+ {
+ // The following code will result in all window-less widgets
+ // being redrawn because the wxWindows class is allowed to
+ // paint over the window-less widgets.
+ GList *children = pizza->children;
+ while (children)
+ {
+ GtkPizzaChild *child = (GtkPizzaChild*) children->data;
+ children = children->next;
+
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_WIDGET_DRAWABLE (child->widget))
+ {
+ // Get intersection of widget area and update region
+ wxRegion region( m_updateRegion );
+ region.Intersect( child->widget->allocation.x,
+ child->widget->allocation.y,
+ child->widget->allocation.width,
+ child->widget->allocation.height );
+
+ // Redraw the whole widget anyway
+ if (!region.IsEmpty())
+ gtk_widget_draw( child->widget, NULL );
+ }
+ }
+ }
+
+ m_updateRegion.Clear();
}
void wxWindowGTK::Clear()