wxWindowDC compiles (wxGTK doesn't link yet because of dcpsg.cpp problems...)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -395,10 +395,10 @@ public:
|
|||||||
if ( x ) *x = m_userScaleX;
|
if ( x ) *x = m_userScaleX;
|
||||||
if ( y ) *y = m_userScaleY;
|
if ( y ) *y = m_userScaleY;
|
||||||
}
|
}
|
||||||
|
void SetSystemScale(double x, double y)
|
||||||
|
{ SetUserScale(x, y); }
|
||||||
virtual void SetUserScale(double x, double y) = 0;
|
virtual void SetUserScale(double x, double y) = 0;
|
||||||
|
|
||||||
virtual void SetSystemScale(double x, double y) = 0;
|
|
||||||
|
|
||||||
virtual void GetLogicalScale(double *x, double *y)
|
virtual void GetLogicalScale(double *x, double *y)
|
||||||
{
|
{
|
||||||
if ( x ) *x = m_logicalScaleX;
|
if ( x ) *x = m_logicalScaleX;
|
||||||
@@ -509,8 +509,11 @@ protected:
|
|||||||
virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
|
virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
|
||||||
virtual void DoSetClippingRegion(long x, long y,
|
virtual void DoSetClippingRegion(long x, long y,
|
||||||
long width, long height) = 0;
|
long width, long height) = 0;
|
||||||
|
|
||||||
|
// FIXME are these functions really different?
|
||||||
virtual void DoGetClippingRegion(long *x, long *y,
|
virtual void DoGetClippingRegion(long *x, long *y,
|
||||||
long *width, long *height) = 0;
|
long *w, long *h)
|
||||||
|
{ DoGetClippingBox(x, y, w, h); }
|
||||||
virtual void DoGetClippingBox(long *x, long *y,
|
virtual void DoGetClippingBox(long *x, long *y,
|
||||||
long *w, long *h) const
|
long *w, long *h) const
|
||||||
{
|
{
|
||||||
|
@@ -142,8 +142,6 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// GTK-specific member variables
|
// GTK-specific member variables
|
||||||
|
|
||||||
int m_textAlignment; // gone in wxWin 2.0 ?
|
|
||||||
|
|
||||||
// not sure what for, but what is a mm on a screen you don't know the size
|
// not sure what for, but what is a mm on a screen you don't know the size
|
||||||
// of?
|
// of?
|
||||||
double m_mm_to_pix_x,
|
double m_mm_to_pix_x,
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKDCCLIENTH__
|
#ifndef __GTKDCCLIENTH__
|
||||||
#define __GTKDCCLIENTH__
|
#define __GTKDCCLIENTH__
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ class wxClientDC;
|
|||||||
// wxWindowDC
|
// wxWindowDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxWindowDC: public wxDC
|
class wxWindowDC : public wxDC
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
||||||
|
|
||||||
@@ -40,39 +39,46 @@ public:
|
|||||||
|
|
||||||
~wxWindowDC();
|
~wxWindowDC();
|
||||||
|
|
||||||
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
|
virtual bool CanDrawBitmap() const { return TRUE; }
|
||||||
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
|
virtual bool CanGetTextExtent() const { return TRUE; }
|
||||||
|
|
||||||
virtual void DrawLine( long x1, long y1, long x2, long y2 );
|
virtual void DoFloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
|
||||||
virtual void CrossHair( long x, long y );
|
virtual bool DoGetPixel( long x1, long y1, wxColour *col ) const;
|
||||||
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long 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 DoDrawLine( long x1, long y1, long x2, long y2 );
|
||||||
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
|
virtual void DoCrossHair( long x, long y );
|
||||||
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
|
virtual void DoDrawArc( long x1, long y1, long x2, long y2,
|
||||||
int fillStyle=wxODDEVEN_RULE );
|
long xc, long yc );
|
||||||
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
|
virtual void DoDrawEllipticArc( long x, long y, long width, long height,
|
||||||
int fillStyle=wxODDEVEN_RULE );
|
double sa, double ea );
|
||||||
|
virtual void DoDrawPoint( long x, long y );
|
||||||
|
|
||||||
virtual void DrawRectangle( long x, long y, long width, long height );
|
virtual void DoDrawLines(int n, wxPoint points[],
|
||||||
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
|
long xoffset, long yoffset);
|
||||||
virtual void DrawEllipse( long x, long y, long width, long height );
|
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||||
|
long xoffset, long yoffset,
|
||||||
|
int fillStyle = wxODDEVEN_RULE);
|
||||||
|
|
||||||
virtual bool CanDrawBitmap() const;
|
virtual void DoDrawRectangle( long x, long y, long width, long height );
|
||||||
virtual void DrawIcon( const wxIcon &icon, long x, long y );
|
virtual void DoDrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
|
||||||
virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE );
|
virtual void DoDrawEllipse( long x, long y, long width, long height );
|
||||||
virtual bool Blit( long xdest, long ydest, long width, long height,
|
|
||||||
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
|
|
||||||
|
|
||||||
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
|
virtual void DoDrawIcon( const wxIcon &icon, long x, long y );
|
||||||
virtual bool CanGetTextExtent() const;
|
virtual void DoDrawBitmap( const wxBitmap &bitmap, long x, long y,
|
||||||
virtual void GetTextExtent( const wxString &string, long *width, long *height,
|
bool useMask = FALSE );
|
||||||
long *descent = (long *) NULL, long *externalLeading = (long *) NULL,
|
|
||||||
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE );
|
virtual bool DoBlit( long xdest, long ydest, long width, long height,
|
||||||
virtual long GetCharWidth();
|
wxDC *source, long xsrc, long ysrc,
|
||||||
virtual long GetCharHeight();
|
int logical_func = wxCOPY, bool useMask = FALSE );
|
||||||
|
|
||||||
|
virtual void DoDrawText( const wxString &text, long x, long y );
|
||||||
|
virtual void GetTextExtent( const wxString &string,
|
||||||
|
long *width, long *height,
|
||||||
|
long *descent = (long *) NULL,
|
||||||
|
long *externalLeading = (long *) NULL,
|
||||||
|
wxFont *theFont = (wxFont *) NULL) const;
|
||||||
|
virtual long GetCharWidth() const;
|
||||||
|
virtual long GetCharHeight() const;
|
||||||
|
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
@@ -86,16 +92,18 @@ public:
|
|||||||
virtual void SetBackgroundMode( int mode );
|
virtual void SetBackgroundMode( int mode );
|
||||||
virtual void SetPalette( const wxPalette& palette );
|
virtual void SetPalette( const wxPalette& palette );
|
||||||
|
|
||||||
virtual void SetClippingRegion( long x, long y, long width, long height );
|
virtual void DoSetClippingRegion( long x, long y, long width, long height );
|
||||||
virtual void DestroyClippingRegion();
|
virtual void DestroyClippingRegion();
|
||||||
virtual void SetClippingRegion( const wxRegion ®ion );
|
virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion );
|
||||||
|
|
||||||
virtual void DrawSpline( wxList *points );
|
virtual void DoDrawSpline( wxList *points );
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
// Resolution in pixels per logical inch
|
||||||
wxSize GetPPI(void) const;
|
virtual wxSize GetPPI() const;
|
||||||
|
virtual int GetDepth() const;
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
// --------------
|
||||||
|
|
||||||
GdkWindow *m_window;
|
GdkWindow *m_window;
|
||||||
GdkGC *m_penGC;
|
GdkGC *m_penGC;
|
||||||
@@ -108,7 +116,7 @@ public:
|
|||||||
|
|
||||||
void SetUpDC();
|
void SetUpDC();
|
||||||
void Destroy();
|
void Destroy();
|
||||||
GdkWindow *GetWindow();
|
GdkWindow *GetWindow() { return m_window; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -142,8 +142,6 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// GTK-specific member variables
|
// GTK-specific member variables
|
||||||
|
|
||||||
int m_textAlignment; // gone in wxWin 2.0 ?
|
|
||||||
|
|
||||||
// not sure what for, but what is a mm on a screen you don't know the size
|
// not sure what for, but what is a mm on a screen you don't know the size
|
||||||
// of?
|
// of?
|
||||||
double m_mm_to_pix_x,
|
double m_mm_to_pix_x,
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GTKDCCLIENTH__
|
#ifndef __GTKDCCLIENTH__
|
||||||
#define __GTKDCCLIENTH__
|
#define __GTKDCCLIENTH__
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ class wxClientDC;
|
|||||||
// wxWindowDC
|
// wxWindowDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxWindowDC: public wxDC
|
class wxWindowDC : public wxDC
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
DECLARE_DYNAMIC_CLASS(wxWindowDC)
|
||||||
|
|
||||||
@@ -40,39 +39,46 @@ public:
|
|||||||
|
|
||||||
~wxWindowDC();
|
~wxWindowDC();
|
||||||
|
|
||||||
virtual void FloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
|
virtual bool CanDrawBitmap() const { return TRUE; }
|
||||||
virtual bool GetPixel( long x1, long y1, wxColour *col ) const;
|
virtual bool CanGetTextExtent() const { return TRUE; }
|
||||||
|
|
||||||
virtual void DrawLine( long x1, long y1, long x2, long y2 );
|
virtual void DoFloodFill( long x, long y, const wxColour& col, int style=wxFLOOD_SURFACE );
|
||||||
virtual void CrossHair( long x, long y );
|
virtual bool DoGetPixel( long x1, long y1, wxColour *col ) const;
|
||||||
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long 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 DoDrawLine( long x1, long y1, long x2, long y2 );
|
||||||
virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 );
|
virtual void DoCrossHair( long x, long y );
|
||||||
virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0,
|
virtual void DoDrawArc( long x1, long y1, long x2, long y2,
|
||||||
int fillStyle=wxODDEVEN_RULE );
|
long xc, long yc );
|
||||||
virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0,
|
virtual void DoDrawEllipticArc( long x, long y, long width, long height,
|
||||||
int fillStyle=wxODDEVEN_RULE );
|
double sa, double ea );
|
||||||
|
virtual void DoDrawPoint( long x, long y );
|
||||||
|
|
||||||
virtual void DrawRectangle( long x, long y, long width, long height );
|
virtual void DoDrawLines(int n, wxPoint points[],
|
||||||
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
|
long xoffset, long yoffset);
|
||||||
virtual void DrawEllipse( long x, long y, long width, long height );
|
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||||
|
long xoffset, long yoffset,
|
||||||
|
int fillStyle = wxODDEVEN_RULE);
|
||||||
|
|
||||||
virtual bool CanDrawBitmap() const;
|
virtual void DoDrawRectangle( long x, long y, long width, long height );
|
||||||
virtual void DrawIcon( const wxIcon &icon, long x, long y );
|
virtual void DoDrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 );
|
||||||
virtual void DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask=FALSE );
|
virtual void DoDrawEllipse( long x, long y, long width, long height );
|
||||||
virtual bool Blit( long xdest, long ydest, long width, long height,
|
|
||||||
wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE );
|
|
||||||
|
|
||||||
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE );
|
virtual void DoDrawIcon( const wxIcon &icon, long x, long y );
|
||||||
virtual bool CanGetTextExtent() const;
|
virtual void DoDrawBitmap( const wxBitmap &bitmap, long x, long y,
|
||||||
virtual void GetTextExtent( const wxString &string, long *width, long *height,
|
bool useMask = FALSE );
|
||||||
long *descent = (long *) NULL, long *externalLeading = (long *) NULL,
|
|
||||||
wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE );
|
virtual bool DoBlit( long xdest, long ydest, long width, long height,
|
||||||
virtual long GetCharWidth();
|
wxDC *source, long xsrc, long ysrc,
|
||||||
virtual long GetCharHeight();
|
int logical_func = wxCOPY, bool useMask = FALSE );
|
||||||
|
|
||||||
|
virtual void DoDrawText( const wxString &text, long x, long y );
|
||||||
|
virtual void GetTextExtent( const wxString &string,
|
||||||
|
long *width, long *height,
|
||||||
|
long *descent = (long *) NULL,
|
||||||
|
long *externalLeading = (long *) NULL,
|
||||||
|
wxFont *theFont = (wxFont *) NULL) const;
|
||||||
|
virtual long GetCharWidth() const;
|
||||||
|
virtual long GetCharHeight() const;
|
||||||
|
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
|
||||||
@@ -86,16 +92,18 @@ public:
|
|||||||
virtual void SetBackgroundMode( int mode );
|
virtual void SetBackgroundMode( int mode );
|
||||||
virtual void SetPalette( const wxPalette& palette );
|
virtual void SetPalette( const wxPalette& palette );
|
||||||
|
|
||||||
virtual void SetClippingRegion( long x, long y, long width, long height );
|
virtual void DoSetClippingRegion( long x, long y, long width, long height );
|
||||||
virtual void DestroyClippingRegion();
|
virtual void DestroyClippingRegion();
|
||||||
virtual void SetClippingRegion( const wxRegion ®ion );
|
virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion );
|
||||||
|
|
||||||
virtual void DrawSpline( wxList *points );
|
virtual void DoDrawSpline( wxList *points );
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
// Resolution in pixels per logical inch
|
||||||
wxSize GetPPI(void) const;
|
virtual wxSize GetPPI() const;
|
||||||
|
virtual int GetDepth() const;
|
||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
// --------------
|
||||||
|
|
||||||
GdkWindow *m_window;
|
GdkWindow *m_window;
|
||||||
GdkGC *m_penGC;
|
GdkGC *m_penGC;
|
||||||
@@ -108,7 +116,7 @@ public:
|
|||||||
|
|
||||||
void SetUpDC();
|
void SetUpDC();
|
||||||
void Destroy();
|
void Destroy();
|
||||||
GdkWindow *GetWindow();
|
GdkWindow *GetWindow() { return m_window; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "wx/font.h"
|
#include "wx/font.h"
|
||||||
#include "wx/palette.h"
|
#include "wx/palette.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
|
#include "wx/dc.h"
|
||||||
|
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@@ -38,9 +38,6 @@ wxDC::wxDC()
|
|||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
|
|
||||||
m_optimize = FALSE;
|
|
||||||
m_autoSetting = FALSE;
|
|
||||||
|
|
||||||
m_mm_to_pix_x = 1.0;
|
m_mm_to_pix_x = 1.0;
|
||||||
m_mm_to_pix_y = 1.0;
|
m_mm_to_pix_y = 1.0;
|
||||||
|
|
||||||
@@ -196,41 +193,41 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
|||||||
|
|
||||||
long wxDCBase::DeviceToLogicalX(long x) const
|
long wxDCBase::DeviceToLogicalX(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOG(x);
|
return ((wxDC *)this)->XDEV2LOG(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::DeviceToLogicalY(long y) const
|
long wxDCBase::DeviceToLogicalY(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOG(y);
|
return ((wxDC *)this)->YDEV2LOG(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::DeviceToLogicalXRel(long x) const
|
long wxDCBase::DeviceToLogicalXRel(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOGREL(x);
|
return ((wxDC *)this)->XDEV2LOGREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::DeviceToLogicalYRel(long y) const
|
long wxDCBase::DeviceToLogicalYRel(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOGREL(y);
|
return ((wxDC *)this)->YDEV2LOGREL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceX(long x) const
|
long wxDCBase::LogicalToDeviceX(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEV(x);
|
return ((wxDC *)this)->XLOG2DEV(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceY(long y) const
|
long wxDCBase::LogicalToDeviceY(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEV(y);
|
return ((wxDC *)this)->YLOG2DEV(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceXRel(long x) const
|
long wxDCBase::LogicalToDeviceXRel(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEVREL(x);
|
return ((wxDC *)this)->XLOG2DEVREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceYRel(long y) const
|
long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEVREL(y);
|
return ((wxDC *)this)->YLOG2DEVREL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,9 @@ static GdkPixmap **hatch_bitmap = (GdkPixmap **) NULL;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// temporary implementation of the missing GDK function
|
// temporary implementation of the missing GDK function
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "gdk/gdkprivate.h"
|
#include "gdk/gdkprivate.h"
|
||||||
|
|
||||||
void gdk_draw_bitmap (GdkDrawable *drawable,
|
void gdk_draw_bitmap (GdkDrawable *drawable,
|
||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
GdkDrawable *src,
|
GdkDrawable *src,
|
||||||
@@ -86,7 +88,7 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
|
|||||||
// wxWindowDC
|
// wxWindowDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC,wxDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
|
||||||
|
|
||||||
wxWindowDC::wxWindowDC()
|
wxWindowDC::wxWindowDC()
|
||||||
{
|
{
|
||||||
@@ -108,7 +110,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
m_cmap = (GdkColormap *) NULL;
|
m_cmap = (GdkColormap *) NULL;
|
||||||
m_owner = (wxWindow *)NULL;
|
m_owner = (wxWindow *)NULL;
|
||||||
|
|
||||||
if (!window) return;
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
GtkWidget *widget = window->m_wxwindow;
|
GtkWidget *widget = window->m_wxwindow;
|
||||||
if (!widget)
|
if (!widget)
|
||||||
@@ -125,7 +128,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* still not realized ? */
|
/* still not realized ? */
|
||||||
if (!m_window) return;
|
if (!m_window)
|
||||||
|
return;
|
||||||
|
|
||||||
if (window->m_wxwindow)
|
if (window->m_wxwindow)
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
||||||
@@ -151,19 +155,19 @@ wxWindowDC::~wxWindowDC()
|
|||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::FloodFill( long WXUNUSED(x), long WXUNUSED(y),
|
void wxWindowDC::DoFloodFill( long WXUNUSED(x), long WXUNUSED(y),
|
||||||
const wxColour &WXUNUSED(col), int WXUNUSED(style) )
|
const wxColour &WXUNUSED(col), int WXUNUSED(style) )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxWindowDC::FloodFill not implemented") );
|
wxFAIL_MSG( _T("wxWindowDC::DoFloodFill not implemented") );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
|
bool wxWindowDC::DoGetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxWindowDC::GetPixel not implemented") );
|
wxFAIL_MSG( _T("wxWindowDC::DoGetPixel not implemented") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
|
void wxWindowDC::DoDrawLine( long x1, long y1, long x2, long y2 )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -177,7 +181,7 @@ void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::CrossHair( long x, long y )
|
void wxWindowDC::DoCrossHair( long x, long y )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -193,7 +197,8 @@ void wxWindowDC::CrossHair( long x, long y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
|
void wxWindowDC::DoDrawArc( long x1, long y1, long x2, long y2,
|
||||||
|
long xc, long yc )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -243,7 +248,7 @@ void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
|
|||||||
CalcBoundingBox (x2, y2);
|
CalcBoundingBox (x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
void wxWindowDC::DoDrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -268,7 +273,7 @@ void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, doubl
|
|||||||
CalcBoundingBox (x + width, y + height);
|
CalcBoundingBox (x + width, y + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawPoint( long x, long y )
|
void wxWindowDC::DoDrawPoint( long x, long y )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -278,7 +283,7 @@ void wxWindowDC::DrawPoint( long x, long y )
|
|||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
void wxWindowDC::DoDrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -299,34 +304,7 @@ void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) )
|
||||||
{
|
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
|
||||||
|
|
||||||
wxNode *node = points->First();
|
|
||||||
if (!node) return;
|
|
||||||
|
|
||||||
wxPoint *pt = (wxPoint*)node->Data();
|
|
||||||
CalcBoundingBox( pt->x + xoffset, pt->y + yoffset );
|
|
||||||
|
|
||||||
while (node->Next())
|
|
||||||
{
|
|
||||||
wxPoint *point = (wxPoint*)node->Data();
|
|
||||||
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
|
||||||
long x1 = XLOG2DEV(point->x + xoffset);
|
|
||||||
long x2 = XLOG2DEV(npoint->x + xoffset);
|
|
||||||
long y1 = YLOG2DEV(point->y + yoffset); // and a waste again...
|
|
||||||
long y2 = YLOG2DEV(npoint->y + yoffset);
|
|
||||||
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
|
||||||
node = node->Next();
|
|
||||||
|
|
||||||
CalcBoundingBox( npoint->x + xoffset, npoint->y + yoffset );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -360,48 +338,7 @@ void wxWindowDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffse
|
|||||||
delete[] gdkpoints;
|
delete[] gdkpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle))
|
void wxWindowDC::DoDrawRectangle( long x, long y, long width, long height )
|
||||||
{
|
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
int n = lines->Number();
|
|
||||||
if (n <= 0) return;
|
|
||||||
|
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n];
|
|
||||||
wxNode *node = lines->First();
|
|
||||||
int cnt = 0;
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxPoint *p = (wxPoint *) node->Data();
|
|
||||||
gdkpoints[cnt].x = XLOG2DEV(p->x + xoffset);
|
|
||||||
gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
|
|
||||||
node = node->Next();
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
CalcBoundingBox( p->x + xoffset, p->y + yoffset );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
|
||||||
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
|
||||||
|
|
||||||
// To do: Fillstyle
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0 ; i < n ; i++)
|
|
||||||
{
|
|
||||||
gdk_draw_line( m_window, m_penGC,
|
|
||||||
gdkpoints[i%n].x,
|
|
||||||
gdkpoints[i%n].y,
|
|
||||||
gdkpoints[(i+1)%n].x,
|
|
||||||
gdkpoints[(i+1)%n].y );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] gdkpoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -427,7 +364,7 @@ void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
|
|||||||
CalcBoundingBox( x + width, y + height );
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
void wxWindowDC::DoDrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -496,7 +433,7 @@ void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height,
|
|||||||
CalcBoundingBox( x + width, y + height );
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
|
void wxWindowDC::DoDrawEllipse( long x, long y, long width, long height )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -519,21 +456,19 @@ void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
|
|||||||
CalcBoundingBox( x + width, y + height );
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::CanDrawBitmap() const
|
void wxWindowDC::DoDrawIcon( const wxIcon &icon, long x, long y )
|
||||||
{
|
{
|
||||||
return TRUE;
|
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
|
||||||
|
DoDrawBitmap( (const wxBitmap&)icon, x, y, (bool)TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y )
|
void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||||
{
|
long x, long y,
|
||||||
DrawBitmap( icon, x, y, TRUE );
|
bool useMask )
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
if (!bitmap.Ok()) return;
|
wxCHECK_RET( bitmap.Ok(), _T("invalid bitmap") );
|
||||||
|
|
||||||
/* scale/translate size and position */
|
/* scale/translate size and position */
|
||||||
|
|
||||||
@@ -601,8 +536,9 @@ void wxWindowDC::DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMas
|
|||||||
CalcBoundingBox( x + w, y + h );
|
CalcBoundingBox( x + w, y + h );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::Blit( long xdest, long ydest, long width, long height,
|
bool wxWindowDC::DoBlit( long xdest, long ydest, long width, long height,
|
||||||
wxDC *source, long xsrc, long ysrc, int logical_func, bool useMask )
|
wxDC *source, long xsrc, long ysrc,
|
||||||
|
int logical_func, bool useMask )
|
||||||
{
|
{
|
||||||
/* this is the nth try to get this utterly useless function to
|
/* this is the nth try to get this utterly useless function to
|
||||||
work. it now completely ignores the scaling or translation
|
work. it now completely ignores the scaling or translation
|
||||||
@@ -793,7 +729,7 @@ bool wxWindowDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) )
|
void wxWindowDC::DoDrawText( const wxString &text, long x, long y )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -830,14 +766,9 @@ void wxWindowDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(u
|
|||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::CanGetTextExtent() const
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
|
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
|
||||||
long *descent, long *externalLeading,
|
long *descent, long *externalLeading,
|
||||||
wxFont *theFont, bool WXUNUSED(use16) )
|
wxFont *theFont ) const
|
||||||
{
|
{
|
||||||
wxFont fontToUse = m_font;
|
wxFont fontToUse = m_font;
|
||||||
if (theFont) fontToUse = *theFont;
|
if (theFont) fontToUse = *theFont;
|
||||||
@@ -849,13 +780,13 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
|
|||||||
if (externalLeading) (*externalLeading) = 0; // ??
|
if (externalLeading) (*externalLeading) = 0; // ??
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxWindowDC::GetCharWidth()
|
long wxWindowDC::GetCharWidth() const
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxWindowDC::GetCharHeight()
|
long wxWindowDC::GetCharHeight() const
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long((font->ascent + font->descent) / m_scaleY);
|
return long((font->ascent + font->descent) / m_scaleY);
|
||||||
@@ -1113,7 +1044,7 @@ void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) )
|
|||||||
wxFAIL_MSG( _T("wxWindowDC::SetPalette not implemented") );
|
wxFAIL_MSG( _T("wxWindowDC::SetPalette not implemented") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
|
void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -1130,7 +1061,7 @@ void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
|
|||||||
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::SetClippingRegion( const wxRegion ®ion )
|
void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -1215,11 +1146,20 @@ void wxWindowDC::Destroy()
|
|||||||
m_bgGC = (GdkGC*) NULL;
|
m_bgGC = (GdkGC*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWindow *wxWindowDC::GetWindow()
|
// Resolution in pixels per logical inch
|
||||||
|
wxSize wxWindowDC::GetPPI() const
|
||||||
{
|
{
|
||||||
return m_window;
|
return wxSize(100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxWindowDC::GetDepth() const
|
||||||
|
{
|
||||||
|
wxFAIL_MSG(_T("not implemented"));
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_SPLINE
|
||||||
// ----------------------------------- spline code ----------------------------------------
|
// ----------------------------------- spline code ----------------------------------------
|
||||||
|
|
||||||
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
|
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
|
||||||
@@ -1335,7 +1275,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawSpline( wxList *points )
|
void wxWindowDC::DoDrawSpline( wxList *points )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -1387,11 +1327,7 @@ void wxWindowDC::DrawSpline( wxList *points )
|
|||||||
wx_spline_draw_point_array( this );
|
wx_spline_draw_point_array( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
#endif // wxUSE_SPLINE
|
||||||
wxSize wxWindowDC::GetPPI(void) const
|
|
||||||
{
|
|
||||||
return wxSize(100, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxPaintDC
|
// wxPaintDC
|
||||||
|
@@ -38,9 +38,6 @@ wxDC::wxDC()
|
|||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
|
|
||||||
m_optimize = FALSE;
|
|
||||||
m_autoSetting = FALSE;
|
|
||||||
|
|
||||||
m_mm_to_pix_x = 1.0;
|
m_mm_to_pix_x = 1.0;
|
||||||
m_mm_to_pix_y = 1.0;
|
m_mm_to_pix_y = 1.0;
|
||||||
|
|
||||||
@@ -196,41 +193,41 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
|||||||
|
|
||||||
long wxDCBase::DeviceToLogicalX(long x) const
|
long wxDCBase::DeviceToLogicalX(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOG(x);
|
return ((wxDC *)this)->XDEV2LOG(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::DeviceToLogicalY(long y) const
|
long wxDCBase::DeviceToLogicalY(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOG(y);
|
return ((wxDC *)this)->YDEV2LOG(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::DeviceToLogicalXRel(long x) const
|
long wxDCBase::DeviceToLogicalXRel(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOGREL(x);
|
return ((wxDC *)this)->XDEV2LOGREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::DeviceToLogicalYRel(long y) const
|
long wxDCBase::DeviceToLogicalYRel(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOGREL(y);
|
return ((wxDC *)this)->YDEV2LOGREL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceX(long x) const
|
long wxDCBase::LogicalToDeviceX(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEV(x);
|
return ((wxDC *)this)->XLOG2DEV(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceY(long y) const
|
long wxDCBase::LogicalToDeviceY(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEV(y);
|
return ((wxDC *)this)->YLOG2DEV(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceXRel(long x) const
|
long wxDCBase::LogicalToDeviceXRel(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEVREL(x);
|
return ((wxDC *)this)->XLOG2DEVREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDCBase::LogicalToDeviceYRel(long y) const
|
long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEVREL(y);
|
return ((wxDC *)this)->YLOG2DEVREL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,9 @@ static GdkPixmap **hatch_bitmap = (GdkPixmap **) NULL;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// temporary implementation of the missing GDK function
|
// temporary implementation of the missing GDK function
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "gdk/gdkprivate.h"
|
#include "gdk/gdkprivate.h"
|
||||||
|
|
||||||
void gdk_draw_bitmap (GdkDrawable *drawable,
|
void gdk_draw_bitmap (GdkDrawable *drawable,
|
||||||
GdkGC *gc,
|
GdkGC *gc,
|
||||||
GdkDrawable *src,
|
GdkDrawable *src,
|
||||||
@@ -86,7 +88,7 @@ void gdk_draw_bitmap (GdkDrawable *drawable,
|
|||||||
// wxWindowDC
|
// wxWindowDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC,wxDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
|
||||||
|
|
||||||
wxWindowDC::wxWindowDC()
|
wxWindowDC::wxWindowDC()
|
||||||
{
|
{
|
||||||
@@ -108,7 +110,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
m_cmap = (GdkColormap *) NULL;
|
m_cmap = (GdkColormap *) NULL;
|
||||||
m_owner = (wxWindow *)NULL;
|
m_owner = (wxWindow *)NULL;
|
||||||
|
|
||||||
if (!window) return;
|
if (!window)
|
||||||
|
return;
|
||||||
|
|
||||||
GtkWidget *widget = window->m_wxwindow;
|
GtkWidget *widget = window->m_wxwindow;
|
||||||
if (!widget)
|
if (!widget)
|
||||||
@@ -125,7 +128,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* still not realized ? */
|
/* still not realized ? */
|
||||||
if (!m_window) return;
|
if (!m_window)
|
||||||
|
return;
|
||||||
|
|
||||||
if (window->m_wxwindow)
|
if (window->m_wxwindow)
|
||||||
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
|
||||||
@@ -151,19 +155,19 @@ wxWindowDC::~wxWindowDC()
|
|||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::FloodFill( long WXUNUSED(x), long WXUNUSED(y),
|
void wxWindowDC::DoFloodFill( long WXUNUSED(x), long WXUNUSED(y),
|
||||||
const wxColour &WXUNUSED(col), int WXUNUSED(style) )
|
const wxColour &WXUNUSED(col), int WXUNUSED(style) )
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxWindowDC::FloodFill not implemented") );
|
wxFAIL_MSG( _T("wxWindowDC::DoFloodFill not implemented") );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
|
bool wxWindowDC::DoGetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxWindowDC::GetPixel not implemented") );
|
wxFAIL_MSG( _T("wxWindowDC::DoGetPixel not implemented") );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
|
void wxWindowDC::DoDrawLine( long x1, long y1, long x2, long y2 )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -177,7 +181,7 @@ void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::CrossHair( long x, long y )
|
void wxWindowDC::DoCrossHair( long x, long y )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -193,7 +197,8 @@ void wxWindowDC::CrossHair( long x, long y )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
|
void wxWindowDC::DoDrawArc( long x1, long y1, long x2, long y2,
|
||||||
|
long xc, long yc )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -243,7 +248,7 @@ void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, long xc, long yc )
|
|||||||
CalcBoundingBox (x2, y2);
|
CalcBoundingBox (x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
void wxWindowDC::DoDrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -268,7 +273,7 @@ void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, doubl
|
|||||||
CalcBoundingBox (x + width, y + height);
|
CalcBoundingBox (x + width, y + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawPoint( long x, long y )
|
void wxWindowDC::DoDrawPoint( long x, long y )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -278,7 +283,7 @@ void wxWindowDC::DrawPoint( long x, long y )
|
|||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
void wxWindowDC::DoDrawLines( int n, wxPoint points[], long xoffset, long yoffset )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -299,34 +304,7 @@ void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
|
void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) )
|
||||||
{
|
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() == wxTRANSPARENT) return;
|
|
||||||
|
|
||||||
wxNode *node = points->First();
|
|
||||||
if (!node) return;
|
|
||||||
|
|
||||||
wxPoint *pt = (wxPoint*)node->Data();
|
|
||||||
CalcBoundingBox( pt->x + xoffset, pt->y + yoffset );
|
|
||||||
|
|
||||||
while (node->Next())
|
|
||||||
{
|
|
||||||
wxPoint *point = (wxPoint*)node->Data();
|
|
||||||
wxPoint *npoint = (wxPoint*)node->Next()->Data();
|
|
||||||
long x1 = XLOG2DEV(point->x + xoffset);
|
|
||||||
long x2 = XLOG2DEV(npoint->x + xoffset);
|
|
||||||
long y1 = YLOG2DEV(point->y + yoffset); // and a waste again...
|
|
||||||
long y2 = YLOG2DEV(npoint->y + yoffset);
|
|
||||||
gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 );
|
|
||||||
node = node->Next();
|
|
||||||
|
|
||||||
CalcBoundingBox( npoint->x + xoffset, npoint->y + yoffset );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -360,48 +338,7 @@ void wxWindowDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffse
|
|||||||
delete[] gdkpoints;
|
delete[] gdkpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle))
|
void wxWindowDC::DoDrawRectangle( long x, long y, long width, long height )
|
||||||
{
|
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
|
||||||
|
|
||||||
int n = lines->Number();
|
|
||||||
if (n <= 0) return;
|
|
||||||
|
|
||||||
GdkPoint *gdkpoints = new GdkPoint[n];
|
|
||||||
wxNode *node = lines->First();
|
|
||||||
int cnt = 0;
|
|
||||||
while (node)
|
|
||||||
{
|
|
||||||
wxPoint *p = (wxPoint *) node->Data();
|
|
||||||
gdkpoints[cnt].x = XLOG2DEV(p->x + xoffset);
|
|
||||||
gdkpoints[cnt].y = YLOG2DEV(p->y + yoffset);
|
|
||||||
node = node->Next();
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
CalcBoundingBox( p->x + xoffset, p->y + yoffset );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
|
||||||
gdk_draw_polygon (m_window, m_brushGC, TRUE, gdkpoints, n);
|
|
||||||
|
|
||||||
// To do: Fillstyle
|
|
||||||
|
|
||||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0 ; i < n ; i++)
|
|
||||||
{
|
|
||||||
gdk_draw_line( m_window, m_penGC,
|
|
||||||
gdkpoints[i%n].x,
|
|
||||||
gdkpoints[i%n].y,
|
|
||||||
gdkpoints[(i+1)%n].x,
|
|
||||||
gdkpoints[(i+1)%n].y );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] gdkpoints;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -427,7 +364,7 @@ void wxWindowDC::DrawRectangle( long x, long y, long width, long height )
|
|||||||
CalcBoundingBox( x + width, y + height );
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
void wxWindowDC::DoDrawRoundedRectangle( long x, long y, long width, long height, double radius )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -496,7 +433,7 @@ void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height,
|
|||||||
CalcBoundingBox( x + width, y + height );
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
|
void wxWindowDC::DoDrawEllipse( long x, long y, long width, long height )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -519,21 +456,19 @@ void wxWindowDC::DrawEllipse( long x, long y, long width, long height )
|
|||||||
CalcBoundingBox( x + width, y + height );
|
CalcBoundingBox( x + width, y + height );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::CanDrawBitmap() const
|
void wxWindowDC::DoDrawIcon( const wxIcon &icon, long x, long y )
|
||||||
{
|
{
|
||||||
return TRUE;
|
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
|
||||||
|
DoDrawBitmap( (const wxBitmap&)icon, x, y, (bool)TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y )
|
void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||||
{
|
long x, long y,
|
||||||
DrawBitmap( icon, x, y, TRUE );
|
bool useMask )
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMask )
|
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
if (!bitmap.Ok()) return;
|
wxCHECK_RET( bitmap.Ok(), _T("invalid bitmap") );
|
||||||
|
|
||||||
/* scale/translate size and position */
|
/* scale/translate size and position */
|
||||||
|
|
||||||
@@ -601,8 +536,9 @@ void wxWindowDC::DrawBitmap( const wxBitmap &bitmap, long x, long y, bool useMas
|
|||||||
CalcBoundingBox( x + w, y + h );
|
CalcBoundingBox( x + w, y + h );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::Blit( long xdest, long ydest, long width, long height,
|
bool wxWindowDC::DoBlit( long xdest, long ydest, long width, long height,
|
||||||
wxDC *source, long xsrc, long ysrc, int logical_func, bool useMask )
|
wxDC *source, long xsrc, long ysrc,
|
||||||
|
int logical_func, bool useMask )
|
||||||
{
|
{
|
||||||
/* this is the nth try to get this utterly useless function to
|
/* this is the nth try to get this utterly useless function to
|
||||||
work. it now completely ignores the scaling or translation
|
work. it now completely ignores the scaling or translation
|
||||||
@@ -793,7 +729,7 @@ bool wxWindowDC::Blit( long xdest, long ydest, long width, long height,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) )
|
void wxWindowDC::DoDrawText( const wxString &text, long x, long y )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -830,14 +766,9 @@ void wxWindowDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(u
|
|||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowDC::CanGetTextExtent() const
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
|
void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height,
|
||||||
long *descent, long *externalLeading,
|
long *descent, long *externalLeading,
|
||||||
wxFont *theFont, bool WXUNUSED(use16) )
|
wxFont *theFont ) const
|
||||||
{
|
{
|
||||||
wxFont fontToUse = m_font;
|
wxFont fontToUse = m_font;
|
||||||
if (theFont) fontToUse = *theFont;
|
if (theFont) fontToUse = *theFont;
|
||||||
@@ -849,13 +780,13 @@ void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *heigh
|
|||||||
if (externalLeading) (*externalLeading) = 0; // ??
|
if (externalLeading) (*externalLeading) = 0; // ??
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxWindowDC::GetCharWidth()
|
long wxWindowDC::GetCharWidth() const
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
return long(gdk_string_width( font, "H" ) / m_scaleX);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxWindowDC::GetCharHeight()
|
long wxWindowDC::GetCharHeight() const
|
||||||
{
|
{
|
||||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||||
return long((font->ascent + font->descent) / m_scaleY);
|
return long((font->ascent + font->descent) / m_scaleY);
|
||||||
@@ -1113,7 +1044,7 @@ void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) )
|
|||||||
wxFAIL_MSG( _T("wxWindowDC::SetPalette not implemented") );
|
wxFAIL_MSG( _T("wxWindowDC::SetPalette not implemented") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
|
void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -1130,7 +1061,7 @@ void wxWindowDC::SetClippingRegion( long x, long y, long width, long height )
|
|||||||
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::SetClippingRegion( const wxRegion ®ion )
|
void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -1215,11 +1146,20 @@ void wxWindowDC::Destroy()
|
|||||||
m_bgGC = (GdkGC*) NULL;
|
m_bgGC = (GdkGC*) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GdkWindow *wxWindowDC::GetWindow()
|
// Resolution in pixels per logical inch
|
||||||
|
wxSize wxWindowDC::GetPPI() const
|
||||||
{
|
{
|
||||||
return m_window;
|
return wxSize(100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxWindowDC::GetDepth() const
|
||||||
|
{
|
||||||
|
wxFAIL_MSG(_T("not implemented"));
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if wxUSE_SPLINE
|
||||||
// ----------------------------------- spline code ----------------------------------------
|
// ----------------------------------- spline code ----------------------------------------
|
||||||
|
|
||||||
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
|
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
|
||||||
@@ -1335,7 +1275,7 @@ static void wx_spline_draw_point_array(wxDC *dc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DrawSpline( wxList *points )
|
void wxWindowDC::DoDrawSpline( wxList *points )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
wxCHECK_RET( Ok(), _T("invalid window dc") );
|
||||||
|
|
||||||
@@ -1387,11 +1327,7 @@ void wxWindowDC::DrawSpline( wxList *points )
|
|||||||
wx_spline_draw_point_array( this );
|
wx_spline_draw_point_array( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
#endif // wxUSE_SPLINE
|
||||||
wxSize wxWindowDC::GetPPI(void) const
|
|
||||||
{
|
|
||||||
return wxSize(100, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxPaintDC
|
// wxPaintDC
|
||||||
|
Reference in New Issue
Block a user