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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -37,29 +37,28 @@ class wxBrush: public wxGDIObject
public:
wxBrush(void);
wxBrush();
wxBrush( const wxColour &colour, int style );
wxBrush( const wxBitmap &stippleBitmap );
wxBrush( const wxBrush &brush );
wxBrush( const wxBrush *brush );
~wxBrush(void);
~wxBrush();
wxBrush& 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( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style );
void SetStipple( const wxBitmap& stipple );
void Unshare(void);
void Unshare();
// no data :-)
};

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -37,9 +37,9 @@ class wxWindowDC: public wxDC
public:
wxWindowDC();
wxWindowDC( wxWindow *win );
~wxWindowDC();
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
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 DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y );
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 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 );
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 );
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 DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap() const;
virtual void DrawIcon( const wxIcon &icon, long x, long y );
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 );
virtual long GetCharWidth();
virtual long GetCharHeight();
virtual void Clear();
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
@ -85,15 +85,15 @@ public:
virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion();
virtual void SetClippingRegion( const wxRegion &region );
virtual void DrawSpline( wxList *points );
// implementation
GdkWindow *m_window;
GdkGC *m_penGC;
GdkGC *m_brushGC;
@ -101,7 +101,7 @@ public:
GdkGC *m_bgGC;
GdkColormap *m_cmap;
bool m_isMemDC;
void SetUpDC();
void Destroy();
GdkWindow *GetWindow();

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -35,9 +35,8 @@ class wxIcon: public wxBitmap
public:
wxIcon(void);
wxIcon();
wxIcon( const wxIcon& icon);
wxIcon( const wxIcon* icon);
wxIcon( const 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
void SetName(const wxString& str);
void SetText(const wxString& str) { SetName(str); } // compatibility
const wxString& GetName() const { return m_text; }
const wxString& GetText() const { return GetName(); }
// what kind of menu item we are
void SetCheckable(bool checkable) { m_isCheckMenu = checkable; }
@ -60,7 +62,7 @@ public:
bool IsSubMenu() const { return m_subMenu != NULL; }
// state
void Enable( bool enable = TRUE );
void Enable( bool enable = TRUE );
bool IsEnabled() const { return m_isEnabled; }
void Check( bool check = TRUE );
bool IsChecked() const;
@ -86,5 +88,5 @@ private:
};
#endif
#endif
//__GTKMENUITEMH__

View File

@ -5,7 +5,7 @@
// Created: 01/02/97
// Id:
// 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)
public:
wxPalette(void);
wxPalette();
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
wxPalette( const wxPalette& palette );
wxPalette( const wxPalette* palette );
~wxPalette(void);
~wxPalette();
wxPalette& 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);
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;

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -37,29 +37,28 @@ class wxBrush: public wxGDIObject
public:
wxBrush(void);
wxBrush();
wxBrush( const wxColour &colour, int style );
wxBrush( const wxBitmap &stippleBitmap );
wxBrush( const wxBrush &brush );
wxBrush( const wxBrush *brush );
~wxBrush(void);
~wxBrush();
wxBrush& 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( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style );
void SetStipple( const wxBitmap& stipple );
void Unshare(void);
void Unshare();
// no data :-)
};

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -37,9 +37,9 @@ class wxWindowDC: public wxDC
public:
wxWindowDC();
wxWindowDC( wxWindow *win );
~wxWindowDC();
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
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 DrawEllipticArc( long x, long y, long width, long height, double sa, double ea );
virtual void DrawPoint( long x, long y );
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 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 );
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 );
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 DrawEllipse( long x, long y, long width, long height );
virtual bool CanDrawBitmap() const;
virtual void DrawIcon( const wxIcon &icon, long x, long y );
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 );
virtual long GetCharWidth();
virtual long GetCharHeight();
virtual void Clear();
virtual void SetFont( const wxFont &font );
virtual void SetPen( const wxPen &pen );
virtual void SetBrush( const wxBrush &brush );
@ -85,15 +85,15 @@ public:
virtual void SetTextBackground( const wxColour &col );
virtual void SetBackgroundMode( int mode );
virtual void SetPalette( const wxPalette& palette );
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion();
virtual void SetClippingRegion( const wxRegion &region );
virtual void DrawSpline( wxList *points );
// implementation
GdkWindow *m_window;
GdkGC *m_penGC;
GdkGC *m_brushGC;
@ -101,7 +101,7 @@ public:
GdkGC *m_bgGC;
GdkColormap *m_cmap;
bool m_isMemDC;
void SetUpDC();
void Destroy();
GdkWindow *GetWindow();

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -35,9 +35,8 @@ class wxIcon: public wxBitmap
public:
wxIcon(void);
wxIcon();
wxIcon( const wxIcon& icon);
wxIcon( const wxIcon* icon);
wxIcon( const 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
void SetName(const wxString& str);
void SetText(const wxString& str) { SetName(str); } // compatibility
const wxString& GetName() const { return m_text; }
const wxString& GetText() const { return GetName(); }
// what kind of menu item we are
void SetCheckable(bool checkable) { m_isCheckMenu = checkable; }
@ -60,7 +62,7 @@ public:
bool IsSubMenu() const { return m_subMenu != NULL; }
// state
void Enable( bool enable = TRUE );
void Enable( bool enable = TRUE );
bool IsEnabled() const { return m_isEnabled; }
void Check( bool check = TRUE );
bool IsChecked() const;
@ -86,5 +88,5 @@ private:
};
#endif
#endif
//__GTKMENUITEMH__

View File

@ -5,7 +5,7 @@
// Created: 01/02/97
// Id:
// 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)
public:
wxPalette(void);
wxPalette();
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
wxPalette( const wxPalette& palette );
wxPalette( const wxPalette* palette );
~wxPalette(void);
~wxPalette();
wxPalette& 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);
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;

View File

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

View File

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

View File

@ -4,9 +4,9 @@
// Author: Vadim Zeitlin
// Modified by:
// Created: 04/01/98
// RCS-ID:
// RCS-ID: $Id$
// Copyright:
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
@ -59,7 +59,7 @@ private:
// Define a new application type
// ----------------------------------------------------------------------------
class DnDApp : public wxApp
{
{
public:
bool OnInit();
};
@ -70,7 +70,7 @@ IMPLEMENT_APP(DnDApp);
// Define a new frame type
// ----------------------------------------------------------------------------
class DnDFrame : public wxFrame
{
{
public:
DnDFrame(wxFrame *frame, char *title, int x, int y, int w, int h);
~DnDFrame();
@ -84,9 +84,9 @@ public:
void OnLeftDown(wxMouseEvent& event);
void OnRightDown(wxMouseEvent& event);
bool OnClose();
DECLARE_EVENT_TABLE()
private:
@ -123,10 +123,10 @@ BEGIN_EVENT_TABLE(DnDFrame, wxFrame)
END_EVENT_TABLE()
// `Main program' equivalent, creating windows and returning main app frame
bool DnDApp::OnInit(void)
bool DnDApp::OnInit()
{
// 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);
// 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
SetIcon(wxICON(mondrian));
// const int widths[] = { -1 };
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");
SetMenuBar(menu_bar);
// make a panel with 3 subwindows
wxPoint pos(0, 0);
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_ctrlText = new wxListBox(this, -1, pos, size, 1, &strText, wxLB_HSCROLL);
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
wxTE_MULTILINE | wxTE_READONLY |
m_ctrlLog = new wxTextCtrl(this, -1, "", pos, size,
wxTE_MULTILINE | wxTE_READONLY |
wxSUNKEN_BORDER| wxHSCROLL);
// 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
m_ctrlFile->SetDropTarget(new DnDFile(m_ctrlFile));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
m_ctrlText->SetDropTarget(new DnDText(m_ctrlText));
wxLayoutConstraints *c;
// Top-left listbox
c = new wxLayoutConstraints;
c->left.SameAs (this, wxLeft);
c->top.SameAs (this, wxTop);
c->left.SameAs(this, wxLeft);
c->top.SameAs(this, wxTop);
c->right.PercentOf(this, wxRight, 50);
c->height.PercentOf(this, wxHeight, 40);
m_ctrlFile->SetConstraints(c);
@ -230,7 +230,7 @@ void DnDFrame::OnPaint(wxPaintEvent& /*event*/)
int w = 0;
int h = 0;
GetClientSize( &w, &h );
wxPaintDC dc(this);
dc.SetFont( wxFont( 24, wxDECORATIVE, wxNORMAL, wxNORMAL ) );
dc.DrawText( "Drag text from here!", 20, h-20 );
@ -252,7 +252,7 @@ void DnDFrame::OnDrag(wxCommandEvent& /* event */)
void DnDFrame::OnAbout(wxCommandEvent& /* event */)
{
wxMessageDialog dialog(this,
wxMessageDialog dialog(this,
"Drag-&-Drop Demo\n"
"Please see \"Help|Help...\" for details\n"
"Copyright (c) 1998 Vadim Zeitlin",
@ -263,22 +263,22 @@ void DnDFrame::OnAbout(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"
"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"
"\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"
"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"
"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"
"work with files) and see what changes.\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"
"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"
"\n"
"\n"
@ -291,19 +291,19 @@ void DnDFrame::OnHelp(wxCommandEvent& /* event */)
void DnDFrame::OnLogClear(wxCommandEvent& /* event */ )
{
// m_ctrlLog->Clear();
m_ctrlLog->Clear();
}
bool DnDFrame::OnClose()
{
return TRUE;
bool DnDFrame::OnClose()
{
return TRUE;
}
void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
{
if ( !m_strText.IsEmpty() ) {
// start drag operation
wxTextDataObject data(m_strText);
wxDropSource dragSource(data, this);
const char *pc;
@ -324,11 +324,11 @@ void DnDFrame::OnLeftDown(wxMouseEvent &WXUNUSED(event) )
void DnDFrame::OnRightDown(wxMouseEvent &event )
{
wxMenu *menu = new wxMenu;
menu->Append(Menu_Drag, "&Test drag...");
menu->Append(Menu_About, "&About");
menu->Append(Menu_Quit, "E&xit");
PopupMenu( menu, event.GetX(), event.GetY() );
}
@ -350,7 +350,7 @@ bool DnDText::OnDropText(long, long, const char *psz)
return TRUE;
}
bool DnDFile::OnDropFiles(long, long, size_t nFiles,
bool DnDFile::OnDropFiles(long, long, size_t nFiles,
const char * const aszFiles[])
{
wxString str;

View File

@ -21,6 +21,8 @@
#endif
#include "wx/toolbar.h"
#include <wx/log.h>
#include "test.h"
#if defined(__WXGTK__) || defined(__WXMOTIF__)
@ -38,7 +40,6 @@
IMPLEMENT_APP(MyApp)
// The `main program' equivalent, creating the windows and returning the
// main frame
bool MyApp::OnInit(void)
@ -51,11 +52,7 @@ bool MyApp::OnInit(void)
frame->CreateStatusBar();
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
#else
frame->SetIcon( wxIcon(mondrian_xpm) );
#endif
frame->SetIcon(wxICON(mondrian));
// Make a menubar
wxMenu *fileMenu = new wxMenu;
@ -92,8 +89,6 @@ bool MyApp::OnInit(void)
bool MyApp::InitToolbar(wxToolBar* toolBar)
{
toolBar->SetMargins(5, 5);
// Set up toolbar
wxBitmap* toolBarBitmaps[8];
@ -167,7 +162,7 @@ END_EVENT_TABLE()
// Define my frame constructor
MyFrame::MyFrame(wxFrame* parent, wxWindowID id, const wxString& title, const wxPoint& pos,
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);
}
@ -179,7 +174,10 @@ void MyFrame::OnQuit(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

View File

@ -17,6 +17,17 @@ class MyApp: public wxApp
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
class MyFrame: public wxFrame
{
@ -34,6 +45,8 @@ public:
private:
wxTextCtrl* m_textWindow;
MyTimer m_timer;
DECLARE_EVENT_TABLE()
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -21,19 +21,19 @@
class wxCursorRefData: public wxObjectRefData
{
public:
wxCursorRefData(void);
~wxCursorRefData(void);
wxCursorRefData();
~wxCursorRefData();
GdkCursor *m_cursor;
};
wxCursorRefData::wxCursorRefData(void)
wxCursorRefData::wxCursorRefData()
{
m_cursor = (GdkCursor *) NULL;
}
wxCursorRefData::~wxCursorRefData(void)
wxCursorRefData::~wxCursorRefData()
{
if (m_cursor) gdk_cursor_destroy( m_cursor );
}
@ -44,14 +44,14 @@ wxCursorRefData::~wxCursorRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
wxCursor::wxCursor(void)
wxCursor::wxCursor()
{
}
wxCursor::wxCursor( int cursorId )
{
m_refData = new wxCursorRefData();
GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId)
{
@ -67,12 +67,12 @@ wxCursor::wxCursor( int cursorId )
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
}
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
/*
do that yourself
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_LEFT_BUTTON,
@ -95,7 +95,7 @@ wxCursor::wxCursor( int cursorId )
wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN
*/
}
wxCursor::wxCursor( const wxCursor &cursor )
@ -103,39 +103,33 @@ wxCursor::wxCursor( const wxCursor &cursor )
Ref( cursor );
}
wxCursor::wxCursor( const wxCursor *cursor )
{
UnRef();
if (cursor) Ref( *cursor );
}
wxCursor::~wxCursor(void)
wxCursor::~wxCursor()
{
}
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
if (*this == cursor) return (*this);
Ref( cursor );
return *this;
if (*this == cursor) return (*this);
Ref( cursor );
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);
}
GdkCursor *wxCursor::GetCursor(void) const
GdkCursor *wxCursor::GetCursor() const
{
return M_CURSORDATA->m_cursor;
}
@ -146,7 +140,7 @@ GdkCursor *wxCursor::GetCursor(void) const
bool g_isBusy = FALSE;
void wxEndBusyCursor(void)
void wxEndBusyCursor()
{
g_isBusy = FALSE;
}
@ -156,7 +150,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
g_isBusy = TRUE;
}
bool wxIsBusy(void)
bool wxIsBusy()
{
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 )
{
if (!win->HasVMT()) return;
/*
printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
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 )
{
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
win->m_y = event->y;
return FALSE;
}
@ -130,7 +130,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
long style, const wxString &name )
{
wxTopLevelWindows.Append( this );
m_needParent = FALSE;
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;
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height );
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_FUNC(gtk_frame_configure_callback), (gpointer)this );
if (m_parent) m_parent->AddChild( this );
PostCreation();
return TRUE;
}
@ -187,17 +187,17 @@ wxFrame::~wxFrame()
bool wxFrame::Show( bool show )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (show && !m_sizeSet)
{
// by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate
// handler, because GTK 1.1.X forbids that.
// by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate
// handler, because GTK 1.1.X forbids that.
GtkOnSize( m_x, m_y, m_width, m_height );
}
return wxWindow::Show( show );
}
@ -209,7 +209,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent &event )
bool wxFrame::Destroy()
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
return TRUE;
@ -236,7 +236,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
// Don't do anything for children of wxMDIChildFrame
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_width = m_width;
int old_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{
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 ((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_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 != 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 );
}
if ((m_width != old_width) || (m_height != old_height))
{
gtk_widget_set_usize( m_widget, m_width, m_height );
}
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
@ -304,20 +304,20 @@ void wxFrame::SetSize( int width, int height )
void wxFrame::Centre( int direction )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int x = 0;
int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y );
}
void wxFrame::GetClientSize( int *width, int *height ) const
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxWindow::GetClientSize( width, height );
if (height)
{
@ -340,7 +340,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const
void wxFrame::SetClientSize( int const width, int const height )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int h = height;
if (m_frameMenuBar) h += wxMENU_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;
m_resizing = TRUE;
if (!m_wxwindow) return;
m_width = width;
m_height = height;
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_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height );
// this emulates the new wxMSW behaviour of placing all
// frame-subwindows (menu, toolbar..) on one native window
// 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.
if (m_frameMenuBar)
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww;
m_frameMenuBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
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)
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int yy = m_miniEdge + m_miniTitle;
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;
m_frameToolBar->m_x = xx;
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
m_frameToolBar->m_height = hh;
m_frameToolBar->m_width = ww;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
}
if (m_frameStatusBar)
{
int xx = 0 + m_miniEdge;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT;
m_frameStatusBar->m_x = xx;
m_frameStatusBar->m_y = yy;
m_frameStatusBar->m_width = ww;
m_frameStatusBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
}
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
@ -440,23 +440,23 @@ void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
if (!m_sizeSet)
GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates();
}
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (GetAutoLayout())
{
Layout();
}
else
else
{
// no child: go out !
if (!GetChildren().First()) return;
// do we have exactly one child?
wxWindow *child = (wxWindow *) NULL;
for(wxNode *node = GetChildren().First(); node; node = node->Next())
@ -470,7 +470,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
#endif
)
{
// it's the second one: do nothing
// it's the second one: do nothing
if (child) return;
child = win;
}
@ -500,9 +500,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
m_frameMenuBar = menuBar;
if (m_frameMenuBar)
{
wxNode *node = m_frameMenuBar->m_menus.First();
@ -512,7 +512,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
SetInvokingWindow( menu, this );
node = node->Next();
}
if (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 );
}
}
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
}
wxMenuBar *wxFrame::GetMenuBar(void) const
wxMenuBar *wxFrame::GetMenuBar() const
{
return m_frameMenuBar;
}
@ -532,15 +532,15 @@ wxMenuBar *wxFrame::GetMenuBar(void) const
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
m_frameToolBar = OnCreateToolBar( style, id, name );
GetChildren().DeleteObject( m_frameToolBar );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
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 );
}
wxToolBar *wxFrame::GetToolBar(void) const
{
return m_frameToolBar;
wxToolBar *wxFrame::GetToolBar() const
{
return m_frameToolBar;
}
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
return m_frameStatusBar;
}
wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{
wxStatusBar *statusBar = (wxStatusBar *) NULL;
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
// Set the height according to the font and the border size
wxClientDC dc(statusBar);
dc.SetFont( *statusBar->GetFont() );
dc.SetFont( statusBar->GetFont() );
long 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)
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
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[] )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
m_frameStatusBar->SetStatusWidths(n, widths_field);
}
wxStatusBar *wxFrame::GetStatusBar(void) const
wxStatusBar *wxFrame::GetStatusBar() const
{
return m_frameStatusBar;
}
@ -614,7 +614,7 @@ wxStatusBar *wxFrame::GetStatusBar(void) const
void wxFrame::SetTitle( const wxString &title )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_title = title;
if (m_title.IsNull()) m_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 )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_icon = icon;
if (!icon.Ok()) return;
wxMask *mask = icon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap();
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -86,14 +86,14 @@
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
can find in m_widget (defined in wxWindow)
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
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 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
represents the client area, must be in the m_wxwindow field and must be of
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
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
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
the type GtkMyFixed.
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_blockEventsOnScroll) 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 page_step = win->m_hAdjust->page_increment;
if (win->m_isScrolling)
{
command = wxEVT_SCROLL_THUMBTRACK;
@ -839,12 +839,12 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
// "button_press_event" from scrollbar
//-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
// if (gdk_event->window != widget->slider) return FALSE;
win->m_isScrolling = TRUE;
g_blockEventsOnScroll = TRUE;
@ -855,8 +855,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
// "button_release_event" from scrollbar
//-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
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
// 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
// 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),
@ -891,13 +891,13 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width,
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width,
child->m_height );
}
@ -920,7 +920,7 @@ wxWindow::wxWindow()
m_wxwindow = (GtkWidget *) NULL;
m_parent = (wxWindow *) NULL;
m_children.DeleteContents( FALSE );
m_x = 0;
m_y = 0;
m_width = 0;
@ -929,46 +929,46 @@ wxWindow::wxWindow()
m_minHeight = -1;
m_maxWidth = -1;
m_maxHeight = -1;
m_retCode = 0;
m_eventHandler = this;
m_windowValidator = (wxValidator *) NULL;
m_windowId = -1;
m_cursor = (wxCursor *) NULL;
m_font = *wxSWISS_FONT;
m_windowStyle = 0;
m_windowName = "noname";
m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE;
m_sizeSet = FALSE;
m_hasVMT = FALSE;
m_needParent = TRUE;
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL;
m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget*) NULL;
m_resizing = FALSE;
m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
m_insertCallback = wxInsertChildInWindow;
m_clientObject = (wxClientData*) NULL;
m_clientData = NULL;
}
@ -980,7 +980,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
m_insertCallback = wxInsertChildInWindow;
Create( parent, id, pos, size, style, name );
}
bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
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
// such as motion events and prevent GTK and wxWindows from fighting
// over where the slider should be
gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event",
(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",
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
// these handers het notified when screen updates are required either when
// scrolling or when the window size (and therefore scrollbar configuration)
// has changed
@ -1086,13 +1086,13 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
gtk_widget_show( m_wxwindow );
if (m_parent) m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
PostCreation();
Show( TRUE );
return TRUE;
@ -1110,13 +1110,13 @@ wxWindow::~wxWindow()
DestroyChildren();
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
if (m_widget) gtk_widget_destroy( m_widget );
if (m_cursor) delete m_cursor;
DeleteRelatedConstraints();
@ -1147,7 +1147,7 @@ wxWindow::~wxWindow()
wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
if (m_clientObject) delete m_clientObject;
}
@ -1157,21 +1157,21 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
{
if (m_needParent && (parent == NULL))
wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL;
m_hasVMT = FALSE;
m_parent = parent;
m_children.DeleteContents( FALSE );
m_width = size.x;
if (m_width == -1) m_width = 20;
m_height = size.y;
if (m_height == -1) m_height = 20;
m_x = (int)pos.x;
m_y = (int)pos.y;
if (!m_needParent) // some reasonable defaults
{
if (m_x == -1)
@ -1185,49 +1185,49 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
if (m_y < 10) m_y = 10;
}
}
m_minWidth = -1;
m_minHeight = -1;
m_maxWidth = -1;
m_maxHeight = -1;
m_retCode = 0;
m_eventHandler = this;
m_windowId = id == -1 ? wxNewId() : id;
m_sizeSet = FALSE;
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE;
// m_foregroundColour = wxBLACK;
m_windowStyle = style;
m_windowName = name;
m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE;
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment *) NULL;
m_vAdjust = (GtkAdjustment *) NULL;
m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL;
m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
m_clientObject = (wxClientData*)NULL;
m_clientData = NULL;
}
@ -1336,7 +1336,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags )
if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
{
wxPoint pt(GetParent()->GetClientAreaOrigin());
x += pt.x;
x += pt.x;
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_parent != NULL), "wxWindow::SetSize requires parent.\n" );
if (m_resizing) return; // I don't like recursions
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_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{
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 ((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_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() );
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))
gtk_widget_set_usize( m_widget, m_width, m_height );
}
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
@ -1457,7 +1457,7 @@ void wxWindow::SetClientSize( int width, int height )
#ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child;
#else
#else
GtkWidget *viewport = scroll_window->viewport;
#endif
@ -1522,7 +1522,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
#ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child;
#else
#else
GtkWidget *viewport = scroll_window->viewport;
#endif
@ -1589,7 +1589,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
wxPoint pt(GetClientAreaOrigin());
org_x += pt.x;
org_y += pt.y;
if (x) *x += org_x;
if (y) *y += org_y;
}
@ -1620,7 +1620,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
wxPoint pt(GetClientAreaOrigin());
org_x -= pt.x;
org_y -= pt.y;
if (x) *x -= org_x;
if (y) *y -= org_y;
}
@ -1631,7 +1631,7 @@ void wxWindow::Centre( int direction )
int x = m_x;
int y = m_y;
if (m_parent)
{
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 & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
}
Move( x, y );
}
@ -1655,7 +1655,7 @@ void wxWindow::Fit()
int maxX = 0;
int maxY = 0;
wxNode *node = m_childrenFirst();
wxNode *node = m_children.First();
while ( node )
{
wxWindow *win = (wxWindow *)node->Data();
@ -1803,25 +1803,20 @@ void wxWindow::AddChild( wxWindow *child )
m_children.Append( child );
}
wxList& wxWindow::GetChildren() const
{
return m_children;
}
wxWindow *wxWindow::ReParent( wxWindow *newParent )
{
wxWindow *oldParent = GetParent();
if (oldParent) oldParent->RemoveChild( this );
gtk_widget_unparent( m_widget );
if (newParent)
{
newParent->AddChild( this );
(newParent->m_insertCallback)( newParent, this );
}
return oldParent;
}
@ -1855,7 +1850,7 @@ void wxWindow::Lower()
if (m_widget) gdk_window_lower( m_widget->window );
}
wxEvtHandler *wxWindow::GetEventHandler()
wxEvtHandler *wxWindow::GetEventHandler() const
{
return m_eventHandler;
}
@ -1934,7 +1929,7 @@ void wxWindow::SetId( wxWindowID id )
m_windowId = id;
}
wxWindowID wxWindow::GetId()
wxWindowID wxWindow::GetId() const
{
return m_windowId;
}
@ -1951,7 +1946,8 @@ void wxWindow::SetCursor( const wxCursor &cursor )
if (cursor.Ok())
{
if (*((wxCursor*)&cursor) == m_cursor) return;
if ( cursor == *m_cursor )
return;
*m_cursor = cursor;
}
else
@ -2054,13 +2050,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_backgroundColour == colour) return;
if (!m_backgroundColour.Ok())
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return;
if (m_wxwindow)
{
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_clear( window );
}
ApplyWidgetStyle();
}
@ -2082,31 +2078,31 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_foregroundColour == colour) return;
m_foregroundColour = colour;
if (!m_foregroundColour.Ok()) return;
ApplyWidgetStyle();
}
GtkStyle *wxWindow::GetWidgetStyle()
{
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
m_widgetStyle =
gtk_style_copy(
m_widgetStyle =
gtk_style_copy(
gtk_widget_get_style( m_widget ) );
return m_widgetStyle;
}
void wxWindow::SetWidgetStyle()
{
GtkStyle *style = GetWidgetStyle();
gdk_font_unref( style->font );
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
if (m_foregroundColour.Ok())
{
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_ACTIVE] = *m_foregroundColour.GetColor();
}
if (m_backgroundColour.Ok())
{
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( menu != NULL, FALSE, "invalid popup-menu" );
SetInvokingWindow( menu, this );
gtk_menu_popup(
GTK_MENU(menu->m_menu),
@ -2274,13 +2270,8 @@ void wxWindow::SetFont( const wxFont &font )
m_font = font;
else
m_font = *wxSWISS_FONT;
ApplyWidgetStyle();
}
wxFont *wxWindow::GetFont()
{
return &m_font;
ApplyWidgetStyle();
}
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" );
if (!m_wxwindow) return;
m_hasScrolling = TRUE;
if (orient == wxHORIZONTAL)
@ -2556,13 +2547,13 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
int d_y = 0;
if (dx > 0) d_x = dx;
if (dy > 0) d_y = dy;
if (!m_scrollGC)
{
m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE );
}
gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
m_wxwindow->window, s_x, s_y, w, h );
@ -2795,7 +2786,7 @@ bool wxWindow::DoPhase(int phase)
{
noChanges = 0;
noFailures = 0;
wxNode *node = m_children.first();
wxNode *node = m_children.First();
while (node)
{
wxWindow *child = (wxWindow *)node->Data();

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@
// Author: Robert Roebling
// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -21,19 +21,19 @@
class wxCursorRefData: public wxObjectRefData
{
public:
wxCursorRefData(void);
~wxCursorRefData(void);
wxCursorRefData();
~wxCursorRefData();
GdkCursor *m_cursor;
};
wxCursorRefData::wxCursorRefData(void)
wxCursorRefData::wxCursorRefData()
{
m_cursor = (GdkCursor *) NULL;
}
wxCursorRefData::~wxCursorRefData(void)
wxCursorRefData::~wxCursorRefData()
{
if (m_cursor) gdk_cursor_destroy( m_cursor );
}
@ -44,14 +44,14 @@ wxCursorRefData::~wxCursorRefData(void)
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
wxCursor::wxCursor(void)
wxCursor::wxCursor()
{
}
wxCursor::wxCursor( int cursorId )
{
m_refData = new wxCursorRefData();
GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId)
{
@ -67,12 +67,12 @@ wxCursor::wxCursor( int cursorId )
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
}
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
/*
do that yourself
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_LEFT_BUTTON,
@ -95,7 +95,7 @@ wxCursor::wxCursor( int cursorId )
wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN
*/
}
wxCursor::wxCursor( const wxCursor &cursor )
@ -103,39 +103,33 @@ wxCursor::wxCursor( const wxCursor &cursor )
Ref( cursor );
}
wxCursor::wxCursor( const wxCursor *cursor )
{
UnRef();
if (cursor) Ref( *cursor );
}
wxCursor::~wxCursor(void)
wxCursor::~wxCursor()
{
}
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
if (*this == cursor) return (*this);
Ref( cursor );
return *this;
if (*this == cursor) return (*this);
Ref( cursor );
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);
}
GdkCursor *wxCursor::GetCursor(void) const
GdkCursor *wxCursor::GetCursor() const
{
return M_CURSORDATA->m_cursor;
}
@ -146,7 +140,7 @@ GdkCursor *wxCursor::GetCursor(void) const
bool g_isBusy = FALSE;
void wxEndBusyCursor(void)
void wxEndBusyCursor()
{
g_isBusy = FALSE;
}
@ -156,7 +150,7 @@ void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
g_isBusy = TRUE;
}
bool wxIsBusy(void)
bool wxIsBusy()
{
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 )
{
if (!win->HasVMT()) return;
/*
printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
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 )
{
if (!win->HasVMT()) return FALSE;
win->m_x = event->x;
win->m_y = event->y;
return FALSE;
}
@ -130,7 +130,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
long style, const wxString &name )
{
wxTopLevelWindows.Append( this );
m_needParent = FALSE;
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;
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height );
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_FUNC(gtk_frame_configure_callback), (gpointer)this );
if (m_parent) m_parent->AddChild( this );
PostCreation();
return TRUE;
}
@ -187,17 +187,17 @@ wxFrame::~wxFrame()
bool wxFrame::Show( bool show )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (show && !m_sizeSet)
{
// by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate
// handler, because GTK 1.1.X forbids that.
// by calling GtkOnSize here, we don't have to call
// either after showing the frame, which would entail
// much ugly flicker nor from within the size_allocate
// handler, because GTK 1.1.X forbids that.
GtkOnSize( m_x, m_y, m_width, m_height );
}
return wxWindow::Show( show );
}
@ -209,7 +209,7 @@ void wxFrame::OnCloseWindow( wxCloseEvent &event )
bool wxFrame::Destroy()
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (!wxPendingDelete.Member(this)) wxPendingDelete.Append(this);
return TRUE;
@ -236,7 +236,7 @@ wxPoint wxFrame::GetClientAreaOrigin() const
void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
// Don't do anything for children of wxMDIChildFrame
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_width = m_width;
int old_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{
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 ((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_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 != 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 );
}
if ((m_width != old_width) || (m_height != old_height))
{
gtk_widget_set_usize( m_widget, m_width, m_height );
}
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
@ -304,20 +304,20 @@ void wxFrame::SetSize( int width, int height )
void wxFrame::Centre( int direction )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int x = 0;
int y = 0;
if (direction & wxHORIZONTAL == wxHORIZONTAL) x = (gdk_screen_width () - m_width) / 2;
if (direction & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
Move( x, y );
}
void wxFrame::GetClientSize( int *width, int *height ) const
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxWindow::GetClientSize( width, height );
if (height)
{
@ -340,7 +340,7 @@ void wxFrame::GetClientSize( int *width, int *height ) const
void wxFrame::SetClientSize( int const width, int const height )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
int h = height;
if (m_frameMenuBar) h += wxMENU_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;
m_resizing = TRUE;
if (!m_wxwindow) return;
m_width = width;
m_height = height;
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_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height );
// this emulates the new wxMSW behaviour of placing all
// frame-subwindows (menu, toolbar..) on one native window
// 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.
if (m_frameMenuBar)
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
int yy = m_miniEdge + m_miniTitle;
int ww = m_width - 2*m_miniEdge;
int hh = wxMENU_HEIGHT;
m_frameMenuBar->m_x = xx;
m_frameMenuBar->m_y = yy;
m_frameMenuBar->m_width = ww;
m_frameMenuBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
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)
{
int xx = m_miniEdge;
int yy = m_miniEdge + m_miniTitle;
int yy = m_miniEdge + m_miniTitle;
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;
m_frameToolBar->m_x = xx;
m_frameToolBar->m_x = xx;
m_frameToolBar->m_y = yy;
m_frameToolBar->m_height = hh;
m_frameToolBar->m_width = ww;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameToolBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameToolBar->m_widget, ww, hh );
}
if (m_frameStatusBar)
{
int xx = 0 + m_miniEdge;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT;
int yy = m_height - wxSTATUS_HEIGHT - m_miniEdge;
int ww = m_width - 2*m_miniEdge;
int hh = wxSTATUS_HEIGHT;
m_frameStatusBar->m_x = xx;
m_frameStatusBar->m_y = yy;
m_frameStatusBar->m_width = ww;
m_frameStatusBar->m_height = hh;
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, xx, yy );
gtk_widget_set_usize( m_frameStatusBar->m_widget, ww, hh );
}
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
@ -440,23 +440,23 @@ void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
if (!m_sizeSet)
GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates();
}
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (GetAutoLayout())
{
Layout();
}
else
else
{
// no child: go out !
if (!GetChildren().First()) return;
// do we have exactly one child?
wxWindow *child = (wxWindow *) NULL;
for(wxNode *node = GetChildren().First(); node; node = node->Next())
@ -470,7 +470,7 @@ void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
#endif
)
{
// it's the second one: do nothing
// it's the second one: do nothing
if (child) return;
child = win;
}
@ -500,9 +500,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxASSERT_MSG( (m_wxwindow != NULL), "invalid frame" );
m_frameMenuBar = menuBar;
if (m_frameMenuBar)
{
wxNode *node = m_frameMenuBar->m_menus.First();
@ -512,7 +512,7 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
SetInvokingWindow( menu, this );
node = node->Next();
}
if (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 );
}
}
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
}
wxMenuBar *wxFrame::GetMenuBar(void) const
wxMenuBar *wxFrame::GetMenuBar() const
{
return m_frameMenuBar;
}
@ -532,15 +532,15 @@ wxMenuBar *wxFrame::GetMenuBar(void) const
wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameToolBar == NULL, FALSE, "recreating toolbar in wxFrame" );
m_frameToolBar = OnCreateToolBar( style, id, name );
GetChildren().DeleteObject( m_frameToolBar );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
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 );
}
wxToolBar *wxFrame::GetToolBar(void) const
{
return m_frameToolBar;
wxToolBar *wxFrame::GetToolBar() const
{
return m_frameToolBar;
}
wxStatusBar* wxFrame::CreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, "recreating status bar in wxFrame" );
m_frameStatusBar = OnCreateStatusBar( number, style, id, name );
if (m_sizeSet) GtkOnSize( m_x, m_y, m_width, m_height );
return m_frameStatusBar;
}
wxStatusBar *wxFrame::OnCreateStatusBar( int number, long style, wxWindowID id, const wxString& name )
{
wxStatusBar *statusBar = (wxStatusBar *) NULL;
statusBar = new wxStatusBar(this, id, wxPoint(0, 0), wxSize(100, 20), style, name);
// Set the height according to the font and the border size
wxClientDC dc(statusBar);
dc.SetFont( *statusBar->GetFont() );
dc.SetFont( statusBar->GetFont() );
long 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)
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" );
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[] )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" );
m_frameStatusBar->SetStatusWidths(n, widths_field);
}
wxStatusBar *wxFrame::GetStatusBar(void) const
wxStatusBar *wxFrame::GetStatusBar() const
{
return m_frameStatusBar;
}
@ -614,7 +614,7 @@ wxStatusBar *wxFrame::GetStatusBar(void) const
void wxFrame::SetTitle( const wxString &title )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_title = title;
if (m_title.IsNull()) m_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 )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
m_icon = icon;
if (!icon.Ok()) return;
wxMask *mask = icon.GetMask();
GdkBitmap *bm = (GdkBitmap *) NULL;
if (mask) bm = mask->GetBitmap();
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -86,14 +86,14 @@
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
can find in m_widget (defined in wxWindow)
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
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 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
represents the client area, must be in the m_wxwindow field and must be of
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
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
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
the type GtkMyFixed.
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_blockEventsOnScroll) 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 page_step = win->m_hAdjust->page_increment;
if (win->m_isScrolling)
{
command = wxEVT_SCROLL_THUMBTRACK;
@ -839,12 +839,12 @@ static void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxW
// "button_press_event" from scrollbar
//-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
GdkEventButton *WXUNUSED(gdk_event),
wxWindow *win )
{
// if (gdk_event->window != widget->slider) return FALSE;
win->m_isScrolling = TRUE;
g_blockEventsOnScroll = TRUE;
@ -855,8 +855,8 @@ static gint gtk_scrollbar_button_press_callback( GtkRange *WXUNUSED(widget),
// "button_release_event" from scrollbar
//-----------------------------------------------------------------------------
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
GdkEventButton *WXUNUSED(gdk_event),
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
// 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
// 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),
@ -891,13 +891,13 @@ static gint gtk_scrollbar_button_release_callback( GtkRange *widget,
static void wxInsertChildInWindow( wxWindow* parent, wxWindow* child )
{
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
gtk_myfixed_put( GTK_MYFIXED(parent->m_wxwindow),
GTK_WIDGET(child->m_widget),
child->m_x,
child->m_y );
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width,
gtk_widget_set_usize( GTK_WIDGET(child->m_widget),
child->m_width,
child->m_height );
}
@ -920,7 +920,7 @@ wxWindow::wxWindow()
m_wxwindow = (GtkWidget *) NULL;
m_parent = (wxWindow *) NULL;
m_children.DeleteContents( FALSE );
m_x = 0;
m_y = 0;
m_width = 0;
@ -929,46 +929,46 @@ wxWindow::wxWindow()
m_minHeight = -1;
m_maxWidth = -1;
m_maxHeight = -1;
m_retCode = 0;
m_eventHandler = this;
m_windowValidator = (wxValidator *) NULL;
m_windowId = -1;
m_cursor = (wxCursor *) NULL;
m_font = *wxSWISS_FONT;
m_windowStyle = 0;
m_windowName = "noname";
m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE;
m_sizeSet = FALSE;
m_hasVMT = FALSE;
m_needParent = TRUE;
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment*) NULL;
m_vAdjust = (GtkAdjustment*) NULL;
m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget*) NULL;
m_resizing = FALSE;
m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
m_insertCallback = wxInsertChildInWindow;
m_clientObject = (wxClientData*) NULL;
m_clientData = NULL;
}
@ -980,7 +980,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
m_insertCallback = wxInsertChildInWindow;
Create( parent, id, pos, size, style, name );
}
bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
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
// such as motion events and prevent GTK and wxWindows from fighting
// over where the slider should be
gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event",
(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",
(GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
// these handers het notified when screen updates are required either when
// scrolling or when the window size (and therefore scrollbar configuration)
// has changed
@ -1086,13 +1086,13 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
(GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
gtk_widget_show( m_wxwindow );
if (m_parent) m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
PostCreation();
Show( TRUE );
return TRUE;
@ -1110,13 +1110,13 @@ wxWindow::~wxWindow()
DestroyChildren();
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
if (m_widget) gtk_widget_destroy( m_widget );
if (m_cursor) delete m_cursor;
DeleteRelatedConstraints();
@ -1147,7 +1147,7 @@ wxWindow::~wxWindow()
wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
if (m_clientObject) delete m_clientObject;
}
@ -1157,21 +1157,21 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
{
if (m_needParent && (parent == NULL))
wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget*) NULL;
m_wxwindow = (GtkWidget*) NULL;
m_hasVMT = FALSE;
m_parent = parent;
m_children.DeleteContents( FALSE );
m_width = size.x;
if (m_width == -1) m_width = 20;
m_height = size.y;
if (m_height == -1) m_height = 20;
m_x = (int)pos.x;
m_y = (int)pos.y;
if (!m_needParent) // some reasonable defaults
{
if (m_x == -1)
@ -1185,49 +1185,49 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
if (m_y < 10) m_y = 10;
}
}
m_minWidth = -1;
m_minHeight = -1;
m_maxWidth = -1;
m_maxHeight = -1;
m_retCode = 0;
m_eventHandler = this;
m_windowId = id == -1 ? wxNewId() : id;
m_sizeSet = FALSE;
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE;
// m_foregroundColour = wxBLACK;
m_windowStyle = style;
m_windowName = name;
m_constraints = (wxLayoutConstraints *) NULL;
m_constraintsInvolvedIn = (wxList *) NULL;
m_windowSizer = (wxSizer *) NULL;
m_sizerParent = (wxWindow *) NULL;
m_autoLayout = FALSE;
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
m_hAdjust = (GtkAdjustment *) NULL;
m_vAdjust = (GtkAdjustment *) NULL;
m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL;
m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
m_clientObject = (wxClientData*)NULL;
m_clientData = NULL;
}
@ -1336,7 +1336,7 @@ void wxWindow::AdjustForParentClientOrigin( int& x, int& y, int sizeFlags )
if (((sizeFlags & wxSIZE_NO_ADJUSTMENTS) == 0) && GetParent())
{
wxPoint pt(GetParent()->GetClientAreaOrigin());
x += pt.x;
x += pt.x;
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_parent != NULL), "wxWindow::SetSize requires parent.\n" );
if (m_resizing) return; // I don't like recursions
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_height = m_height;
if ((sizeFlags & wxSIZE_USE_EXISTING) == wxSIZE_USE_EXISTING)
{
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 ((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_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() );
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))
gtk_widget_set_usize( m_widget, m_width, m_height );
}
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
@ -1457,7 +1457,7 @@ void wxWindow::SetClientSize( int width, int height )
#ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child;
#else
#else
GtkWidget *viewport = scroll_window->viewport;
#endif
@ -1522,7 +1522,7 @@ void wxWindow::GetClientSize( int *width, int *height ) const
#ifdef NEW_GTK_SCROLL_CODE
GtkWidget *viewport = scroll_window->child;
#else
#else
GtkWidget *viewport = scroll_window->viewport;
#endif
@ -1589,7 +1589,7 @@ void wxWindow::ClientToScreen( int *x, int *y )
wxPoint pt(GetClientAreaOrigin());
org_x += pt.x;
org_y += pt.y;
if (x) *x += org_x;
if (y) *y += org_y;
}
@ -1620,7 +1620,7 @@ void wxWindow::ScreenToClient( int *x, int *y )
wxPoint pt(GetClientAreaOrigin());
org_x -= pt.x;
org_y -= pt.y;
if (x) *x -= org_x;
if (y) *y -= org_y;
}
@ -1631,7 +1631,7 @@ void wxWindow::Centre( int direction )
int x = m_x;
int y = m_y;
if (m_parent)
{
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 & wxVERTICAL == wxVERTICAL) y = (gdk_screen_height () - m_height) / 2;
}
Move( x, y );
}
@ -1655,7 +1655,7 @@ void wxWindow::Fit()
int maxX = 0;
int maxY = 0;
wxNode *node = m_childrenFirst();
wxNode *node = m_children.First();
while ( node )
{
wxWindow *win = (wxWindow *)node->Data();
@ -1803,25 +1803,20 @@ void wxWindow::AddChild( wxWindow *child )
m_children.Append( child );
}
wxList& wxWindow::GetChildren() const
{
return m_children;
}
wxWindow *wxWindow::ReParent( wxWindow *newParent )
{
wxWindow *oldParent = GetParent();
if (oldParent) oldParent->RemoveChild( this );
gtk_widget_unparent( m_widget );
if (newParent)
{
newParent->AddChild( this );
(newParent->m_insertCallback)( newParent, this );
}
return oldParent;
}
@ -1855,7 +1850,7 @@ void wxWindow::Lower()
if (m_widget) gdk_window_lower( m_widget->window );
}
wxEvtHandler *wxWindow::GetEventHandler()
wxEvtHandler *wxWindow::GetEventHandler() const
{
return m_eventHandler;
}
@ -1934,7 +1929,7 @@ void wxWindow::SetId( wxWindowID id )
m_windowId = id;
}
wxWindowID wxWindow::GetId()
wxWindowID wxWindow::GetId() const
{
return m_windowId;
}
@ -1951,7 +1946,8 @@ void wxWindow::SetCursor( const wxCursor &cursor )
if (cursor.Ok())
{
if (*((wxCursor*)&cursor) == m_cursor) return;
if ( cursor == *m_cursor )
return;
*m_cursor = cursor;
}
else
@ -2054,13 +2050,13 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_backgroundColour == colour) return;
if (!m_backgroundColour.Ok())
if (wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE ) == colour) return;
m_backgroundColour = colour;
if (!m_backgroundColour.Ok()) return;
if (m_wxwindow)
{
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_clear( window );
}
ApplyWidgetStyle();
}
@ -2082,31 +2078,31 @@ void wxWindow::SetForegroundColour( const wxColour &colour )
wxCHECK_RET( m_widget != NULL, "invalid window" );
if (m_foregroundColour == colour) return;
m_foregroundColour = colour;
if (!m_foregroundColour.Ok()) return;
ApplyWidgetStyle();
}
GtkStyle *wxWindow::GetWidgetStyle()
{
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
m_widgetStyle =
gtk_style_copy(
m_widgetStyle =
gtk_style_copy(
gtk_widget_get_style( m_widget ) );
return m_widgetStyle;
}
void wxWindow::SetWidgetStyle()
{
GtkStyle *style = GetWidgetStyle();
gdk_font_unref( style->font );
style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
if (m_foregroundColour.Ok())
{
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_ACTIVE] = *m_foregroundColour.GetColor();
}
if (m_backgroundColour.Ok())
{
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( menu != NULL, FALSE, "invalid popup-menu" );
SetInvokingWindow( menu, this );
gtk_menu_popup(
GTK_MENU(menu->m_menu),
@ -2274,13 +2270,8 @@ void wxWindow::SetFont( const wxFont &font )
m_font = font;
else
m_font = *wxSWISS_FONT;
ApplyWidgetStyle();
}
wxFont *wxWindow::GetFont()
{
return &m_font;
ApplyWidgetStyle();
}
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" );
if (!m_wxwindow) return;
m_hasScrolling = TRUE;
if (orient == wxHORIZONTAL)
@ -2556,13 +2547,13 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) )
int d_y = 0;
if (dx > 0) d_x = dx;
if (dy > 0) d_y = dy;
if (!m_scrollGC)
{
m_scrollGC = gdk_gc_new( m_wxwindow->window );
gdk_gc_set_exposures( m_scrollGC, TRUE );
}
gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y,
m_wxwindow->window, s_x, s_y, w, h );
@ -2795,7 +2786,7 @@ bool wxWindow::DoPhase(int phase)
{
noChanges = 0;
noFailures = 0;
wxNode *node = m_children.first();
wxNode *node = m_children.First();
while (node)
{
wxWindow *child = (wxWindow *)node->Data();

View File

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