"wxGDIObject * => &" related changes (see mail to the list)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1142 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-12-09 17:30:17 +00:00
parent e7003166c3
commit 8bbe427f8e
66 changed files with 2551 additions and 2698 deletions

View File

@@ -76,7 +76,7 @@ extern wxString wxExpandEnvVars(const wxString &sz);
extern void wxSplitPath(wxArrayString& aParts, const char *sz); extern void wxSplitPath(wxArrayString& aParts, const char *sz);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// abstract base class wxConfigBase which defines the interface for derived // abstract base class wxConfigBase which defines the interface for derived
// classes // classes
// //
// wxConfig organizes the items in a tree-like structure (modeled after the // wxConfig organizes the items in a tree-like structure (modeled after the
@@ -222,14 +222,14 @@ public:
protected: protected:
static bool IsImmutable(const wxString& key) static bool IsImmutable(const wxString& key)
{ return key[0u] == wxCONFIG_IMMUTABLE_PREFIX; } { return !key.IsEmpty() && key[0u] == wxCONFIG_IMMUTABLE_PREFIX; }
private: private:
// are we doing automatic environment variable expansion? // are we doing automatic environment variable expansion?
bool m_bExpandEnvVars; bool m_bExpandEnvVars;
// do we record default values? // do we record default values?
bool m_bRecordDefaults; bool m_bRecordDefaults;
// static variables // static variables
static wxConfigBase *ms_pConfig; static wxConfigBase *ms_pConfig;
static bool ms_bAutoCreate; static bool ms_bAutoCreate;

View File

@@ -55,7 +55,7 @@ public:
~wxMask(); ~wxMask();
// implementation // implementation
GdkBitmap *m_bitmap; GdkBitmap *m_bitmap;
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;
}; };
@@ -75,14 +75,13 @@ public:
wxBitmap( const char **bits ); wxBitmap( const char **bits );
wxBitmap( char **bits ); wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp ); wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp );
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
~wxBitmap(); ~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp ); wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp ); bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp ); bool operator != ( const wxBitmap& bmp );
bool Ok() const; bool Ok() const;
int GetHeight() const; int GetHeight() const;
int GetWidth() const; int GetWidth() const;
int GetDepth() const; int GetDepth() const;
@@ -96,14 +95,14 @@ public:
wxPalette *GetPalette() const; wxPalette *GetPalette() const;
wxPalette *GetColourMap() const wxPalette *GetColourMap() const
{ return GetPalette(); }; { return GetPalette(); };
// implementation // implementation
void SetHeight( int height ); void SetHeight( int height );
void SetWidth( int width ); void SetWidth( int width );
void SetDepth( int depth ); void SetDepth( int depth );
void SetPixmap( GdkPixmap *pixmap ); void SetPixmap( GdkPixmap *pixmap );
GdkPixmap *GetPixmap() const; GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -37,29 +37,28 @@ class wxBrush: public wxGDIObject
public: public:
wxBrush(void); wxBrush();
wxBrush( const wxColour &colour, int style ); wxBrush( const wxColour &colour, int style );
wxBrush( const wxBitmap &stippleBitmap ); wxBrush( const wxBitmap &stippleBitmap );
wxBrush( const wxBrush &brush ); wxBrush( const wxBrush &brush );
wxBrush( const wxBrush *brush ); ~wxBrush();
~wxBrush(void);
wxBrush& operator = ( const wxBrush& brush ); wxBrush& operator = ( const wxBrush& brush );
bool operator == ( const wxBrush& brush ); bool operator == ( const wxBrush& brush );
bool operator != ( const wxBrush& brush ); bool operator != ( const wxBrush& brush );
bool Ok(void) const; bool Ok() const;
int GetStyle() const;
wxColour &GetColour() const;
wxBitmap *GetStipple() const;
int GetStyle(void) const;
wxColour &GetColour(void) const;
wxBitmap *GetStipple(void) const;
void SetColour( const wxColour& col ); void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style ); void SetStyle( int style );
void SetStipple( const wxBitmap& stipple ); void SetStipple( const wxBitmap& stipple );
void Unshare(void); void Unshare();
// no data :-) // no data :-)
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -50,7 +50,6 @@ public:
// copy ctors and assignment operators // copy ctors and assignment operators
wxColour( const wxColour& col ); wxColour( const wxColour& col );
wxColour( const wxColour* col );
wxColour& operator = ( const wxColour& col ); wxColour& operator = ( const wxColour& col );
// dtor // dtor
@@ -59,7 +58,7 @@ public:
// comparison // comparison
bool operator == ( const wxColour& col ); bool operator == ( const wxColour& col );
bool operator != ( const wxColour& col ); bool operator != ( const wxColour& col );
// accessors // accessors
void Set( unsigned char red, unsigned char green, unsigned char blue ); void Set( unsigned char red, unsigned char green, unsigned char blue );
unsigned char Red() const; unsigned char Red() const;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -19,14 +19,6 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxWindow;
class wxCursor;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxCursor // wxCursor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -37,22 +29,16 @@ class wxCursor: public wxObject
public: public:
wxCursor(void); wxCursor();
wxCursor( int cursorId ); wxCursor( int cursorId );
wxCursor( const wxCursor &cursor ); wxCursor( const wxCursor &cursor );
wxCursor( const wxCursor *cursor ); ~wxCursor();
~wxCursor(void);
wxCursor& operator = ( const wxCursor& cursor ); wxCursor& operator = ( const wxCursor& cursor );
bool operator == ( const wxCursor& cursor ); bool operator == ( const wxCursor& cursor ) const;
bool operator != ( const wxCursor& cursor ); bool operator != ( const wxCursor& cursor ) const;
bool Ok(void) const; bool Ok() const;
private: GdkCursor *GetCursor() const;
public:
friend wxWindow;
GdkCursor *GetCursor(void) const;
// no data :-) // no data :-)
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -34,14 +34,14 @@ class wxDC;
// constants // constants
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define MM_TEXT 0 #define MM_TEXT 0
#define MM_ISOTROPIC 1 #define MM_ISOTROPIC 1
#define MM_ANISOTROPIC 2 #define MM_ANISOTROPIC 2
#define MM_LOMETRIC 3 #define MM_LOMETRIC 3
#define MM_HIMETRIC 4 #define MM_HIMETRIC 4
#define MM_TWIPS 5 #define MM_TWIPS 5
#define MM_POINTS 6 #define MM_POINTS 6
#define MM_METRIC 7 #define MM_METRIC 7
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global variables // global variables
@@ -61,10 +61,10 @@ public:
wxDC(); wxDC();
~wxDC(); ~wxDC();
virtual void BeginDrawing() {} virtual void BeginDrawing() {}
virtual void EndDrawing() {} virtual void EndDrawing() {}
virtual bool Ok() const; virtual bool Ok() const;
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0; virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0;
@@ -104,14 +104,14 @@ public:
DrawPoint(pt.x, pt.y); DrawPoint(pt.x, pt.y);
} }
virtual void DrawPoint( wxPoint& point ); virtual void DrawPoint( wxPoint& point );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 0; virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 0;
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ) = 0; int fillStyle=wxODDEVEN_RULE ) = 0;
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ); int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height ) = 0; virtual void DrawRectangle( long x, long y, long width, long height ) = 0;
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz) inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
{ {
@@ -139,11 +139,11 @@ public:
{ {
DrawEllipse(rect.x, rect.y, rect.width, rect.height); DrawEllipse(rect.x, rect.y, rect.width, rect.height);
} }
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ); virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points ) = 0; virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( int n, wxPoint points[] ); virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0; virtual bool CanDrawBitmap(void) const = 0;
virtual void DrawIcon( const wxIcon &icon, long x, long y ) = 0; virtual void DrawIcon( const wxIcon &icon, long x, long y ) = 0;
inline void DrawIcon( const wxIcon& icon, const wxPoint& pt ) inline void DrawIcon( const wxIcon& icon, const wxPoint& pt )
@@ -155,18 +155,18 @@ public:
{ {
DrawBitmap(bitmap, pt.x, pt.y, useMask ); DrawBitmap(bitmap, pt.x, pt.y, useMask );
} }
virtual bool Blit( long xdest, long ydest, virtual bool Blit( long xdest, long ydest,
long width, long height, long width, long height,
wxDC *source, wxDC *source,
long xsrc, long ysrc, long xsrc, long ysrc,
int logical_func=wxCOPY, int logical_func=wxCOPY,
bool useMask=FALSE ) = 0; bool useMask=FALSE ) = 0;
inline bool Blit( const wxPoint& destPt, inline bool Blit( const wxPoint& destPt,
const wxSize& sz, const wxSize& sz,
wxDC *source, wxDC *source,
const wxPoint& srcPt, const wxPoint& srcPt,
int rop = wxCOPY, int rop = wxCOPY,
bool useMask=FALSE) bool useMask=FALSE)
{ {
return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask); return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
} }
@@ -177,49 +177,49 @@ public:
DrawText(text, pt.x, pt.y, use16bit); DrawText(text, pt.x, pt.y, use16bit);
} }
virtual bool CanGetTextExtent(void) const = 0; virtual bool CanGetTextExtent(void) const = 0;
virtual void GetTextExtent( const wxString &string, virtual void GetTextExtent( const wxString &string,
long *width, long *height, long *width, long *height,
long *descent = (long *) NULL, long *descent = (long *) NULL,
long *externalLeading = (long *) NULL, long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, wxFont *theFont = (wxFont *) NULL,
bool use16 = FALSE ) = 0; bool use16 = FALSE ) = 0;
virtual long GetCharWidth(void) = 0; virtual long GetCharWidth(void) = 0;
virtual long GetCharHeight(void) = 0; virtual long GetCharHeight(void) = 0;
virtual void Clear() = 0; virtual void Clear() = 0;
virtual void SetFont( const wxFont &font ) = 0; virtual void SetFont( const wxFont &font ) = 0;
virtual wxFont *GetFont() { return &m_font; }; virtual const wxFont& GetFont() const { return m_font; };
virtual void SetPen( const wxPen &pen ) = 0; virtual void SetPen( const wxPen &pen ) = 0;
virtual wxPen *GetPen() { return &m_pen; }; virtual const wxPen& GetPen() const { return m_pen; };
virtual void SetBrush( const wxBrush &brush ) = 0; virtual void SetBrush( const wxBrush &brush ) = 0;
virtual wxBrush *GetBrush() { return &m_brush; }; virtual const wxBrush& GetBrush() const { return m_brush; };
virtual void SetBackground( const wxBrush &brush ) = 0; virtual void SetBackground( const wxBrush &brush ) = 0;
virtual wxBrush *GetBackground() { return &m_backgroundBrush; }; virtual const wxBrush& GetBackground() const { return m_backgroundBrush; };
virtual void SetLogicalFunction( int function ) = 0; virtual void SetLogicalFunction( int function ) = 0;
virtual int GetLogicalFunction() { return m_logicalFunction; }; virtual int GetLogicalFunction() { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col ); virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col ); virtual void SetTextBackground( const wxColour &col );
virtual wxColour& GetTextBackground() const { return (wxColour&)m_textBackgroundColour; }; virtual wxColour& GetTextBackground() const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground() const { return (wxColour&)m_textForegroundColour; }; virtual wxColour& GetTextForeground() const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode ) = 0; virtual void SetBackgroundMode( int mode ) = 0;
virtual int GetBackgroundMode() { return m_backgroundMode; }; virtual int GetBackgroundMode() { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette ) = 0; virtual void SetPalette( const wxPalette& palette ) = 0;
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called // the first two must be overridden and called
virtual void DestroyClippingRegion(void); virtual void DestroyClippingRegion(void);
virtual void SetClippingRegion( long x, long y, long width, long height ); virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const; virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void SetClippingRegion( const wxRegion &region ) = 0; virtual void SetClippingRegion( const wxRegion &region ) = 0;
virtual long MinX() const { return m_minX; } virtual long MinX() const { return m_minX; }
virtual long MaxX() const { return m_maxX; } virtual long MaxX() const { return m_maxX; }
virtual long MinY() const { return m_minY; } virtual long MinY() const { return m_minY; }
@@ -228,30 +228,30 @@ public:
virtual void GetSize( int* width, int* height ) const; virtual void GetSize( int* width, int* height ) const;
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); } inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
virtual void GetSizeMM( long* width, long* height ) const; virtual void GetSizeMM( long* width, long* height ) const;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; } virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
virtual void EndDoc() {} virtual void EndDoc() {}
virtual void StartPage() {} virtual void StartPage() {}
virtual void EndPage() {} virtual void EndPage() {}
virtual void SetMapMode( int mode ); virtual void SetMapMode( int mode );
virtual int GetMapMode(void) const { return m_mappingMode; }; virtual int GetMapMode(void) const { return m_mappingMode; };
virtual void SetUserScale( double x, double y ); virtual void SetUserScale( double x, double y );
virtual void GetUserScale( double *x, double *y ); virtual void GetUserScale( double *x, double *y );
virtual void SetLogicalScale( double x, double y ); virtual void SetLogicalScale( double x, double y );
virtual void GetLogicalScale( double *x, double *y ); virtual void GetLogicalScale( double *x, double *y );
virtual void SetLogicalOrigin( long x, long y ); virtual void SetLogicalOrigin( long x, long y );
virtual void GetLogicalOrigin( long *x, long *y ); virtual void GetLogicalOrigin( long *x, long *y );
virtual void SetDeviceOrigin( long x, long y ); virtual void SetDeviceOrigin( long x, long y );
virtual void GetDeviceOrigin( long *x, long *y ); virtual void GetDeviceOrigin( long *x, long *y );
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {} virtual void SetOptimization( bool WXUNUSED(optimize) ) {}
virtual bool GetOptimization() { return m_optimize; } virtual bool GetOptimization() { return m_optimize; }
virtual long DeviceToLogicalX(long x) const; virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const; virtual long DeviceToLogicalY(long y) const;
virtual long DeviceToLogicalXRel(long x) const; virtual long DeviceToLogicalXRel(long x) const;
@@ -262,77 +262,77 @@ public:
virtual long LogicalToDeviceYRel(long y) const; virtual long LogicalToDeviceYRel(long y) const;
// implementation // implementation
void CalcBoundingBox( long x, long y ); void CalcBoundingBox( long x, long y );
void ComputeScaleAndOrigin(); void ComputeScaleAndOrigin();
long XDEV2LOG(long x) const long XDEV2LOG(long x) const
{ {
long new_x = x - m_deviceOriginX; long new_x = x - m_deviceOriginX;
if (new_x > 0) if (new_x > 0)
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
else else
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
} }
long XDEV2LOGREL(long x) const long XDEV2LOGREL(long x) const
{ {
if (x > 0) if (x > 0)
return (long)((double)(x) / m_scaleX + 0.5); return (long)((double)(x) / m_scaleX + 0.5);
else else
return (long)((double)(x) / m_scaleX - 0.5); return (long)((double)(x) / m_scaleX - 0.5);
} }
long YDEV2LOG(long y) const long YDEV2LOG(long y) const
{ {
long new_y = y - m_deviceOriginY; long new_y = y - m_deviceOriginY;
if (new_y > 0) if (new_y > 0)
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
else else
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
} }
long YDEV2LOGREL(long y) const long YDEV2LOGREL(long y) const
{ {
if (y > 0) if (y > 0)
return (long)((double)(y) / m_scaleY + 0.5); return (long)((double)(y) / m_scaleY + 0.5);
else else
return (long)((double)(y) / m_scaleY - 0.5); return (long)((double)(y) / m_scaleY - 0.5);
} }
long XLOG2DEV(long x) const long XLOG2DEV(long x) const
{ {
long new_x = x - m_logicalOriginX; long new_x = x - m_logicalOriginX;
if (new_x > 0) if (new_x > 0)
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
else else
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
} }
long XLOG2DEVREL(long x) const long XLOG2DEVREL(long x) const
{ {
if (x > 0) if (x > 0)
return (long)((double)(x) * m_scaleX + 0.5); return (long)((double)(x) * m_scaleX + 0.5);
else else
return (long)((double)(x) * m_scaleX - 0.5); return (long)((double)(x) * m_scaleX - 0.5);
} }
long YLOG2DEV(long y) const long YLOG2DEV(long y) const
{ {
long new_y = y - m_logicalOriginY; long new_y = y - m_logicalOriginY;
if (new_y > 0) if (new_y > 0)
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
else else
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
} }
long YLOG2DEVREL(long y) const long YLOG2DEVREL(long y) const
{ {
if (y > 0) if (y > 0)
return (long)((double)(y) * m_scaleY + 0.5); return (long)((double)(y) * m_scaleY + 0.5);
else else
return (long)((double)(y) * m_scaleY - 0.5); return (long)((double)(y) * m_scaleY - 0.5);
} }
public: public:
bool m_ok; bool m_ok;
bool m_colour; bool m_colour;
// not sure, what these mean // not sure, what these mean
bool m_clipping; // Is clipping on right now ? bool m_clipping; // Is clipping on right now ?
bool m_isInteractive; // Is GetPixel possible ? bool m_isInteractive; // Is GetPixel possible ?
@@ -340,36 +340,36 @@ public:
bool m_dontDelete; // wxMSW only ? bool m_dontDelete; // wxMSW only ?
bool m_optimize; // wxMSW only ? bool m_optimize; // wxMSW only ?
wxString m_filename; // Not sure where this belongs. wxString m_filename; // Not sure where this belongs.
wxPen m_pen; wxPen m_pen;
wxBrush m_brush; wxBrush m_brush;
wxBrush m_backgroundBrush; wxBrush m_backgroundBrush;
wxColour m_textForegroundColour; wxColour m_textForegroundColour;
wxColour m_textBackgroundColour; wxColour m_textBackgroundColour;
wxFont m_font; wxFont m_font;
int m_logicalFunction; int m_logicalFunction;
int m_backgroundMode; int m_backgroundMode;
int m_textAlignment; // gone in wxWin 2.0 ? int m_textAlignment; // gone in wxWin 2.0 ?
int m_mappingMode; int m_mappingMode;
// not sure what for, but what is a mm on a screen you don't know the size of? // not sure what for, but what is a mm on a screen you don't know the size of?
double m_mm_to_pix_x,m_mm_to_pix_y; double m_mm_to_pix_x,m_mm_to_pix_y;
long m_deviceOriginX,m_deviceOriginY; long m_deviceOriginX,m_deviceOriginY;
long m_logicalOriginX,m_logicalOriginY; // User defined. long m_logicalOriginX,m_logicalOriginY; // User defined.
double m_scaleX,m_scaleY; double m_scaleX,m_scaleY;
double m_logicalScaleX,m_logicalScaleY; double m_logicalScaleX,m_logicalScaleY;
double m_userScaleX,m_userScaleY; double m_userScaleX,m_userScaleY;
long m_signX,m_signY; long m_signX,m_signY;
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
float m_scaleFactor; // wxPSDC wants to have this. Will disappear. float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
long m_clipX1,m_clipY1,m_clipX2,m_clipY2; long m_clipX1,m_clipY1,m_clipX2,m_clipY2;
long m_minX,m_maxX,m_minY,m_maxY; long m_minX,m_maxX,m_minY,m_maxY;
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -37,9 +37,9 @@ class wxWindowDC: public wxDC
public: public:
wxWindowDC(); wxWindowDC();
wxWindowDC( wxWindow *win ); wxWindowDC( wxWindow *win );
~wxWindowDC(); ~wxWindowDC();
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ); virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const; virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
@@ -48,18 +48,18 @@ public:
virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc );
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y ); virtual void DrawPoint( long x, long y );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ); int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ); int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height ); virtual void DrawRectangle( long x, long y, long width, long height );
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height ); virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap() const; virtual bool CanDrawBitmap() const;
virtual void DrawIcon( const wxIcon &icon, long x, long y ); virtual void DrawIcon( const wxIcon &icon, long x, long y );
virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE ); virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE );
@@ -73,9 +73,9 @@ public:
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE ); wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE );
virtual long GetCharWidth(); virtual long GetCharWidth();
virtual long GetCharHeight(); virtual long GetCharHeight();
virtual void Clear(); virtual void Clear();
virtual void SetFont( const wxFont &font ); virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen ); virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush ); virtual void SetBrush( const wxBrush &brush );
@@ -85,15 +85,15 @@ public:
virtual void SetTextBackground( const wxColour &col ); virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode ); virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette ); virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height ); virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(); virtual void DestroyClippingRegion();
virtual void SetClippingRegion( const wxRegion &region ); virtual void SetClippingRegion( const wxRegion &region );
virtual void DrawSpline( wxList *points ); virtual void DrawSpline( wxList *points );
// implementation // implementation
GdkWindow *m_window; GdkWindow *m_window;
GdkGC *m_penGC; GdkGC *m_penGC;
GdkGC *m_brushGC; GdkGC *m_brushGC;
@@ -101,7 +101,7 @@ public:
GdkGC *m_bgGC; GdkGC *m_bgGC;
GdkColormap *m_cmap; GdkColormap *m_cmap;
bool m_isMemDC; bool m_isMemDC;
void SetUpDC(); void SetUpDC();
void Destroy(); void Destroy();
GdkWindow *GetWindow(); GdkWindow *GetWindow();

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -39,8 +39,8 @@ public:
virtual void SelectObject( const wxBitmap& bitmap ); virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const; void GetSize( int *width, int *height ) const;
// implementation // implementation
wxBitmap m_selected; wxBitmap m_selected;
}; };

View File

@@ -82,7 +82,7 @@ public:
void DrawIcon( const wxIcon& icon, long x, long y ); void DrawIcon( const wxIcon& icon, long x, long y );
void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE ); void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE); void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
void Clear(); void Clear();
@@ -91,7 +91,7 @@ public:
void SetBrush( const wxBrush& brush ); void SetBrush( const wxBrush& brush );
void SetLogicalFunction( int function ); void SetLogicalFunction( int function );
void SetBackground( const wxBrush& brush ); void SetBackground( const wxBrush& brush );
void SetClippingRegion(long x, long y, long width, long height); void SetClippingRegion(long x, long y, long width, long height);
void SetClippingRegion( const wxRegion &region ); void SetClippingRegion( const wxRegion &region );
void DestroyClippingRegion(); void DestroyClippingRegion();
@@ -108,16 +108,16 @@ public:
long *descent = (long *) NULL, long *descent = (long *) NULL,
long *externalLeading = (long *) NULL, long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE); wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE);
void GetSize(int* width, int* height) const; void GetSize(int* width, int* height) const;
void GetSizeMM(long *width, long *height) const; void GetSizeMM(long *width, long *height) const;
void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
void SetDeviceOrigin( long x, long y ); void SetDeviceOrigin( long x, long y );
inline void SetBackgroundMode(int WXUNUSED(mode)) {} inline void SetBackgroundMode(int WXUNUSED(mode)) {}
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {} inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
inline ofstream *GetStream(void) const { return m_pstream; } inline ofstream *GetStream(void) const { return m_pstream; }
protected: protected:
@@ -133,7 +133,7 @@ protected:
double m_underlineThickness; double m_underlineThickness;
}; };
#endif #endif
// wxUSE_POSTSCRIPT // wxUSE_POSTSCRIPT
#endif #endif

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -42,40 +42,39 @@ class wxFontNameDirectory;
// wxFont // wxFont
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxFont: public wxGDIObject class wxFont: public wxGDIObject
{ {
DECLARE_DYNAMIC_CLASS(wxFont) DECLARE_DYNAMIC_CLASS(wxFont)
public: public:
wxFont(void); wxFont();
wxFont( int PointSize, int FontIdOrFamily, int Style, int Weight, wxFont( int PointSize, int FontIdOrFamily, int Style, int Weight,
bool underlined = FALSE, const char *Face= ( const char *) NULL ); bool underlined = FALSE, const char *Face = ( const char *) NULL );
wxFont( int PointSize, const char *Face, int Family, int Style, int Weight, wxFont( int PointSize, const char *Face, int Family,
bool underlined = FALSE ); int Style, int Weight, bool underlined = FALSE );
wxFont( const wxFont& font ); wxFont( const wxFont& font );
wxFont( const wxFont* font ); ~wxFont();
~wxFont(void);
wxFont& operator = ( const wxFont& font ); wxFont& operator = ( const wxFont& font );
bool operator == ( const wxFont& font ); bool operator == ( const wxFont& font );
bool operator != ( const wxFont& font ); bool operator != ( const wxFont& font );
bool Ok() const; bool Ok() const;
int GetPointSize(void) const; int GetPointSize() const;
wxString GetFaceName(void) const; wxString GetFaceName() const;
int GetFamily(void) const; int GetFamily() const;
wxString GetFamilyString(void) const; wxString GetFamilyString() const;
int GetFontId(void) const; int GetFontId() const;
wxString GetFaceString(void) const; wxString GetFaceString() const;
int GetStyle(void) const; int GetStyle() const;
wxString GetStyleString(void) const; wxString GetStyleString() const;
int GetWeight(void) const; int GetWeight() const;
wxString GetWeightString(void) const; wxString GetWeightString() const;
bool GetUnderlined(void) const; bool GetUnderlined() const;
wxFont( char *xFontName ); wxFont( char *xFontName );
// implementation // implementation
GdkFont* GetInternalFont(float scale = 1.0) const; GdkFont* GetInternalFont(float scale = 1.0) const;
// no data :-) // no data :-)
@@ -85,15 +84,15 @@ class wxFont: public wxGDIObject
// wxFontDirectory // wxFontDirectory
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxFontNameDirectory: public wxObject class wxFontNameDirectory: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxFontNameDirectory) DECLARE_DYNAMIC_CLASS(wxFontNameDirectory)
public: public:
wxFontNameDirectory(void); wxFontNameDirectory();
~wxFontNameDirectory(); ~wxFontNameDirectory();
void Initialize(void); void Initialize();
void Initialize(int fontid, int family, const char *name); void Initialize(int fontid, int family, const char *name);
int FindOrCreateFontId(const char *name, int family); int FindOrCreateFontId(const char *name, int family);
@@ -101,11 +100,10 @@ class wxFontNameDirectory: public wxObject
int GetFamily(int fontid); int GetFamily(int fontid);
int GetFontId(const char *name); int GetFontId(const char *name);
char* GetFontName(int fontid); char* GetFontName(int fontid);
int GetNewFontId(void); int GetNewFontId();
char* GetPostScriptName(int fontid, int weight, int style); char* GetPostScriptName(int fontid, int weight, int style);
char* GetScreenName(int fontid, int weight, int style); char* GetScreenName(int fontid, int weight, int style);
class wxHashTable *table; class wxHashTable *table;
int nextFontId; int nextFontId;
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -35,9 +35,8 @@ class wxIcon: public wxBitmap
public: public:
wxIcon(void); wxIcon();
wxIcon( const wxIcon& icon); wxIcon( const wxIcon& icon);
wxIcon( const wxIcon* icon);
wxIcon( const char **bits, int width=-1, int height=-1 ); wxIcon( const char **bits, int width=-1, int height=-1 );
wxIcon( char **bits, int width=-1, int height=-1 ); wxIcon( char **bits, int width=-1, int height=-1 );

View File

@@ -50,7 +50,9 @@ public:
// the item's text = name // the item's text = name
void SetName(const wxString& str); void SetName(const wxString& str);
void SetText(const wxString& str) { SetName(str); } // compatibility
const wxString& GetName() const { return m_text; } const wxString& GetName() const { return m_text; }
const wxString& GetText() const { return GetName(); }
// what kind of menu item we are // what kind of menu item we are
void SetCheckable(bool checkable) { m_isCheckMenu = checkable; } void SetCheckable(bool checkable) { m_isCheckMenu = checkable; }
@@ -60,7 +62,7 @@ public:
bool IsSubMenu() const { return m_subMenu != NULL; } bool IsSubMenu() const { return m_subMenu != NULL; }
// state // state
void Enable( bool enable = TRUE ); void Enable( bool enable = TRUE );
bool IsEnabled() const { return m_isEnabled; } bool IsEnabled() const { return m_isEnabled; }
void Check( bool check = TRUE ); void Check( bool check = TRUE );
bool IsChecked() const; bool IsChecked() const;
@@ -86,5 +88,5 @@ private:
}; };
#endif #endif
//__GTKMENUITEMH__ //__GTKMENUITEMH__

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -36,17 +36,16 @@ class wxPalette: public wxGDIObject
DECLARE_DYNAMIC_CLASS(wxPalette) DECLARE_DYNAMIC_CLASS(wxPalette)
public: public:
wxPalette(void); wxPalette();
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
wxPalette( const wxPalette& palette ); wxPalette( const wxPalette& palette );
wxPalette( const wxPalette* palette ); ~wxPalette();
~wxPalette(void);
wxPalette& operator = ( const wxPalette& palette ); wxPalette& operator = ( const wxPalette& palette );
bool operator == ( const wxPalette& palette ); bool operator == ( const wxPalette& palette );
bool operator != ( const wxPalette& palette ); bool operator != ( const wxPalette& palette );
bool Ok(void) const; bool Ok() const;
bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const; int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const;
bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -36,31 +36,30 @@ class wxPen: public wxGDIObject
DECLARE_DYNAMIC_CLASS(wxPen) DECLARE_DYNAMIC_CLASS(wxPen)
public: public:
wxPen(void); wxPen();
wxPen( const wxColour &colour, int width, int style ); wxPen( const wxColour &colour, int width, int style );
wxPen( const wxPen& pen ); wxPen( const wxPen& pen );
wxPen( const wxPen* pen ); ~wxPen();
~wxPen(void);
wxPen& operator = ( const wxPen& pen ); wxPen& operator = ( const wxPen& pen );
bool operator == ( const wxPen& pen ); bool operator == ( const wxPen& pen );
bool operator != ( const wxPen& pen ); bool operator != ( const wxPen& pen );
void SetColour( const wxColour &colour ); void SetColour( const wxColour &colour );
void SetColour( int red, int green, int blue ); void SetColour( int red, int green, int blue );
void SetCap( int capStyle ); void SetCap( int capStyle );
void SetJoin( int joinStyle ); void SetJoin( int joinStyle );
void SetStyle( int style ); void SetStyle( int style );
void SetWidth( int width ); void SetWidth( int width );
wxColour &GetColour(void) const; wxColour &GetColour() const;
int GetCap(void) const; int GetCap() const;
int GetJoin(void) const; int GetJoin() const;
int GetStyle(void) const; int GetStyle() const;
int GetWidth(void) const; int GetWidth() const;
bool Ok(void) const; bool Ok() const;
void Unshare(void); void Unshare();
// no data :-) // no data :-)
}; };

View File

@@ -83,7 +83,7 @@ public:
wxStringClientData( wxString &data ) { m_data = data; } wxStringClientData( wxString &data ) { m_data = data; }
void SetData( wxString &data ) { m_data = data; } void SetData( wxString &data ) { m_data = data; }
wxString GetData() const { return m_data; } wxString GetData() const { return m_data; }
private: private:
wxString m_data; wxString m_data;
}; };
@@ -95,7 +95,7 @@ private:
class wxWindow: public wxEvtHandler class wxWindow: public wxEvtHandler
{ {
DECLARE_DYNAMIC_CLASS(wxWindow) DECLARE_DYNAMIC_CLASS(wxWindow)
public: public:
wxWindow(); wxWindow();
wxWindow(wxWindow *parent, wxWindowID id, wxWindow(wxWindow *parent, wxWindowID id,
@@ -110,7 +110,7 @@ public:
const wxString& name = wxPanelNameStr); const wxString& name = wxPanelNameStr);
virtual ~wxWindow(); virtual ~wxWindow();
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName, virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
@@ -155,7 +155,8 @@ public:
virtual bool OnClose(); virtual bool OnClose();
virtual void AddChild( wxWindow *child ); virtual void AddChild( wxWindow *child );
wxList& GetChildren() const; wxList& GetChildren() { return m_children; }
virtual void RemoveChild( wxWindow *child ); virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode ); void SetReturnCode( int retCode );
int GetReturnCode(); int GetReturnCode();
@@ -167,7 +168,7 @@ public:
{ m_parent = p; } { m_parent = p; }
virtual wxWindow *ReParent( wxWindow *newParent ); virtual wxWindow *ReParent( wxWindow *newParent );
wxEvtHandler *GetEventHandler(); wxEvtHandler *GetEventHandler() const;
void SetEventHandler( wxEvtHandler *handler ); void SetEventHandler( wxEvtHandler *handler );
void PushEventHandler( wxEvtHandler *handler ); void PushEventHandler( wxEvtHandler *handler );
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
@@ -177,23 +178,23 @@ public:
virtual void SetClientObject( wxClientData *data ); virtual void SetClientObject( wxClientData *data );
virtual wxClientData *GetClientObject(); virtual wxClientData *GetClientObject();
virtual void SetClientData( void *data ); virtual void SetClientData( void *data );
virtual void *GetClientData(); virtual void *GetClientData();
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
bool IsBeingDeleted(); bool IsBeingDeleted();
void SetId( wxWindowID id ); void SetId( wxWindowID id );
wxWindowID GetId(); wxWindowID GetId() const;
void SetCursor( const wxCursor &cursor ); void SetCursor( const wxCursor &cursor );
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
virtual void Clear(); virtual void Clear();
virtual wxRegion GetUpdateRegion() const; virtual wxRegion GetUpdateRegion() const;
virtual bool IsExposed(int x, int y) const; virtual bool IsExposed(int x, int y) const;
virtual bool IsExposed(int x, int y, int w, int h) const; virtual bool IsExposed(int x, int y, int w, int h) const;
@@ -213,20 +214,20 @@ public:
const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const;
virtual void SetFont( const wxFont &font ); virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont(); virtual const wxFont& GetFont() { return m_font; }
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont *GetLabelFont() { return GetFont(); }; inline virtual const wxFont& GetLabelFont() { return GetFont(); };
inline virtual wxFont *GetButtonFont() { return GetFont(); }; inline virtual const wxFont& GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag ); virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const; virtual long GetWindowStyleFlag() const;
virtual void CaptureMouse(); virtual void CaptureMouse();
virtual void ReleaseMouse(); virtual void ReleaseMouse();
virtual void SetTitle( const wxString &title ); virtual void SetTitle( const wxString &title );
virtual wxString GetTitle() const; virtual wxString GetTitle() const;
virtual void SetName( const wxString &name ); virtual void SetName( const wxString &name );
@@ -243,10 +244,10 @@ public:
virtual bool IsRetained(); virtual bool IsRetained();
virtual wxWindow *FindWindow( long id ); virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name ); virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {}; void AllowDoubleClick( bool WXUNUSED(allow) ) {};
void SetDoubleClick( bool WXUNUSED(allow) ) {}; void SetDoubleClick( bool WXUNUSED(allow) ) {};
virtual void ClientToScreen( int *x, int *y ); virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y ); virtual void ScreenToClient( int *x, int *y );
@@ -270,27 +271,27 @@ public:
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL );
virtual bool AcceptsFocus() const; virtual bool AcceptsFocus() const;
void UpdateWindowUI(); void UpdateWindowUI();
// implementation // implementation
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name ); const wxSize &size, long style, const wxString &name );
void PostCreation(); void PostCreation();
virtual GtkWidget *GetConnectWidget(); virtual GtkWidget *GetConnectWidget();
virtual bool IsOwnGtkWindow( GdkWindow *window ); virtual bool IsOwnGtkWindow( GdkWindow *window );
void ConnectWidget( GtkWidget *widget ); void ConnectWidget( GtkWidget *widget );
bool HasVMT(); bool HasVMT();
virtual wxPoint GetClientAreaOrigin() const; virtual wxPoint GetClientAreaOrigin() const;
virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags );
GtkStyle *GetWidgetStyle(); GtkStyle *GetWidgetStyle();
void SetWidgetStyle(); void SetWidgetStyle();
virtual void ApplyWidgetStyle(); virtual void ApplyWidgetStyle();
wxWindow *m_parent; wxWindow *m_parent;
wxList m_children; wxList m_children;
@@ -329,7 +330,7 @@ public:
bool m_resizing; bool m_resizing;
GdkGC *m_scrollGC; GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle; GtkStyle *m_widgetStyle;
wxInsertChildFunction m_insertCallback; wxInsertChildFunction m_insertCallback;
public: public:

View File

@@ -55,7 +55,7 @@ public:
~wxMask(); ~wxMask();
// implementation // implementation
GdkBitmap *m_bitmap; GdkBitmap *m_bitmap;
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;
}; };
@@ -75,14 +75,13 @@ public:
wxBitmap( const char **bits ); wxBitmap( const char **bits );
wxBitmap( char **bits ); wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp ); wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp );
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM ); wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
~wxBitmap(); ~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp ); wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp ); bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp ); bool operator != ( const wxBitmap& bmp );
bool Ok() const; bool Ok() const;
int GetHeight() const; int GetHeight() const;
int GetWidth() const; int GetWidth() const;
int GetDepth() const; int GetDepth() const;
@@ -96,14 +95,14 @@ public:
wxPalette *GetPalette() const; wxPalette *GetPalette() const;
wxPalette *GetColourMap() const wxPalette *GetColourMap() const
{ return GetPalette(); }; { return GetPalette(); };
// implementation // implementation
void SetHeight( int height ); void SetHeight( int height );
void SetWidth( int width ); void SetWidth( int width );
void SetDepth( int depth ); void SetDepth( int depth );
void SetPixmap( GdkPixmap *pixmap ); void SetPixmap( GdkPixmap *pixmap );
GdkPixmap *GetPixmap() const; GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const; GdkBitmap *GetBitmap() const;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -37,29 +37,28 @@ class wxBrush: public wxGDIObject
public: public:
wxBrush(void); wxBrush();
wxBrush( const wxColour &colour, int style ); wxBrush( const wxColour &colour, int style );
wxBrush( const wxBitmap &stippleBitmap ); wxBrush( const wxBitmap &stippleBitmap );
wxBrush( const wxBrush &brush ); wxBrush( const wxBrush &brush );
wxBrush( const wxBrush *brush ); ~wxBrush();
~wxBrush(void);
wxBrush& operator = ( const wxBrush& brush ); wxBrush& operator = ( const wxBrush& brush );
bool operator == ( const wxBrush& brush ); bool operator == ( const wxBrush& brush );
bool operator != ( const wxBrush& brush ); bool operator != ( const wxBrush& brush );
bool Ok(void) const; bool Ok() const;
int GetStyle() const;
wxColour &GetColour() const;
wxBitmap *GetStipple() const;
int GetStyle(void) const;
wxColour &GetColour(void) const;
wxBitmap *GetStipple(void) const;
void SetColour( const wxColour& col ); void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style ); void SetStyle( int style );
void SetStipple( const wxBitmap& stipple ); void SetStipple( const wxBitmap& stipple );
void Unshare(void); void Unshare();
// no data :-) // no data :-)
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -50,7 +50,6 @@ public:
// copy ctors and assignment operators // copy ctors and assignment operators
wxColour( const wxColour& col ); wxColour( const wxColour& col );
wxColour( const wxColour* col );
wxColour& operator = ( const wxColour& col ); wxColour& operator = ( const wxColour& col );
// dtor // dtor
@@ -59,7 +58,7 @@ public:
// comparison // comparison
bool operator == ( const wxColour& col ); bool operator == ( const wxColour& col );
bool operator != ( const wxColour& col ); bool operator != ( const wxColour& col );
// accessors // accessors
void Set( unsigned char red, unsigned char green, unsigned char blue ); void Set( unsigned char red, unsigned char green, unsigned char blue );
unsigned char Red() const; unsigned char Red() const;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -19,14 +19,6 @@
#include "wx/object.h" #include "wx/object.h"
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxWindow;
class wxCursor;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxCursor // wxCursor
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -37,22 +29,16 @@ class wxCursor: public wxObject
public: public:
wxCursor(void); wxCursor();
wxCursor( int cursorId ); wxCursor( int cursorId );
wxCursor( const wxCursor &cursor ); wxCursor( const wxCursor &cursor );
wxCursor( const wxCursor *cursor ); ~wxCursor();
~wxCursor(void);
wxCursor& operator = ( const wxCursor& cursor ); wxCursor& operator = ( const wxCursor& cursor );
bool operator == ( const wxCursor& cursor ); bool operator == ( const wxCursor& cursor ) const;
bool operator != ( const wxCursor& cursor ); bool operator != ( const wxCursor& cursor ) const;
bool Ok(void) const; bool Ok() const;
private: GdkCursor *GetCursor() const;
public:
friend wxWindow;
GdkCursor *GetCursor(void) const;
// no data :-) // no data :-)
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -34,14 +34,14 @@ class wxDC;
// constants // constants
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define MM_TEXT 0 #define MM_TEXT 0
#define MM_ISOTROPIC 1 #define MM_ISOTROPIC 1
#define MM_ANISOTROPIC 2 #define MM_ANISOTROPIC 2
#define MM_LOMETRIC 3 #define MM_LOMETRIC 3
#define MM_HIMETRIC 4 #define MM_HIMETRIC 4
#define MM_TWIPS 5 #define MM_TWIPS 5
#define MM_POINTS 6 #define MM_POINTS 6
#define MM_METRIC 7 #define MM_METRIC 7
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global variables // global variables
@@ -61,10 +61,10 @@ public:
wxDC(); wxDC();
~wxDC(); ~wxDC();
virtual void BeginDrawing() {} virtual void BeginDrawing() {}
virtual void EndDrawing() {} virtual void EndDrawing() {}
virtual bool Ok() const; virtual bool Ok() const;
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0; virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ) = 0;
@@ -104,14 +104,14 @@ public:
DrawPoint(pt.x, pt.y); DrawPoint(pt.x, pt.y);
} }
virtual void DrawPoint( wxPoint& point ); virtual void DrawPoint( wxPoint& point );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 0; virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ) = 0;
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ) = 0; int fillStyle=wxODDEVEN_RULE ) = 0;
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ); int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height ) = 0; virtual void DrawRectangle( long x, long y, long width, long height ) = 0;
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz) inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
{ {
@@ -139,11 +139,11 @@ public:
{ {
DrawEllipse(rect.x, rect.y, rect.width, rect.height); DrawEllipse(rect.x, rect.y, rect.width, rect.height);
} }
virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 ); virtual void DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 );
virtual void DrawSpline( wxList *points ) = 0; virtual void DrawSpline( wxList *points ) = 0;
virtual void DrawSpline( int n, wxPoint points[] ); virtual void DrawSpline( int n, wxPoint points[] );
virtual bool CanDrawBitmap(void) const = 0; virtual bool CanDrawBitmap(void) const = 0;
virtual void DrawIcon( const wxIcon &icon, long x, long y ) = 0; virtual void DrawIcon( const wxIcon &icon, long x, long y ) = 0;
inline void DrawIcon( const wxIcon& icon, const wxPoint& pt ) inline void DrawIcon( const wxIcon& icon, const wxPoint& pt )
@@ -155,18 +155,18 @@ public:
{ {
DrawBitmap(bitmap, pt.x, pt.y, useMask ); DrawBitmap(bitmap, pt.x, pt.y, useMask );
} }
virtual bool Blit( long xdest, long ydest, virtual bool Blit( long xdest, long ydest,
long width, long height, long width, long height,
wxDC *source, wxDC *source,
long xsrc, long ysrc, long xsrc, long ysrc,
int logical_func=wxCOPY, int logical_func=wxCOPY,
bool useMask=FALSE ) = 0; bool useMask=FALSE ) = 0;
inline bool Blit( const wxPoint& destPt, inline bool Blit( const wxPoint& destPt,
const wxSize& sz, const wxSize& sz,
wxDC *source, wxDC *source,
const wxPoint& srcPt, const wxPoint& srcPt,
int rop = wxCOPY, int rop = wxCOPY,
bool useMask=FALSE) bool useMask=FALSE)
{ {
return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask); return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
} }
@@ -177,49 +177,49 @@ public:
DrawText(text, pt.x, pt.y, use16bit); DrawText(text, pt.x, pt.y, use16bit);
} }
virtual bool CanGetTextExtent(void) const = 0; virtual bool CanGetTextExtent(void) const = 0;
virtual void GetTextExtent( const wxString &string, virtual void GetTextExtent( const wxString &string,
long *width, long *height, long *width, long *height,
long *descent = (long *) NULL, long *descent = (long *) NULL,
long *externalLeading = (long *) NULL, long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, wxFont *theFont = (wxFont *) NULL,
bool use16 = FALSE ) = 0; bool use16 = FALSE ) = 0;
virtual long GetCharWidth(void) = 0; virtual long GetCharWidth(void) = 0;
virtual long GetCharHeight(void) = 0; virtual long GetCharHeight(void) = 0;
virtual void Clear() = 0; virtual void Clear() = 0;
virtual void SetFont( const wxFont &font ) = 0; virtual void SetFont( const wxFont &font ) = 0;
virtual wxFont *GetFont() { return &m_font; }; virtual const wxFont& GetFont() const { return m_font; };
virtual void SetPen( const wxPen &pen ) = 0; virtual void SetPen( const wxPen &pen ) = 0;
virtual wxPen *GetPen() { return &m_pen; }; virtual const wxPen& GetPen() const { return m_pen; };
virtual void SetBrush( const wxBrush &brush ) = 0; virtual void SetBrush( const wxBrush &brush ) = 0;
virtual wxBrush *GetBrush() { return &m_brush; }; virtual const wxBrush& GetBrush() const { return m_brush; };
virtual void SetBackground( const wxBrush &brush ) = 0; virtual void SetBackground( const wxBrush &brush ) = 0;
virtual wxBrush *GetBackground() { return &m_backgroundBrush; }; virtual const wxBrush& GetBackground() const { return m_backgroundBrush; };
virtual void SetLogicalFunction( int function ) = 0; virtual void SetLogicalFunction( int function ) = 0;
virtual int GetLogicalFunction() { return m_logicalFunction; }; virtual int GetLogicalFunction() { return m_logicalFunction; };
virtual void SetTextForeground( const wxColour &col ); virtual void SetTextForeground( const wxColour &col );
virtual void SetTextBackground( const wxColour &col ); virtual void SetTextBackground( const wxColour &col );
virtual wxColour& GetTextBackground() const { return (wxColour&)m_textBackgroundColour; }; virtual wxColour& GetTextBackground() const { return (wxColour&)m_textBackgroundColour; };
virtual wxColour& GetTextForeground() const { return (wxColour&)m_textForegroundColour; }; virtual wxColour& GetTextForeground() const { return (wxColour&)m_textForegroundColour; };
virtual void SetBackgroundMode( int mode ) = 0; virtual void SetBackgroundMode( int mode ) = 0;
virtual int GetBackgroundMode() { return m_backgroundMode; }; virtual int GetBackgroundMode() { return m_backgroundMode; };
virtual void SetPalette( const wxPalette& palette ) = 0; virtual void SetPalette( const wxPalette& palette ) = 0;
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); }; void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
// the first two must be overridden and called // the first two must be overridden and called
virtual void DestroyClippingRegion(void); virtual void DestroyClippingRegion(void);
virtual void SetClippingRegion( long x, long y, long width, long height ); virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const; virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void SetClippingRegion( const wxRegion &region ) = 0; virtual void SetClippingRegion( const wxRegion &region ) = 0;
virtual long MinX() const { return m_minX; } virtual long MinX() const { return m_minX; }
virtual long MaxX() const { return m_maxX; } virtual long MaxX() const { return m_maxX; }
virtual long MinY() const { return m_minY; } virtual long MinY() const { return m_minY; }
@@ -228,30 +228,30 @@ public:
virtual void GetSize( int* width, int* height ) const; virtual void GetSize( int* width, int* height ) const;
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); } inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
virtual void GetSizeMM( long* width, long* height ) const; virtual void GetSizeMM( long* width, long* height ) const;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; } virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
virtual void EndDoc() {} virtual void EndDoc() {}
virtual void StartPage() {} virtual void StartPage() {}
virtual void EndPage() {} virtual void EndPage() {}
virtual void SetMapMode( int mode ); virtual void SetMapMode( int mode );
virtual int GetMapMode(void) const { return m_mappingMode; }; virtual int GetMapMode(void) const { return m_mappingMode; };
virtual void SetUserScale( double x, double y ); virtual void SetUserScale( double x, double y );
virtual void GetUserScale( double *x, double *y ); virtual void GetUserScale( double *x, double *y );
virtual void SetLogicalScale( double x, double y ); virtual void SetLogicalScale( double x, double y );
virtual void GetLogicalScale( double *x, double *y ); virtual void GetLogicalScale( double *x, double *y );
virtual void SetLogicalOrigin( long x, long y ); virtual void SetLogicalOrigin( long x, long y );
virtual void GetLogicalOrigin( long *x, long *y ); virtual void GetLogicalOrigin( long *x, long *y );
virtual void SetDeviceOrigin( long x, long y ); virtual void SetDeviceOrigin( long x, long y );
virtual void GetDeviceOrigin( long *x, long *y ); virtual void GetDeviceOrigin( long *x, long *y );
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {} virtual void SetOptimization( bool WXUNUSED(optimize) ) {}
virtual bool GetOptimization() { return m_optimize; } virtual bool GetOptimization() { return m_optimize; }
virtual long DeviceToLogicalX(long x) const; virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const; virtual long DeviceToLogicalY(long y) const;
virtual long DeviceToLogicalXRel(long x) const; virtual long DeviceToLogicalXRel(long x) const;
@@ -262,77 +262,77 @@ public:
virtual long LogicalToDeviceYRel(long y) const; virtual long LogicalToDeviceYRel(long y) const;
// implementation // implementation
void CalcBoundingBox( long x, long y ); void CalcBoundingBox( long x, long y );
void ComputeScaleAndOrigin(); void ComputeScaleAndOrigin();
long XDEV2LOG(long x) const long XDEV2LOG(long x) const
{ {
long new_x = x - m_deviceOriginX; long new_x = x - m_deviceOriginX;
if (new_x > 0) if (new_x > 0)
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX; return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
else else
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX; return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
} }
long XDEV2LOGREL(long x) const long XDEV2LOGREL(long x) const
{ {
if (x > 0) if (x > 0)
return (long)((double)(x) / m_scaleX + 0.5); return (long)((double)(x) / m_scaleX + 0.5);
else else
return (long)((double)(x) / m_scaleX - 0.5); return (long)((double)(x) / m_scaleX - 0.5);
} }
long YDEV2LOG(long y) const long YDEV2LOG(long y) const
{ {
long new_y = y - m_deviceOriginY; long new_y = y - m_deviceOriginY;
if (new_y > 0) if (new_y > 0)
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY; return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
else else
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY; return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
} }
long YDEV2LOGREL(long y) const long YDEV2LOGREL(long y) const
{ {
if (y > 0) if (y > 0)
return (long)((double)(y) / m_scaleY + 0.5); return (long)((double)(y) / m_scaleY + 0.5);
else else
return (long)((double)(y) / m_scaleY - 0.5); return (long)((double)(y) / m_scaleY - 0.5);
} }
long XLOG2DEV(long x) const long XLOG2DEV(long x) const
{ {
long new_x = x - m_logicalOriginX; long new_x = x - m_logicalOriginX;
if (new_x > 0) if (new_x > 0)
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX; return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
else else
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX; return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
} }
long XLOG2DEVREL(long x) const long XLOG2DEVREL(long x) const
{ {
if (x > 0) if (x > 0)
return (long)((double)(x) * m_scaleX + 0.5); return (long)((double)(x) * m_scaleX + 0.5);
else else
return (long)((double)(x) * m_scaleX - 0.5); return (long)((double)(x) * m_scaleX - 0.5);
} }
long YLOG2DEV(long y) const long YLOG2DEV(long y) const
{ {
long new_y = y - m_logicalOriginY; long new_y = y - m_logicalOriginY;
if (new_y > 0) if (new_y > 0)
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY; return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
else else
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY; return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
} }
long YLOG2DEVREL(long y) const long YLOG2DEVREL(long y) const
{ {
if (y > 0) if (y > 0)
return (long)((double)(y) * m_scaleY + 0.5); return (long)((double)(y) * m_scaleY + 0.5);
else else
return (long)((double)(y) * m_scaleY - 0.5); return (long)((double)(y) * m_scaleY - 0.5);
} }
public: public:
bool m_ok; bool m_ok;
bool m_colour; bool m_colour;
// not sure, what these mean // not sure, what these mean
bool m_clipping; // Is clipping on right now ? bool m_clipping; // Is clipping on right now ?
bool m_isInteractive; // Is GetPixel possible ? bool m_isInteractive; // Is GetPixel possible ?
@@ -340,36 +340,36 @@ public:
bool m_dontDelete; // wxMSW only ? bool m_dontDelete; // wxMSW only ?
bool m_optimize; // wxMSW only ? bool m_optimize; // wxMSW only ?
wxString m_filename; // Not sure where this belongs. wxString m_filename; // Not sure where this belongs.
wxPen m_pen; wxPen m_pen;
wxBrush m_brush; wxBrush m_brush;
wxBrush m_backgroundBrush; wxBrush m_backgroundBrush;
wxColour m_textForegroundColour; wxColour m_textForegroundColour;
wxColour m_textBackgroundColour; wxColour m_textBackgroundColour;
wxFont m_font; wxFont m_font;
int m_logicalFunction; int m_logicalFunction;
int m_backgroundMode; int m_backgroundMode;
int m_textAlignment; // gone in wxWin 2.0 ? int m_textAlignment; // gone in wxWin 2.0 ?
int m_mappingMode; int m_mappingMode;
// not sure what for, but what is a mm on a screen you don't know the size of? // not sure what for, but what is a mm on a screen you don't know the size of?
double m_mm_to_pix_x,m_mm_to_pix_y; double m_mm_to_pix_x,m_mm_to_pix_y;
long m_deviceOriginX,m_deviceOriginY; long m_deviceOriginX,m_deviceOriginY;
long m_logicalOriginX,m_logicalOriginY; // User defined. long m_logicalOriginX,m_logicalOriginY; // User defined.
double m_scaleX,m_scaleY; double m_scaleX,m_scaleY;
double m_logicalScaleX,m_logicalScaleY; double m_logicalScaleX,m_logicalScaleY;
double m_userScaleX,m_userScaleY; double m_userScaleX,m_userScaleY;
long m_signX,m_signY; long m_signX,m_signY;
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
float m_scaleFactor; // wxPSDC wants to have this. Will disappear. float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
long m_clipX1,m_clipY1,m_clipX2,m_clipY2; long m_clipX1,m_clipY1,m_clipX2,m_clipY2;
long m_minX,m_maxX,m_minY,m_maxY; long m_minX,m_maxX,m_minY,m_maxY;
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -37,9 +37,9 @@ class wxWindowDC: public wxDC
public: public:
wxWindowDC(); wxWindowDC();
wxWindowDC( wxWindow *win ); wxWindowDC( wxWindow *win );
~wxWindowDC(); ~wxWindowDC();
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE ); virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
virtual bool GetPixel( long x1, long y1, wxColour *col ) const; virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
@@ -48,18 +48,18 @@ public:
virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc );
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y ); virtual void DrawPoint( long x, long y );
virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 );
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ); int fillStyle=wxODDEVEN_RULE );
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
int fillStyle=wxODDEVEN_RULE ); int fillStyle=wxODDEVEN_RULE );
virtual void DrawRectangle( long x, long y, long width, long height ); virtual void DrawRectangle( long x, long y, long width, long height );
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
virtual void DrawEllipse( long x, long y, long width, long height ); virtual void DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap() const; virtual bool CanDrawBitmap() const;
virtual void DrawIcon( const wxIcon &icon, long x, long y ); virtual void DrawIcon( const wxIcon &icon, long x, long y );
virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE ); virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE );
@@ -73,9 +73,9 @@ public:
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE ); wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE );
virtual long GetCharWidth(); virtual long GetCharWidth();
virtual long GetCharHeight(); virtual long GetCharHeight();
virtual void Clear(); virtual void Clear();
virtual void SetFont( const wxFont &font ); virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen ); virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush ); virtual void SetBrush( const wxBrush &brush );
@@ -85,15 +85,15 @@ public:
virtual void SetTextBackground( const wxColour &col ); virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode ); virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette ); virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height ); virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(); virtual void DestroyClippingRegion();
virtual void SetClippingRegion( const wxRegion &region ); virtual void SetClippingRegion( const wxRegion &region );
virtual void DrawSpline( wxList *points ); virtual void DrawSpline( wxList *points );
// implementation // implementation
GdkWindow *m_window; GdkWindow *m_window;
GdkGC *m_penGC; GdkGC *m_penGC;
GdkGC *m_brushGC; GdkGC *m_brushGC;
@@ -101,7 +101,7 @@ public:
GdkGC *m_bgGC; GdkGC *m_bgGC;
GdkColormap *m_cmap; GdkColormap *m_cmap;
bool m_isMemDC; bool m_isMemDC;
void SetUpDC(); void SetUpDC();
void Destroy(); void Destroy();
GdkWindow *GetWindow(); GdkWindow *GetWindow();

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -39,8 +39,8 @@ public:
virtual void SelectObject( const wxBitmap& bitmap ); virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const; void GetSize( int *width, int *height ) const;
// implementation // implementation
wxBitmap m_selected; wxBitmap m_selected;
}; };

View File

@@ -82,7 +82,7 @@ public:
void DrawIcon( const wxIcon& icon, long x, long y ); void DrawIcon( const wxIcon& icon, long x, long y );
void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE ); void DrawBitmap( const wxBitmap& bitmap, long x, long y, bool useMask=FALSE );
void DrawText(const wxString& text, long x, long y, bool use16 = FALSE); void DrawText(const wxString& text, long x, long y, bool use16 = FALSE);
void Clear(); void Clear();
@@ -91,7 +91,7 @@ public:
void SetBrush( const wxBrush& brush ); void SetBrush( const wxBrush& brush );
void SetLogicalFunction( int function ); void SetLogicalFunction( int function );
void SetBackground( const wxBrush& brush ); void SetBackground( const wxBrush& brush );
void SetClippingRegion(long x, long y, long width, long height); void SetClippingRegion(long x, long y, long width, long height);
void SetClippingRegion( const wxRegion &region ); void SetClippingRegion( const wxRegion &region );
void DestroyClippingRegion(); void DestroyClippingRegion();
@@ -108,16 +108,16 @@ public:
long *descent = (long *) NULL, long *descent = (long *) NULL,
long *externalLeading = (long *) NULL, long *externalLeading = (long *) NULL,
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE); wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE);
void GetSize(int* width, int* height) const; void GetSize(int* width, int* height) const;
void GetSizeMM(long *width, long *height) const; void GetSizeMM(long *width, long *height) const;
void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
void SetDeviceOrigin( long x, long y ); void SetDeviceOrigin( long x, long y );
inline void SetBackgroundMode(int WXUNUSED(mode)) {} inline void SetBackgroundMode(int WXUNUSED(mode)) {}
inline void SetPalette(const wxPalette& WXUNUSED(palette)) {} inline void SetPalette(const wxPalette& WXUNUSED(palette)) {}
inline ofstream *GetStream(void) const { return m_pstream; } inline ofstream *GetStream(void) const { return m_pstream; }
protected: protected:
@@ -133,7 +133,7 @@ protected:
double m_underlineThickness; double m_underlineThickness;
}; };
#endif #endif
// wxUSE_POSTSCRIPT // wxUSE_POSTSCRIPT
#endif #endif

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -42,40 +42,39 @@ class wxFontNameDirectory;
// wxFont // wxFont
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxFont: public wxGDIObject class wxFont: public wxGDIObject
{ {
DECLARE_DYNAMIC_CLASS(wxFont) DECLARE_DYNAMIC_CLASS(wxFont)
public: public:
wxFont(void); wxFont();
wxFont( int PointSize, int FontIdOrFamily, int Style, int Weight, wxFont( int PointSize, int FontIdOrFamily, int Style, int Weight,
bool underlined = FALSE, const char *Face= ( const char *) NULL ); bool underlined = FALSE, const char *Face = ( const char *) NULL );
wxFont( int PointSize, const char *Face, int Family, int Style, int Weight, wxFont( int PointSize, const char *Face, int Family,
bool underlined = FALSE ); int Style, int Weight, bool underlined = FALSE );
wxFont( const wxFont& font ); wxFont( const wxFont& font );
wxFont( const wxFont* font ); ~wxFont();
~wxFont(void);
wxFont& operator = ( const wxFont& font ); wxFont& operator = ( const wxFont& font );
bool operator == ( const wxFont& font ); bool operator == ( const wxFont& font );
bool operator != ( const wxFont& font ); bool operator != ( const wxFont& font );
bool Ok() const; bool Ok() const;
int GetPointSize(void) const; int GetPointSize() const;
wxString GetFaceName(void) const; wxString GetFaceName() const;
int GetFamily(void) const; int GetFamily() const;
wxString GetFamilyString(void) const; wxString GetFamilyString() const;
int GetFontId(void) const; int GetFontId() const;
wxString GetFaceString(void) const; wxString GetFaceString() const;
int GetStyle(void) const; int GetStyle() const;
wxString GetStyleString(void) const; wxString GetStyleString() const;
int GetWeight(void) const; int GetWeight() const;
wxString GetWeightString(void) const; wxString GetWeightString() const;
bool GetUnderlined(void) const; bool GetUnderlined() const;
wxFont( char *xFontName ); wxFont( char *xFontName );
// implementation // implementation
GdkFont* GetInternalFont(float scale = 1.0) const; GdkFont* GetInternalFont(float scale = 1.0) const;
// no data :-) // no data :-)
@@ -85,15 +84,15 @@ class wxFont: public wxGDIObject
// wxFontDirectory // wxFontDirectory
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxFontNameDirectory: public wxObject class wxFontNameDirectory: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxFontNameDirectory) DECLARE_DYNAMIC_CLASS(wxFontNameDirectory)
public: public:
wxFontNameDirectory(void); wxFontNameDirectory();
~wxFontNameDirectory(); ~wxFontNameDirectory();
void Initialize(void); void Initialize();
void Initialize(int fontid, int family, const char *name); void Initialize(int fontid, int family, const char *name);
int FindOrCreateFontId(const char *name, int family); int FindOrCreateFontId(const char *name, int family);
@@ -101,11 +100,10 @@ class wxFontNameDirectory: public wxObject
int GetFamily(int fontid); int GetFamily(int fontid);
int GetFontId(const char *name); int GetFontId(const char *name);
char* GetFontName(int fontid); char* GetFontName(int fontid);
int GetNewFontId(void); int GetNewFontId();
char* GetPostScriptName(int fontid, int weight, int style); char* GetPostScriptName(int fontid, int weight, int style);
char* GetScreenName(int fontid, int weight, int style); char* GetScreenName(int fontid, int weight, int style);
class wxHashTable *table; class wxHashTable *table;
int nextFontId; int nextFontId;
}; };

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -35,9 +35,8 @@ class wxIcon: public wxBitmap
public: public:
wxIcon(void); wxIcon();
wxIcon( const wxIcon& icon); wxIcon( const wxIcon& icon);
wxIcon( const wxIcon* icon);
wxIcon( const char **bits, int width=-1, int height=-1 ); wxIcon( const char **bits, int width=-1, int height=-1 );
wxIcon( char **bits, int width=-1, int height=-1 ); wxIcon( char **bits, int width=-1, int height=-1 );

View File

@@ -50,7 +50,9 @@ public:
// the item's text = name // the item's text = name
void SetName(const wxString& str); void SetName(const wxString& str);
void SetText(const wxString& str) { SetName(str); } // compatibility
const wxString& GetName() const { return m_text; } const wxString& GetName() const { return m_text; }
const wxString& GetText() const { return GetName(); }
// what kind of menu item we are // what kind of menu item we are
void SetCheckable(bool checkable) { m_isCheckMenu = checkable; } void SetCheckable(bool checkable) { m_isCheckMenu = checkable; }
@@ -60,7 +62,7 @@ public:
bool IsSubMenu() const { return m_subMenu != NULL; } bool IsSubMenu() const { return m_subMenu != NULL; }
// state // state
void Enable( bool enable = TRUE ); void Enable( bool enable = TRUE );
bool IsEnabled() const { return m_isEnabled; } bool IsEnabled() const { return m_isEnabled; }
void Check( bool check = TRUE ); void Check( bool check = TRUE );
bool IsChecked() const; bool IsChecked() const;
@@ -86,5 +88,5 @@ private:
}; };
#endif #endif
//__GTKMENUITEMH__ //__GTKMENUITEMH__

View File

@@ -5,7 +5,7 @@
// Created: 01/02/97 // Created: 01/02/97
// Id: // Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -36,17 +36,16 @@ class wxPalette: public wxGDIObject
DECLARE_DYNAMIC_CLASS(wxPalette) DECLARE_DYNAMIC_CLASS(wxPalette)
public: public:
wxPalette(void); wxPalette();
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue ); wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
wxPalette( const wxPalette& palette ); wxPalette( const wxPalette& palette );
wxPalette( const wxPalette* palette ); ~wxPalette();
~wxPalette(void);
wxPalette& operator = ( const wxPalette& palette ); wxPalette& operator = ( const wxPalette& palette );
bool operator == ( const wxPalette& palette ); bool operator == ( const wxPalette& palette );
bool operator != ( const wxPalette& palette ); bool operator != ( const wxPalette& palette );
bool Ok(void) const; bool Ok() const;
bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue); bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const; int GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const;
bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const; bool GetRGB( int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const;

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -36,31 +36,30 @@ class wxPen: public wxGDIObject
DECLARE_DYNAMIC_CLASS(wxPen) DECLARE_DYNAMIC_CLASS(wxPen)
public: public:
wxPen(void); wxPen();
wxPen( const wxColour &colour, int width, int style ); wxPen( const wxColour &colour, int width, int style );
wxPen( const wxPen& pen ); wxPen( const wxPen& pen );
wxPen( const wxPen* pen ); ~wxPen();
~wxPen(void);
wxPen& operator = ( const wxPen& pen ); wxPen& operator = ( const wxPen& pen );
bool operator == ( const wxPen& pen ); bool operator == ( const wxPen& pen );
bool operator != ( const wxPen& pen ); bool operator != ( const wxPen& pen );
void SetColour( const wxColour &colour ); void SetColour( const wxColour &colour );
void SetColour( int red, int green, int blue ); void SetColour( int red, int green, int blue );
void SetCap( int capStyle ); void SetCap( int capStyle );
void SetJoin( int joinStyle ); void SetJoin( int joinStyle );
void SetStyle( int style ); void SetStyle( int style );
void SetWidth( int width ); void SetWidth( int width );
wxColour &GetColour(void) const; wxColour &GetColour() const;
int GetCap(void) const; int GetCap() const;
int GetJoin(void) const; int GetJoin() const;
int GetStyle(void) const; int GetStyle() const;
int GetWidth(void) const; int GetWidth() const;
bool Ok(void) const; bool Ok() const;
void Unshare(void); void Unshare();
// no data :-) // no data :-)
}; };

View File

@@ -83,7 +83,7 @@ public:
wxStringClientData( wxString &data ) { m_data = data; } wxStringClientData( wxString &data ) { m_data = data; }
void SetData( wxString &data ) { m_data = data; } void SetData( wxString &data ) { m_data = data; }
wxString GetData() const { return m_data; } wxString GetData() const { return m_data; }
private: private:
wxString m_data; wxString m_data;
}; };
@@ -95,7 +95,7 @@ private:
class wxWindow: public wxEvtHandler class wxWindow: public wxEvtHandler
{ {
DECLARE_DYNAMIC_CLASS(wxWindow) DECLARE_DYNAMIC_CLASS(wxWindow)
public: public:
wxWindow(); wxWindow();
wxWindow(wxWindow *parent, wxWindowID id, wxWindow(wxWindow *parent, wxWindowID id,
@@ -110,7 +110,7 @@ public:
const wxString& name = wxPanelNameStr); const wxString& name = wxPanelNameStr);
virtual ~wxWindow(); virtual ~wxWindow();
virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName, virtual bool LoadFromResource( wxWindow *parent, const wxString& resourceName,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource, virtual wxControl *CreateItem(const wxItemResource* childResource, const wxItemResource* parentResource,
const wxResourceTable *table = (const wxResourceTable *) NULL); const wxResourceTable *table = (const wxResourceTable *) NULL);
@@ -155,7 +155,8 @@ public:
virtual bool OnClose(); virtual bool OnClose();
virtual void AddChild( wxWindow *child ); virtual void AddChild( wxWindow *child );
wxList& GetChildren() const; wxList& GetChildren() { return m_children; }
virtual void RemoveChild( wxWindow *child ); virtual void RemoveChild( wxWindow *child );
void SetReturnCode( int retCode ); void SetReturnCode( int retCode );
int GetReturnCode(); int GetReturnCode();
@@ -167,7 +168,7 @@ public:
{ m_parent = p; } { m_parent = p; }
virtual wxWindow *ReParent( wxWindow *newParent ); virtual wxWindow *ReParent( wxWindow *newParent );
wxEvtHandler *GetEventHandler(); wxEvtHandler *GetEventHandler() const;
void SetEventHandler( wxEvtHandler *handler ); void SetEventHandler( wxEvtHandler *handler );
void PushEventHandler( wxEvtHandler *handler ); void PushEventHandler( wxEvtHandler *handler );
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
@@ -177,23 +178,23 @@ public:
virtual void SetClientObject( wxClientData *data ); virtual void SetClientObject( wxClientData *data );
virtual wxClientData *GetClientObject(); virtual wxClientData *GetClientObject();
virtual void SetClientData( void *data ); virtual void SetClientData( void *data );
virtual void *GetClientData(); virtual void *GetClientData();
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel ); virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; } virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
bool IsBeingDeleted(); bool IsBeingDeleted();
void SetId( wxWindowID id ); void SetId( wxWindowID id );
wxWindowID GetId(); wxWindowID GetId() const;
void SetCursor( const wxCursor &cursor ); void SetCursor( const wxCursor &cursor );
virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL );
virtual void Clear(); virtual void Clear();
virtual wxRegion GetUpdateRegion() const; virtual wxRegion GetUpdateRegion() const;
virtual bool IsExposed(int x, int y) const; virtual bool IsExposed(int x, int y) const;
virtual bool IsExposed(int x, int y, int w, int h) const; virtual bool IsExposed(int x, int y, int w, int h) const;
@@ -213,20 +214,20 @@ public:
const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const;
virtual void SetFont( const wxFont &font ); virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont(); virtual const wxFont& GetFont() { return m_font; }
// For backward compatibility // For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont *GetLabelFont() { return GetFont(); }; inline virtual const wxFont& GetLabelFont() { return GetFont(); };
inline virtual wxFont *GetButtonFont() { return GetFont(); }; inline virtual const wxFont& GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag ); virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const; virtual long GetWindowStyleFlag() const;
virtual void CaptureMouse(); virtual void CaptureMouse();
virtual void ReleaseMouse(); virtual void ReleaseMouse();
virtual void SetTitle( const wxString &title ); virtual void SetTitle( const wxString &title );
virtual wxString GetTitle() const; virtual wxString GetTitle() const;
virtual void SetName( const wxString &name ); virtual void SetName( const wxString &name );
@@ -243,10 +244,10 @@ public:
virtual bool IsRetained(); virtual bool IsRetained();
virtual wxWindow *FindWindow( long id ); virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name ); virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {}; void AllowDoubleClick( bool WXUNUSED(allow) ) {};
void SetDoubleClick( bool WXUNUSED(allow) ) {}; void SetDoubleClick( bool WXUNUSED(allow) ) {};
virtual void ClientToScreen( int *x, int *y ); virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y ); virtual void ScreenToClient( int *x, int *y );
@@ -270,27 +271,27 @@ public:
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL );
virtual bool AcceptsFocus() const; virtual bool AcceptsFocus() const;
void UpdateWindowUI(); void UpdateWindowUI();
// implementation // implementation
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos, void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name ); const wxSize &size, long style, const wxString &name );
void PostCreation(); void PostCreation();
virtual GtkWidget *GetConnectWidget(); virtual GtkWidget *GetConnectWidget();
virtual bool IsOwnGtkWindow( GdkWindow *window ); virtual bool IsOwnGtkWindow( GdkWindow *window );
void ConnectWidget( GtkWidget *widget ); void ConnectWidget( GtkWidget *widget );
bool HasVMT(); bool HasVMT();
virtual wxPoint GetClientAreaOrigin() const; virtual wxPoint GetClientAreaOrigin() const;
virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags ); virtual void AdjustForParentClientOrigin( int& x, int& y, int sizeFlags );
GtkStyle *GetWidgetStyle(); GtkStyle *GetWidgetStyle();
void SetWidgetStyle(); void SetWidgetStyle();
virtual void ApplyWidgetStyle(); virtual void ApplyWidgetStyle();
wxWindow *m_parent; wxWindow *m_parent;
wxList m_children; wxList m_children;
@@ -329,7 +330,7 @@ public:
bool m_resizing; bool m_resizing;
GdkGC *m_scrollGC; GdkGC *m_scrollGC;
GtkStyle *m_widgetStyle; GtkStyle *m_widgetStyle;
wxInsertChildFunction m_insertCallback; wxInsertChildFunction m_insertCallback;
public: public:

View File

@@ -4,9 +4,9 @@
// Author: Vadim Zeitlin // Author: Vadim Zeitlin
// Modified by: // Modified by:
// Created: 04/01/98 // Created: 04/01/98
// RCS-ID: // RCS-ID: $Id$
// Copyright: // Copyright:
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h" #include "wx/wxprec.h"
@@ -59,7 +59,7 @@ private:
// Define a new application type // Define a new application type
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class DnDApp : public wxApp class DnDApp : public wxApp
{ {
public: public:
bool OnInit(); bool OnInit();
}; };
@@ -70,7 +70,7 @@ IMPLEMENT_APP(DnDApp);
// Define a new frame type // Define a new frame type
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class DnDFrame : public wxFrame class DnDFrame : public wxFrame
{ {
public: public:
DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h); DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
~DnDFrame(); ~DnDFrame();
@@ -84,9 +84,9 @@ public:
void OnLeftDown(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event); void OnRightDown(wxMouseEvent& event);
bool OnClose(); bool OnClose();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
private: private:
@@ -123,10 +123,10 @@ BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
END_EVENT_TABLE() END_EVENT_TABLE()
// `Main program' equivalent, creating windows and returning main app frame // `Main program' equivalent, creating windows and returning main app frame
bool DnDApp::OnInit(void) bool DnDApp::OnInit()
{ {
// create the main frame window // create the main frame window
DnDFrame *frame = new DnDFrame((wxFrame *) NULL, "Drag & Drop wxWindows App", DnDFrame *frame = new DnDFrame((wxFrame *) NULL, "Drag & Drop wxWindows App",
50, 50, 450, 340); 50, 50, 450, 340);
// activate it // activate it
@@ -145,7 +145,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
// frame icon and status bar // frame icon and status bar
SetIcon(wxICON(mondrian)); SetIcon(wxICON(mondrian));
// const int widths[] = { -1 }; // const int widths[] = { -1 };
CreateStatusBar(); CreateStatusBar();
@@ -169,7 +169,7 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
menu_bar->Append(help_menu, "&Help"); menu_bar->Append(help_menu, "&Help");
SetMenuBar(menu_bar); SetMenuBar(menu_bar);
// make a panel with 3 subwindows // make a panel with 3 subwindows
wxPoint pos(0, 0); wxPoint pos(0, 0);
wxSize size(400, 200); wxSize size(400, 200);
@@ -179,8 +179,8 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL); m_ctrlFile = new wxListBox(this, -1, pos, size, 1, &strFile, wxLB_HSCROLL);
m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL); m_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL);
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size, m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
wxTE_MULTILINE | wxTE_READONLY | wxTE_MULTILINE | wxTE_READONLY |
wxSUNKEN_BORDER| wxHSCROLL); wxSUNKEN_BORDER| wxHSCROLL);
// redirect log messages to the text window (don't forget to delete it!) // redirect log messages to the text window (don't forget to delete it!)
@@ -189,14 +189,14 @@ DnDFrame::DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h)
// associate drop targets with 2 text controls // associate drop targets with 2 text controls
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile)); m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText)); m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
wxLayoutConstraints *c; wxLayoutConstraints *c;
// Top-left listbox // Top-left listbox
c = new wxLayoutConstraints; c = new wxLayoutConstraints;
c->left.SameAs (this, wxLeft); c->left.SameAs(this, wxLeft);
c->top.SameAs (this, wxTop); c->top.SameAs(this, wxTop);
c->right.PercentOf(this, wxRight, 50); c->right.PercentOf(this, wxRight, 50);
c->height.PercentOf(this, wxHeight, 40); c->height.PercentOf(this, wxHeight, 40);
m_ctrlFile->SetConstraints(c); m_ctrlFile->SetConstraints(c);
@@ -230,7 +230,7 @@ void DnDFrame::OnPaint(wxPaintEvent& /*event*/)
int w = 0; int w = 0;
int h = 0; int h = 0;
GetClientSize( &w, &h ); GetClientSize( &w, &h );
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL ) ); dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL ) );
dc.DrawText( "Drag text from here!", 20, h-20 ); dc.DrawText( "Drag text from here!", 20, h-20 );
@@ -252,7 +252,7 @@ void DnDFrame::OnDrag(wxCommandEvent& /* event */)
void DnDFrame::OnAbout(wxCommandEvent& /* event */) void DnDFrame::OnAbout(wxCommandEvent& /* event */)
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
"Drag-&-Drop Demo\n" "Drag-&-Drop Demo\n"
"Please see \"Help|Help...\" for details\n" "Please see \"Help|Help...\" for details\n"
"Copyright (c) 1998 Vadim Zeitlin", "Copyright (c) 1998 Vadim Zeitlin",
@@ -263,22 +263,22 @@ void DnDFrame::OnAbout(wxCommandEvent& /* event */)
void DnDFrame::OnHelp(wxCommandEvent& /* event */) void DnDFrame::OnHelp(wxCommandEvent& /* event */)
{ {
wxMessageDialog dialog(this, wxMessageDialog dialog(this,
"This small program demonstrates drag & drop support in wxWindows. The program window\n" "This small program demonstrates drag & drop support in wxWindows. The program window\n"
"consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n" "consists of 3 parts: the bottom pane is for debug messages, so that you can see what's\n"
"going on inside. The top part is split into 2 listboxes, the left one accepts files\n" "going on inside. The top part is split into 2 listboxes, the left one accepts files\n"
"and the right one accepts text.\n" "and the right one accepts text.\n"
"\n" "\n"
"To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n" "To test wxDropTarget: open wordpad (write.exe), select some text in it and drag it to\n"
"the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n" "the right listbox (you'll notice the usual visual feedback, i.e. the cursor will change).\n"
"Also, try dragging some files (you can select several at once) from Windows Explorer (or \n" "Also, try dragging some files (you can select several at once) from Windows Explorer (or \n"
"File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n" "File Manager) to the left pane. Hold down Ctrl/Shift keys when you drop text (doesn't \n"
"work with files) and see what changes.\n" "work with files) and see what changes.\n"
"\n" "\n"
"To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n" "To test wxDropSource: just press any mouse button on the empty zone of the window and drag\n"
"it to wordpad or any other droptarget accepting text (and of course you can just drag it\n" "it to wordpad or any other droptarget accepting text (and of course you can just drag it\n"
"to the right pane). Due to a lot of trace messages, the cursor might take some time to \n" "to the right pane). Due to a lot of trace messages, the cursor might take some time to \n"
"change, don't release the mouse button until it does. You can change the string being\n" "change, don't release the mouse button until it does. You can change the string being\n"
"dragged in in \"File|Test drag...\" dialog.\n" "dragged in in \"File|Test drag...\" dialog.\n"
"\n" "\n"
"\n" "\n"
@@ -291,19 +291,19 @@ void DnDFrame::OnHelp(wxCommandEvent& /* event */)
void DnDFrame::OnLogClear(wxCommandEvent& /* event */ ) void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
{ {
// m_ctrlLog->Clear(); m_ctrlLog->Clear();
} }
bool DnDFrame::OnClose() bool DnDFrame::OnClose()
{ {
return TRUE; return TRUE;
} }
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) ) void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{ {
if ( !m_strText.IsEmpty() ) { if ( !m_strText.IsEmpty() ) {
// start drag operation // start drag operation
wxTextDataObject data(m_strText); wxTextDataObject data(m_strText);
wxDropSource dragSource(data, this); wxDropSource dragSource(data, this);
const char *pc; const char *pc;
@@ -324,11 +324,11 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
void DnDFrame::OnRightDown(wxMouseEvent &event ) void DnDFrame::OnRightDown(wxMouseEvent &event )
{ {
wxMenu *menu = new wxMenu; wxMenu *menu = new wxMenu;
menu->Append(Menu_Drag, "&Test drag..."); menu->Append(Menu_Drag, "&Test drag...");
menu->Append(Menu_About, "&About"); menu->Append(Menu_About, "&About");
menu->Append(Menu_Quit, "E&xit"); menu->Append(Menu_Quit, "E&xit");
PopupMenu( menu, event.GetX(), event.GetY() ); PopupMenu( menu, event.GetX(), event.GetY() );
} }
@@ -350,7 +350,7 @@ bool DnDText::OnDropText(long, long, const char *psz)
return TRUE; return TRUE;
} }
bool DnDFile::OnDropFiles(long, long, size_t nFiles, bool DnDFile::OnDropFiles(long, long, size_t nFiles,
const char * const aszFiles[]) const char * const aszFiles[])
{ {
wxString str; wxString str;

View File

@@ -21,6 +21,8 @@
#endif #endif
#include "wx/toolbar.h" #include "wx/toolbar.h"
#include <wx/log.h>
#include "test.h" #include "test.h"
#if defined(__WXGTK__) || defined(__WXMOTIF__) #if defined(__WXGTK__) || defined(__WXMOTIF__)
@@ -38,7 +40,6 @@
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
// The `main program' equivalent, creating the windows and returning the // The `main program' equivalent, creating the windows and returning the
// main frame // main frame
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
@@ -51,11 +52,7 @@ bool MyApp::OnInit(void)
frame->CreateStatusBar(); frame->CreateStatusBar();
// Give it an icon // Give it an icon
#ifdef __WXMSW__ frame->SetIcon(wxICON(mondrian));
frame->SetIcon(wxIcon("mondrian"));
#else
frame->SetIcon( wxIcon(mondrian_xpm) );
#endif
// Make a menubar // Make a menubar
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
@@ -92,8 +89,6 @@ bool MyApp::OnInit(void)
bool MyApp::InitToolbar(wxToolBar* toolBar) bool MyApp::InitToolbar(wxToolBar* toolBar)
{ {
toolBar->SetMargins(5, 5);
// Set up toolbar // Set up toolbar
wxBitmap* toolBarBitmaps[8]; wxBitmap* toolBarBitmaps[8];
@@ -167,7 +162,7 @@ END_EVENT_TABLE()
// Define my frame constructor // Define my frame constructor
MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos, MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
const wxSize& size, long style): const wxSize& size, long style):
wxFrame(parent, id, title, pos, size, style) wxFrame(parent, id, title, pos, size, style), m_timer(this)
{ {
m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE); m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE);
} }
@@ -179,7 +174,10 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{ {
(void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar"); // (void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar");
wxLogStatus("Started timer.");
m_timer.Start(500, TRUE);
} }
// Define the behaviour for the frame closing // Define the behaviour for the frame closing

View File

@@ -17,6 +17,17 @@ class MyApp: public wxApp
bool InitToolbar(wxToolBar* toolBar); bool InitToolbar(wxToolBar* toolBar);
}; };
class MyTimer : public wxTimer
{
public:
MyTimer(wxFrame *frame) { m_frame = frame; }
virtual void Notify() { wxLogStatus(m_frame, "Timer arrived!"); }
private:
wxFrame *m_frame;
};
// Define a new frame // Define a new frame
class MyFrame: public wxFrame class MyFrame: public wxFrame
{ {
@@ -34,6 +45,8 @@ public:
private: private:
wxTextCtrl* m_textWindow; wxTextCtrl* m_textWindow;
MyTimer m_timer;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -50,7 +50,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
* wxColourData * wxColourData
*/ */
wxColourData::wxColourData(void) wxColourData::wxColourData()
{ {
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
@@ -58,9 +58,9 @@ wxColourData::wxColourData(void)
chooseFull = FALSE; chooseFull = FALSE;
dataColour.Set(0,0,0); dataColour.Set(0,0,0);
} }
wxColourData::~wxColourData(void) wxColourData::~wxColourData()
{ {
} }
@@ -94,7 +94,7 @@ void wxColourData::operator=(const wxColourData& data)
* Font data * Font data
*/ */
wxFontData::wxFontData(void) wxFontData::wxFontData()
{ {
// Intialize colour to black. // Intialize colour to black.
fontColour.Set(0, 0, 0); fontColour.Set(0, 0, 0);
@@ -106,7 +106,7 @@ wxFontData::wxFontData(void)
maxSize = 0; maxSize = 0;
} }
wxFontData::~wxFontData(void) wxFontData::~wxFontData()
{ {
} }
@@ -126,7 +126,7 @@ void wxFontData::operator=(const wxFontData& data)
* Print data * Print data
*/ */
wxPrintData::wxPrintData(void) wxPrintData::wxPrintData()
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
printData = NULL; printData = NULL;
@@ -147,7 +147,7 @@ wxPrintData::wxPrintData(void)
printSetupDialog = FALSE; printSetupDialog = FALSE;
} }
wxPrintData::~wxPrintData(void) wxPrintData::~wxPrintData()
{ {
#ifdef __WXMSW__ #ifdef __WXMSW__
PRINTDLG *pd = (PRINTDLG *)printData; PRINTDLG *pd = (PRINTDLG *)printData;
@@ -159,7 +159,7 @@ wxPrintData::~wxPrintData(void)
} }
#ifdef __WXMSW__ #ifdef __WXMSW__
void wxPrintData::ConvertToNative(void) void wxPrintData::ConvertToNative()
{ {
PRINTDLG *pd = (PRINTDLG*) printData; PRINTDLG *pd = (PRINTDLG*) printData;
if ( pd == NULL ) if ( pd == NULL )
@@ -174,8 +174,6 @@ void wxPrintData::ConvertToNative(void)
pd->hDevMode = NULL; // Will be created by PrintDlg pd->hDevMode = NULL; // Will be created by PrintDlg
pd->hDevNames = NULL; // Ditto pd->hDevNames = NULL; // Ditto
// Why had I put this #ifdef in?? Seems fine to me.
#if 1
pd->Flags = PD_RETURNDEFAULT; pd->Flags = PD_RETURNDEFAULT;
pd->nCopies = 1; pd->nCopies = 1;
@@ -196,7 +194,6 @@ void wxPrintData::ConvertToNative(void)
GlobalFree(pd->hDevNames); GlobalFree(pd->hDevNames);
pd->hDevNames = NULL; pd->hDevNames = NULL;
} }
#endif
} }
if ( pd->hDevMode ) if ( pd->hDevMode )
@@ -245,7 +242,7 @@ void wxPrintData::ConvertToNative(void)
pd->Flags |= PD_PRINTSETUP; pd->Flags |= PD_PRINTSETUP;
} }
void wxPrintData::ConvertFromNative(void) void wxPrintData::ConvertFromNative()
{ {
PRINTDLG *pd = (PRINTDLG*) printData; PRINTDLG *pd = (PRINTDLG*) printData;
if ( pd == NULL ) if ( pd == NULL )
@@ -308,7 +305,7 @@ void wxPrintData::operator=(const wxPrintData& data)
* wxPageSetupData * wxPageSetupData
*/ */
wxPageSetupData::wxPageSetupData(void) wxPageSetupData::wxPageSetupData()
{ {
#if defined(__WIN95__) #if defined(__WIN95__)
m_pageSetupData = NULL; m_pageSetupData = NULL;
@@ -330,7 +327,7 @@ wxPageSetupData::wxPageSetupData(void)
m_getDefaultInfo = FALSE; m_getDefaultInfo = FALSE;
} }
wxPageSetupData::~wxPageSetupData(void) wxPageSetupData::~wxPageSetupData()
{ {
#if defined(__WIN95__) && defined(__WXMSW__) #if defined(__WIN95__) && defined(__WXMSW__)
PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageSetupData; PAGESETUPDLG *pd = (PAGESETUPDLG *)m_pageSetupData;
@@ -360,7 +357,7 @@ void wxPageSetupData::operator=(const wxPageSetupData& data)
} }
#if defined(__WXMSW__) && defined(__WIN95__) #if defined(__WXMSW__) && defined(__WIN95__)
void wxPageSetupData::ConvertToNative(void) void wxPageSetupData::ConvertToNative()
{ {
PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageSetupData; PAGESETUPDLG *pd = (PAGESETUPDLG*) m_pageSetupData;
if ( m_pageSetupData == NULL ) if ( m_pageSetupData == NULL )
@@ -369,7 +366,7 @@ void wxPageSetupData::ConvertToNative(void)
pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE)); pd->hDevMode = GlobalAlloc(GMEM_MOVEABLE, sizeof(DEVMODE));
m_pageSetupData = (void *)pd; m_pageSetupData = (void *)pd;
} }
pd->Flags = PSD_MARGINS|PSD_MINMARGINS; pd->Flags = PSD_MARGINS|PSD_MINMARGINS;
if ( m_defaultMinMargins ) if ( m_defaultMinMargins )
@@ -422,7 +419,7 @@ void wxPageSetupData::ConvertToNative(void)
} }
} }
void wxPageSetupData::ConvertFromNative(void) void wxPageSetupData::ConvertFromNative()
{ {
PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ; PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageSetupData ;
if ( !pd ) if ( !pd )

View File

@@ -211,15 +211,14 @@ bool wxConfigBase::Write(const wxString& key, bool value)
} }
wxString wxConfigBase::ExpandEnvVars(const wxString& str) const wxString wxConfigBase::ExpandEnvVars(const wxString& str) const
{ {
wxString tmp; // Required for BC++ wxString tmp; // Required for BC++
if (IsExpandingEnvVars()) if (IsExpandingEnvVars())
tmp = wxExpandEnvVars(str); tmp = wxExpandEnvVars(str);
else else
tmp = str; tmp = str;
return tmp; return tmp;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxConfigPathChanger // wxConfigPathChanger
@@ -410,5 +409,3 @@ void wxSplitPath(wxArrayString& aParts, const char *sz)
pc++; pc++;
} }
} }

View File

@@ -111,9 +111,9 @@ wxString wxFileConfig::GetGlobalDir()
wxString wxFileConfig::GetLocalDir() wxString wxFileConfig::GetLocalDir()
{ {
wxString strDir; wxString strDir;
wxGetHomeDir(&strDir); wxGetHomeDir(&strDir);
#ifdef __UNIX__ #ifdef __UNIX__
if (strDir.Last() != '/') strDir << '/'; if (strDir.Last() != '/') strDir << '/';
#else #else
@@ -152,7 +152,7 @@ wxString wxFileConfig::GetLocalFileName(const char *szFile)
if ( strchr(szFile, '.') == NULL ) if ( strchr(szFile, '.') == NULL )
str << ".ini"; str << ".ini";
#endif #endif
return str; return str;
} }
@@ -762,7 +762,7 @@ void wxFileConfig::LineListRemove(LineList *pLine)
// last entry? // last entry?
if ( pNext == NULL ) if ( pNext == NULL )
m_linesTail = pPrev; m_linesTail = pPrev;
else else
pNext->SetPrev(pPrev); pNext->SetPrev(pPrev);
delete pLine; delete pLine;
@@ -1328,7 +1328,7 @@ wxString FilterOut(const wxString& str)
{ {
if(str.IsEmpty()) if(str.IsEmpty())
return str; return str;
wxString strResult; wxString strResult;
strResult.Alloc(str.Len()); strResult.Alloc(str.Len());

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem // Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -72,13 +72,13 @@ wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
y = topLeft.y; y = topLeft.y;
width = bottomRight.x - topLeft.x; width = bottomRight.x - topLeft.x;
height = bottomRight.y - topLeft.y; height = bottomRight.y - topLeft.y;
if (width < 0) if (width < 0)
{ {
width = -width; width = -width;
x -= width; x -= width;
} }
if (height < 0) if (height < 0)
{ {
height = -height; height = -height;
@@ -94,9 +94,9 @@ wxRect::wxRect(const wxPoint& point, const wxSize& size)
wxRect::wxRect(const wxRect& rect) wxRect::wxRect(const wxRect& rect)
{ {
x = rect.x; x = rect.x;
y = rect.y; y = rect.y;
width = rect.width; width = rect.width;
height = rect.height; height = rect.height;
} }
@@ -146,14 +146,14 @@ void wxColourDatabase::Initialize ()
// Don't initialize for X: colours are found // Don't initialize for X: colours are found
// in FindColour below. // in FindColour below.
// Added: Not all // Added: Not all
struct cdef { struct cdef {
char *name; char *name;
int r,g,b; int r,g,b;
}; };
cdef cc; cdef cc;
static cdef table[]={ static cdef table[]={
// #ifdef __WXMSW__ // #ifdef __WXMSW__
{"AQUAMARINE",112, 219, 147}, {"AQUAMARINE",112, 219, 147},
{"BLACK",0, 0, 0}, {"BLACK",0, 0, 0},
@@ -234,7 +234,7 @@ void wxColourDatabase::Initialize ()
{"LIGHT MAGENTA", 255, 0, 255}, {"LIGHT MAGENTA", 255, 0, 255},
{"MEDIUM GREY", 100, 100, 100}, {"MEDIUM GREY", 100, 100, 100},
#endif #endif
{0,0,0,0} {0,0,0,0}
}; };
int i; int i;
@@ -263,7 +263,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
wxNode *node = Find(str); wxNode *node = Find(str);
if (node) if (node)
return (wxColour *)node->Data(); return (wxColour *)node->Data();
#ifdef __WXMSW__ #ifdef __WXMSW__
else return NULL; else return NULL;
#endif #endif
@@ -277,7 +277,7 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
#ifdef __WXGTK__ #ifdef __WXGTK__
else { else {
wxColour *col = new wxColour( colour ); wxColour *col = new wxColour( colour );
if (!(col->Ok())) { if (!(col->Ok())) {
delete col; delete col;
return (wxColour *) NULL; return (wxColour *) NULL;
@@ -321,19 +321,19 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
unsigned char red = colour.Red (); unsigned char red = colour.Red ();
unsigned char green = colour.Green (); unsigned char green = colour.Green ();
unsigned char blue = colour.Blue (); unsigned char blue = colour.Blue ();
for (wxNode * node = First (); node; node = node->Next ()) for (wxNode * node = First (); node; node = node->Next ())
{ {
wxColour *col = (wxColour *) node->Data (); wxColour *col = (wxColour *) node->Data ();
if (col->Red () == red && col->Green () == green && col->Blue () == blue) if (col->Red () == red && col->Green () == green && col->Blue () == blue)
{ {
const char *found = node->GetKeyString(); const char *found = node->GetKeyString();
if (found) if (found)
return wxString(found); return wxString(found);
} }
} }
return wxString(""); // Not Found return wxString(""); // Not Found
} }
@@ -393,8 +393,7 @@ void wxInitializeStockObjects ()
wxCROSS_CURSOR = new wxCursor (wxCURSOR_CROSS); wxCROSS_CURSOR = new wxCursor (wxCURSOR_CROSS);
} }
void void wxDeleteStockObjects ()
wxDeleteStockObjects ()
{ {
wxDELETE(wxNORMAL_FONT); wxDELETE(wxNORMAL_FONT);
wxDELETE(wxSMALL_FONT); wxDELETE(wxSMALL_FONT);
@@ -494,12 +493,12 @@ wxPen *wxPenList::FindOrCreatePen (const wxColour& colour, int width, int style)
{ {
wxPen *each_pen = (wxPen *) node->Data (); wxPen *each_pen = (wxPen *) node->Data ();
if (each_pen && each_pen->GetVisible() && if (each_pen && 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 () &&
each_pen->GetColour ().Green () == colour.Green () && each_pen->GetColour ().Green () == colour.Green () &&
each_pen->GetColour ().Blue () == colour.Blue ()) each_pen->GetColour ().Blue () == colour.Blue ())
return each_pen; return each_pen;
} }
wxPen *pen = new wxPen (colour, width, style); wxPen *pen = new wxPen (colour, width, style);
@@ -537,11 +536,11 @@ wxBrush *wxBrushList::FindOrCreateBrush (const wxColour& colour, int style)
{ {
wxBrush *each_brush = (wxBrush *) node->Data (); wxBrush *each_brush = (wxBrush *) node->Data ();
if (each_brush && each_brush->GetVisible() && if (each_brush && 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 () &&
each_brush->GetColour ().Blue () == colour.Blue ()) each_brush->GetColour ().Blue () == colour.Blue ())
return each_brush; return each_brush;
} }
// Yes, we can return a pointer to this in a later FindOrCreateBrush call, // Yes, we can return a pointer to this in a later FindOrCreateBrush call,
// because we created it within FindOrCreateBrush. Safeguards against // because we created it within FindOrCreateBrush. Safeguards against
@@ -562,14 +561,14 @@ wxFontList::~wxFontList ()
wxNode *node = First (); wxNode *node = First ();
while (node) while (node)
{ {
// Only delete objects that are 'visible', i.e. // Only delete objects that are 'visible', i.e.
// that have been created using FindOrCreate..., // that have been created using FindOrCreate...,
// where the pointers are expected to be shared // where the pointers are expected to be shared
// (and therefore not deleted by any one part of an app). // (and therefore not deleted by any one part of an app).
wxFont *font = (wxFont *) node->Data (); wxFont *font = (wxFont *) node->Data ();
wxNode *next = node->Next (); wxNode *next = node->Next ();
if (font->GetVisible()) if (font->GetVisible())
delete font; delete font;
node = next; node = next;
} }
} }
@@ -585,23 +584,23 @@ void wxFontList::RemoveFont (wxFont * font)
} }
wxFont *wxFontList:: wxFont *wxFontList::
FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face) FindOrCreateFont (int PointSize, int FamilyOrFontId, int Style, int Weight, bool underline, const wxString& Face)
{ {
for (wxNode * node = First (); node; node = node->Next ()) for (wxNode * node = First (); node; node = node->Next ())
{ {
wxFont *each_font = (wxFont *) node->Data (); wxFont *each_font = (wxFont *) node->Data ();
if (each_font && each_font->GetVisible() && each_font->Ok() && if (each_font && each_font->GetVisible() && each_font->Ok() &&
each_font->GetPointSize () == PointSize && each_font->GetPointSize () == PointSize &&
each_font->GetStyle () == Style && each_font->GetStyle () == Style &&
each_font->GetWeight () == Weight && each_font->GetWeight () == Weight &&
each_font->GetUnderlined () == underline && each_font->GetUnderlined () == underline &&
//#if defined(__X__) //#if defined(__X__)
// each_font->GetFontId () == FamilyOrFontId) /* New font system */ // each_font->GetFontId () == FamilyOrFontId) /* New font system */
//#else //#else
each_font->GetFamily () == FamilyOrFontId && each_font->GetFamily () == FamilyOrFontId &&
(!each_font->GetFaceName() || each_font->GetFaceName() == Face)) (!each_font->GetFaceName() || each_font->GetFaceName() == Face))
//#endif //#endif
return each_font; return each_font;
} }
wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face); wxFont *font = new wxFont (PointSize, FamilyOrFontId, Style, Weight, underline, Face);
font->SetVisible(TRUE); font->SetVisible(TRUE);
@@ -609,9 +608,14 @@ wxFont *wxFontList::
} }
void wxBitmapList::AddBitmap(wxBitmap *bitmap) void wxBitmapList::AddBitmap(wxBitmap *bitmap)
{ Append(bitmap); } {
Append(bitmap);
}
void wxBitmapList::RemoveBitmap(wxBitmap *bitmap) void wxBitmapList::RemoveBitmap(wxBitmap *bitmap)
{ DeleteObject(bitmap); } {
DeleteObject(bitmap);
}
wxSize wxGetDisplaySize() wxSize wxGetDisplaySize()
{ {
@@ -620,7 +624,8 @@ wxSize wxGetDisplaySize()
return wxSize(x, y); return wxSize(x, y);
} }
wxResourceCache::~wxResourceCache () { wxResourceCache::~wxResourceCache ()
{
wxNode *node = First (); wxNode *node = First ();
while (node) { while (node) {
wxGDIObject *item = (wxGDIObject *)node->Data(); wxGDIObject *item = (wxGDIObject *)node->Data();

View File

@@ -148,7 +148,7 @@ wxItemResource::~wxItemResource()
/* /*
* Resource table * Resource table
*/ */
wxResourceTable::wxResourceTable():wxHashTable(wxKEY_STRING), identifiers(wxKEY_STRING) wxResourceTable::wxResourceTable():wxHashTable(wxKEY_STRING), identifiers(wxKEY_STRING)
{ {
} }
@@ -157,7 +157,7 @@ wxResourceTable::~wxResourceTable()
{ {
ClearTable(); ClearTable();
} }
wxItemResource *wxResourceTable::FindResource(const wxString& name) const wxItemResource *wxResourceTable::FindResource(const wxString& name) const
{ {
wxItemResource *item = (wxItemResource *)Get((char *)(const char *)name); wxItemResource *item = (wxItemResource *)Get((char *)(const char *)name);
@@ -196,7 +196,7 @@ bool wxResourceTable::DeleteResource(const wxString& name)
break; break;
} }
} }
delete item; delete item;
return TRUE; return TRUE;
} }
@@ -588,7 +588,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
long windowStyle = wxDEFAULT_DIALOG_STYLE; long windowStyle = wxDEFAULT_DIALOG_STYLE;
if (isPanel) if (isPanel)
windowStyle = 0; windowStyle = 0;
int x = 0; int y = 0; int width = -1; int height = -1; int x = 0; int y = 0; int width = -1; int height = -1;
int isModal = 0; int isModal = 0;
wxExpr *labelFontExpr = (wxExpr *) NULL; wxExpr *labelFontExpr = (wxExpr *) NULL;
@@ -632,7 +632,7 @@ wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr,
dialogItem->SetName(name); dialogItem->SetName(name);
dialogItem->SetTitle(title); dialogItem->SetTitle(title);
dialogItem->SetSize(x, y, width, height); dialogItem->SetSize(x, y, width, height);
if (backColourHex != "") if (backColourHex != "")
{ {
int r = 0; int r = 0;
@@ -1033,7 +1033,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
controlItem->SetValue4(str); controlItem->SetValue4(str);
count ++; count ++;
wxExpr *valueList = (wxExpr *) NULL; wxExpr *valueList = (wxExpr *) NULL;
// Check for default value list // Check for default value list
if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList)) if ((valueList = expr->Nth(count)) && (valueList->Type() == PrologList))
@@ -1106,7 +1106,7 @@ wxItemResource *wxResourceInterpretControl(wxResourceTable& table, wxExpr *expr)
return controlItem; return controlItem;
} }
// Forward declaration // Forward declaration
wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr); wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr);
/* /*
@@ -1116,7 +1116,7 @@ wxItemResource *wxResourceInterpretMenu1(wxResourceTable& table, wxExpr *expr);
wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr) wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr)
{ {
wxItemResource *item = new wxItemResource; wxItemResource *item = new wxItemResource;
wxExpr *labelExpr = expr->Nth(0); wxExpr *labelExpr = expr->Nth(0);
wxExpr *idExpr = expr->Nth(1); wxExpr *idExpr = expr->Nth(1);
wxExpr *helpExpr = expr->Nth(2); wxExpr *helpExpr = expr->Nth(2);
@@ -1170,7 +1170,7 @@ wxItemResource *wxResourceInterpretMenuItem(wxResourceTable& table, wxExpr *expr
wxExpr *subMenuExpr = expr->GetFirst(); wxExpr *subMenuExpr = expr->GetFirst();
while (subMenuExpr && (subMenuExpr->Type() != PrologList)) while (subMenuExpr && (subMenuExpr->Type() != PrologList))
subMenuExpr = subMenuExpr->GetNext(); subMenuExpr = subMenuExpr->GetNext();
while (subMenuExpr) while (subMenuExpr)
{ {
wxItemResource *child = wxResourceInterpretMenuItem(table, subMenuExpr); wxItemResource *child = wxResourceInterpretMenuItem(table, subMenuExpr);
@@ -1208,7 +1208,7 @@ wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr)
expr->GetAttributeValue("menu", &listExpr); expr->GetAttributeValue("menu", &listExpr);
if (!listExpr) if (!listExpr)
return (wxItemResource *) NULL; return (wxItemResource *) NULL;
wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr); wxItemResource *menuResource = wxResourceInterpretMenuItem(table, listExpr);
if (!menuResource) if (!menuResource)
@@ -1219,7 +1219,7 @@ wxItemResource *wxResourceInterpretMenu(wxResourceTable& table, wxExpr *expr)
{ {
menuResource->SetName(name); menuResource->SetName(name);
} }
return menuResource; return menuResource;
} }
@@ -1233,7 +1233,7 @@ wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr)
wxItemResource *resource = new wxItemResource; wxItemResource *resource = new wxItemResource;
resource->SetType("wxMenu"); resource->SetType("wxMenu");
// resource->SetType(wxTYPE_MENU); // resource->SetType(wxTYPE_MENU);
wxExpr *element = listExpr->GetFirst(); wxExpr *element = listExpr->GetFirst();
while (element) while (element)
{ {
@@ -1247,7 +1247,7 @@ wxItemResource *wxResourceInterpretMenuBar(wxResourceTable& table, wxExpr *expr)
{ {
resource->SetName(name); resource->SetName(name);
} }
return resource; return resource;
} }
@@ -1301,7 +1301,7 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx
} }
else else
bitmapSpec->SetValue1(0); bitmapSpec->SetValue1(0);
if (platformExpr && platformExpr->StringValue()) if (platformExpr && platformExpr->StringValue())
{ {
wxString plat(platformExpr->StringValue()); wxString plat(platformExpr->StringValue());
@@ -1326,14 +1326,14 @@ wxItemResource *wxResourceInterpretBitmap(wxResourceTable& WXUNUSED(table), wxEx
if (yresExpr) if (yresExpr)
yres = (int)yresExpr->IntegerValue(); yres = (int)yresExpr->IntegerValue();
bitmapSpec->SetSize(0, 0, xres, yres); bitmapSpec->SetSize(0, 0, xres, yres);
bitmapItem->GetChildren().Append(bitmapSpec); bitmapItem->GetChildren().Append(bitmapSpec);
} }
} }
} }
bitmapExpr = bitmapExpr->GetNext(); bitmapExpr = bitmapExpr->GetNext();
} }
return bitmapItem; return bitmapItem;
} }
@@ -1362,7 +1362,7 @@ wxFont wxResourceInterpretFontSpec(wxExpr *expr)
int weight = wxNORMAL; int weight = wxNORMAL;
int underline = 0; int underline = 0;
wxString faceName(""); wxString faceName("");
wxExpr *pointExpr = expr->Nth(0); wxExpr *pointExpr = expr->Nth(0);
wxExpr *familyExpr = expr->Nth(1); wxExpr *familyExpr = expr->Nth(1);
wxExpr *styleExpr = expr->Nth(2); wxExpr *styleExpr = expr->Nth(2);
@@ -1518,7 +1518,7 @@ bool wxGetResourceToken(FILE *fd)
wxReallocateResourceBuffer(); wxReallocateResourceBuffer();
wxResourceBuffer[wxResourceBufferCount] = (char)ch; wxResourceBuffer[wxResourceBufferCount] = (char)ch;
wxResourceBufferCount ++; wxResourceBufferCount ++;
ch = getc(fd); ch = getc(fd);
} }
wxResourceBuffer[wxResourceBufferCount] = 0; wxResourceBuffer[wxResourceBufferCount] = 0;
@@ -1533,12 +1533,12 @@ bool wxGetResourceToken(FILE *fd)
static char *name = "...."; static char *name = "....";
with possible comments. with possible comments.
*/ */
bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table) bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
// static or #define // static or #define
if (!wxGetResourceToken(fd)) if (!wxGetResourceToken(fd))
{ {
@@ -1566,7 +1566,7 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour
} }
delete[] name; delete[] name;
delete[] value; delete[] value;
return TRUE; return TRUE;
} }
else if (strcmp(wxResourceBuffer, "#include") == 0) else if (strcmp(wxResourceBuffer, "#include") == 0)
@@ -1609,7 +1609,7 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour
wxLogWarning(_("Expected 'char' whilst parsing resource.")); wxLogWarning(_("Expected 'char' whilst parsing resource."));
return FALSE; return FALSE;
} }
// *name // *name
if (!wxGetResourceToken(fd)) if (!wxGetResourceToken(fd))
{ {
@@ -1625,7 +1625,7 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour
} }
char nameBuf[100]; char nameBuf[100];
strncpy(nameBuf, wxResourceBuffer+1, 99); strncpy(nameBuf, wxResourceBuffer+1, 99);
// = // =
if (!wxGetResourceToken(fd)) if (!wxGetResourceToken(fd))
{ {
@@ -1666,7 +1666,7 @@ bool wxResourceReadOneResource(FILE *fd, wxExprDatabase& db, bool *eof, wxResour
/* /*
* Parses string window style into integer window style * Parses string window style into integer window style
*/ */
/* /*
* Style flag parsing, e.g. * Style flag parsing, e.g.
* "wxSYSTEM_MENU | wxBORDER" -> integer * "wxSYSTEM_MENU | wxBORDER" -> integer
@@ -1722,13 +1722,13 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
{ "wxLB_SORT", wxLB_SORT }, { "wxLB_SORT", wxLB_SORT },
{ "wxLB_OWNERDRAW", wxLB_OWNERDRAW }, { "wxLB_OWNERDRAW", wxLB_OWNERDRAW },
{ "wxLB_HSCROLL", wxLB_HSCROLL }, { "wxLB_HSCROLL", wxLB_HSCROLL },
/* wxComboxBox */ /* wxComboxBox */
{ "wxCB_SIMPLE", wxCB_SIMPLE }, { "wxCB_SIMPLE", wxCB_SIMPLE },
{ "wxCB_DROPDOWN", wxCB_DROPDOWN }, { "wxCB_DROPDOWN", wxCB_DROPDOWN },
{ "wxCB_READONLY", wxCB_READONLY }, { "wxCB_READONLY", wxCB_READONLY },
{ "wxCB_SORT", wxCB_SORT }, { "wxCB_SORT", wxCB_SORT },
/* wxGauge */ /* wxGauge */
{ "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR }, { "wxGA_PROGRESSBAR", wxGA_PROGRESSBAR },
{ "wxGA_HORIZONTAL", wxGA_HORIZONTAL }, { "wxGA_HORIZONTAL", wxGA_HORIZONTAL },
@@ -1815,7 +1815,7 @@ static wxResourceBitListStruct wxResourceBitListTable[] =
{ "wxALIGN_CENTRE", wxALIGN_CENTRE}, { "wxALIGN_CENTRE", wxALIGN_CENTRE},
{ "wxALIGN_RIGHT", wxALIGN_RIGHT}, { "wxALIGN_RIGHT", wxALIGN_RIGHT},
{ "wxCOLOURED", wxCOLOURED}, { "wxCOLOURED", wxCOLOURED},
/* wxToolBar */ /* wxToolBar */
{ "wxTB_3DBUTTONS", wxTB_3DBUTTONS}, { "wxTB_3DBUTTONS", wxTB_3DBUTTONS},
{ "wxTB_HORIZONTAL", wxTB_HORIZONTAL}, { "wxTB_HORIZONTAL", wxTB_HORIZONTAL},
@@ -1990,12 +1990,12 @@ long wxParseWindowStyle(const wxString& bitListString)
* Load a bitmap from a wxWindows resource, choosing an optimum * Load a bitmap from a wxWindows resource, choosing an optimum
* depth and appropriate type. * depth and appropriate type.
*/ */
wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table) wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *item = table->FindResource(resource); wxItemResource *item = table->FindResource(resource);
if (item) if (item)
{ {
@@ -2008,7 +2008,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
long thisNoColours = (long)pow(2.0, (double)thisDepth); long thisNoColours = (long)pow(2.0, (double)thisDepth);
wxItemResource *optResource = (wxItemResource *) NULL; wxItemResource *optResource = (wxItemResource *) NULL;
// Try to find optimum bitmap for this platform/colour depth // Try to find optimum bitmap for this platform/colour depth
wxNode *node = item->GetChildren().First(); wxNode *node = item->GetChildren().First();
while (node) while (node)
@@ -2102,7 +2102,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
{ {
wxLogWarning(_("Failed to find XBM resource %s.\n" wxLogWarning(_("Failed to find XBM resource %s.\n"
"Forgot to use wxResourceLoadBitmapData?"), (const char*) name); "Forgot to use wxResourceLoadBitmapData?"), (const char*) name);
return (wxBitmap *) NULL; return wxNullBitmap;
} }
return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ; return wxBitmap(item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()) ;
#else #else
@@ -2118,7 +2118,7 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
{ {
wxLogWarning(_("Failed to find XPM resource %s.\n" wxLogWarning(_("Failed to find XPM resource %s.\n"
"Forgot to use wxResourceLoadBitmapData?"), (const char*) name); "Forgot to use wxResourceLoadBitmapData?"), (const char*) name);
return (wxBitmap *) NULL; return wxNullBitmap;
} }
return wxBitmap(item->GetValue1()); return wxBitmap(item->GetValue1());
#else #else
@@ -2145,12 +2145,12 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table
* Load an icon from a wxWindows resource, choosing an optimum * Load an icon from a wxWindows resource, choosing an optimum
* depth and appropriate type. * depth and appropriate type.
*/ */
wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *item = table->FindResource(resource); wxItemResource *item = table->FindResource(resource);
if (item) if (item)
{ {
@@ -2163,7 +2163,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
long thisNoColours = (long)pow(2.0, (double)thisDepth); long thisNoColours = (long)pow(2.0, (double)thisDepth);
wxItemResource *optResource = (wxItemResource *) NULL; wxItemResource *optResource = (wxItemResource *) NULL;
// Try to find optimum icon for this platform/colour depth // Try to find optimum icon for this platform/colour depth
wxNode *node = item->GetChildren().First(); wxNode *node = item->GetChildren().First();
while (node) while (node)
@@ -2257,7 +2257,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
{ {
wxLogWarning(_("Failed to find XBM resource %s.\n" wxLogWarning(_("Failed to find XBM resource %s.\n"
"Forgot to use wxResourceLoadIconData?"), (const char*) name); "Forgot to use wxResourceLoadIconData?"), (const char*) name);
return (wxIcon *) NULL; return wxNullIcon;
} }
return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
#else #else
@@ -2333,7 +2333,7 @@ wxMenuBar *wxResourceCreateMenuBar(const wxString& resource, wxResourceTable *ta
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *menuResource = table->FindResource(resource); wxItemResource *menuResource = table->FindResource(resource);
if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu")) if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu"))
{ {
@@ -2357,7 +2357,7 @@ wxMenu *wxResourceCreateMenu(const wxString& resource, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *menuResource = table->FindResource(resource); wxItemResource *menuResource = table->FindResource(resource);
if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu")) if (menuResource && (menuResource->GetType() != "") && (menuResource->GetType() == "wxMenu"))
// if (menuResource && (menuResource->GetType() == wxTYPE_MENU)) // if (menuResource && (menuResource->GetType() == wxTYPE_MENU))
@@ -2370,7 +2370,7 @@ bool wxResourceParseData(const wxString& resource, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
return table->ParseResourceData(resource); return table->ParseResourceData(resource);
} }
@@ -2378,7 +2378,7 @@ bool wxResourceParseFile(const wxString& filename, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
return table->ParseResourceFile(filename); return table->ParseResourceFile(filename);
} }
@@ -2387,7 +2387,7 @@ bool wxResourceRegisterBitmapData(const wxString& name, char bits[], int width,
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
return table->RegisterResourceBitmapData(name, bits, width, height); return table->RegisterResourceBitmapData(name, bits, width, height);
} }
@@ -2415,7 +2415,7 @@ bool wxResourceAddIdentifier(const wxString& name, int value, wxResourceTable *t
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
table->identifiers.Put(name, (wxObject *)value); table->identifiers.Put(name, (wxObject *)value);
return TRUE; return TRUE;
} }
@@ -2424,7 +2424,7 @@ int wxResourceGetIdentifier(const wxString& name, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
return (int)table->identifiers.Get(name); return (int)table->identifiers.Get(name);
} }
@@ -2436,7 +2436,7 @@ bool wxResourceParseIncludeFile(const wxString& f, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
FILE *fd = fopen(f, "r"); FILE *fd = fopen(f, "r");
if (!fd) if (!fd)
{ {
@@ -2490,7 +2490,7 @@ bool wxEatWhiteSpaceString(char *s)
int ch = getc_string(s); int ch = getc_string(s);
if (ch == EOF) if (ch == EOF)
return TRUE; return TRUE;
if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9)) if ((ch != ' ') && (ch != '/') && (ch != ' ') && (ch != 10) && (ch != 13) && (ch != 9))
{ {
ungetc_string(); ungetc_string();
@@ -2585,7 +2585,7 @@ bool wxGetResourceTokenString(char *s)
wxReallocateResourceBuffer(); wxReallocateResourceBuffer();
wxResourceBuffer[wxResourceBufferCount] = (char)ch; wxResourceBuffer[wxResourceBufferCount] = (char)ch;
wxResourceBufferCount ++; wxResourceBufferCount ++;
ch = getc_string(s); ch = getc_string(s);
} }
wxResourceBuffer[wxResourceBufferCount] = 0; wxResourceBuffer[wxResourceBufferCount] = 0;
@@ -2600,12 +2600,12 @@ bool wxGetResourceTokenString(char *s)
static char *name = "...."; static char *name = "....";
with possible comments. with possible comments.
*/ */
bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxResourceTable *table) bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
// static or #define // static or #define
if (!wxGetResourceTokenString(s)) if (!wxGetResourceTokenString(s))
{ {
@@ -2633,7 +2633,7 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR
} }
delete[] name; delete[] name;
delete[] value; delete[] value;
return TRUE; return TRUE;
} }
/* /*
@@ -2680,7 +2680,7 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR
wxLogWarning(_("Expected 'char' whilst parsing resource.")); wxLogWarning(_("Expected 'char' whilst parsing resource."));
return FALSE; return FALSE;
} }
// *name // *name
if (!wxGetResourceTokenString(s)) if (!wxGetResourceTokenString(s))
{ {
@@ -2696,7 +2696,7 @@ bool wxResourceReadOneResourceString(char *s, wxExprDatabase& db, bool *eof, wxR
} }
char nameBuf[100]; char nameBuf[100];
strncpy(nameBuf, wxResourceBuffer+1, 99); strncpy(nameBuf, wxResourceBuffer+1, 99);
// = // =
if (!wxGetResourceTokenString(s)) if (!wxGetResourceTokenString(s))
{ {
@@ -2738,11 +2738,11 @@ bool wxResourceParseString(char *s, wxResourceTable *table)
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
if (!s) if (!s)
return FALSE; return FALSE;
// Turn backslashes into spaces // Turn backslashes into spaces
if (s) if (s)
{ {
int len = strlen(s); int len = strlen(s);
@@ -2774,7 +2774,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
{ {
if (!table) if (!table)
table = wxDefaultResourceTable; table = wxDefaultResourceTable;
wxItemResource *resource = table->FindResource((const char *)resourceName); wxItemResource *resource = table->FindResource((const char *)resourceName);
// if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX)) // if (!resource || (resource->GetType() != wxTYPE_DIALOG_BOX))
if (!resource || !resource->GetType() || if (!resource || !resource->GetType() ||
@@ -2848,7 +2848,7 @@ bool wxWindow::LoadFromResource(wxWindow *parent, const wxString& resourceName,
while (node) while (node)
{ {
wxItemResource *childResource = (wxItemResource *)node->Data(); wxItemResource *childResource = (wxItemResource *)node->Data();
(void) CreateItem(childResource, resource, table); (void) CreateItem(childResource, resource, table);
node = node->Next(); node = node->Next();

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart // Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -213,8 +213,8 @@ bool wxApp::SendIdleEvents(void)
wxNode* node = wxTopLevelWindows.First(); wxNode* node = wxTopLevelWindows.First();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->Next();
} }
@@ -225,22 +225,22 @@ bool wxApp::SendIdleEvents( wxWindow* win )
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxIdleEvent event; wxIdleEvent event;
event.SetEventObject(win); event.SetEventObject(win);
win->ProcessEvent(event); win->ProcessEvent(event);
if (event.MoreRequested()) if (event.MoreRequested())
needMore = TRUE; needMore = TRUE;
wxNode* node = win->GetChildren()->First(); wxNode* node = win->GetChildren().First();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->Next();
} }
return needMore ; return needMore ;
} }

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -24,7 +24,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
wxMask::wxMask(void) wxMask::wxMask()
{ {
m_bitmap = (GdkBitmap *) NULL; m_bitmap = (GdkBitmap *) NULL;
} }
@@ -41,7 +41,7 @@ wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) )
{ {
} }
wxMask::~wxMask(void) wxMask::~wxMask()
{ {
if (m_bitmap) gdk_bitmap_unref( m_bitmap ); if (m_bitmap) gdk_bitmap_unref( m_bitmap );
} }
@@ -50,7 +50,7 @@ GdkBitmap *wxMask::GetBitmap(void) const
{ {
return m_bitmap; return m_bitmap;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmap // wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -60,7 +60,7 @@ class wxBitmapRefData: public wxObjectRefData
public: public:
wxBitmapRefData(void); wxBitmapRefData(void);
~wxBitmapRefData(void); ~wxBitmapRefData(void);
GdkPixmap *m_pixmap; GdkPixmap *m_pixmap;
GdkBitmap *m_bitmap; GdkBitmap *m_bitmap;
wxMask *m_mask; wxMask *m_mask;
@@ -70,7 +70,7 @@ public:
wxPalette *m_palette; wxPalette *m_palette;
}; };
wxBitmapRefData::wxBitmapRefData(void) wxBitmapRefData::wxBitmapRefData()
{ {
m_pixmap = (GdkPixmap *) NULL; m_pixmap = (GdkPixmap *) NULL;
m_bitmap = (GdkBitmap *) NULL; m_bitmap = (GdkBitmap *) NULL;
@@ -81,7 +81,7 @@ wxBitmapRefData::wxBitmapRefData(void)
m_palette = (wxPalette *) NULL; m_palette = (wxPalette *) NULL;
} }
wxBitmapRefData::~wxBitmapRefData(void) wxBitmapRefData::~wxBitmapRefData()
{ {
if (m_pixmap) gdk_pixmap_unref( m_pixmap ); if (m_pixmap) gdk_pixmap_unref( m_pixmap );
if (m_bitmap) gdk_bitmap_unref( m_bitmap ); if (m_bitmap) gdk_bitmap_unref( m_bitmap );
@@ -95,95 +95,88 @@ wxBitmapRefData::~wxBitmapRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap(void) wxBitmap::wxBitmap()
{ {
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( int width, int height, int depth ) wxBitmap::wxBitmap( int width, int height, int depth )
{ {
wxCHECK_RET( (width > 0) && (height > 0), "invalid bitmap size" ) wxCHECK_RET( (width > 0) && (height > 0), "invalid bitmap size" )
wxCHECK_RET( (depth > 0) || (depth == -1), "invalid bitmap depth" ) wxCHECK_RET( (depth > 0) || (depth == -1), "invalid bitmap depth" )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_mask = (wxMask *) NULL; M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth ); M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
M_BMPDATA->m_width = width; M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height; M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const char **bits ) wxBitmap::wxBitmap( const char **bits )
{ {
wxCHECK_RET( bits != NULL, "invalid bitmap data" ) wxCHECK_RET( bits != NULL, "invalid bitmap data" )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
if (mask) if (mask)
{ {
M_BMPDATA->m_mask = new wxMask(); M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask; M_BMPDATA->m_mask->m_bitmap = mask;
} }
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ? M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( char **bits ) wxBitmap::wxBitmap( char **bits )
{ {
wxCHECK_RET( bits != NULL, "invalid bitmap data" ) wxCHECK_RET( bits != NULL, "invalid bitmap data" )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
wxCHECK_RET( M_BMPDATA->m_pixmap, "couldn't create pixmap" ); wxCHECK_RET( M_BMPDATA->m_pixmap, "couldn't create pixmap" );
if (mask) if (mask)
{ {
M_BMPDATA->m_mask = new wxMask(); M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask; M_BMPDATA->m_mask->m_bitmap = mask;
} }
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ? M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const wxBitmap& bmp ) wxBitmap::wxBitmap( const wxBitmap& bmp )
{ {
Ref( bmp ); Ref( bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap( const wxBitmap* bmp )
{
if (bmp) Ref( *bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const wxString &filename, int type ) wxBitmap::wxBitmap( const wxString &filename, int type )
{ {
LoadFile( filename, type ); LoadFile( filename, type );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
@@ -192,44 +185,44 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = (wxMask *) NULL; M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_bitmap = M_BMPDATA->m_bitmap =
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height ); gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
M_BMPDATA->m_width = width; M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height; M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1; M_BMPDATA->m_bpp = 1;
wxCHECK_RET( M_BMPDATA->m_bitmap, "couldn't create bitmap" ); wxCHECK_RET( M_BMPDATA->m_bitmap, "couldn't create bitmap" );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::~wxBitmap(void) wxBitmap::~wxBitmap()
{ {
if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this); if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
} }
wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp ) wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
{ {
if (*this == bmp) return (*this); if (*this == bmp) return (*this);
Ref( bmp ); Ref( bmp );
return *this; return *this;
} }
bool wxBitmap::operator == ( const wxBitmap& bmp ) bool wxBitmap::operator == ( const wxBitmap& bmp )
{ {
return m_refData == bmp.m_refData; return m_refData == bmp.m_refData;
} }
bool wxBitmap::operator != ( const wxBitmap& bmp ) bool wxBitmap::operator != ( const wxBitmap& bmp )
{ {
return m_refData != bmp.m_refData; return m_refData != bmp.m_refData;
} }
bool wxBitmap::Ok(void) const bool wxBitmap::Ok(void) const
{ {
return (m_refData != NULL); return (m_refData != NULL);
} }
int wxBitmap::GetHeight(void) const int wxBitmap::GetHeight(void) const
{ {
wxCHECK_MSG( Ok(), -1, "invalid bitmap" ); wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
@@ -240,69 +233,69 @@ int wxBitmap::GetHeight(void) const
int wxBitmap::GetWidth(void) const int wxBitmap::GetWidth(void) const
{ {
wxCHECK_MSG( Ok(), -1, "invalid bitmap" ); wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
return M_BMPDATA->m_width; return M_BMPDATA->m_width;
} }
int wxBitmap::GetDepth(void) const int wxBitmap::GetDepth(void) const
{ {
wxCHECK_MSG( Ok(), -1, "invalid bitmap" ); wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
return M_BMPDATA->m_bpp; return M_BMPDATA->m_bpp;
} }
wxMask *wxBitmap::GetMask(void) const wxMask *wxBitmap::GetMask(void) const
{ {
wxCHECK_MSG( Ok(), (wxMask *) NULL, "invalid bitmap" ); wxCHECK_MSG( Ok(), (wxMask *) NULL, "invalid bitmap" );
return M_BMPDATA->m_mask; return M_BMPDATA->m_mask;
} }
void wxBitmap::SetMask( wxMask *mask ) void wxBitmap::SetMask( wxMask *mask )
{ {
wxCHECK_RET( Ok(), "invalid bitmap" ); wxCHECK_RET( Ok(), "invalid bitmap" );
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask; if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
M_BMPDATA->m_mask = mask; M_BMPDATA->m_mask = mask;
} }
bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) ) bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) )
{ {
wxCHECK_MSG( Ok(), FALSE, "invalid bitmap" ); wxCHECK_MSG( Ok(), FALSE, "invalid bitmap" );
if (type == wxBITMAP_TYPE_PNG) if (type == wxBITMAP_TYPE_PNG)
{ {
wxImage image( *this ); wxImage image( *this );
if (image.Ok()) return image.SaveFile( name, type ); if (image.Ok()) return image.SaveFile( name, type );
} }
return FALSE; return FALSE;
} }
bool wxBitmap::LoadFile( const wxString &name, int type ) bool wxBitmap::LoadFile( const wxString &name, int type )
{ {
UnRef(); UnRef();
if (!wxFileExists(name)) return FALSE; if (!wxFileExists(name)) return FALSE;
if (type == wxBITMAP_TYPE_XPM) if (type == wxBITMAP_TYPE_XPM)
{ {
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( parent, &mask, NULL, name ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( parent, &mask, NULL, name );
if (mask) if (mask)
{ {
M_BMPDATA->m_mask = new wxMask(); M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask; M_BMPDATA->m_mask->m_bitmap = mask;
} }
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
} }
else if (type == wxBITMAP_TYPE_PNG) else if (type == wxBITMAP_TYPE_PNG)
{ {
@@ -316,16 +309,16 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
image.LoadFile( name, type ); image.LoadFile( name, type );
if (image.Ok()) *this = image.ConvertToBitmap(); if (image.Ok()) *this = image.ConvertToBitmap();
} }
else else
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
wxPalette *wxBitmap::GetPalette(void) const wxPalette *wxBitmap::GetPalette(void) const
{ {
if (!Ok()) return (wxPalette *) NULL; if (!Ok()) return (wxPalette *) NULL;
return M_BMPDATA->m_palette; return M_BMPDATA->m_palette;
} }
@@ -360,17 +353,17 @@ void wxBitmap::SetPixmap( GdkPixmap *pixmap )
GdkPixmap *wxBitmap::GetPixmap(void) const GdkPixmap *wxBitmap::GetPixmap(void) const
{ {
wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, "invalid bitmap" ); wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, "invalid bitmap" );
return M_BMPDATA->m_pixmap; return M_BMPDATA->m_pixmap;
} }
GdkBitmap *wxBitmap::GetBitmap(void) const GdkBitmap *wxBitmap::GetBitmap(void) const
{ {
wxCHECK_MSG( Ok(), (GdkBitmap *) NULL, "invalid bitmap" ); wxCHECK_MSG( Ok(), (GdkBitmap *) NULL, "invalid bitmap" );
return M_BMPDATA->m_bitmap; return M_BMPDATA->m_bitmap;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxImage // wxImage
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -383,46 +376,46 @@ wxBitmap wxImage::ConvertToBitmap() const
int width = GetWidth(); int width = GetWidth();
int height = GetHeight(); int height = GetHeight();
bitmap.SetHeight( height ); bitmap.SetHeight( height );
bitmap.SetWidth( width ); bitmap.SetWidth( width );
// Create picture // Create picture
GdkImage *data_image = GdkImage *data_image =
gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(), width, height ); gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(), width, height );
bitmap.SetPixmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, -1 ) ); bitmap.SetPixmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, -1 ) );
// Create mask // Create mask
GdkImage *mask_image = (GdkImage*) NULL; GdkImage *mask_image = (GdkImage*) NULL;
if (HasMask()) if (HasMask())
{ {
unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height ); unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height ); mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height );
wxMask *mask = new wxMask(); wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 ); mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 );
bitmap.SetMask( mask ); bitmap.SetMask( mask );
} }
// Retrieve depth // Retrieve depth
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() ); GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent ); if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
int bpp = visual->depth; int bpp = visual->depth;
if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15; if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
if (bpp < 8) bpp = 8; if (bpp < 8) bpp = 8;
// Render // Render
enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR }; enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR };
byte_order b_o = RGB; byte_order b_o = RGB;
if (bpp >= 24) if (bpp >= 24)
{ {
GdkVisual *visual = gdk_visual_get_system(); GdkVisual *visual = gdk_visual_get_system();
@@ -433,13 +426,13 @@ wxBitmap wxImage::ConvertToBitmap() const
else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask)) b_o = GRB; else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask)) b_o = GRB;
else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask)) b_o = GBR; else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask)) b_o = GBR;
} }
int r_mask = GetMaskRed(); int r_mask = GetMaskRed();
int g_mask = GetMaskGreen(); int g_mask = GetMaskGreen();
int b_mask = GetMaskBlue(); int b_mask = GetMaskBlue();
unsigned char* data = GetData(); unsigned char* data = GetData();
int index = 0; int index = 0;
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
{ {
@@ -451,7 +444,7 @@ wxBitmap wxImage::ConvertToBitmap() const
index++; index++;
int b = data[index]; int b = data[index];
index++; index++;
if (HasMask()) if (HasMask())
{ {
if ((r == r_mask) && (b == b_mask) && (g == g_mask)) if ((r == r_mask) && (b == b_mask) && (g == g_mask))
@@ -459,7 +452,7 @@ wxBitmap wxImage::ConvertToBitmap() const
else else
gdk_image_put_pixel( mask_image, x, y, 0 ); gdk_image_put_pixel( mask_image, x, y, 0 );
} }
switch (bpp) switch (bpp)
{ {
case 8: case 8:
@@ -477,9 +470,9 @@ wxBitmap wxImage::ConvertToBitmap() const
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff); int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; } if (sum < max) { index = i; max = sum; }
} }
gdk_image_put_pixel( data_image, x, y, index ); gdk_image_put_pixel( data_image, x, y, index );
break; break;
} }
case 15: case 15:
@@ -513,68 +506,68 @@ wxBitmap wxImage::ConvertToBitmap() const
} }
} // for } // for
} // for } // for
// Blit picture // Blit picture
GdkGC *data_gc = gdk_gc_new( bitmap.GetPixmap() ); GdkGC *data_gc = gdk_gc_new( bitmap.GetPixmap() );
gdk_draw_image( bitmap.GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height ); gdk_draw_image( bitmap.GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
gdk_image_destroy( data_image ); gdk_image_destroy( data_image );
gdk_gc_unref( data_gc ); gdk_gc_unref( data_gc );
// Blit mask // Blit mask
if (HasMask()) if (HasMask())
{ {
GdkGC *mask_gc = gdk_gc_new( bitmap.GetMask()->GetBitmap() ); GdkGC *mask_gc = gdk_gc_new( bitmap.GetMask()->GetBitmap() );
gdk_draw_image( bitmap.GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height ); gdk_draw_image( bitmap.GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
gdk_image_destroy( mask_image ); gdk_image_destroy( mask_image );
gdk_gc_unref( mask_gc ); gdk_gc_unref( mask_gc );
} }
return bitmap; return bitmap;
} }
wxImage::wxImage( const wxBitmap &bitmap ) wxImage::wxImage( const wxBitmap &bitmap )
{ {
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" ); wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(), GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(),
0, 0, 0, 0,
bitmap.GetWidth(), bitmap.GetHeight() ); bitmap.GetWidth(), bitmap.GetHeight() );
wxCHECK_RET( gdk_image, "couldn't create image" ); wxCHECK_RET( gdk_image, "couldn't create image" );
Create( bitmap.GetWidth(), bitmap.GetHeight() ); Create( bitmap.GetWidth(), bitmap.GetHeight() );
char unsigned *data = GetData(); char unsigned *data = GetData();
if (!data) if (!data)
{ {
gdk_image_destroy( gdk_image ); gdk_image_destroy( gdk_image );
wxFAIL_MSG( "couldn't create image" ); wxFAIL_MSG( "couldn't create image" );
return; return;
} }
GdkImage *gdk_image_mask = (GdkImage*) NULL; GdkImage *gdk_image_mask = (GdkImage*) NULL;
if (bitmap.GetMask()) if (bitmap.GetMask())
{ {
gdk_image_mask = gdk_image_get( bitmap.GetMask()->GetBitmap(), gdk_image_mask = gdk_image_get( bitmap.GetMask()->GetBitmap(),
0, 0, 0, 0,
bitmap.GetWidth(), bitmap.GetHeight() ); bitmap.GetWidth(), bitmap.GetHeight() );
SetMaskColour( 16, 16, 16 ); // anything unlikely and dividable SetMaskColour( 16, 16, 16 ); // anything unlikely and dividable
} }
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() ); GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent ); if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
int bpp = visual->depth; int bpp = visual->depth;
if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15; if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
GdkColormap *cmap = gtk_widget_get_default_colormap(); GdkColormap *cmap = gtk_widget_get_default_colormap();
long pos = 0; long pos = 0;
for (int j = 0; j < bitmap.GetHeight(); j++) for (int j = 0; j < bitmap.GetHeight(); j++)
{ {
@@ -602,7 +595,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
data[pos+1] = (pixel >> 8) & 0xff; data[pos+1] = (pixel >> 8) & 0xff;
data[pos+2] = pixel & 0xff; data[pos+2] = pixel & 0xff;
} }
if (gdk_image_mask) if (gdk_image_mask)
{ {
int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j ); int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j );
@@ -613,11 +606,11 @@ wxImage::wxImage( const wxBitmap &bitmap )
data[pos+2] = 16; data[pos+2] = 16;
} }
} }
pos += 3; pos += 3;
} }
} }
gdk_image_destroy( gdk_image ); gdk_image_destroy( gdk_image );
if (gdk_image_mask) gdk_image_destroy( gdk_image_mask ); if (gdk_image_mask) gdk_image_destroy( gdk_image_mask );
} }

View File

@@ -20,16 +20,16 @@
class wxBrushRefData: public wxObjectRefData class wxBrushRefData: public wxObjectRefData
{ {
public: public:
wxBrushRefData(void); wxBrushRefData();
wxBrushRefData( const wxBrushRefData& data ); wxBrushRefData( const wxBrushRefData& data );
int m_style; int m_style;
wxBitmap m_stipple; wxBitmap m_stipple;
wxColour m_colour; wxColour m_colour;
}; };
wxBrushRefData::wxBrushRefData(void) wxBrushRefData::wxBrushRefData()
{ {
m_style = 0; m_style = 0;
} }
@@ -47,7 +47,7 @@ wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
wxBrush::wxBrush(void) wxBrush::wxBrush()
{ {
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
@@ -57,7 +57,7 @@ wxBrush::wxBrush( const wxColour &colour, int style )
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style; M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour; M_BRUSHDATA->m_colour = colour;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
@@ -67,52 +67,45 @@ wxBrush::wxBrush( const wxBitmap &stippleBitmap )
M_BRUSHDATA->m_style = wxSTIPPLE; M_BRUSHDATA->m_style = wxSTIPPLE;
M_BRUSHDATA->m_colour = *wxBLACK; M_BRUSHDATA->m_colour = *wxBLACK;
M_BRUSHDATA->m_stipple = stippleBitmap; M_BRUSHDATA->m_stipple = stippleBitmap;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBrush &brush ) wxBrush::wxBrush( const wxBrush &brush )
{ {
Ref( brush ); Ref( brush );
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBrush *brush ) wxBrush::~wxBrush()
{
if (brush) Ref( *brush );
if (wxTheBrushList) wxTheBrushList->Append( this );
}
wxBrush::~wxBrush(void)
{ {
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
} }
wxBrush& wxBrush::operator = ( const wxBrush& brush ) wxBrush& wxBrush::operator = ( const wxBrush& brush )
{ {
if (*this == brush) return (*this); if (*this == brush) return (*this);
Ref( brush ); Ref( brush );
return *this; return *this;
} }
bool wxBrush::operator == ( const wxBrush& brush ) bool wxBrush::operator == ( const wxBrush& brush )
{ {
return m_refData == brush.m_refData; return m_refData == brush.m_refData;
} }
bool wxBrush::operator != ( const wxBrush& brush ) bool wxBrush::operator != ( const wxBrush& brush )
{ {
return m_refData != brush.m_refData; return m_refData != brush.m_refData;
} }
bool wxBrush::Ok(void) const bool wxBrush::Ok() const
{ {
return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
} }
int wxBrush::GetStyle(void) const int wxBrush::GetStyle() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
@@ -123,25 +116,25 @@ int wxBrush::GetStyle(void) const
return M_BRUSHDATA->m_style; return M_BRUSHDATA->m_style;
} }
wxColour &wxBrush::GetColour(void) const wxColour &wxBrush::GetColour() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( "invalid brush" ); wxFAIL_MSG( "invalid brush" );
return wxNullColour; return wxNullColour;
} }
return M_BRUSHDATA->m_colour; return M_BRUSHDATA->m_colour;
} }
wxBitmap *wxBrush::GetStipple(void) const wxBitmap *wxBrush::GetStipple() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( "invalid brush" ); wxFAIL_MSG( "invalid brush" );
return &wxNullBitmap; return &wxNullBitmap;
} }
return &M_BRUSHDATA->m_stipple; return &M_BRUSHDATA->m_stipple;
} }
@@ -169,7 +162,7 @@ void wxBrush::SetStipple( const wxBitmap& stipple )
M_BRUSHDATA->m_stipple = stipple; M_BRUSHDATA->m_stipple = stipple;
} }
void wxBrush::Unshare(void) void wxBrush::Unshare()
{ {
if (!m_refData) if (!m_refData)
{ {

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -23,15 +23,15 @@
class wxColourRefData: public wxObjectRefData class wxColourRefData: public wxObjectRefData
{ {
public: public:
wxColourRefData(); wxColourRefData();
~wxColourRefData(); ~wxColourRefData();
void FreeColour(); void FreeColour();
GdkColor m_color; GdkColor m_color;
GdkColormap *m_colormap; GdkColormap *m_colormap;
bool m_hasPixel; bool m_hasPixel;
friend wxColour; friend wxColour;
}; };
@@ -75,17 +75,17 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT; M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0; M_COLDATA->m_color.pixel = 0;
} }
void wxColour::InitFromName( const wxString &colourName ) void wxColour::InitFromName( const wxString &colourName )
{ {
wxNode *node = (wxNode *) NULL; wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{ {
wxColour *col = (wxColour*)node->Data(); wxColour *col = (wxColour*)node->Data();
UnRef(); UnRef();
if (col) Ref( *col ); if (col) Ref( *col );
} }
else else
{ {
m_refData = new wxColourRefData(); m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color )) if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
@@ -98,34 +98,29 @@ void wxColour::InitFromName( const wxString &colourName )
} }
wxColour::wxColour( const wxColour& col ) wxColour::wxColour( const wxColour& col )
{ {
Ref( col ); Ref( col );
}
wxColour::wxColour( const wxColour* col )
{
if (col) Ref( *col );
} }
wxColour::~wxColour() wxColour::~wxColour()
{ {
} }
wxColour& wxColour::operator = ( const wxColour& col ) wxColour& wxColour::operator = ( const wxColour& col )
{ {
if (*this == col) return (*this); if (*this == col) return (*this);
Ref( col ); Ref( col );
return *this; return *this;
} }
bool wxColour::operator == ( const wxColour& col ) bool wxColour::operator == ( const wxColour& col )
{ {
return m_refData == col.m_refData; return m_refData == col.m_refData;
} }
bool wxColour::operator != ( const wxColour& col) bool wxColour::operator != ( const wxColour& col)
{ {
return m_refData != col.m_refData; return m_refData != col.m_refData;
} }
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
@@ -145,7 +140,7 @@ unsigned char wxColour::Red() const
wxFAIL_MSG( "invalid colour" ); wxFAIL_MSG( "invalid colour" );
return 0; return 0;
} }
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT); return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
} }
@@ -156,7 +151,7 @@ unsigned char wxColour::Green() const
wxFAIL_MSG( "invalid colour" ); wxFAIL_MSG( "invalid colour" );
return 0; return 0;
} }
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT); return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
} }
@@ -167,7 +162,7 @@ unsigned char wxColour::Blue() const
wxFAIL_MSG( "invalid colour" ); wxFAIL_MSG( "invalid colour" );
return 0; return 0;
} }
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT); return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
} }
@@ -179,10 +174,10 @@ bool wxColour::Ok() const
void wxColour::CalcPixel( GdkColormap *cmap ) void wxColour::CalcPixel( GdkColormap *cmap )
{ {
if (!Ok()) return; if (!Ok()) return;
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return; if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour(); M_COLDATA->FreeColour();
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
@@ -199,7 +194,7 @@ void wxColour::CalcPixel( GdkColormap *cmap )
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff); int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; } if (sum < max) { index = i; max = sum; }
} }
M_COLDATA->m_hasPixel = TRUE; M_COLDATA->m_hasPixel = TRUE;
M_COLDATA->m_color.pixel = index; M_COLDATA->m_color.pixel = index;
} }
@@ -207,21 +202,21 @@ void wxColour::CalcPixel( GdkColormap *cmap )
{ {
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color ); M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
} }
M_COLDATA->m_colormap = cmap; M_COLDATA->m_colormap = cmap;
} }
int wxColour::GetPixel() const int wxColour::GetPixel() const
{ {
if (!Ok()) return 0; if (!Ok()) return 0;
return M_COLDATA->m_color.pixel; return M_COLDATA->m_color.pixel;
} }
GdkColor *wxColour::GetColor() const GdkColor *wxColour::GetColor() const
{ {
if (!Ok()) return (GdkColor *) NULL; if (!Ok()) return (GdkColor *) NULL;
return &M_COLDATA->m_color; return &M_COLDATA->m_color;
} }

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -21,19 +21,19 @@
class wxCursorRefData: public wxObjectRefData class wxCursorRefData: public wxObjectRefData
{ {
public: public:
wxCursorRefData(void); wxCursorRefData();
~wxCursorRefData(void); ~wxCursorRefData();
GdkCursor *m_cursor; GdkCursor *m_cursor;
}; };
wxCursorRefData::wxCursorRefData(void) wxCursorRefData::wxCursorRefData()
{ {
m_cursor = (GdkCursor *) NULL; m_cursor = (GdkCursor *) NULL;
} }
wxCursorRefData::~wxCursorRefData(void) wxCursorRefData::~wxCursorRefData()
{ {
if (m_cursor) gdk_cursor_destroy( m_cursor ); if (m_cursor) gdk_cursor_destroy( m_cursor );
} }
@@ -44,14 +44,14 @@ wxCursorRefData::~wxCursorRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
wxCursor::wxCursor(void) wxCursor::wxCursor()
{ {
} }
wxCursor::wxCursor( int cursorId ) wxCursor::wxCursor( int cursorId )
{ {
m_refData = new wxCursorRefData(); m_refData = new wxCursorRefData();
GdkCursorType gdk_cur = GDK_LEFT_PTR; GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId) switch (cursorId)
{ {
@@ -67,12 +67,12 @@ wxCursor::wxCursor( int cursorId )
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break; case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break; case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
} }
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur ); M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
/* /*
do that yourself do that yourself
wxCURSOR_BULLSEYE, wxCURSOR_BULLSEYE,
wxCURSOR_CHAR, wxCURSOR_CHAR,
wxCURSOR_LEFT_BUTTON, wxCURSOR_LEFT_BUTTON,
@@ -95,7 +95,7 @@ wxCursor::wxCursor( int cursorId )
wxCURSOR_BASED_ARROW_UP, wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN wxCURSOR_BASED_ARROW_DOWN
*/ */
} }
wxCursor::wxCursor( const wxCursor &cursor ) wxCursor::wxCursor( const wxCursor &cursor )
@@ -103,39 +103,33 @@ wxCursor::wxCursor( const wxCursor &cursor )
Ref( cursor ); Ref( cursor );
} }
wxCursor::wxCursor( const wxCursor *cursor ) wxCursor::~wxCursor()
{
UnRef();
if (cursor) Ref( *cursor );
}
wxCursor::~wxCursor(void)
{ {
} }
wxCursor& wxCursor::operator = ( const wxCursor& cursor ) wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{ {
if (*this == cursor) return (*this); if (*this == cursor) return (*this);
Ref( cursor ); Ref( cursor );
return *this; return *this;
} }
bool wxCursor::operator == ( const wxCursor& cursor ) bool wxCursor::operator == ( const wxCursor& cursor ) const
{ {
return m_refData == cursor.m_refData; return m_refData == cursor.m_refData;
} }
bool wxCursor::operator != ( const wxCursor& cursor ) bool wxCursor::operator != ( const wxCursor& cursor ) const
{ {
return m_refData != cursor.m_refData; return m_refData != cursor.m_refData;
} }
bool wxCursor::Ok(void) const bool wxCursor::Ok() const
{ {
return (m_refData != NULL); return (m_refData != NULL);
} }
GdkCursor *wxCursor::GetCursor(void) const GdkCursor *wxCursor::GetCursor() const
{ {
return M_CURSORDATA->m_cursor; return M_CURSORDATA->m_cursor;
} }
@@ -146,7 +140,7 @@ GdkCursor *wxCursor::GetCursor(void) const
bool g_isBusy = FALSE; bool g_isBusy = FALSE;
void wxEndBusyCursor(void) void wxEndBusyCursor()
{ {
g_isBusy = FALSE; g_isBusy = FALSE;
} }
@@ -156,7 +150,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
g_isBusy = TRUE; g_isBusy = TRUE;
} }
bool wxIsBusy(void) bool wxIsBusy()
{ {
return g_isBusy; return g_isBusy;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -42,14 +42,14 @@ extern wxList wxPendingDelete;
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win ) static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{ {
if (!win->HasVMT()) return; if (!win->HasVMT()) return;
/* /*
printf( "OnFrameResize from " ); printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() ); printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" ); printf( ".\n" );
*/ */
if ((win->m_width != alloc->width) || (win->m_height != alloc->height)) if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{ {
win->m_sizeSet = FALSE; win->m_sizeSet = FALSE;
@@ -83,10 +83,10 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win ) static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
{ {
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return FALSE;
win->m_x = event->x; win->m_x = event->x;
win->m_y = event->y; win->m_y = event->y;
return FALSE; return FALSE;
} }
@@ -130,7 +130,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
long style, const wxString &name ) long style, const wxString &name )
{ {
wxTopLevelWindows.Append( this ); wxTopLevelWindows.Append( this );
m_needParent = FALSE; m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
@@ -139,9 +139,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
m_widget = gtk_window_new( win_type ); m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1)) if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1)) if ((pos.x != -1) && (pos.y != -1))
@@ -166,11 +166,11 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event", gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
if (m_parent) m_parent->AddChild( this ); if (m_parent) m_parent->AddChild( this );
PostCreation(); PostCreation();
return TRUE; return TRUE;
} }
@@ -187,17 +187,17 @@ wxFrame::~wxFrame()
bool wxFrame::Show( bool show ) bool wxFrame::Show( bool show )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (show && !m_sizeSet) if (show && !m_sizeSet)
{ {
// by calling GtkOnSize here, we don't have to call // by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail // either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate // much ugly flicker nor from within the size_allocate
// handler, because GTK 1.1.X forbids that. // handler, because GTK 1.1.X forbids that.
GtkOnSize( m_x, m_y, m_width, m_height ); GtkOnSize( m_x, m_y, m_width, m_height );
} }
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
@@ -209,7 +209,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent &event )
bool wxFrame::Destroy() bool wxFrame::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
return TRUE; return TRUE;
@@ -236,7 +236,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), "invalid window" );
// Don't do anything for children of wxMDIChildFrame // Don't do anything for children of wxMDIChildFrame
if (!m_wxwindow) return; if (!m_wxwindow) return;
@@ -247,7 +247,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
int old_y = m_y; int old_y = m_y;
int old_width = m_width; int old_width = m_width;
int old_height = m_height; int old_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{ {
if (x != -1) m_x = x; if (x != -1) m_x = x;
@@ -272,7 +272,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
if (height == -1) m_height = 26; if (height == -1) m_height = 26;
} }
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
@@ -280,15 +280,15 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_x != -1) || (m_y != -1)) if ((m_x != -1) || (m_y != -1))
{ {
if ((m_x != old_x) || (m_y != old_y)) if ((m_x != old_x) || (m_y != old_y))
gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_uposition( m_widget, m_x, m_y );
} }
if ((m_width != old_width) || (m_height != old_height)) if ((m_width != old_width) || (m_height != old_height))
{ {
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
} }
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
@@ -304,20 +304,20 @@ void wxFrame::SetSize( int width, int height )
void wxFrame::Centre( int direction ) void wxFrame::Centre( int direction )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int x = 0; int x = 0;
int y = 0; int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y ); Move( x, y );
} }
void wxFrame::GetClientSize( int *width, int *height ) const void wxFrame::GetClientSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxWindow::GetClientSize( width, height ); wxWindow::GetClientSize( width, height );
if (height) if (height)
{ {
@@ -340,7 +340,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const
void wxFrame::SetClientSize( int const width, int const height ) void wxFrame::SetClientSize( int const width, int const height )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int h = height; int h = height;
if (m_frameMenuBar) h += wxMENU_HEIGHT; if (m_frameMenuBar) h += wxMENU_HEIGHT;
if (m_frameStatusBar) h += wxSTATUS_HEIGHT; if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
@@ -361,35 +361,35 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_resizing) return; if (m_resizing) return;
m_resizing = TRUE; m_resizing = TRUE;
if (!m_wxwindow) return; if (!m_wxwindow) return;
m_width = width; m_width = width;
m_height = height; m_height = height;
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
// this emulates the new wxMSW behaviour of placing all // this emulates the new wxMSW behaviour of placing all
// frame-subwindows (menu, toolbar..) on one native window // frame-subwindows (menu, toolbar..) on one native window
// OK, this hurts in the eye, but I don't want to call SetSize() // OK, this hurts in the eye, but I don't want to call SetSize()
// because I don't want to call any non-native functions here. // because I don't want to call any non-native functions here.
if (m_frameMenuBar) if (m_frameMenuBar)
{ {
int xx = m_miniEdge; int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle; int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge; int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT; int hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx; m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy; m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww; m_frameMenuBar->m_width = ww;
m_frameMenuBar->m_height = hh; m_frameMenuBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
} }
@@ -397,42 +397,42 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_frameToolBar) if (m_frameToolBar)
{ {
int xx = m_miniEdge; int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle; int yy = m_miniEdge + m_miniTitle;
if (m_frameMenuBar) yy += wxMENU_HEIGHT; if (m_frameMenuBar) yy += wxMENU_HEIGHT;
int ww = m_width - 2*m_miniEdge; int ww = m_width - 2*m_miniEdge;
int hh = m_frameToolBar->m_height; int hh = m_frameToolBar->m_height;
m_frameToolBar->m_x = xx; m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy; m_frameToolBar->m_y = yy;
m_frameToolBar->m_height = hh; m_frameToolBar->m_height = hh;
m_frameToolBar->m_width = ww; m_frameToolBar->m_width = ww;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
} }
if (m_frameStatusBar) if (m_frameStatusBar)
{ {
int xx = 0 + m_miniEdge; int xx = 0 + m_miniEdge;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge; int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
int ww = m_width - 2*m_miniEdge; int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT; int hh = wxSTATUS_HEIGHT;
m_frameStatusBar->m_x = xx; m_frameStatusBar->m_x = xx;
m_frameStatusBar->m_y = yy; m_frameStatusBar->m_y = yy;
m_frameStatusBar->m_width = ww; m_frameStatusBar->m_width = ww;
m_frameStatusBar->m_height = hh; m_frameStatusBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }
@@ -440,23 +440,23 @@ void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{ {
if (!m_sizeSet) if (!m_sizeSet)
GtkOnSize( m_x, m_y, m_width, m_height ); GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates(); DoMenuUpdates();
} }
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (GetAutoLayout()) if (GetAutoLayout())
{ {
Layout(); Layout();
} }
else else
{ {
// no child: go out ! // no child: go out !
if (!GetChildren().First()) return; if (!GetChildren().First()) return;
// do we have exactly one child? // do we have exactly one child?
wxWindow *child = (wxWindow *) NULL; wxWindow *child = (wxWindow *) NULL;
for(wxNode *node = GetChildren().First(); node; node = node->Next()) for(wxNode *node = GetChildren().First(); node; node = node->Next())
@@ -470,7 +470,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
#endif #endif
) )
{ {
// it's the second one: do nothing // it's the second one: do nothing
if (child) return; if (child) return;
child = win; child = win;
} }
@@ -500,9 +500,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
m_frameMenuBar = menuBar; m_frameMenuBar = menuBar;
if (m_frameMenuBar) if (m_frameMenuBar)
{ {
wxNode *node = m_frameMenuBar->m_menus.First(); wxNode *node = m_frameMenuBar->m_menus.First();
@@ -512,7 +512,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
SetInvokingWindow( menu, this ); SetInvokingWindow( menu, this );
node = node->Next(); node = node->Next();
} }
if (m_frameMenuBar->m_parent != this) if (m_frameMenuBar->m_parent != this)
{ {
m_frameMenuBar->m_parent = this; m_frameMenuBar->m_parent = this;
@@ -520,11 +520,11 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y ); m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
} }
} }
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
} }
wxMenuBar *wxFrame::GetMenuBar(void) const wxMenuBar *wxFrame::GetMenuBar() const
{ {
return m_frameMenuBar; return m_frameMenuBar;
} }
@@ -532,15 +532,15 @@ wxMenuBar *wxFrame::GetMenuBar(void) const
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" ); wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
m_frameToolBar = OnCreateToolBar( style, id, name ); m_frameToolBar = OnCreateToolBar( style, id, name );
GetChildren().DeleteObject( m_frameToolBar ); GetChildren().DeleteObject( m_frameToolBar );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
return m_frameToolBar; return m_frameToolBar;
} }
@@ -549,33 +549,33 @@ wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString&
return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name ); return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
} }
wxToolBar *wxFrame::GetToolBar(void) const wxToolBar *wxFrame::GetToolBar() const
{ {
return m_frameToolBar; return m_frameToolBar;
} }
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" ); wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
m_frameStatusBar = OnCreateStatusBar( number, style, id, name ); m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
return m_frameStatusBar; return m_frameStatusBar;
} }
wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{ {
wxStatusBar *statusBar = (wxStatusBar *) NULL; wxStatusBar *statusBar = (wxStatusBar *) NULL;
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name); statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
// Set the height according to the font and the border size // Set the height according to the font and the border size
wxClientDC dc(statusBar); wxClientDC dc(statusBar);
dc.SetFont( *statusBar->GetFont() ); dc.SetFont( statusBar->GetFont() );
long x, y; long x, y;
dc.GetTextExtent( "X", &x, &y ); dc.GetTextExtent( "X", &x, &y );
@@ -591,7 +591,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id,
void wxFrame::SetStatusText(const wxString& text, int number) void wxFrame::SetStatusText(const wxString& text, int number)
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
m_frameStatusBar->SetStatusText(text, number); m_frameStatusBar->SetStatusText(text, number);
@@ -600,13 +600,13 @@ void wxFrame::SetStatusText(const wxString& text, int number)
void wxFrame::SetStatusWidths(int n, const int widths_field[] ) void wxFrame::SetStatusWidths(int n, const int widths_field[] )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
m_frameStatusBar->SetStatusWidths(n, widths_field); m_frameStatusBar->SetStatusWidths(n, widths_field);
} }
wxStatusBar *wxFrame::GetStatusBar(void) const wxStatusBar *wxFrame::GetStatusBar() const
{ {
return m_frameStatusBar; return m_frameStatusBar;
} }
@@ -614,7 +614,7 @@ wxStatusBar *wxFrame::GetStatusBar(void) const
void wxFrame::SetTitle( const wxString &title ) void wxFrame::SetTitle( const wxString &title )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_title = title; m_title = title;
if (m_title.IsNull()) m_title = ""; if (m_title.IsNull()) m_title = "";
gtk_window_set_title( GTK_WINDOW(m_widget), title ); gtk_window_set_title( GTK_WINDOW(m_widget), title );
@@ -623,14 +623,14 @@ void wxFrame::SetTitle( const wxString &title )
void wxFrame::SetIcon( const wxIcon &icon ) void wxFrame::SetIcon( const wxIcon &icon )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_icon = icon; m_icon = icon;
if (!icon.Ok()) return; if (!icon.Ok()) return;
wxMask *mask = icon.GetMask(); wxMask *mask = icon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL; GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap(); if (mask) bm = mask->GetBitmap();
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
} }

View File

@@ -19,34 +19,29 @@
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits ) wxBitmap( bits )
{ {
} }
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits ) wxBitmap( bits )
{ {
} }
wxIcon::wxIcon() : wxBitmap() wxIcon::wxIcon() : wxBitmap()
{ {
} }
wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap() wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{ {
Ref(icon); Ref(icon);
}
wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
{
if (icon) Ref(*icon);
} }
wxIcon& wxIcon::operator = ( const wxIcon& icon ) wxIcon& wxIcon::operator = ( const wxIcon& icon )
{ {
if (*this == icon) return (*this); if (*this == icon) return (*this);
Ref(icon); Ref(icon);
return *this; return *this;
} }

View File

@@ -31,7 +31,7 @@ wxMenuBar::wxMenuBar()
m_menus.DeleteContents( TRUE ); m_menus.DeleteContents( TRUE );
m_menubar = gtk_menu_bar_new(); m_menubar = gtk_menu_bar_new();
m_widget = GTK_WIDGET(m_menubar); m_widget = GTK_WIDGET(m_menubar);
PostCreation(); PostCreation();
@@ -159,7 +159,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
event.SetEventObject( menu ); event.SetEventObject( menu );
event.SetInt(id ); event.SetInt(id );
if (menu->m_callback) if (menu->m_callback)
{ {
(void) (*(menu->m_callback)) (*menu, event); (void) (*(menu->m_callback)) (*menu, event);
@@ -187,7 +187,7 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id ); wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id );
event.SetEventObject( menu ); event.SetEventObject( menu );
event.SetInt(id ); event.SetInt(id );
/* wxMSW doesn't call callback here either /* wxMSW doesn't call callback here either
if (menu->m_callback) if (menu->m_callback)
{ {
@@ -218,22 +218,24 @@ wxMenuItem::wxMenuItem()
m_menuItem = (GtkWidget *) NULL; m_menuItem = (GtkWidget *) NULL;
} }
// it's valid for this function to be called even if m_menuItem == NULL
void wxMenuItem::SetName(const wxString& str) void wxMenuItem::SetName(const wxString& str)
{ {
wxCHECK_RET( m_menuItem, "invalid menu item" );
m_text = ""; m_text = "";
for ( const char *pc = str; *pc != '\0'; pc++ ) for ( const char *pc = str; *pc != '\0'; pc++ )
{ {
if ( *pc == '&' ) if ( *pc == '&' )
pc++; // skip it pc++; // skip it
m_text << *pc; m_text << *pc;
} }
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); if ( m_menuItem )
{
gtk_label_set( label, m_text.c_str()); GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
gtk_label_set( label, m_text.c_str());
}
} }
void wxMenuItem::Check( bool check ) void wxMenuItem::Check( bool check )
@@ -246,12 +248,12 @@ void wxMenuItem::Check( bool check )
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
} }
void wxMenuItem::Enable( bool enable ) void wxMenuItem::Enable( bool enable )
{ {
wxCHECK_RET( m_menuItem, "invalid menu item" ); wxCHECK_RET( m_menuItem, "invalid menu item" );
gtk_widget_set_sensitive( m_menuItem, enable ); gtk_widget_set_sensitive( m_menuItem, enable );
m_isEnabled = enable; m_isEnabled = enable;
} }
bool wxMenuItem::IsChecked() const bool wxMenuItem::IsChecked() const
@@ -279,11 +281,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
m_items.DeleteContents( TRUE ); m_items.DeleteContents( TRUE );
m_invokingWindow = (wxWindow *) NULL; m_invokingWindow = (wxWindow *) NULL;
m_menu = gtk_menu_new(); // Do not show! m_menu = gtk_menu_new(); // Do not show!
m_callback = func; m_callback = func;
m_eventHandler = this; m_eventHandler = this;
m_clientData = (void*) NULL; m_clientData = (void*) NULL;
if (m_title.IsNull()) m_title = ""; if (m_title.IsNull()) m_title = "";
if (m_title != "") if (m_title != "")
{ {
@@ -325,7 +327,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
const char *text = mitem->GetText(); const char *text = mitem->GetText();
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text) GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
: gtk_menu_item_new_with_label(text); : gtk_menu_item_new_with_label(text);
mitem->SetMenuItem(menuItem); mitem->SetMenuItem(menuItem);
gtk_signal_connect( GTK_OBJECT(menuItem), "activate", gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
@@ -466,7 +468,7 @@ wxMenuItem *wxMenu::FindItem(int id) const
// Not finding anything here can be correct // Not finding anything here can be correct
// when search the entire menu system for // when search the entire menu system for
// an entry -> no error message. // an entry -> no error message.
return (wxMenuItem *) NULL; return (wxMenuItem *) NULL;
} }

View File

@@ -22,19 +22,19 @@
class wxPaletteRefData: public wxObjectRefData class wxPaletteRefData: public wxObjectRefData
{ {
public: public:
wxPaletteRefData(void); wxPaletteRefData(void);
~wxPaletteRefData(void); ~wxPaletteRefData(void);
GdkColormap *m_colormap; GdkColormap *m_colormap;
}; };
wxPaletteRefData::wxPaletteRefData(void) wxPaletteRefData::wxPaletteRefData()
{ {
m_colormap = (GdkColormap *) NULL; m_colormap = (GdkColormap *) NULL;
}; };
wxPaletteRefData::~wxPaletteRefData(void) wxPaletteRefData::~wxPaletteRefData()
{ {
if (m_colormap) gdk_colormap_unref( m_colormap ); if (m_colormap) gdk_colormap_unref( m_colormap );
}; };
@@ -45,7 +45,7 @@ wxPaletteRefData::~wxPaletteRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
wxPalette::wxPalette(void) wxPalette::wxPalette()
{ {
}; };
@@ -60,31 +60,25 @@ wxPalette::wxPalette( const wxPalette& palette )
Ref( palette ); Ref( palette );
}; };
wxPalette::wxPalette( const wxPalette* palette ) wxPalette::~wxPalette()
{
UnRef();
if (palette) Ref( *palette );
};
wxPalette::~wxPalette(void)
{ {
}; };
wxPalette& wxPalette::operator = ( const wxPalette& palette ) wxPalette& wxPalette::operator = ( const wxPalette& palette )
{ {
if (*this == palette) return (*this); if (*this == palette) return (*this);
Ref( palette ); Ref( palette );
return *this; return *this;
}; };
bool wxPalette::operator == ( const wxPalette& palette ) bool wxPalette::operator == ( const wxPalette& palette )
{ {
return m_refData == palette.m_refData; return m_refData == palette.m_refData;
}; };
bool wxPalette::operator != ( const wxPalette& palette ) bool wxPalette::operator != ( const wxPalette& palette )
{ {
return m_refData != palette.m_refData; return m_refData != palette.m_refData;
}; };
bool wxPalette::Ok(void) const bool wxPalette::Ok(void) const

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -21,10 +21,10 @@
class wxPenRefData: public wxObjectRefData class wxPenRefData: public wxObjectRefData
{ {
public: public:
wxPenRefData(void); wxPenRefData(void);
wxPenRefData(const wxPenRefData& data); wxPenRefData(const wxPenRefData& data);
int m_width; int m_width;
int m_style; int m_style;
int m_joinStyle; int m_joinStyle;
@@ -55,7 +55,7 @@ wxPenRefData::wxPenRefData( const wxPenRefData& data )
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen(void) wxPen::wxPen()
{ {
if (wxThePenList) wxThePenList->AddPen( this ); if (wxThePenList) wxThePenList->AddPen( this );
} }
@@ -66,7 +66,7 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
M_PENDATA->m_width = width; M_PENDATA->m_width = width;
M_PENDATA->m_style = style; M_PENDATA->m_style = style;
M_PENDATA->m_colour = colour; M_PENDATA->m_colour = colour;
if (wxThePenList) wxThePenList->AddPen( this ); if (wxThePenList) wxThePenList->AddPen( this );
} }
@@ -76,14 +76,6 @@ wxPen::wxPen( const wxPen& pen )
if (wxThePenList) wxThePenList->AddPen( this ); if (wxThePenList) wxThePenList->AddPen( this );
} }
wxPen::wxPen( const wxPen* pen )
{
UnRef();
if (pen) Ref( *pen );
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::~wxPen() wxPen::~wxPen()
{ {
if (wxThePenList) wxThePenList->RemovePen( this ); if (wxThePenList) wxThePenList->RemovePen( this );
@@ -91,19 +83,19 @@ wxPen::~wxPen()
wxPen& wxPen::operator = ( const wxPen& pen ) wxPen& wxPen::operator = ( const wxPen& pen )
{ {
if (*this == pen) return (*this); if (*this == pen) return (*this);
Ref( pen ); Ref( pen );
return *this; return *this;
} }
bool wxPen::operator == ( const wxPen& pen ) bool wxPen::operator == ( const wxPen& pen )
{ {
return m_refData == pen.m_refData; return m_refData == pen.m_refData;
} }
bool wxPen::operator != ( const wxPen& pen ) bool wxPen::operator != ( const wxPen& pen )
{ {
return m_refData != pen.m_refData; return m_refData != pen.m_refData;
} }
void wxPen::SetColour( const wxColour &colour ) void wxPen::SetColour( const wxColour &colour )
@@ -145,35 +137,35 @@ void wxPen::SetWidth( int width )
int wxPen::GetCap() const int wxPen::GetCap() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_capStyle; return M_PENDATA->m_capStyle;
} }
int wxPen::GetJoin() const int wxPen::GetJoin() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_joinStyle; return M_PENDATA->m_joinStyle;
} }
int wxPen::GetStyle() const int wxPen::GetStyle() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_style; return M_PENDATA->m_style;
} }
int wxPen::GetWidth() const int wxPen::GetWidth() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_width; return M_PENDATA->m_width;
} }
wxColour &wxPen::GetColour() const wxColour &wxPen::GetColour() const
{ {
wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" ); wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" );
return M_PENDATA->m_colour; return M_PENDATA->m_colour;
} }

View File

@@ -26,7 +26,7 @@
static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{ {
win->SetModified(); win->SetModified();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId ); wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
wxString val( win->GetValue() ); wxString val( win->GetValue() );
if (!val.IsNull()) event.m_commandString = WXSTRINGCAST val; if (!val.IsNull()) event.m_commandString = WXSTRINGCAST val;
@@ -89,7 +89,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
0, 0); 0, 0);
// put the horizontal scrollbar in the lower left hand corner // put the horizontal scrollbar in the lower left hand corner
if (bHasHScrollbar) if (bHasHScrollbar)
{ {
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj); GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2, gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
@@ -107,7 +107,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
0, 0); 0, 0);
gtk_widget_show( vscrollbar ); gtk_widget_show( vscrollbar );
} }
else else
{ {
// a single-line text control: no need for scrollbars // a single-line text control: no need for scrollbars
m_widget = m_widget =
@@ -122,10 +122,10 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
m_parent->AddChild( this ); m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this ); (m_parent->m_insertCallback)( m_parent, this );
PostCreation(); PostCreation();
if (multi_line) if (multi_line)
{ {
gtk_widget_realize(m_text); gtk_widget_realize(m_text);
gtk_widget_show(m_text); gtk_widget_show(m_text);
@@ -148,9 +148,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
if (!multi_line) if (!multi_line)
gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE ); gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE );
} }
if (style & wxTE_READONLY) if (style & wxTE_READONLY)
{ {
if (!multi_line) if (!multi_line)
gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE ); gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
} }
@@ -171,7 +171,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
{ {
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" );
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
@@ -190,7 +190,7 @@ wxString wxTextCtrl::GetValue() const
void wxTextCtrl::SetValue( const wxString &value ) void wxTextCtrl::SetValue( const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
wxString tmp = ""; wxString tmp = "";
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -209,7 +209,7 @@ void wxTextCtrl::SetValue( const wxString &value )
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
if (text.IsNull()) return; if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -226,14 +226,14 @@ void wxTextCtrl::WriteText( const wxString &text )
bool wxTextCtrl::LoadFile( const wxString &file ) bool wxTextCtrl::LoadFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
if (!wxFileExists(file)) return FALSE; if (!wxFileExists(file)) return FALSE;
Clear(); Clear();
FILE *fp = NULL; FILE *fp = NULL;
struct stat statb; struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
!(fp = fopen ((char*) (const char*) file, "r"))) !(fp = fopen ((char*) (const char*) file, "r")))
{ {
@@ -254,7 +254,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
fclose (fp); fclose (fp);
text[len] = 0; text[len] = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
@@ -263,7 +263,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
{ {
gtk_entry_set_text( GTK_ENTRY(m_text), text ); gtk_entry_set_text( GTK_ENTRY(m_text), text );
} }
free (text); free (text);
m_modified = FALSE; m_modified = FALSE;
return TRUE; return TRUE;
@@ -274,9 +274,9 @@ bool wxTextCtrl::LoadFile( const wxString &file )
bool wxTextCtrl::SaveFile( const wxString &file ) bool wxTextCtrl::SaveFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
if (file == "") return FALSE; if (file == "") return FALSE;
FILE *fp; FILE *fp;
if (!(fp = fopen ((char*) (const char*) file, "w"))) if (!(fp = fopen ((char*) (const char*) file, "w")))
@@ -287,7 +287,7 @@ bool wxTextCtrl::SaveFile( const wxString &file )
{ {
char *text = NULL; char *text = NULL;
gint len = 0; gint len = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
len = gtk_text_get_length( GTK_TEXT(m_text) ); len = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -297,20 +297,20 @@ bool wxTextCtrl::SaveFile( const wxString &file )
{ {
text = gtk_entry_get_text( GTK_ENTRY(m_text) ); text = gtk_entry_get_text( GTK_ENTRY(m_text) );
} }
if (fwrite (text, sizeof (char), len, fp) != (size_t) len) if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
{ {
// Did not write whole file // Did not write whole file
} }
// Make sure newline terminates the file // Make sure newline terminates the file
if (text[len - 1] != '\n') if (text[len - 1] != '\n')
fputc ('\n', fp); fputc ('\n', fp);
fclose (fp); fclose (fp);
if (m_windowStyle & wxTE_MULTILINE) g_free( text ); if (m_windowStyle & wxTE_MULTILINE) g_free( text );
m_modified = FALSE; m_modified = FALSE;
return TRUE; return TRUE;
} }
@@ -337,7 +337,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
int j; int j;
for (j = 0; text[i] && text[i] != '\n'; i++, j++ ) for (j = 0; text[i] && text[i] != '\n'; i++, j++ )
buf += text[i]; buf += text[i];
g_free( text ); g_free( text );
return buf; return buf;
} }
@@ -366,7 +366,7 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
return 0; return 0;
if( pos >= len) if( pos >= len)
return pos=len-1; return pos=len-1;
*x=1; // Col 1 *x=1; // Col 1
*y=1; // Line 1 *y=1; // Line 1
for (int i = 0; i < pos; i++ ) for (int i = 0; i < pos; i++ )
@@ -378,7 +378,7 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
} }
else else
(*x)++; (*x)++;
} }
g_free( text ); g_free( text );
return 1; return 1;
} }
@@ -388,7 +388,7 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
if (!(m_windowStyle & wxTE_MULTILINE)) if (!(m_windowStyle & wxTE_MULTILINE))
return 0; return 0;
long pos=0; long pos=0;
for(int i=1;i<y;i++) for(int i=1;i<y;i++)
pos +=GetLineLength(i); pos +=GetLineLength(i);
pos +=x-1; // Pos start with 0 pos +=x-1; // Pos start with 0
@@ -414,7 +414,7 @@ int wxTextCtrl::GetNumberOfLines() const
for (int i = 0; i < len; i++ ) for (int i = 0; i < len; i++ )
if (text[i] == '\n') if (text[i] == '\n')
currentLine++; currentLine++;
g_free( text ); g_free( text );
return currentLine; return currentLine;
} }
@@ -430,7 +430,7 @@ int wxTextCtrl::GetNumberOfLines() const
void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetInsertionPoint( long pos )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
int tmp = (int) pos; int tmp = (int) pos;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_point( GTK_TEXT(m_text), tmp ); gtk_text_set_point( GTK_TEXT(m_text), tmp );
@@ -441,7 +441,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
void wxTextCtrl::SetInsertionPointEnd() void wxTextCtrl::SetInsertionPointEnd()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) ); pos = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -453,7 +453,7 @@ void wxTextCtrl::SetInsertionPointEnd()
void wxTextCtrl::SetEditable( bool editable ) void wxTextCtrl::SetEditable( bool editable )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_text), editable ); gtk_text_set_editable( GTK_TEXT(m_text), editable );
else else
@@ -463,7 +463,7 @@ void wxTextCtrl::SetEditable( bool editable )
void wxTextCtrl::SetSelection( long from, long to ) void wxTextCtrl::SetSelection( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
@@ -475,14 +475,14 @@ void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
long wxTextCtrl::GetInsertionPoint() const long wxTextCtrl::GetInsertionPoint() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
return (long) GTK_EDITABLE(m_text)->current_pos; return (long) GTK_EDITABLE(m_text)->current_pos;
} }
long wxTextCtrl::GetLastPosition() const long wxTextCtrl::GetLastPosition() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) ); pos = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -494,14 +494,14 @@ long wxTextCtrl::GetLastPosition() const
void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Remove( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
void wxTextCtrl::Replace( long from, long to, const wxString &value ) void wxTextCtrl::Replace( long from, long to, const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
@@ -511,7 +511,7 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
void wxTextCtrl::Cut() void wxTextCtrl::Cut()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
#if (GTK_MINOR_VERSION == 1) #if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else #else
@@ -522,7 +522,7 @@ void wxTextCtrl::Cut()
void wxTextCtrl::Copy() void wxTextCtrl::Copy()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
#if (GTK_MINOR_VERSION == 1) #if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
#else #else
@@ -533,7 +533,7 @@ void wxTextCtrl::Copy()
void wxTextCtrl::Paste() void wxTextCtrl::Paste()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
#if (GTK_MINOR_VERSION == 1) #if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else #else
@@ -554,7 +554,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
event.SetEventObject(this); event.SetEventObject(this);
if (GetEventHandler()->ProcessEvent(event)) return; if (GetEventHandler()->ProcessEvent(event)) return;
} }
else if (key_event.KeyCode() == WXK_TAB) else if (key_event.KeyCode() == WXK_TAB)
{ {
wxNavigationKeyEvent event; wxNavigationKeyEvent event;
event.SetDirection( key_event.m_shiftDown ); event.SetDirection( key_event.m_shiftDown );
@@ -659,14 +659,14 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) ) void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
// doesn't work // doesn't work
} }
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) ) void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
// doesn't work // doesn't work
} }
@@ -675,9 +675,9 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
wxControl::SetBackgroundColour( colour ); wxControl::SetBackgroundColour( colour );
if (!m_backgroundColour.Ok()) return; if (!m_backgroundColour.Ok()) return;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
GdkWindow *window = GTK_TEXT(m_text)->text_area; GdkWindow *window = GTK_TEXT(m_text)->text_area;

View File

@@ -109,7 +109,7 @@ static char *GetIniFile(char *dest, const char *filename)
return dest; return dest;
} }
static void wxXMergeDatabases(void) static void wxXMergeDatabases()
{ {
XrmDatabase homeDB, serverDB, applicationDB; XrmDatabase homeDB, serverDB, applicationDB;
char filenamebuf[1024]; char filenamebuf[1024];
@@ -159,7 +159,7 @@ static void wxXMergeDatabases(void)
// called on application exit // called on application exit
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void wxFlushResources(void) void wxFlushResources()
{ {
char nameBuffer[512]; char nameBuffer[512];

View File

@@ -86,14 +86,14 @@
this is (in most cases) the only GTK widget the class manages. E.g. the this is (in most cases) the only GTK widget the class manages. E.g. the
wxStatitText class handles only a GtkLabel widget a pointer to which you wxStatitText class handles only a GtkLabel widget a pointer to which you
can find in m_widget (defined in wxWindow) can find in m_widget (defined in wxWindow)
When the class has a client area for drawing into and for containing children When the class has a client area for drawing into and for containing children
it has to handle the client area widget (of the type GtkMyFixed, defined in it has to handle the client area widget (of the type GtkMyFixed, defined in
win_gtk.c), but there could be any number of widgets, handled by a class win_gtk.c), but there could be any number of widgets, handled by a class
The common rule for all windows is only, that the widget that interacts with The common rule for all windows is only, that the widget that interacts with
the rest of GTK must be referenced in m_widget and all other widgets must be the rest of GTK must be referenced in m_widget and all other widgets must be
children of this widget on the GTK level. The top-most widget, which also children of this widget on the GTK level. The top-most widget, which also
represents the client area, must be in the m_wxwindow field and must be of represents the client area, must be in the m_wxwindow field and must be of
the type GtkMyFixed. the type GtkMyFixed.
As I said, the window classes that display a GTK native widget only have As I said, the window classes that display a GTK native widget only have
@@ -504,7 +504,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE; if (g_blockEventsOnScroll) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
/* /*
@@ -762,7 +762,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
float line_step = win->m_hAdjust->step_increment; float line_step = win->m_hAdjust->step_increment;
float page_step = win->m_hAdjust->page_increment; float page_step = win->m_hAdjust->page_increment;
if (win->m_isScrolling) if (win->m_isScrolling)
{ {
command = wxEVT_SCROLL_THUMBTRACK; command = wxEVT_SCROLL_THUMBTRACK;
@@ -839,12 +839,12 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
// "button_press_event" from scrollbar // "button_press_event" from scrollbar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
win->m_isScrolling = TRUE; win->m_isScrolling = TRUE;
g_blockEventsOnScroll = TRUE; g_blockEventsOnScroll = TRUE;
@@ -855,8 +855,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
// "button_release_event" from scrollbar // "button_release_event" from scrollbar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_release_callback( GtkRange *widget, static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
@@ -883,7 +883,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Callback for wxWindow. This very strange beast has to be used because // Callback for wxWindow. This very strange beast has to be used because
// C++ has no virtual methods in a constructor. We have to emulate a // C++ has no virtual methods in a constructor. We have to emulate a
// virtual function here as wxNotebook requires a different way to insert // virtual function here as wxNotebook requires a different way to insert
// a child in it. I had opted for creating a wxNotebookPage window class // a child in it. I had opted for creating a wxNotebookPage window class
// which would have made this superflouus (such in the MDI window system), // which would have made this superflouus (such in the MDI window system),
@@ -891,13 +891,13 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child ) static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{ {
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow), gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget), GTK_WIDGET(child->m_widget),
child->m_x, child->m_x,
child->m_y ); child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget), gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width, child->m_width,
child->m_height ); child->m_height );
} }
@@ -920,7 +920,7 @@ wxWindow::wxWindow()
m_wxwindow = (GtkWidget *) NULL; m_wxwindow = (GtkWidget *) NULL;
m_parent = (wxWindow *) NULL; m_parent = (wxWindow *) NULL;
m_children.DeleteContents( FALSE ); m_children.DeleteContents( FALSE );
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;
m_width = 0; m_width = 0;
@@ -929,46 +929,46 @@ wxWindow::wxWindow()
m_minHeight = -1; m_minHeight = -1;
m_maxWidth = -1; m_maxWidth = -1;
m_maxHeight = -1; m_maxHeight = -1;
m_retCode = 0; m_retCode = 0;
m_eventHandler = this; m_eventHandler = this;
m_windowValidator = (wxValidator *) NULL; m_windowValidator = (wxValidator *) NULL;
m_windowId = -1; m_windowId = -1;
m_cursor = (wxCursor *) NULL; m_cursor = (wxCursor *) NULL;
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
m_windowStyle = 0; m_windowStyle = 0;
m_windowName = "noname"; m_windowName = "noname";
m_constraints = (wxLayoutConstraints *) NULL; m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL; m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL; m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL; m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE; m_autoLayout = FALSE;
m_sizeSet = FALSE; m_sizeSet = FALSE;
m_hasVMT = FALSE; m_hasVMT = FALSE;
m_needParent = TRUE; m_needParent = TRUE;
m_hasScrolling = FALSE; m_hasScrolling = FALSE;
m_isScrolling = FALSE; m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment*) NULL; m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL; m_vAdjust = (GtkAdjustment*) NULL;
m_oldHorizontalPos = 0.0; m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0; m_oldVerticalPos = 0.0;
m_isShown = FALSE; m_isShown = FALSE;
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget*) NULL; m_dropTarget = (wxDropTarget*) NULL;
m_resizing = FALSE; m_resizing = FALSE;
m_scrollGC = (GdkGC*) NULL; m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL; m_widgetStyle = (GtkStyle*) NULL;
m_insertCallback = wxInsertChildInWindow; m_insertCallback = wxInsertChildInWindow;
m_clientObject = (wxClientData*) NULL; m_clientObject = (wxClientData*) NULL;
m_clientData = NULL; m_clientData = NULL;
} }
@@ -980,7 +980,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
m_insertCallback = wxInsertChildInWindow; m_insertCallback = wxInsertChildInWindow;
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
} }
bool wxWindow::Create( wxWindow *parent, wxWindowID id, bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
@@ -1058,7 +1058,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
// these handlers block mouse events to any window during scrolling // these handlers block mouse events to any window during scrolling
// such as motion events and prevent GTK and wxWindows from fighting // such as motion events and prevent GTK and wxWindows from fighting
// over where the slider should be // over where the slider should be
gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event", gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event",
(GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
@@ -1070,7 +1070,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event", gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
// these handers het notified when screen updates are required either when // these handers het notified when screen updates are required either when
// scrolling or when the window size (and therefore scrollbar configuration) // scrolling or when the window size (and therefore scrollbar configuration)
// has changed // has changed
@@ -1086,13 +1086,13 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this ); (GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
gtk_widget_show( m_wxwindow ); gtk_widget_show( m_wxwindow );
if (m_parent) m_parent->AddChild( this ); if (m_parent) m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this ); (m_parent->m_insertCallback)( m_parent, this );
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
@@ -1110,13 +1110,13 @@ wxWindow::~wxWindow()
DestroyChildren(); DestroyChildren();
if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
if (m_scrollGC) gdk_gc_unref( m_scrollGC ); if (m_scrollGC) gdk_gc_unref( m_scrollGC );
if (m_wxwindow) gtk_widget_destroy( m_wxwindow ); if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
if (m_widget) gtk_widget_destroy( m_widget ); if (m_widget) gtk_widget_destroy( m_widget );
if (m_cursor) delete m_cursor; if (m_cursor) delete m_cursor;
DeleteRelatedConstraints(); DeleteRelatedConstraints();
@@ -1147,7 +1147,7 @@ wxWindow::~wxWindow()
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator; if (m_windowValidator) delete m_windowValidator;
if (m_clientObject) delete m_clientObject; if (m_clientObject) delete m_clientObject;
} }
@@ -1157,21 +1157,21 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
{ {
if (m_needParent && (parent == NULL)) if (m_needParent && (parent == NULL))
wxFatalError( "Need complete parent.", name ); wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget*) NULL; m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
m_hasVMT = FALSE; m_hasVMT = FALSE;
m_parent = parent; m_parent = parent;
m_children.DeleteContents( FALSE ); m_children.DeleteContents( FALSE );
m_width = size.x; m_width = size.x;
if (m_width == -1) m_width = 20; if (m_width == -1) m_width = 20;
m_height = size.y; m_height = size.y;
if (m_height == -1) m_height = 20; if (m_height == -1) m_height = 20;
m_x = (int)pos.x; m_x = (int)pos.x;
m_y = (int)pos.y; m_y = (int)pos.y;
if (!m_needParent) // some reasonable defaults if (!m_needParent) // some reasonable defaults
{ {
if (m_x == -1) if (m_x == -1)
@@ -1185,49 +1185,49 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
if (m_y < 10) m_y = 10; if (m_y < 10) m_y = 10;
} }
} }
m_minWidth = -1; m_minWidth = -1;
m_minHeight = -1; m_minHeight = -1;
m_maxWidth = -1; m_maxWidth = -1;
m_maxHeight = -1; m_maxHeight = -1;
m_retCode = 0; m_retCode = 0;
m_eventHandler = this; m_eventHandler = this;
m_windowId = id == -1 ? wxNewId() : id; m_windowId = id == -1 ? wxNewId() : id;
m_sizeSet = FALSE; m_sizeSet = FALSE;
m_cursor = new wxCursor( wxCURSOR_ARROW ); m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE; // m_backgroundColour = wxWHITE;
// m_foregroundColour = wxBLACK; // m_foregroundColour = wxBLACK;
m_windowStyle = style; m_windowStyle = style;
m_windowName = name; m_windowName = name;
m_constraints = (wxLayoutConstraints *) NULL; m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL; m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL; m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL; m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE; m_autoLayout = FALSE;
m_hasScrolling = FALSE; m_hasScrolling = FALSE;
m_isScrolling = FALSE; m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment *) NULL; m_hAdjust = (GtkAdjustment *) NULL;
m_vAdjust = (GtkAdjustment *) NULL; m_vAdjust = (GtkAdjustment *) NULL;
m_oldHorizontalPos = 0.0; m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0; m_oldVerticalPos = 0.0;
m_isShown = FALSE; m_isShown = FALSE;
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget *) NULL; m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE; m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL; m_windowValidator = (wxValidator *) NULL;
m_scrollGC = (GdkGC*) NULL; m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL; m_widgetStyle = (GtkStyle*) NULL;
m_clientObject = (wxClientData*)NULL; m_clientObject = (wxClientData*)NULL;
m_clientData = NULL; m_clientData = NULL;
} }
@@ -1336,7 +1336,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags )
if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent()) if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
{ {
wxPoint pt(GetParent()->GetClientAreaOrigin()); wxPoint pt(GetParent()->GetClientAreaOrigin());
x += pt.x; x += pt.x;
y += pt.y; y += pt.y;
} }
} }
@@ -1345,7 +1345,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
if (m_resizing) return; // I don't like recursions if (m_resizing) return; // I don't like recursions
m_resizing = TRUE; m_resizing = TRUE;
@@ -1361,7 +1361,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
int old_width = m_width; int old_width = m_width;
int old_height = m_height; int old_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{ {
if (x != -1) m_x = x; if (x != -1) m_x = x;
@@ -1386,7 +1386,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
if (height == -1) m_height = 26; if (height == -1) m_height = 26;
} }
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
@@ -1394,11 +1394,11 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
wxPoint pt( m_parent->GetClientAreaOrigin() ); wxPoint pt( m_parent->GetClientAreaOrigin() );
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
if ((old_width != m_width) || (old_height != m_height)) if ((old_width != m_width) || (old_height != m_height))
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
@@ -1457,7 +1457,7 @@ void wxWindow::SetClientSize( int width, int height )
#ifdef NEW_GTK_SCROLL_CODE #ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child; GtkWidget *viewport = scroll_window->child;
#else #else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif #endif
@@ -1522,7 +1522,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
#ifdef NEW_GTK_SCROLL_CODE #ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child; GtkWidget *viewport = scroll_window->child;
#else #else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif #endif
@@ -1589,7 +1589,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
wxPoint pt(GetClientAreaOrigin()); wxPoint pt(GetClientAreaOrigin());
org_x += pt.x; org_x += pt.x;
org_y += pt.y; org_y += pt.y;
if (x) *x += org_x; if (x) *x += org_x;
if (y) *y += org_y; if (y) *y += org_y;
} }
@@ -1620,7 +1620,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
wxPoint pt(GetClientAreaOrigin()); wxPoint pt(GetClientAreaOrigin());
org_x -= pt.x; org_x -= pt.x;
org_y -= pt.y; org_y -= pt.y;
if (x) *x -= org_x; if (x) *x -= org_x;
if (y) *y -= org_y; if (y) *y -= org_y;
} }
@@ -1631,7 +1631,7 @@ void wxWindow::Centre( int direction )
int x = m_x; int x = m_x;
int y = m_y; int y = m_y;
if (m_parent) if (m_parent)
{ {
int p_w = 0; int p_w = 0;
@@ -1645,7 +1645,7 @@ void wxWindow::Centre( int direction )
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
} }
Move( x, y ); Move( x, y );
} }
@@ -1655,7 +1655,7 @@ void wxWindow::Fit()
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
wxNode *node = m_childrenFirst(); wxNode *node = m_children.First();
while ( node ) while ( node )
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
@@ -1803,25 +1803,20 @@ void wxWindow::AddChild( wxWindow *child )
m_children.Append( child ); m_children.Append( child );
} }
wxList& wxWindow::GetChildren() const
{
return m_children;
}
wxWindow *wxWindow::ReParent( wxWindow *newParent ) wxWindow *wxWindow::ReParent( wxWindow *newParent )
{ {
wxWindow *oldParent = GetParent(); wxWindow *oldParent = GetParent();
if (oldParent) oldParent->RemoveChild( this ); if (oldParent) oldParent->RemoveChild( this );
gtk_widget_unparent( m_widget ); gtk_widget_unparent( m_widget );
if (newParent) if (newParent)
{ {
newParent->AddChild( this ); newParent->AddChild( this );
(newParent->m_insertCallback)( newParent, this ); (newParent->m_insertCallback)( newParent, this );
} }
return oldParent; return oldParent;
} }
@@ -1855,7 +1850,7 @@ void wxWindow::Lower()
if (m_widget) gdk_window_lower( m_widget->window ); if (m_widget) gdk_window_lower( m_widget->window );
} }
wxEvtHandler *wxWindow::GetEventHandler() wxEvtHandler *wxWindow::GetEventHandler() const
{ {
return m_eventHandler; return m_eventHandler;
} }
@@ -1934,7 +1929,7 @@ void wxWindow::SetId( wxWindowID id )
m_windowId = id; m_windowId = id;
} }
wxWindowID wxWindow::GetId() wxWindowID wxWindow::GetId() const
{ {
return m_windowId; return m_windowId;
} }
@@ -1951,7 +1946,8 @@ void wxWindow::SetCursor( const wxCursor &cursor )
if (cursor.Ok()) if (cursor.Ok())
{ {
if (*((wxCursor*)&cursor) == m_cursor) return; if ( cursor == *m_cursor )
return;
*m_cursor = cursor; *m_cursor = cursor;
} }
else else
@@ -2054,13 +2050,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_backgroundColour == colour) return; if (m_backgroundColour == colour) return;
if (!m_backgroundColour.Ok()) if (!m_backgroundColour.Ok())
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return; if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
m_backgroundColour = colour; m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return; if (!m_backgroundColour.Ok()) return;
if (m_wxwindow) if (m_wxwindow)
{ {
GdkWindow *window = m_wxwindow->window; GdkWindow *window = m_wxwindow->window;
@@ -2068,7 +2064,7 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window ); gdk_window_clear( window );
} }
ApplyWidgetStyle(); ApplyWidgetStyle();
} }
@@ -2082,31 +2078,31 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_foregroundColour == colour) return; if (m_foregroundColour == colour) return;
m_foregroundColour = colour; m_foregroundColour = colour;
if (!m_foregroundColour.Ok()) return; if (!m_foregroundColour.Ok()) return;
ApplyWidgetStyle(); ApplyWidgetStyle();
} }
GtkStyle *wxWindow::GetWidgetStyle() GtkStyle *wxWindow::GetWidgetStyle()
{ {
if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
m_widgetStyle = m_widgetStyle =
gtk_style_copy( gtk_style_copy(
gtk_widget_get_style( m_widget ) ); gtk_widget_get_style( m_widget ) );
return m_widgetStyle; return m_widgetStyle;
} }
void wxWindow::SetWidgetStyle() void wxWindow::SetWidgetStyle()
{ {
GtkStyle *style = GetWidgetStyle(); GtkStyle *style = GetWidgetStyle();
gdk_font_unref( style->font ); gdk_font_unref( style->font );
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
if (m_foregroundColour.Ok()) if (m_foregroundColour.Ok())
{ {
m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
@@ -2114,7 +2110,7 @@ void wxWindow::SetWidgetStyle()
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
} }
if (m_backgroundColour.Ok()) if (m_backgroundColour.Ok())
{ {
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
@@ -2219,7 +2215,7 @@ bool wxWindow::PopupMenu( wxMenu *menu, int WXUNUSED(x), int WXUNUSED(y) )
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" ); wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
SetInvokingWindow( menu, this ); SetInvokingWindow( menu, this );
gtk_menu_popup( gtk_menu_popup(
GTK_MENU(menu->m_menu), GTK_MENU(menu->m_menu),
@@ -2274,13 +2270,8 @@ void wxWindow::SetFont( const wxFont &font )
m_font = font; m_font = font;
else else
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
ApplyWidgetStyle();
}
wxFont *wxWindow::GetFont() ApplyWidgetStyle();
{
return &m_font;
} }
void wxWindow::SetWindowStyleFlag( long flag ) void wxWindow::SetWindowStyleFlag( long flag )
@@ -2392,7 +2383,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" );
if (!m_wxwindow) return; if (!m_wxwindow) return;
m_hasScrolling = TRUE; m_hasScrolling = TRUE;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
@@ -2556,13 +2547,13 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
int d_y = 0; int d_y = 0;
if (dx > 0) d_x = dx; if (dx > 0) d_x = dx;
if (dy > 0) d_y = dy; if (dy > 0) d_y = dy;
if (!m_scrollGC) if (!m_scrollGC)
{ {
m_scrollGC = gdk_gc_new( m_wxwindow->window ); m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE ); gdk_gc_set_exposures( m_scrollGC, TRUE );
} }
gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y, gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
m_wxwindow->window, s_x, s_y, w, h ); m_wxwindow->window, s_x, s_y, w, h );
@@ -2795,7 +2786,7 @@ bool wxWindow::DoPhase(int phase)
{ {
noChanges = 0; noChanges = 0;
noFailures = 0; noFailures = 0;
wxNode *node = m_children.first(); wxNode *node = m_children.First();
while (node) while (node)
{ {
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Julian Smart // Copyright: (c) 1998 Robert Roebling, Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -213,8 +213,8 @@ bool wxApp::SendIdleEvents(void)
wxNode* node = wxTopLevelWindows.First(); wxNode* node = wxTopLevelWindows.First();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->Next();
} }
@@ -225,22 +225,22 @@ bool wxApp::SendIdleEvents( wxWindow* win )
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxIdleEvent event; wxIdleEvent event;
event.SetEventObject(win); event.SetEventObject(win);
win->ProcessEvent(event); win->ProcessEvent(event);
if (event.MoreRequested()) if (event.MoreRequested())
needMore = TRUE; needMore = TRUE;
wxNode* node = win->GetChildren()->First(); wxNode* node = win->GetChildren().First();
while (node) while (node)
{ {
wxWindow* win = (wxWindow*) node->Data(); wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win)) if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next(); node = node->Next();
} }
return needMore ; return needMore ;
} }

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__ #ifdef __GNUG__
@@ -24,7 +24,7 @@
IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
wxMask::wxMask(void) wxMask::wxMask()
{ {
m_bitmap = (GdkBitmap *) NULL; m_bitmap = (GdkBitmap *) NULL;
} }
@@ -41,7 +41,7 @@ wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) )
{ {
} }
wxMask::~wxMask(void) wxMask::~wxMask()
{ {
if (m_bitmap) gdk_bitmap_unref( m_bitmap ); if (m_bitmap) gdk_bitmap_unref( m_bitmap );
} }
@@ -50,7 +50,7 @@ GdkBitmap *wxMask::GetBitmap(void) const
{ {
return m_bitmap; return m_bitmap;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxBitmap // wxBitmap
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -60,7 +60,7 @@ class wxBitmapRefData: public wxObjectRefData
public: public:
wxBitmapRefData(void); wxBitmapRefData(void);
~wxBitmapRefData(void); ~wxBitmapRefData(void);
GdkPixmap *m_pixmap; GdkPixmap *m_pixmap;
GdkBitmap *m_bitmap; GdkBitmap *m_bitmap;
wxMask *m_mask; wxMask *m_mask;
@@ -70,7 +70,7 @@ public:
wxPalette *m_palette; wxPalette *m_palette;
}; };
wxBitmapRefData::wxBitmapRefData(void) wxBitmapRefData::wxBitmapRefData()
{ {
m_pixmap = (GdkPixmap *) NULL; m_pixmap = (GdkPixmap *) NULL;
m_bitmap = (GdkBitmap *) NULL; m_bitmap = (GdkBitmap *) NULL;
@@ -81,7 +81,7 @@ wxBitmapRefData::wxBitmapRefData(void)
m_palette = (wxPalette *) NULL; m_palette = (wxPalette *) NULL;
} }
wxBitmapRefData::~wxBitmapRefData(void) wxBitmapRefData::~wxBitmapRefData()
{ {
if (m_pixmap) gdk_pixmap_unref( m_pixmap ); if (m_pixmap) gdk_pixmap_unref( m_pixmap );
if (m_bitmap) gdk_bitmap_unref( m_bitmap ); if (m_bitmap) gdk_bitmap_unref( m_bitmap );
@@ -95,95 +95,88 @@ wxBitmapRefData::~wxBitmapRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap(void) wxBitmap::wxBitmap()
{ {
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( int width, int height, int depth ) wxBitmap::wxBitmap( int width, int height, int depth )
{ {
wxCHECK_RET( (width > 0) && (height > 0), "invalid bitmap size" ) wxCHECK_RET( (width > 0) && (height > 0), "invalid bitmap size" )
wxCHECK_RET( (depth > 0) || (depth == -1), "invalid bitmap depth" ) wxCHECK_RET( (depth > 0) || (depth == -1), "invalid bitmap depth" )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_mask = (wxMask *) NULL; M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth ); M_BMPDATA->m_pixmap = gdk_pixmap_new( parent, width, height, depth );
M_BMPDATA->m_width = width; M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height; M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const char **bits ) wxBitmap::wxBitmap( const char **bits )
{ {
wxCHECK_RET( bits != NULL, "invalid bitmap data" ) wxCHECK_RET( bits != NULL, "invalid bitmap data" )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
if (mask) if (mask)
{ {
M_BMPDATA->m_mask = new wxMask(); M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask; M_BMPDATA->m_mask->m_bitmap = mask;
} }
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ? M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( char **bits ) wxBitmap::wxBitmap( char **bits )
{ {
wxCHECK_RET( bits != NULL, "invalid bitmap data" ) wxCHECK_RET( bits != NULL, "invalid bitmap data" )
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
wxCHECK_RET( M_BMPDATA->m_pixmap, "couldn't create pixmap" ); wxCHECK_RET( M_BMPDATA->m_pixmap, "couldn't create pixmap" );
if (mask) if (mask)
{ {
M_BMPDATA->m_mask = new wxMask(); M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask; M_BMPDATA->m_mask->m_bitmap = mask;
} }
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ? M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const wxBitmap& bmp ) wxBitmap::wxBitmap( const wxBitmap& bmp )
{ {
Ref( bmp ); Ref( bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap( const wxBitmap* bmp )
{
if (bmp) Ref( *bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const wxString &filename, int type ) wxBitmap::wxBitmap( const wxString &filename, int type )
{ {
LoadFile( filename, type ); LoadFile( filename, type );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
@@ -192,44 +185,44 @@ wxBitmap::wxBitmap( const char bits[], int width, int height, int WXUNUSED(depth
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = (wxMask *) NULL; M_BMPDATA->m_mask = (wxMask *) NULL;
M_BMPDATA->m_bitmap = M_BMPDATA->m_bitmap =
gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height ); gdk_bitmap_create_from_data( (GdkWindow*) &gdk_root_parent, (gchar *) bits, width, height );
M_BMPDATA->m_width = width; M_BMPDATA->m_width = width;
M_BMPDATA->m_height = height; M_BMPDATA->m_height = height;
M_BMPDATA->m_bpp = 1; M_BMPDATA->m_bpp = 1;
wxCHECK_RET( M_BMPDATA->m_bitmap, "couldn't create bitmap" ); wxCHECK_RET( M_BMPDATA->m_bitmap, "couldn't create bitmap" );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::~wxBitmap(void) wxBitmap::~wxBitmap()
{ {
if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this); if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
} }
wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp ) wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
{ {
if (*this == bmp) return (*this); if (*this == bmp) return (*this);
Ref( bmp ); Ref( bmp );
return *this; return *this;
} }
bool wxBitmap::operator == ( const wxBitmap& bmp ) bool wxBitmap::operator == ( const wxBitmap& bmp )
{ {
return m_refData == bmp.m_refData; return m_refData == bmp.m_refData;
} }
bool wxBitmap::operator != ( const wxBitmap& bmp ) bool wxBitmap::operator != ( const wxBitmap& bmp )
{ {
return m_refData != bmp.m_refData; return m_refData != bmp.m_refData;
} }
bool wxBitmap::Ok(void) const bool wxBitmap::Ok(void) const
{ {
return (m_refData != NULL); return (m_refData != NULL);
} }
int wxBitmap::GetHeight(void) const int wxBitmap::GetHeight(void) const
{ {
wxCHECK_MSG( Ok(), -1, "invalid bitmap" ); wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
@@ -240,69 +233,69 @@ int wxBitmap::GetHeight(void) const
int wxBitmap::GetWidth(void) const int wxBitmap::GetWidth(void) const
{ {
wxCHECK_MSG( Ok(), -1, "invalid bitmap" ); wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
return M_BMPDATA->m_width; return M_BMPDATA->m_width;
} }
int wxBitmap::GetDepth(void) const int wxBitmap::GetDepth(void) const
{ {
wxCHECK_MSG( Ok(), -1, "invalid bitmap" ); wxCHECK_MSG( Ok(), -1, "invalid bitmap" );
return M_BMPDATA->m_bpp; return M_BMPDATA->m_bpp;
} }
wxMask *wxBitmap::GetMask(void) const wxMask *wxBitmap::GetMask(void) const
{ {
wxCHECK_MSG( Ok(), (wxMask *) NULL, "invalid bitmap" ); wxCHECK_MSG( Ok(), (wxMask *) NULL, "invalid bitmap" );
return M_BMPDATA->m_mask; return M_BMPDATA->m_mask;
} }
void wxBitmap::SetMask( wxMask *mask ) void wxBitmap::SetMask( wxMask *mask )
{ {
wxCHECK_RET( Ok(), "invalid bitmap" ); wxCHECK_RET( Ok(), "invalid bitmap" );
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask; if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
M_BMPDATA->m_mask = mask; M_BMPDATA->m_mask = mask;
} }
bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) ) bool wxBitmap::SaveFile( const wxString &name, int type, wxPalette *WXUNUSED(palette) )
{ {
wxCHECK_MSG( Ok(), FALSE, "invalid bitmap" ); wxCHECK_MSG( Ok(), FALSE, "invalid bitmap" );
if (type == wxBITMAP_TYPE_PNG) if (type == wxBITMAP_TYPE_PNG)
{ {
wxImage image( *this ); wxImage image( *this );
if (image.Ok()) return image.SaveFile( name, type ); if (image.Ok()) return image.SaveFile( name, type );
} }
return FALSE; return FALSE;
} }
bool wxBitmap::LoadFile( const wxString &name, int type ) bool wxBitmap::LoadFile( const wxString &name, int type )
{ {
UnRef(); UnRef();
if (!wxFileExists(name)) return FALSE; if (!wxFileExists(name)) return FALSE;
if (type == wxBITMAP_TYPE_XPM) if (type == wxBITMAP_TYPE_XPM)
{ {
m_refData = new wxBitmapRefData(); m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL; GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent; GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( parent, &mask, NULL, name ); M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm( parent, &mask, NULL, name );
if (mask) if (mask)
{ {
M_BMPDATA->m_mask = new wxMask(); M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask; M_BMPDATA->m_mask->m_bitmap = mask;
} }
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) ); gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth; M_BMPDATA->m_bpp = gdk_window_get_visual( parent )->depth;
} }
else if (type == wxBITMAP_TYPE_PNG) else if (type == wxBITMAP_TYPE_PNG)
{ {
@@ -316,16 +309,16 @@ bool wxBitmap::LoadFile( const wxString &name, int type )
image.LoadFile( name, type ); image.LoadFile( name, type );
if (image.Ok()) *this = image.ConvertToBitmap(); if (image.Ok()) *this = image.ConvertToBitmap();
} }
else else
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
wxPalette *wxBitmap::GetPalette(void) const wxPalette *wxBitmap::GetPalette(void) const
{ {
if (!Ok()) return (wxPalette *) NULL; if (!Ok()) return (wxPalette *) NULL;
return M_BMPDATA->m_palette; return M_BMPDATA->m_palette;
} }
@@ -360,17 +353,17 @@ void wxBitmap::SetPixmap( GdkPixmap *pixmap )
GdkPixmap *wxBitmap::GetPixmap(void) const GdkPixmap *wxBitmap::GetPixmap(void) const
{ {
wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, "invalid bitmap" ); wxCHECK_MSG( Ok(), (GdkPixmap *) NULL, "invalid bitmap" );
return M_BMPDATA->m_pixmap; return M_BMPDATA->m_pixmap;
} }
GdkBitmap *wxBitmap::GetBitmap(void) const GdkBitmap *wxBitmap::GetBitmap(void) const
{ {
wxCHECK_MSG( Ok(), (GdkBitmap *) NULL, "invalid bitmap" ); wxCHECK_MSG( Ok(), (GdkBitmap *) NULL, "invalid bitmap" );
return M_BMPDATA->m_bitmap; return M_BMPDATA->m_bitmap;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxImage // wxImage
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -383,46 +376,46 @@ wxBitmap wxImage::ConvertToBitmap() const
int width = GetWidth(); int width = GetWidth();
int height = GetHeight(); int height = GetHeight();
bitmap.SetHeight( height ); bitmap.SetHeight( height );
bitmap.SetWidth( width ); bitmap.SetWidth( width );
// Create picture // Create picture
GdkImage *data_image = GdkImage *data_image =
gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(), width, height ); gdk_image_new( GDK_IMAGE_FASTEST, gdk_visual_get_system(), width, height );
bitmap.SetPixmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, -1 ) ); bitmap.SetPixmap( gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, -1 ) );
// Create mask // Create mask
GdkImage *mask_image = (GdkImage*) NULL; GdkImage *mask_image = (GdkImage*) NULL;
if (HasMask()) if (HasMask())
{ {
unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height ); unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height ); mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height );
wxMask *mask = new wxMask(); wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 ); mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 );
bitmap.SetMask( mask ); bitmap.SetMask( mask );
} }
// Retrieve depth // Retrieve depth
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() ); GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent ); if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
int bpp = visual->depth; int bpp = visual->depth;
if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15; if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
if (bpp < 8) bpp = 8; if (bpp < 8) bpp = 8;
// Render // Render
enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR }; enum byte_order { RGB, RBG, BRG, BGR, GRB, GBR };
byte_order b_o = RGB; byte_order b_o = RGB;
if (bpp >= 24) if (bpp >= 24)
{ {
GdkVisual *visual = gdk_visual_get_system(); GdkVisual *visual = gdk_visual_get_system();
@@ -433,13 +426,13 @@ wxBitmap wxImage::ConvertToBitmap() const
else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask)) b_o = GRB; else if ((visual->green_mask > visual->red_mask) && (visual->red_mask > visual->blue_mask)) b_o = GRB;
else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask)) b_o = GBR; else if ((visual->green_mask > visual->blue_mask) && (visual->blue_mask > visual->red_mask)) b_o = GBR;
} }
int r_mask = GetMaskRed(); int r_mask = GetMaskRed();
int g_mask = GetMaskGreen(); int g_mask = GetMaskGreen();
int b_mask = GetMaskBlue(); int b_mask = GetMaskBlue();
unsigned char* data = GetData(); unsigned char* data = GetData();
int index = 0; int index = 0;
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
{ {
@@ -451,7 +444,7 @@ wxBitmap wxImage::ConvertToBitmap() const
index++; index++;
int b = data[index]; int b = data[index];
index++; index++;
if (HasMask()) if (HasMask())
{ {
if ((r == r_mask) && (b == b_mask) && (g == g_mask)) if ((r == r_mask) && (b == b_mask) && (g == g_mask))
@@ -459,7 +452,7 @@ wxBitmap wxImage::ConvertToBitmap() const
else else
gdk_image_put_pixel( mask_image, x, y, 0 ); gdk_image_put_pixel( mask_image, x, y, 0 );
} }
switch (bpp) switch (bpp)
{ {
case 8: case 8:
@@ -477,9 +470,9 @@ wxBitmap wxImage::ConvertToBitmap() const
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff); int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; } if (sum < max) { index = i; max = sum; }
} }
gdk_image_put_pixel( data_image, x, y, index ); gdk_image_put_pixel( data_image, x, y, index );
break; break;
} }
case 15: case 15:
@@ -513,68 +506,68 @@ wxBitmap wxImage::ConvertToBitmap() const
} }
} // for } // for
} // for } // for
// Blit picture // Blit picture
GdkGC *data_gc = gdk_gc_new( bitmap.GetPixmap() ); GdkGC *data_gc = gdk_gc_new( bitmap.GetPixmap() );
gdk_draw_image( bitmap.GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height ); gdk_draw_image( bitmap.GetPixmap(), data_gc, data_image, 0, 0, 0, 0, width, height );
gdk_image_destroy( data_image ); gdk_image_destroy( data_image );
gdk_gc_unref( data_gc ); gdk_gc_unref( data_gc );
// Blit mask // Blit mask
if (HasMask()) if (HasMask())
{ {
GdkGC *mask_gc = gdk_gc_new( bitmap.GetMask()->GetBitmap() ); GdkGC *mask_gc = gdk_gc_new( bitmap.GetMask()->GetBitmap() );
gdk_draw_image( bitmap.GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height ); gdk_draw_image( bitmap.GetMask()->GetBitmap(), mask_gc, mask_image, 0, 0, 0, 0, width, height );
gdk_image_destroy( mask_image ); gdk_image_destroy( mask_image );
gdk_gc_unref( mask_gc ); gdk_gc_unref( mask_gc );
} }
return bitmap; return bitmap;
} }
wxImage::wxImage( const wxBitmap &bitmap ) wxImage::wxImage( const wxBitmap &bitmap )
{ {
wxCHECK_RET( bitmap.Ok(), "invalid bitmap" ); wxCHECK_RET( bitmap.Ok(), "invalid bitmap" );
GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(), GdkImage *gdk_image = gdk_image_get( bitmap.GetPixmap(),
0, 0, 0, 0,
bitmap.GetWidth(), bitmap.GetHeight() ); bitmap.GetWidth(), bitmap.GetHeight() );
wxCHECK_RET( gdk_image, "couldn't create image" ); wxCHECK_RET( gdk_image, "couldn't create image" );
Create( bitmap.GetWidth(), bitmap.GetHeight() ); Create( bitmap.GetWidth(), bitmap.GetHeight() );
char unsigned *data = GetData(); char unsigned *data = GetData();
if (!data) if (!data)
{ {
gdk_image_destroy( gdk_image ); gdk_image_destroy( gdk_image );
wxFAIL_MSG( "couldn't create image" ); wxFAIL_MSG( "couldn't create image" );
return; return;
} }
GdkImage *gdk_image_mask = (GdkImage*) NULL; GdkImage *gdk_image_mask = (GdkImage*) NULL;
if (bitmap.GetMask()) if (bitmap.GetMask())
{ {
gdk_image_mask = gdk_image_get( bitmap.GetMask()->GetBitmap(), gdk_image_mask = gdk_image_get( bitmap.GetMask()->GetBitmap(),
0, 0, 0, 0,
bitmap.GetWidth(), bitmap.GetHeight() ); bitmap.GetWidth(), bitmap.GetHeight() );
SetMaskColour( 16, 16, 16 ); // anything unlikely and dividable SetMaskColour( 16, 16, 16 ); // anything unlikely and dividable
} }
GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() ); GdkVisual *visual = gdk_window_get_visual( bitmap.GetPixmap() );
if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent ); if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
int bpp = visual->depth; int bpp = visual->depth;
if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15; if ((bpp == 16) && (visual->red_mask != 0xf800)) bpp = 15;
GdkColormap *cmap = gtk_widget_get_default_colormap(); GdkColormap *cmap = gtk_widget_get_default_colormap();
long pos = 0; long pos = 0;
for (int j = 0; j < bitmap.GetHeight(); j++) for (int j = 0; j < bitmap.GetHeight(); j++)
{ {
@@ -602,7 +595,7 @@ wxImage::wxImage( const wxBitmap &bitmap )
data[pos+1] = (pixel >> 8) & 0xff; data[pos+1] = (pixel >> 8) & 0xff;
data[pos+2] = pixel & 0xff; data[pos+2] = pixel & 0xff;
} }
if (gdk_image_mask) if (gdk_image_mask)
{ {
int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j ); int mask_pixel = gdk_image_get_pixel( gdk_image_mask, i, j );
@@ -613,11 +606,11 @@ wxImage::wxImage( const wxBitmap &bitmap )
data[pos+2] = 16; data[pos+2] = 16;
} }
} }
pos += 3; pos += 3;
} }
} }
gdk_image_destroy( gdk_image ); gdk_image_destroy( gdk_image );
if (gdk_image_mask) gdk_image_destroy( gdk_image_mask ); if (gdk_image_mask) gdk_image_destroy( gdk_image_mask );
} }

View File

@@ -20,16 +20,16 @@
class wxBrushRefData: public wxObjectRefData class wxBrushRefData: public wxObjectRefData
{ {
public: public:
wxBrushRefData(void); wxBrushRefData();
wxBrushRefData( const wxBrushRefData& data ); wxBrushRefData( const wxBrushRefData& data );
int m_style; int m_style;
wxBitmap m_stipple; wxBitmap m_stipple;
wxColour m_colour; wxColour m_colour;
}; };
wxBrushRefData::wxBrushRefData(void) wxBrushRefData::wxBrushRefData()
{ {
m_style = 0; m_style = 0;
} }
@@ -47,7 +47,7 @@ wxBrushRefData::wxBrushRefData( const wxBrushRefData& data )
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
wxBrush::wxBrush(void) wxBrush::wxBrush()
{ {
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
@@ -57,7 +57,7 @@ wxBrush::wxBrush( const wxColour &colour, int style )
m_refData = new wxBrushRefData(); m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style; M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour; M_BRUSHDATA->m_colour = colour;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
@@ -67,52 +67,45 @@ wxBrush::wxBrush( const wxBitmap &stippleBitmap )
M_BRUSHDATA->m_style = wxSTIPPLE; M_BRUSHDATA->m_style = wxSTIPPLE;
M_BRUSHDATA->m_colour = *wxBLACK; M_BRUSHDATA->m_colour = *wxBLACK;
M_BRUSHDATA->m_stipple = stippleBitmap; M_BRUSHDATA->m_stipple = stippleBitmap;
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBrush &brush ) wxBrush::wxBrush( const wxBrush &brush )
{ {
Ref( brush ); Ref( brush );
if (wxTheBrushList) wxTheBrushList->AddBrush( this ); if (wxTheBrushList) wxTheBrushList->AddBrush( this );
} }
wxBrush::wxBrush( const wxBrush *brush ) wxBrush::~wxBrush()
{
if (brush) Ref( *brush );
if (wxTheBrushList) wxTheBrushList->Append( this );
}
wxBrush::~wxBrush(void)
{ {
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this ); if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
} }
wxBrush& wxBrush::operator = ( const wxBrush& brush ) wxBrush& wxBrush::operator = ( const wxBrush& brush )
{ {
if (*this == brush) return (*this); if (*this == brush) return (*this);
Ref( brush ); Ref( brush );
return *this; return *this;
} }
bool wxBrush::operator == ( const wxBrush& brush ) bool wxBrush::operator == ( const wxBrush& brush )
{ {
return m_refData == brush.m_refData; return m_refData == brush.m_refData;
} }
bool wxBrush::operator != ( const wxBrush& brush ) bool wxBrush::operator != ( const wxBrush& brush )
{ {
return m_refData != brush.m_refData; return m_refData != brush.m_refData;
} }
bool wxBrush::Ok(void) const bool wxBrush::Ok() const
{ {
return ((m_refData) && M_BRUSHDATA->m_colour.Ok()); return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
} }
int wxBrush::GetStyle(void) const int wxBrush::GetStyle() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
@@ -123,25 +116,25 @@ int wxBrush::GetStyle(void) const
return M_BRUSHDATA->m_style; return M_BRUSHDATA->m_style;
} }
wxColour &wxBrush::GetColour(void) const wxColour &wxBrush::GetColour() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( "invalid brush" ); wxFAIL_MSG( "invalid brush" );
return wxNullColour; return wxNullColour;
} }
return M_BRUSHDATA->m_colour; return M_BRUSHDATA->m_colour;
} }
wxBitmap *wxBrush::GetStipple(void) const wxBitmap *wxBrush::GetStipple() const
{ {
if (m_refData == NULL) if (m_refData == NULL)
{ {
wxFAIL_MSG( "invalid brush" ); wxFAIL_MSG( "invalid brush" );
return &wxNullBitmap; return &wxNullBitmap;
} }
return &M_BRUSHDATA->m_stipple; return &M_BRUSHDATA->m_stipple;
} }
@@ -169,7 +162,7 @@ void wxBrush::SetStipple( const wxBitmap& stipple )
M_BRUSHDATA->m_stipple = stipple; M_BRUSHDATA->m_stipple = stipple;
} }
void wxBrush::Unshare(void) void wxBrush::Unshare()
{ {
if (!m_refData) if (!m_refData)
{ {

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -23,15 +23,15 @@
class wxColourRefData: public wxObjectRefData class wxColourRefData: public wxObjectRefData
{ {
public: public:
wxColourRefData(); wxColourRefData();
~wxColourRefData(); ~wxColourRefData();
void FreeColour(); void FreeColour();
GdkColor m_color; GdkColor m_color;
GdkColormap *m_colormap; GdkColormap *m_colormap;
bool m_hasPixel; bool m_hasPixel;
friend wxColour; friend wxColour;
}; };
@@ -75,17 +75,17 @@ wxColour::wxColour( unsigned char red, unsigned char green, unsigned char blue )
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT; M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0; M_COLDATA->m_color.pixel = 0;
} }
void wxColour::InitFromName( const wxString &colourName ) void wxColour::InitFromName( const wxString &colourName )
{ {
wxNode *node = (wxNode *) NULL; wxNode *node = (wxNode *) NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) ) if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{ {
wxColour *col = (wxColour*)node->Data(); wxColour *col = (wxColour*)node->Data();
UnRef(); UnRef();
if (col) Ref( *col ); if (col) Ref( *col );
} }
else else
{ {
m_refData = new wxColourRefData(); m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color )) if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
@@ -98,34 +98,29 @@ void wxColour::InitFromName( const wxString &colourName )
} }
wxColour::wxColour( const wxColour& col ) wxColour::wxColour( const wxColour& col )
{ {
Ref( col ); Ref( col );
}
wxColour::wxColour( const wxColour* col )
{
if (col) Ref( *col );
} }
wxColour::~wxColour() wxColour::~wxColour()
{ {
} }
wxColour& wxColour::operator = ( const wxColour& col ) wxColour& wxColour::operator = ( const wxColour& col )
{ {
if (*this == col) return (*this); if (*this == col) return (*this);
Ref( col ); Ref( col );
return *this; return *this;
} }
bool wxColour::operator == ( const wxColour& col ) bool wxColour::operator == ( const wxColour& col )
{ {
return m_refData == col.m_refData; return m_refData == col.m_refData;
} }
bool wxColour::operator != ( const wxColour& col) bool wxColour::operator != ( const wxColour& col)
{ {
return m_refData != col.m_refData; return m_refData != col.m_refData;
} }
void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue ) void wxColour::Set( unsigned char red, unsigned char green, unsigned char blue )
@@ -145,7 +140,7 @@ unsigned char wxColour::Red() const
wxFAIL_MSG( "invalid colour" ); wxFAIL_MSG( "invalid colour" );
return 0; return 0;
} }
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT); return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
} }
@@ -156,7 +151,7 @@ unsigned char wxColour::Green() const
wxFAIL_MSG( "invalid colour" ); wxFAIL_MSG( "invalid colour" );
return 0; return 0;
} }
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT); return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
} }
@@ -167,7 +162,7 @@ unsigned char wxColour::Blue() const
wxFAIL_MSG( "invalid colour" ); wxFAIL_MSG( "invalid colour" );
return 0; return 0;
} }
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT); return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
} }
@@ -179,10 +174,10 @@ bool wxColour::Ok() const
void wxColour::CalcPixel( GdkColormap *cmap ) void wxColour::CalcPixel( GdkColormap *cmap )
{ {
if (!Ok()) return; if (!Ok()) return;
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return; if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour(); M_COLDATA->FreeColour();
GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap; GdkColormapPrivate *private_colormap = (GdkColormapPrivate*) cmap;
if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) || if ((private_colormap->visual->type == GDK_VISUAL_GRAYSCALE) ||
(private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR)) (private_colormap->visual->type == GDK_VISUAL_PSEUDO_COLOR))
@@ -199,7 +194,7 @@ void wxColour::CalcPixel( GdkColormap *cmap )
int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff); int sum = ABS (rdiff) + ABS (gdiff) + ABS (bdiff);
if (sum < max) { index = i; max = sum; } if (sum < max) { index = i; max = sum; }
} }
M_COLDATA->m_hasPixel = TRUE; M_COLDATA->m_hasPixel = TRUE;
M_COLDATA->m_color.pixel = index; M_COLDATA->m_color.pixel = index;
} }
@@ -207,21 +202,21 @@ void wxColour::CalcPixel( GdkColormap *cmap )
{ {
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color ); M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
} }
M_COLDATA->m_colormap = cmap; M_COLDATA->m_colormap = cmap;
} }
int wxColour::GetPixel() const int wxColour::GetPixel() const
{ {
if (!Ok()) return 0; if (!Ok()) return 0;
return M_COLDATA->m_color.pixel; return M_COLDATA->m_color.pixel;
} }
GdkColor *wxColour::GetColor() const GdkColor *wxColour::GetColor() const
{ {
if (!Ok()) return (GdkColor *) NULL; if (!Ok()) return (GdkColor *) NULL;
return &M_COLDATA->m_color; return &M_COLDATA->m_color;
} }

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -21,19 +21,19 @@
class wxCursorRefData: public wxObjectRefData class wxCursorRefData: public wxObjectRefData
{ {
public: public:
wxCursorRefData(void); wxCursorRefData();
~wxCursorRefData(void); ~wxCursorRefData();
GdkCursor *m_cursor; GdkCursor *m_cursor;
}; };
wxCursorRefData::wxCursorRefData(void) wxCursorRefData::wxCursorRefData()
{ {
m_cursor = (GdkCursor *) NULL; m_cursor = (GdkCursor *) NULL;
} }
wxCursorRefData::~wxCursorRefData(void) wxCursorRefData::~wxCursorRefData()
{ {
if (m_cursor) gdk_cursor_destroy( m_cursor ); if (m_cursor) gdk_cursor_destroy( m_cursor );
} }
@@ -44,14 +44,14 @@ wxCursorRefData::~wxCursorRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
wxCursor::wxCursor(void) wxCursor::wxCursor()
{ {
} }
wxCursor::wxCursor( int cursorId ) wxCursor::wxCursor( int cursorId )
{ {
m_refData = new wxCursorRefData(); m_refData = new wxCursorRefData();
GdkCursorType gdk_cur = GDK_LEFT_PTR; GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId) switch (cursorId)
{ {
@@ -67,12 +67,12 @@ wxCursor::wxCursor( int cursorId )
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break; case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break; case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
} }
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur ); M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
/* /*
do that yourself do that yourself
wxCURSOR_BULLSEYE, wxCURSOR_BULLSEYE,
wxCURSOR_CHAR, wxCURSOR_CHAR,
wxCURSOR_LEFT_BUTTON, wxCURSOR_LEFT_BUTTON,
@@ -95,7 +95,7 @@ wxCursor::wxCursor( int cursorId )
wxCURSOR_BASED_ARROW_UP, wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN wxCURSOR_BASED_ARROW_DOWN
*/ */
} }
wxCursor::wxCursor( const wxCursor &cursor ) wxCursor::wxCursor( const wxCursor &cursor )
@@ -103,39 +103,33 @@ wxCursor::wxCursor( const wxCursor &cursor )
Ref( cursor ); Ref( cursor );
} }
wxCursor::wxCursor( const wxCursor *cursor ) wxCursor::~wxCursor()
{
UnRef();
if (cursor) Ref( *cursor );
}
wxCursor::~wxCursor(void)
{ {
} }
wxCursor& wxCursor::operator = ( const wxCursor& cursor ) wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{ {
if (*this == cursor) return (*this); if (*this == cursor) return (*this);
Ref( cursor ); Ref( cursor );
return *this; return *this;
} }
bool wxCursor::operator == ( const wxCursor& cursor ) bool wxCursor::operator == ( const wxCursor& cursor ) const
{ {
return m_refData == cursor.m_refData; return m_refData == cursor.m_refData;
} }
bool wxCursor::operator != ( const wxCursor& cursor ) bool wxCursor::operator != ( const wxCursor& cursor ) const
{ {
return m_refData != cursor.m_refData; return m_refData != cursor.m_refData;
} }
bool wxCursor::Ok(void) const bool wxCursor::Ok() const
{ {
return (m_refData != NULL); return (m_refData != NULL);
} }
GdkCursor *wxCursor::GetCursor(void) const GdkCursor *wxCursor::GetCursor() const
{ {
return M_CURSORDATA->m_cursor; return M_CURSORDATA->m_cursor;
} }
@@ -146,7 +140,7 @@ GdkCursor *wxCursor::GetCursor(void) const
bool g_isBusy = FALSE; bool g_isBusy = FALSE;
void wxEndBusyCursor(void) void wxEndBusyCursor()
{ {
g_isBusy = FALSE; g_isBusy = FALSE;
} }
@@ -156,7 +150,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
g_isBusy = TRUE; g_isBusy = TRUE;
} }
bool wxIsBusy(void) bool wxIsBusy()
{ {
return g_isBusy; return g_isBusy;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -42,14 +42,14 @@ extern wxList wxPendingDelete;
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win ) static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{ {
if (!win->HasVMT()) return; if (!win->HasVMT()) return;
/* /*
printf( "OnFrameResize from " ); printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() ); printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" ); printf( ".\n" );
*/ */
if ((win->m_width != alloc->width) || (win->m_height != alloc->height)) if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{ {
win->m_sizeSet = FALSE; win->m_sizeSet = FALSE;
@@ -83,10 +83,10 @@ static gint gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WX
static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win ) static gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
{ {
if (!win->HasVMT()) return FALSE; if (!win->HasVMT()) return FALSE;
win->m_x = event->x; win->m_x = event->x;
win->m_y = event->y; win->m_y = event->y;
return FALSE; return FALSE;
} }
@@ -130,7 +130,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
long style, const wxString &name ) long style, const wxString &name )
{ {
wxTopLevelWindows.Append( this ); wxTopLevelWindows.Append( this );
m_needParent = FALSE; m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
@@ -139,9 +139,9 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; GtkWindowType win_type = GTK_WINDOW_TOPLEVEL;
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
m_widget = gtk_window_new( win_type ); m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1)) if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1)) if ((pos.x != -1) && (pos.y != -1))
@@ -166,11 +166,11 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event", gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
if (m_parent) m_parent->AddChild( this ); if (m_parent) m_parent->AddChild( this );
PostCreation(); PostCreation();
return TRUE; return TRUE;
} }
@@ -187,17 +187,17 @@ wxFrame::~wxFrame()
bool wxFrame::Show( bool show ) bool wxFrame::Show( bool show )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (show && !m_sizeSet) if (show && !m_sizeSet)
{ {
// by calling GtkOnSize here, we don't have to call // by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail // either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate // much ugly flicker nor from within the size_allocate
// handler, because GTK 1.1.X forbids that. // handler, because GTK 1.1.X forbids that.
GtkOnSize( m_x, m_y, m_width, m_height ); GtkOnSize( m_x, m_y, m_width, m_height );
} }
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
@@ -209,7 +209,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent &event )
bool wxFrame::Destroy() bool wxFrame::Destroy()
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this); if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
return TRUE; return TRUE;
@@ -236,7 +236,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags ) void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), "invalid window" );
// Don't do anything for children of wxMDIChildFrame // Don't do anything for children of wxMDIChildFrame
if (!m_wxwindow) return; if (!m_wxwindow) return;
@@ -247,7 +247,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
int old_y = m_y; int old_y = m_y;
int old_width = m_width; int old_width = m_width;
int old_height = m_height; int old_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{ {
if (x != -1) m_x = x; if (x != -1) m_x = x;
@@ -272,7 +272,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
if (height == -1) m_height = 26; if (height == -1) m_height = 26;
} }
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
@@ -280,15 +280,15 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
if ((m_x != -1) || (m_y != -1)) if ((m_x != -1) || (m_y != -1))
{ {
if ((m_x != old_x) || (m_y != old_y)) if ((m_x != old_x) || (m_y != old_y))
gtk_widget_set_uposition( m_widget, m_x, m_y ); gtk_widget_set_uposition( m_widget, m_x, m_y );
} }
if ((m_width != old_width) || (m_height != old_height)) if ((m_width != old_width) || (m_height != old_height))
{ {
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
} }
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
@@ -304,20 +304,20 @@ void wxFrame::SetSize( int width, int height )
void wxFrame::Centre( int direction ) void wxFrame::Centre( int direction )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int x = 0; int x = 0;
int y = 0; int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y ); Move( x, y );
} }
void wxFrame::GetClientSize( int *width, int *height ) const void wxFrame::GetClientSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxWindow::GetClientSize( width, height ); wxWindow::GetClientSize( width, height );
if (height) if (height)
{ {
@@ -340,7 +340,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const
void wxFrame::SetClientSize( int const width, int const height ) void wxFrame::SetClientSize( int const width, int const height )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int h = height; int h = height;
if (m_frameMenuBar) h += wxMENU_HEIGHT; if (m_frameMenuBar) h += wxMENU_HEIGHT;
if (m_frameStatusBar) h += wxSTATUS_HEIGHT; if (m_frameStatusBar) h += wxSTATUS_HEIGHT;
@@ -361,35 +361,35 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_resizing) return; if (m_resizing) return;
m_resizing = TRUE; m_resizing = TRUE;
if (!m_wxwindow) return; if (!m_wxwindow) return;
m_width = width; m_width = width;
m_height = height; m_height = height;
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
// this emulates the new wxMSW behaviour of placing all // this emulates the new wxMSW behaviour of placing all
// frame-subwindows (menu, toolbar..) on one native window // frame-subwindows (menu, toolbar..) on one native window
// OK, this hurts in the eye, but I don't want to call SetSize() // OK, this hurts in the eye, but I don't want to call SetSize()
// because I don't want to call any non-native functions here. // because I don't want to call any non-native functions here.
if (m_frameMenuBar) if (m_frameMenuBar)
{ {
int xx = m_miniEdge; int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle; int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge; int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT; int hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx; m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy; m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww; m_frameMenuBar->m_width = ww;
m_frameMenuBar->m_height = hh; m_frameMenuBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
} }
@@ -397,42 +397,42 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if (m_frameToolBar) if (m_frameToolBar)
{ {
int xx = m_miniEdge; int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle; int yy = m_miniEdge + m_miniTitle;
if (m_frameMenuBar) yy += wxMENU_HEIGHT; if (m_frameMenuBar) yy += wxMENU_HEIGHT;
int ww = m_width - 2*m_miniEdge; int ww = m_width - 2*m_miniEdge;
int hh = m_frameToolBar->m_height; int hh = m_frameToolBar->m_height;
m_frameToolBar->m_x = xx; m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy; m_frameToolBar->m_y = yy;
m_frameToolBar->m_height = hh; m_frameToolBar->m_height = hh;
m_frameToolBar->m_width = ww; m_frameToolBar->m_width = ww;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
} }
if (m_frameStatusBar) if (m_frameStatusBar)
{ {
int xx = 0 + m_miniEdge; int xx = 0 + m_miniEdge;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge; int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
int ww = m_width - 2*m_miniEdge; int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT; int hh = wxSTATUS_HEIGHT;
m_frameStatusBar->m_x = xx; m_frameStatusBar->m_x = xx;
m_frameStatusBar->m_y = yy; m_frameStatusBar->m_y = yy;
m_frameStatusBar->m_width = ww; m_frameStatusBar->m_width = ww;
m_frameStatusBar->m_height = hh; m_frameStatusBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh ); gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }
@@ -440,23 +440,23 @@ void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{ {
if (!m_sizeSet) if (!m_sizeSet)
GtkOnSize( m_x, m_y, m_width, m_height ); GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates(); DoMenuUpdates();
} }
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (GetAutoLayout()) if (GetAutoLayout())
{ {
Layout(); Layout();
} }
else else
{ {
// no child: go out ! // no child: go out !
if (!GetChildren().First()) return; if (!GetChildren().First()) return;
// do we have exactly one child? // do we have exactly one child?
wxWindow *child = (wxWindow *) NULL; wxWindow *child = (wxWindow *) NULL;
for(wxNode *node = GetChildren().First(); node; node = node->Next()) for(wxNode *node = GetChildren().First(); node; node = node->Next())
@@ -470,7 +470,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
#endif #endif
) )
{ {
// it's the second one: do nothing // it's the second one: do nothing
if (child) return; if (child) return;
child = win; child = win;
} }
@@ -500,9 +500,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" ); wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
m_frameMenuBar = menuBar; m_frameMenuBar = menuBar;
if (m_frameMenuBar) if (m_frameMenuBar)
{ {
wxNode *node = m_frameMenuBar->m_menus.First(); wxNode *node = m_frameMenuBar->m_menus.First();
@@ -512,7 +512,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
SetInvokingWindow( menu, this ); SetInvokingWindow( menu, this );
node = node->Next(); node = node->Next();
} }
if (m_frameMenuBar->m_parent != this) if (m_frameMenuBar->m_parent != this)
{ {
m_frameMenuBar->m_parent = this; m_frameMenuBar->m_parent = this;
@@ -520,11 +520,11 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y ); m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
} }
} }
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
} }
wxMenuBar *wxFrame::GetMenuBar(void) const wxMenuBar *wxFrame::GetMenuBar() const
{ {
return m_frameMenuBar; return m_frameMenuBar;
} }
@@ -532,15 +532,15 @@ wxMenuBar *wxFrame::GetMenuBar(void) const
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" ); wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
m_frameToolBar = OnCreateToolBar( style, id, name ); m_frameToolBar = OnCreateToolBar( style, id, name );
GetChildren().DeleteObject( m_frameToolBar ); GetChildren().DeleteObject( m_frameToolBar );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
return m_frameToolBar; return m_frameToolBar;
} }
@@ -549,33 +549,33 @@ wxToolBar* wxFrame::OnCreateToolBar( long style, wxWindowID id, const wxString&
return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name ); return new wxToolBar( this, id, wxDefaultPosition, wxDefaultSize, style, name );
} }
wxToolBar *wxFrame::GetToolBar(void) const wxToolBar *wxFrame::GetToolBar() const
{ {
return m_frameToolBar; return m_frameToolBar;
} }
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" ); wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
m_frameStatusBar = OnCreateStatusBar( number, style, id, name ); m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height ); if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
return m_frameStatusBar; return m_frameStatusBar;
} }
wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name ) wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{ {
wxStatusBar *statusBar = (wxStatusBar *) NULL; wxStatusBar *statusBar = (wxStatusBar *) NULL;
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name); statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
// Set the height according to the font and the border size // Set the height according to the font and the border size
wxClientDC dc(statusBar); wxClientDC dc(statusBar);
dc.SetFont( *statusBar->GetFont() ); dc.SetFont( statusBar->GetFont() );
long x, y; long x, y;
dc.GetTextExtent( "X", &x, &y ); dc.GetTextExtent( "X", &x, &y );
@@ -591,7 +591,7 @@ wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id,
void wxFrame::SetStatusText(const wxString& text, int number) void wxFrame::SetStatusText(const wxString& text, int number)
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
m_frameStatusBar->SetStatusText(text, number); m_frameStatusBar->SetStatusText(text, number);
@@ -600,13 +600,13 @@ void wxFrame::SetStatusText(const wxString& text, int number)
void wxFrame::SetStatusWidths(int n, const int widths_field[] ) void wxFrame::SetStatusWidths(int n, const int widths_field[] )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
m_frameStatusBar->SetStatusWidths(n, widths_field); m_frameStatusBar->SetStatusWidths(n, widths_field);
} }
wxStatusBar *wxFrame::GetStatusBar(void) const wxStatusBar *wxFrame::GetStatusBar() const
{ {
return m_frameStatusBar; return m_frameStatusBar;
} }
@@ -614,7 +614,7 @@ wxStatusBar *wxFrame::GetStatusBar(void) const
void wxFrame::SetTitle( const wxString &title ) void wxFrame::SetTitle( const wxString &title )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_title = title; m_title = title;
if (m_title.IsNull()) m_title = ""; if (m_title.IsNull()) m_title = "";
gtk_window_set_title( GTK_WINDOW(m_widget), title ); gtk_window_set_title( GTK_WINDOW(m_widget), title );
@@ -623,14 +623,14 @@ void wxFrame::SetTitle( const wxString &title )
void wxFrame::SetIcon( const wxIcon &icon ) void wxFrame::SetIcon( const wxIcon &icon )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid frame" ); wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_icon = icon; m_icon = icon;
if (!icon.Ok()) return; if (!icon.Ok()) return;
wxMask *mask = icon.GetMask(); wxMask *mask = icon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL; GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap(); if (mask) bm = mask->GetBitmap();
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm ); gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
} }

View File

@@ -19,34 +19,29 @@
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits ) wxBitmap( bits )
{ {
} }
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits ) wxBitmap( bits )
{ {
} }
wxIcon::wxIcon() : wxBitmap() wxIcon::wxIcon() : wxBitmap()
{ {
} }
wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap() wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{ {
Ref(icon); Ref(icon);
}
wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
{
if (icon) Ref(*icon);
} }
wxIcon& wxIcon::operator = ( const wxIcon& icon ) wxIcon& wxIcon::operator = ( const wxIcon& icon )
{ {
if (*this == icon) return (*this); if (*this == icon) return (*this);
Ref(icon); Ref(icon);
return *this; return *this;
} }

View File

@@ -31,7 +31,7 @@ wxMenuBar::wxMenuBar()
m_menus.DeleteContents( TRUE ); m_menus.DeleteContents( TRUE );
m_menubar = gtk_menu_bar_new(); m_menubar = gtk_menu_bar_new();
m_widget = GTK_WIDGET(m_menubar); m_widget = GTK_WIDGET(m_menubar);
PostCreation(); PostCreation();
@@ -159,7 +159,7 @@ static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id ); wxCommandEvent event( wxEVT_COMMAND_MENU_SELECTED, id );
event.SetEventObject( menu ); event.SetEventObject( menu );
event.SetInt(id ); event.SetInt(id );
if (menu->m_callback) if (menu->m_callback)
{ {
(void) (*(menu->m_callback)) (*menu, event); (void) (*(menu->m_callback)) (*menu, event);
@@ -187,7 +187,7 @@ static void gtk_menu_hilight_callback( GtkWidget *widget, wxMenu *menu )
wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id ); wxCommandEvent event( wxEVT_MENU_HIGHLIGHT, id );
event.SetEventObject( menu ); event.SetEventObject( menu );
event.SetInt(id ); event.SetInt(id );
/* wxMSW doesn't call callback here either /* wxMSW doesn't call callback here either
if (menu->m_callback) if (menu->m_callback)
{ {
@@ -218,22 +218,24 @@ wxMenuItem::wxMenuItem()
m_menuItem = (GtkWidget *) NULL; m_menuItem = (GtkWidget *) NULL;
} }
// it's valid for this function to be called even if m_menuItem == NULL
void wxMenuItem::SetName(const wxString& str) void wxMenuItem::SetName(const wxString& str)
{ {
wxCHECK_RET( m_menuItem, "invalid menu item" );
m_text = ""; m_text = "";
for ( const char *pc = str; *pc != '\0'; pc++ ) for ( const char *pc = str; *pc != '\0'; pc++ )
{ {
if ( *pc == '&' ) if ( *pc == '&' )
pc++; // skip it pc++; // skip it
m_text << *pc; m_text << *pc;
} }
GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child ); if ( m_menuItem )
{
gtk_label_set( label, m_text.c_str()); GtkLabel *label = GTK_LABEL( GTK_BIN(m_menuItem)->child );
gtk_label_set( label, m_text.c_str());
}
} }
void wxMenuItem::Check( bool check ) void wxMenuItem::Check( bool check )
@@ -246,12 +248,12 @@ void wxMenuItem::Check( bool check )
gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check ); gtk_check_menu_item_set_state( (GtkCheckMenuItem*)m_menuItem, (gint)check );
} }
void wxMenuItem::Enable( bool enable ) void wxMenuItem::Enable( bool enable )
{ {
wxCHECK_RET( m_menuItem, "invalid menu item" ); wxCHECK_RET( m_menuItem, "invalid menu item" );
gtk_widget_set_sensitive( m_menuItem, enable ); gtk_widget_set_sensitive( m_menuItem, enable );
m_isEnabled = enable; m_isEnabled = enable;
} }
bool wxMenuItem::IsChecked() const bool wxMenuItem::IsChecked() const
@@ -279,11 +281,11 @@ wxMenu::wxMenu( const wxString& title, const wxFunction func )
m_items.DeleteContents( TRUE ); m_items.DeleteContents( TRUE );
m_invokingWindow = (wxWindow *) NULL; m_invokingWindow = (wxWindow *) NULL;
m_menu = gtk_menu_new(); // Do not show! m_menu = gtk_menu_new(); // Do not show!
m_callback = func; m_callback = func;
m_eventHandler = this; m_eventHandler = this;
m_clientData = (void*) NULL; m_clientData = (void*) NULL;
if (m_title.IsNull()) m_title = ""; if (m_title.IsNull()) m_title = "";
if (m_title != "") if (m_title != "")
{ {
@@ -325,7 +327,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
const char *text = mitem->GetText(); const char *text = mitem->GetText();
GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text) GtkWidget *menuItem = checkable ? gtk_check_menu_item_new_with_label(text)
: gtk_menu_item_new_with_label(text); : gtk_menu_item_new_with_label(text);
mitem->SetMenuItem(menuItem); mitem->SetMenuItem(menuItem);
gtk_signal_connect( GTK_OBJECT(menuItem), "activate", gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
@@ -466,7 +468,7 @@ wxMenuItem *wxMenu::FindItem(int id) const
// Not finding anything here can be correct // Not finding anything here can be correct
// when search the entire menu system for // when search the entire menu system for
// an entry -> no error message. // an entry -> no error message.
return (wxMenuItem *) NULL; return (wxMenuItem *) NULL;
} }

View File

@@ -22,19 +22,19 @@
class wxPaletteRefData: public wxObjectRefData class wxPaletteRefData: public wxObjectRefData
{ {
public: public:
wxPaletteRefData(void); wxPaletteRefData(void);
~wxPaletteRefData(void); ~wxPaletteRefData(void);
GdkColormap *m_colormap; GdkColormap *m_colormap;
}; };
wxPaletteRefData::wxPaletteRefData(void) wxPaletteRefData::wxPaletteRefData()
{ {
m_colormap = (GdkColormap *) NULL; m_colormap = (GdkColormap *) NULL;
}; };
wxPaletteRefData::~wxPaletteRefData(void) wxPaletteRefData::~wxPaletteRefData()
{ {
if (m_colormap) gdk_colormap_unref( m_colormap ); if (m_colormap) gdk_colormap_unref( m_colormap );
}; };
@@ -45,7 +45,7 @@ wxPaletteRefData::~wxPaletteRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
wxPalette::wxPalette(void) wxPalette::wxPalette()
{ {
}; };
@@ -60,31 +60,25 @@ wxPalette::wxPalette( const wxPalette& palette )
Ref( palette ); Ref( palette );
}; };
wxPalette::wxPalette( const wxPalette* palette ) wxPalette::~wxPalette()
{
UnRef();
if (palette) Ref( *palette );
};
wxPalette::~wxPalette(void)
{ {
}; };
wxPalette& wxPalette::operator = ( const wxPalette& palette ) wxPalette& wxPalette::operator = ( const wxPalette& palette )
{ {
if (*this == palette) return (*this); if (*this == palette) return (*this);
Ref( palette ); Ref( palette );
return *this; return *this;
}; };
bool wxPalette::operator == ( const wxPalette& palette ) bool wxPalette::operator == ( const wxPalette& palette )
{ {
return m_refData == palette.m_refData; return m_refData == palette.m_refData;
}; };
bool wxPalette::operator != ( const wxPalette& palette ) bool wxPalette::operator != ( const wxPalette& palette )
{ {
return m_refData != palette.m_refData; return m_refData != palette.m_refData;
}; };
bool wxPalette::Ok(void) const bool wxPalette::Ok(void) const

View File

@@ -4,7 +4,7 @@
// Author: Robert Roebling // Author: Robert Roebling
// Id: $Id$ // Id: $Id$
// Copyright: (c) 1998 Robert Roebling // Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -21,10 +21,10 @@
class wxPenRefData: public wxObjectRefData class wxPenRefData: public wxObjectRefData
{ {
public: public:
wxPenRefData(void); wxPenRefData(void);
wxPenRefData(const wxPenRefData& data); wxPenRefData(const wxPenRefData& data);
int m_width; int m_width;
int m_style; int m_style;
int m_joinStyle; int m_joinStyle;
@@ -55,7 +55,7 @@ wxPenRefData::wxPenRefData( const wxPenRefData& data )
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen(void) wxPen::wxPen()
{ {
if (wxThePenList) wxThePenList->AddPen( this ); if (wxThePenList) wxThePenList->AddPen( this );
} }
@@ -66,7 +66,7 @@ wxPen::wxPen( const wxColour &colour, int width, int style )
M_PENDATA->m_width = width; M_PENDATA->m_width = width;
M_PENDATA->m_style = style; M_PENDATA->m_style = style;
M_PENDATA->m_colour = colour; M_PENDATA->m_colour = colour;
if (wxThePenList) wxThePenList->AddPen( this ); if (wxThePenList) wxThePenList->AddPen( this );
} }
@@ -76,14 +76,6 @@ wxPen::wxPen( const wxPen& pen )
if (wxThePenList) wxThePenList->AddPen( this ); if (wxThePenList) wxThePenList->AddPen( this );
} }
wxPen::wxPen( const wxPen* pen )
{
UnRef();
if (pen) Ref( *pen );
if (wxThePenList) wxThePenList->AddPen( this );
}
wxPen::~wxPen() wxPen::~wxPen()
{ {
if (wxThePenList) wxThePenList->RemovePen( this ); if (wxThePenList) wxThePenList->RemovePen( this );
@@ -91,19 +83,19 @@ wxPen::~wxPen()
wxPen& wxPen::operator = ( const wxPen& pen ) wxPen& wxPen::operator = ( const wxPen& pen )
{ {
if (*this == pen) return (*this); if (*this == pen) return (*this);
Ref( pen ); Ref( pen );
return *this; return *this;
} }
bool wxPen::operator == ( const wxPen& pen ) bool wxPen::operator == ( const wxPen& pen )
{ {
return m_refData == pen.m_refData; return m_refData == pen.m_refData;
} }
bool wxPen::operator != ( const wxPen& pen ) bool wxPen::operator != ( const wxPen& pen )
{ {
return m_refData != pen.m_refData; return m_refData != pen.m_refData;
} }
void wxPen::SetColour( const wxColour &colour ) void wxPen::SetColour( const wxColour &colour )
@@ -145,35 +137,35 @@ void wxPen::SetWidth( int width )
int wxPen::GetCap() const int wxPen::GetCap() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_capStyle; return M_PENDATA->m_capStyle;
} }
int wxPen::GetJoin() const int wxPen::GetJoin() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_joinStyle; return M_PENDATA->m_joinStyle;
} }
int wxPen::GetStyle() const int wxPen::GetStyle() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_style; return M_PENDATA->m_style;
} }
int wxPen::GetWidth() const int wxPen::GetWidth() const
{ {
wxCHECK_MSG( Ok(), -1, "invalid pen" ); wxCHECK_MSG( Ok(), -1, "invalid pen" );
return M_PENDATA->m_width; return M_PENDATA->m_width;
} }
wxColour &wxPen::GetColour() const wxColour &wxPen::GetColour() const
{ {
wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" ); wxCHECK_MSG( Ok(), wxNullColour, "invalid pen" );
return M_PENDATA->m_colour; return M_PENDATA->m_colour;
} }

View File

@@ -26,7 +26,7 @@
static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{ {
win->SetModified(); win->SetModified();
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId ); wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->m_windowId );
wxString val( win->GetValue() ); wxString val( win->GetValue() );
if (!val.IsNull()) event.m_commandString = WXSTRINGCAST val; if (!val.IsNull()) event.m_commandString = WXSTRINGCAST val;
@@ -89,7 +89,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
0, 0); 0, 0);
// put the horizontal scrollbar in the lower left hand corner // put the horizontal scrollbar in the lower left hand corner
if (bHasHScrollbar) if (bHasHScrollbar)
{ {
GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj); GtkWidget *hscrollbar = gtk_hscrollbar_new(GTK_TEXT(m_text)->hadj);
gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2, gtk_table_attach(GTK_TABLE(m_widget), hscrollbar, 0, 1, 1, 2,
@@ -107,7 +107,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
0, 0); 0, 0);
gtk_widget_show( vscrollbar ); gtk_widget_show( vscrollbar );
} }
else else
{ {
// a single-line text control: no need for scrollbars // a single-line text control: no need for scrollbars
m_widget = m_widget =
@@ -122,10 +122,10 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
m_parent->AddChild( this ); m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this ); (m_parent->m_insertCallback)( m_parent, this );
PostCreation(); PostCreation();
if (multi_line) if (multi_line)
{ {
gtk_widget_realize(m_text); gtk_widget_realize(m_text);
gtk_widget_show(m_text); gtk_widget_show(m_text);
@@ -148,9 +148,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
if (!multi_line) if (!multi_line)
gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE ); gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE );
} }
if (style & wxTE_READONLY) if (style & wxTE_READONLY)
{ {
if (!multi_line) if (!multi_line)
gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE ); gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
} }
@@ -171,7 +171,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
wxString wxTextCtrl::GetValue() const wxString wxTextCtrl::GetValue() const
{ {
wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, "", "invalid text ctrl" );
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
@@ -190,7 +190,7 @@ wxString wxTextCtrl::GetValue() const
void wxTextCtrl::SetValue( const wxString &value ) void wxTextCtrl::SetValue( const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
wxString tmp = ""; wxString tmp = "";
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -209,7 +209,7 @@ void wxTextCtrl::SetValue( const wxString &value )
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
if (text.IsNull()) return; if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -226,14 +226,14 @@ void wxTextCtrl::WriteText( const wxString &text )
bool wxTextCtrl::LoadFile( const wxString &file ) bool wxTextCtrl::LoadFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
if (!wxFileExists(file)) return FALSE; if (!wxFileExists(file)) return FALSE;
Clear(); Clear();
FILE *fp = NULL; FILE *fp = NULL;
struct stat statb; struct stat statb;
if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG || if ((stat ((char*) (const char*) file, &statb) == -1) || (statb.st_mode & S_IFMT) != S_IFREG ||
!(fp = fopen ((char*) (const char*) file, "r"))) !(fp = fopen ((char*) (const char*) file, "r")))
{ {
@@ -254,7 +254,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
fclose (fp); fclose (fp);
text[len] = 0; text[len] = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len ); gtk_editable_insert_text( GTK_EDITABLE(m_text), text, 0, &len );
@@ -263,7 +263,7 @@ bool wxTextCtrl::LoadFile( const wxString &file )
{ {
gtk_entry_set_text( GTK_ENTRY(m_text), text ); gtk_entry_set_text( GTK_ENTRY(m_text), text );
} }
free (text); free (text);
m_modified = FALSE; m_modified = FALSE;
return TRUE; return TRUE;
@@ -274,9 +274,9 @@ bool wxTextCtrl::LoadFile( const wxString &file )
bool wxTextCtrl::SaveFile( const wxString &file ) bool wxTextCtrl::SaveFile( const wxString &file )
{ {
wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, FALSE, "invalid text ctrl" );
if (file == "") return FALSE; if (file == "") return FALSE;
FILE *fp; FILE *fp;
if (!(fp = fopen ((char*) (const char*) file, "w"))) if (!(fp = fopen ((char*) (const char*) file, "w")))
@@ -287,7 +287,7 @@ bool wxTextCtrl::SaveFile( const wxString &file )
{ {
char *text = NULL; char *text = NULL;
gint len = 0; gint len = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
len = gtk_text_get_length( GTK_TEXT(m_text) ); len = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -297,20 +297,20 @@ bool wxTextCtrl::SaveFile( const wxString &file )
{ {
text = gtk_entry_get_text( GTK_ENTRY(m_text) ); text = gtk_entry_get_text( GTK_ENTRY(m_text) );
} }
if (fwrite (text, sizeof (char), len, fp) != (size_t) len) if (fwrite (text, sizeof (char), len, fp) != (size_t) len)
{ {
// Did not write whole file // Did not write whole file
} }
// Make sure newline terminates the file // Make sure newline terminates the file
if (text[len - 1] != '\n') if (text[len - 1] != '\n')
fputc ('\n', fp); fputc ('\n', fp);
fclose (fp); fclose (fp);
if (m_windowStyle & wxTE_MULTILINE) g_free( text ); if (m_windowStyle & wxTE_MULTILINE) g_free( text );
m_modified = FALSE; m_modified = FALSE;
return TRUE; return TRUE;
} }
@@ -337,7 +337,7 @@ wxString wxTextCtrl::GetLineText( long lineNo ) const
int j; int j;
for (j = 0; text[i] && text[i] != '\n'; i++, j++ ) for (j = 0; text[i] && text[i] != '\n'; i++, j++ )
buf += text[i]; buf += text[i];
g_free( text ); g_free( text );
return buf; return buf;
} }
@@ -366,7 +366,7 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
return 0; return 0;
if( pos >= len) if( pos >= len)
return pos=len-1; return pos=len-1;
*x=1; // Col 1 *x=1; // Col 1
*y=1; // Line 1 *y=1; // Line 1
for (int i = 0; i < pos; i++ ) for (int i = 0; i < pos; i++ )
@@ -378,7 +378,7 @@ long wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
} }
else else
(*x)++; (*x)++;
} }
g_free( text ); g_free( text );
return 1; return 1;
} }
@@ -388,7 +388,7 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
if (!(m_windowStyle & wxTE_MULTILINE)) if (!(m_windowStyle & wxTE_MULTILINE))
return 0; return 0;
long pos=0; long pos=0;
for(int i=1;i<y;i++) for(int i=1;i<y;i++)
pos +=GetLineLength(i); pos +=GetLineLength(i);
pos +=x-1; // Pos start with 0 pos +=x-1; // Pos start with 0
@@ -414,7 +414,7 @@ int wxTextCtrl::GetNumberOfLines() const
for (int i = 0; i < len; i++ ) for (int i = 0; i < len; i++ )
if (text[i] == '\n') if (text[i] == '\n')
currentLine++; currentLine++;
g_free( text ); g_free( text );
return currentLine; return currentLine;
} }
@@ -430,7 +430,7 @@ int wxTextCtrl::GetNumberOfLines() const
void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetInsertionPoint( long pos )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
int tmp = (int) pos; int tmp = (int) pos;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_point( GTK_TEXT(m_text), tmp ); gtk_text_set_point( GTK_TEXT(m_text), tmp );
@@ -441,7 +441,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
void wxTextCtrl::SetInsertionPointEnd() void wxTextCtrl::SetInsertionPointEnd()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) ); pos = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -453,7 +453,7 @@ void wxTextCtrl::SetInsertionPointEnd()
void wxTextCtrl::SetEditable( bool editable ) void wxTextCtrl::SetEditable( bool editable )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_text), editable ); gtk_text_set_editable( GTK_TEXT(m_text), editable );
else else
@@ -463,7 +463,7 @@ void wxTextCtrl::SetEditable( bool editable )
void wxTextCtrl::SetSelection( long from, long to ) void wxTextCtrl::SetSelection( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
@@ -475,14 +475,14 @@ void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
long wxTextCtrl::GetInsertionPoint() const long wxTextCtrl::GetInsertionPoint() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
return (long) GTK_EDITABLE(m_text)->current_pos; return (long) GTK_EDITABLE(m_text)->current_pos;
} }
long wxTextCtrl::GetLastPosition() const long wxTextCtrl::GetLastPosition() const
{ {
wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" ); wxCHECK_MSG( m_text != NULL, 0, "invalid text ctrl" );
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_text) ); pos = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -494,14 +494,14 @@ long wxTextCtrl::GetLastPosition() const
void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Remove( long from, long to )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
} }
void wxTextCtrl::Replace( long from, long to, const wxString &value ) void wxTextCtrl::Replace( long from, long to, const wxString &value )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
@@ -511,7 +511,7 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
void wxTextCtrl::Cut() void wxTextCtrl::Cut()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
#if (GTK_MINOR_VERSION == 1) #if (GTK_MINOR_VERSION == 1)
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text) );
#else #else
@@ -522,7 +522,7 @@ void wxTextCtrl::Cut()
void wxTextCtrl::Copy() void wxTextCtrl::Copy()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
#if (GTK_MINOR_VERSION == 1) #if (GTK_MINOR_VERSION == 1)
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text) );
#else #else
@@ -533,7 +533,7 @@ void wxTextCtrl::Copy()
void wxTextCtrl::Paste() void wxTextCtrl::Paste()
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
#if (GTK_MINOR_VERSION == 1) #if (GTK_MINOR_VERSION == 1)
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text) );
#else #else
@@ -554,7 +554,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &key_event )
event.SetEventObject(this); event.SetEventObject(this);
if (GetEventHandler()->ProcessEvent(event)) return; if (GetEventHandler()->ProcessEvent(event)) return;
} }
else if (key_event.KeyCode() == WXK_TAB) else if (key_event.KeyCode() == WXK_TAB)
{ {
wxNavigationKeyEvent event; wxNavigationKeyEvent event;
event.SetDirection( key_event.m_shiftDown ); event.SetDirection( key_event.m_shiftDown );
@@ -659,14 +659,14 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) ) void wxTextCtrl::SetFont( const wxFont &WXUNUSED(font) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
// doesn't work // doesn't work
} }
void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) ) void wxTextCtrl::SetForegroundColour( const wxColour &WXUNUSED(colour) )
{ {
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
// doesn't work // doesn't work
} }
@@ -675,9 +675,9 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
wxCHECK_RET( m_text != NULL, "invalid text ctrl" ); wxCHECK_RET( m_text != NULL, "invalid text ctrl" );
wxControl::SetBackgroundColour( colour ); wxControl::SetBackgroundColour( colour );
if (!m_backgroundColour.Ok()) return; if (!m_backgroundColour.Ok()) return;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
{ {
GdkWindow *window = GTK_TEXT(m_text)->text_area; GdkWindow *window = GTK_TEXT(m_text)->text_area;

View File

@@ -109,7 +109,7 @@ static char *GetIniFile(char *dest, const char *filename)
return dest; return dest;
} }
static void wxXMergeDatabases(void) static void wxXMergeDatabases()
{ {
XrmDatabase homeDB, serverDB, applicationDB; XrmDatabase homeDB, serverDB, applicationDB;
char filenamebuf[1024]; char filenamebuf[1024];
@@ -159,7 +159,7 @@ static void wxXMergeDatabases(void)
// called on application exit // called on application exit
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void wxFlushResources(void) void wxFlushResources()
{ {
char nameBuffer[512]; char nameBuffer[512];

View File

@@ -86,14 +86,14 @@
this is (in most cases) the only GTK widget the class manages. E.g. the this is (in most cases) the only GTK widget the class manages. E.g. the
wxStatitText class handles only a GtkLabel widget a pointer to which you wxStatitText class handles only a GtkLabel widget a pointer to which you
can find in m_widget (defined in wxWindow) can find in m_widget (defined in wxWindow)
When the class has a client area for drawing into and for containing children When the class has a client area for drawing into and for containing children
it has to handle the client area widget (of the type GtkMyFixed, defined in it has to handle the client area widget (of the type GtkMyFixed, defined in
win_gtk.c), but there could be any number of widgets, handled by a class win_gtk.c), but there could be any number of widgets, handled by a class
The common rule for all windows is only, that the widget that interacts with The common rule for all windows is only, that the widget that interacts with
the rest of GTK must be referenced in m_widget and all other widgets must be the rest of GTK must be referenced in m_widget and all other widgets must be
children of this widget on the GTK level. The top-most widget, which also children of this widget on the GTK level. The top-most widget, which also
represents the client area, must be in the m_wxwindow field and must be of represents the client area, must be in the m_wxwindow field and must be of
the type GtkMyFixed. the type GtkMyFixed.
As I said, the window classes that display a GTK native widget only have As I said, the window classes that display a GTK native widget only have
@@ -504,7 +504,7 @@ static gint gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion
if (g_blockEventsOnDrag) return TRUE; if (g_blockEventsOnDrag) return TRUE;
if (g_blockEventsOnScroll) return TRUE; if (g_blockEventsOnScroll) return TRUE;
if (!win->HasVMT()) return TRUE; if (!win->HasVMT()) return TRUE;
/* /*
@@ -762,7 +762,7 @@ static void gtk_window_hscroll_callback( GtkWidget *WXUNUSED(widget), wxWindow *
float line_step = win->m_hAdjust->step_increment; float line_step = win->m_hAdjust->step_increment;
float page_step = win->m_hAdjust->page_increment; float page_step = win->m_hAdjust->page_increment;
if (win->m_isScrolling) if (win->m_isScrolling)
{ {
command = wxEVT_SCROLL_THUMBTRACK; command = wxEVT_SCROLL_THUMBTRACK;
@@ -839,12 +839,12 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
// "button_press_event" from scrollbar // "button_press_event" from scrollbar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget), static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
// if (gdk_event->window != widget->slider) return FALSE; // if (gdk_event->window != widget->slider) return FALSE;
win->m_isScrolling = TRUE; win->m_isScrolling = TRUE;
g_blockEventsOnScroll = TRUE; g_blockEventsOnScroll = TRUE;
@@ -855,8 +855,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
// "button_release_event" from scrollbar // "button_release_event" from scrollbar
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_release_callback( GtkRange *widget, static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event), GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win ) wxWindow *win )
{ {
@@ -883,7 +883,7 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Callback for wxWindow. This very strange beast has to be used because // Callback for wxWindow. This very strange beast has to be used because
// C++ has no virtual methods in a constructor. We have to emulate a // C++ has no virtual methods in a constructor. We have to emulate a
// virtual function here as wxNotebook requires a different way to insert // virtual function here as wxNotebook requires a different way to insert
// a child in it. I had opted for creating a wxNotebookPage window class // a child in it. I had opted for creating a wxNotebookPage window class
// which would have made this superflouus (such in the MDI window system), // which would have made this superflouus (such in the MDI window system),
@@ -891,13 +891,13 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child ) static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{ {
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow), gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget), GTK_WIDGET(child->m_widget),
child->m_x, child->m_x,
child->m_y ); child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget), gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width, child->m_width,
child->m_height ); child->m_height );
} }
@@ -920,7 +920,7 @@ wxWindow::wxWindow()
m_wxwindow = (GtkWidget *) NULL; m_wxwindow = (GtkWidget *) NULL;
m_parent = (wxWindow *) NULL; m_parent = (wxWindow *) NULL;
m_children.DeleteContents( FALSE ); m_children.DeleteContents( FALSE );
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;
m_width = 0; m_width = 0;
@@ -929,46 +929,46 @@ wxWindow::wxWindow()
m_minHeight = -1; m_minHeight = -1;
m_maxWidth = -1; m_maxWidth = -1;
m_maxHeight = -1; m_maxHeight = -1;
m_retCode = 0; m_retCode = 0;
m_eventHandler = this; m_eventHandler = this;
m_windowValidator = (wxValidator *) NULL; m_windowValidator = (wxValidator *) NULL;
m_windowId = -1; m_windowId = -1;
m_cursor = (wxCursor *) NULL; m_cursor = (wxCursor *) NULL;
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
m_windowStyle = 0; m_windowStyle = 0;
m_windowName = "noname"; m_windowName = "noname";
m_constraints = (wxLayoutConstraints *) NULL; m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL; m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL; m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL; m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE; m_autoLayout = FALSE;
m_sizeSet = FALSE; m_sizeSet = FALSE;
m_hasVMT = FALSE; m_hasVMT = FALSE;
m_needParent = TRUE; m_needParent = TRUE;
m_hasScrolling = FALSE; m_hasScrolling = FALSE;
m_isScrolling = FALSE; m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment*) NULL; m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL; m_vAdjust = (GtkAdjustment*) NULL;
m_oldHorizontalPos = 0.0; m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0; m_oldVerticalPos = 0.0;
m_isShown = FALSE; m_isShown = FALSE;
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget*) NULL; m_dropTarget = (wxDropTarget*) NULL;
m_resizing = FALSE; m_resizing = FALSE;
m_scrollGC = (GdkGC*) NULL; m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL; m_widgetStyle = (GtkStyle*) NULL;
m_insertCallback = wxInsertChildInWindow; m_insertCallback = wxInsertChildInWindow;
m_clientObject = (wxClientData*) NULL; m_clientObject = (wxClientData*) NULL;
m_clientData = NULL; m_clientData = NULL;
} }
@@ -980,7 +980,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
m_insertCallback = wxInsertChildInWindow; m_insertCallback = wxInsertChildInWindow;
Create( parent, id, pos, size, style, name ); Create( parent, id, pos, size, style, name );
} }
bool wxWindow::Create( wxWindow *parent, wxWindowID id, bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
@@ -1058,7 +1058,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
// these handlers block mouse events to any window during scrolling // these handlers block mouse events to any window during scrolling
// such as motion events and prevent GTK and wxWindows from fighting // such as motion events and prevent GTK and wxWindows from fighting
// over where the slider should be // over where the slider should be
gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event", gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event",
(GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this ); (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
@@ -1070,7 +1070,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event", gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this ); (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
// these handers het notified when screen updates are required either when // these handers het notified when screen updates are required either when
// scrolling or when the window size (and therefore scrollbar configuration) // scrolling or when the window size (and therefore scrollbar configuration)
// has changed // has changed
@@ -1086,13 +1086,13 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this ); (GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
gtk_widget_show( m_wxwindow ); gtk_widget_show( m_wxwindow );
if (m_parent) m_parent->AddChild( this ); if (m_parent) m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this ); (m_parent->m_insertCallback)( m_parent, this );
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
@@ -1110,13 +1110,13 @@ wxWindow::~wxWindow()
DestroyChildren(); DestroyChildren();
if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
if (m_scrollGC) gdk_gc_unref( m_scrollGC ); if (m_scrollGC) gdk_gc_unref( m_scrollGC );
if (m_wxwindow) gtk_widget_destroy( m_wxwindow ); if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
if (m_widget) gtk_widget_destroy( m_widget ); if (m_widget) gtk_widget_destroy( m_widget );
if (m_cursor) delete m_cursor; if (m_cursor) delete m_cursor;
DeleteRelatedConstraints(); DeleteRelatedConstraints();
@@ -1147,7 +1147,7 @@ wxWindow::~wxWindow()
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator; if (m_windowValidator) delete m_windowValidator;
if (m_clientObject) delete m_clientObject; if (m_clientObject) delete m_clientObject;
} }
@@ -1157,21 +1157,21 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
{ {
if (m_needParent && (parent == NULL)) if (m_needParent && (parent == NULL))
wxFatalError( "Need complete parent.", name ); wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget*) NULL; m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL; m_wxwindow = (GtkWidget*) NULL;
m_hasVMT = FALSE; m_hasVMT = FALSE;
m_parent = parent; m_parent = parent;
m_children.DeleteContents( FALSE ); m_children.DeleteContents( FALSE );
m_width = size.x; m_width = size.x;
if (m_width == -1) m_width = 20; if (m_width == -1) m_width = 20;
m_height = size.y; m_height = size.y;
if (m_height == -1) m_height = 20; if (m_height == -1) m_height = 20;
m_x = (int)pos.x; m_x = (int)pos.x;
m_y = (int)pos.y; m_y = (int)pos.y;
if (!m_needParent) // some reasonable defaults if (!m_needParent) // some reasonable defaults
{ {
if (m_x == -1) if (m_x == -1)
@@ -1185,49 +1185,49 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
if (m_y < 10) m_y = 10; if (m_y < 10) m_y = 10;
} }
} }
m_minWidth = -1; m_minWidth = -1;
m_minHeight = -1; m_minHeight = -1;
m_maxWidth = -1; m_maxWidth = -1;
m_maxHeight = -1; m_maxHeight = -1;
m_retCode = 0; m_retCode = 0;
m_eventHandler = this; m_eventHandler = this;
m_windowId = id == -1 ? wxNewId() : id; m_windowId = id == -1 ? wxNewId() : id;
m_sizeSet = FALSE; m_sizeSet = FALSE;
m_cursor = new wxCursor( wxCURSOR_ARROW ); m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE; // m_backgroundColour = wxWHITE;
// m_foregroundColour = wxBLACK; // m_foregroundColour = wxBLACK;
m_windowStyle = style; m_windowStyle = style;
m_windowName = name; m_windowName = name;
m_constraints = (wxLayoutConstraints *) NULL; m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL; m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL; m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL; m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE; m_autoLayout = FALSE;
m_hasScrolling = FALSE; m_hasScrolling = FALSE;
m_isScrolling = FALSE; m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment *) NULL; m_hAdjust = (GtkAdjustment *) NULL;
m_vAdjust = (GtkAdjustment *) NULL; m_vAdjust = (GtkAdjustment *) NULL;
m_oldHorizontalPos = 0.0; m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0; m_oldVerticalPos = 0.0;
m_isShown = FALSE; m_isShown = FALSE;
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget *) NULL; m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE; m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL; m_windowValidator = (wxValidator *) NULL;
m_scrollGC = (GdkGC*) NULL; m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL; m_widgetStyle = (GtkStyle*) NULL;
m_clientObject = (wxClientData*)NULL; m_clientObject = (wxClientData*)NULL;
m_clientData = NULL; m_clientData = NULL;
} }
@@ -1336,7 +1336,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags )
if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent()) if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
{ {
wxPoint pt(GetParent()->GetClientAreaOrigin()); wxPoint pt(GetParent()->GetClientAreaOrigin());
x += pt.x; x += pt.x;
y += pt.y; y += pt.y;
} }
} }
@@ -1345,7 +1345,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), "invalid window" );
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" ); wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
if (m_resizing) return; // I don't like recursions if (m_resizing) return; // I don't like recursions
m_resizing = TRUE; m_resizing = TRUE;
@@ -1361,7 +1361,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
int old_width = m_width; int old_width = m_width;
int old_height = m_height; int old_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING) if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{ {
if (x != -1) m_x = x; if (x != -1) m_x = x;
@@ -1386,7 +1386,7 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
if (height == -1) m_height = 26; if (height == -1) m_height = 26;
} }
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth; if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight; if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
@@ -1394,11 +1394,11 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
wxPoint pt( m_parent->GetClientAreaOrigin() ); wxPoint pt( m_parent->GetClientAreaOrigin() );
gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y ); gtk_myfixed_move( GTK_MYFIXED(m_parent->m_wxwindow), m_widget, m_x+pt.x, m_y+pt.y );
if ((old_width != m_width) || (old_height != m_height)) if ((old_width != m_width) || (old_height != m_height))
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
@@ -1457,7 +1457,7 @@ void wxWindow::SetClientSize( int width, int height )
#ifdef NEW_GTK_SCROLL_CODE #ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child; GtkWidget *viewport = scroll_window->child;
#else #else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif #endif
@@ -1522,7 +1522,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
#ifdef NEW_GTK_SCROLL_CODE #ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child; GtkWidget *viewport = scroll_window->child;
#else #else
GtkWidget *viewport = scroll_window->viewport; GtkWidget *viewport = scroll_window->viewport;
#endif #endif
@@ -1589,7 +1589,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
wxPoint pt(GetClientAreaOrigin()); wxPoint pt(GetClientAreaOrigin());
org_x += pt.x; org_x += pt.x;
org_y += pt.y; org_y += pt.y;
if (x) *x += org_x; if (x) *x += org_x;
if (y) *y += org_y; if (y) *y += org_y;
} }
@@ -1620,7 +1620,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
wxPoint pt(GetClientAreaOrigin()); wxPoint pt(GetClientAreaOrigin());
org_x -= pt.x; org_x -= pt.x;
org_y -= pt.y; org_y -= pt.y;
if (x) *x -= org_x; if (x) *x -= org_x;
if (y) *y -= org_y; if (y) *y -= org_y;
} }
@@ -1631,7 +1631,7 @@ void wxWindow::Centre( int direction )
int x = m_x; int x = m_x;
int y = m_y; int y = m_y;
if (m_parent) if (m_parent)
{ {
int p_w = 0; int p_w = 0;
@@ -1645,7 +1645,7 @@ void wxWindow::Centre( int direction )
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2; if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2; if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
} }
Move( x, y ); Move( x, y );
} }
@@ -1655,7 +1655,7 @@ void wxWindow::Fit()
int maxX = 0; int maxX = 0;
int maxY = 0; int maxY = 0;
wxNode *node = m_childrenFirst(); wxNode *node = m_children.First();
while ( node ) while ( node )
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
@@ -1803,25 +1803,20 @@ void wxWindow::AddChild( wxWindow *child )
m_children.Append( child ); m_children.Append( child );
} }
wxList& wxWindow::GetChildren() const
{
return m_children;
}
wxWindow *wxWindow::ReParent( wxWindow *newParent ) wxWindow *wxWindow::ReParent( wxWindow *newParent )
{ {
wxWindow *oldParent = GetParent(); wxWindow *oldParent = GetParent();
if (oldParent) oldParent->RemoveChild( this ); if (oldParent) oldParent->RemoveChild( this );
gtk_widget_unparent( m_widget ); gtk_widget_unparent( m_widget );
if (newParent) if (newParent)
{ {
newParent->AddChild( this ); newParent->AddChild( this );
(newParent->m_insertCallback)( newParent, this ); (newParent->m_insertCallback)( newParent, this );
} }
return oldParent; return oldParent;
} }
@@ -1855,7 +1850,7 @@ void wxWindow::Lower()
if (m_widget) gdk_window_lower( m_widget->window ); if (m_widget) gdk_window_lower( m_widget->window );
} }
wxEvtHandler *wxWindow::GetEventHandler() wxEvtHandler *wxWindow::GetEventHandler() const
{ {
return m_eventHandler; return m_eventHandler;
} }
@@ -1934,7 +1929,7 @@ void wxWindow::SetId( wxWindowID id )
m_windowId = id; m_windowId = id;
} }
wxWindowID wxWindow::GetId() wxWindowID wxWindow::GetId() const
{ {
return m_windowId; return m_windowId;
} }
@@ -1951,7 +1946,8 @@ void wxWindow::SetCursor( const wxCursor &cursor )
if (cursor.Ok()) if (cursor.Ok())
{ {
if (*((wxCursor*)&cursor) == m_cursor) return; if ( cursor == *m_cursor )
return;
*m_cursor = cursor; *m_cursor = cursor;
} }
else else
@@ -2054,13 +2050,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_backgroundColour == colour) return; if (m_backgroundColour == colour) return;
if (!m_backgroundColour.Ok()) if (!m_backgroundColour.Ok())
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return; if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
m_backgroundColour = colour; m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return; if (!m_backgroundColour.Ok()) return;
if (m_wxwindow) if (m_wxwindow)
{ {
GdkWindow *window = m_wxwindow->window; GdkWindow *window = m_wxwindow->window;
@@ -2068,7 +2064,7 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
gdk_window_set_background( window, m_backgroundColour.GetColor() ); gdk_window_set_background( window, m_backgroundColour.GetColor() );
gdk_window_clear( window ); gdk_window_clear( window );
} }
ApplyWidgetStyle(); ApplyWidgetStyle();
} }
@@ -2082,31 +2078,31 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" ); wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_foregroundColour == colour) return; if (m_foregroundColour == colour) return;
m_foregroundColour = colour; m_foregroundColour = colour;
if (!m_foregroundColour.Ok()) return; if (!m_foregroundColour.Ok()) return;
ApplyWidgetStyle(); ApplyWidgetStyle();
} }
GtkStyle *wxWindow::GetWidgetStyle() GtkStyle *wxWindow::GetWidgetStyle()
{ {
if (m_widgetStyle) gtk_style_unref( m_widgetStyle ); if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
m_widgetStyle = m_widgetStyle =
gtk_style_copy( gtk_style_copy(
gtk_widget_get_style( m_widget ) ); gtk_widget_get_style( m_widget ) );
return m_widgetStyle; return m_widgetStyle;
} }
void wxWindow::SetWidgetStyle() void wxWindow::SetWidgetStyle()
{ {
GtkStyle *style = GetWidgetStyle(); GtkStyle *style = GetWidgetStyle();
gdk_font_unref( style->font ); gdk_font_unref( style->font );
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) ); style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
if (m_foregroundColour.Ok()) if (m_foregroundColour.Ok())
{ {
m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); m_foregroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
@@ -2114,7 +2110,7 @@ void wxWindow::SetWidgetStyle()
style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_PRELIGHT] = *m_foregroundColour.GetColor();
style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor(); style->fg[GTK_STATE_ACTIVE] = *m_foregroundColour.GetColor();
} }
if (m_backgroundColour.Ok()) if (m_backgroundColour.Ok())
{ {
m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) ); m_backgroundColour.CalcPixel( gdk_window_get_colormap( m_widget->window ) );
@@ -2219,7 +2215,7 @@ bool wxWindow::PopupMenu( wxMenu *menu, int WXUNUSED(x), int WXUNUSED(y) )
wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" ); wxCHECK_MSG( m_widget != NULL, FALSE, "invalid window" );
wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" ); wxCHECK_MSG( menu != NULL, FALSE, "invalid popup-menu" );
SetInvokingWindow( menu, this ); SetInvokingWindow( menu, this );
gtk_menu_popup( gtk_menu_popup(
GTK_MENU(menu->m_menu), GTK_MENU(menu->m_menu),
@@ -2274,13 +2270,8 @@ void wxWindow::SetFont( const wxFont &font )
m_font = font; m_font = font;
else else
m_font = *wxSWISS_FONT; m_font = *wxSWISS_FONT;
ApplyWidgetStyle();
}
wxFont *wxWindow::GetFont() ApplyWidgetStyle();
{
return &m_font;
} }
void wxWindow::SetWindowStyleFlag( long flag ) void wxWindow::SetWindowStyleFlag( long flag )
@@ -2392,7 +2383,7 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible,
wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" ); wxASSERT_MSG( (m_wxwindow != NULL), "window needs client area" );
if (!m_wxwindow) return; if (!m_wxwindow) return;
m_hasScrolling = TRUE; m_hasScrolling = TRUE;
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
@@ -2556,13 +2547,13 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
int d_y = 0; int d_y = 0;
if (dx > 0) d_x = dx; if (dx > 0) d_x = dx;
if (dy > 0) d_y = dy; if (dy > 0) d_y = dy;
if (!m_scrollGC) if (!m_scrollGC)
{ {
m_scrollGC = gdk_gc_new( m_wxwindow->window ); m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE ); gdk_gc_set_exposures( m_scrollGC, TRUE );
} }
gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y, gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
m_wxwindow->window, s_x, s_y, w, h ); m_wxwindow->window, s_x, s_y, w, h );
@@ -2795,7 +2786,7 @@ bool wxWindow::DoPhase(int phase)
{ {
noChanges = 0; noChanges = 0;
noFailures = 0; noFailures = 0;
wxNode *node = m_children.first(); wxNode *node = m_children.First();
while (node) while (node)
{ {
wxWindow *child = (wxWindow *)node->Data(); wxWindow *child = (wxWindow *)node->Data();

View File

@@ -8,8 +8,7 @@
########################### Programs ################################# ########################### Programs #################################
# Replace this with your own path if necessary # Replace this with your own path if necessary
#WXDIR = /home/karl/wxWindows WXDIR = $(wx)
WXDIR = /home/jacs/wx2
# C++ compiler # C++ compiler
CC = g++ CC = g++