1. MSW message handling simplifications
2. wxDC split into wxDC and wxDCBase 3. Several minor bug fixes, many major new bugs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
598
include/wx/dc.h
598
include/wx/dc.h
@@ -1,18 +1,604 @@
|
||||
#ifndef _WX_DC_H_BASE_
|
||||
#define _WX_DC_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dcbase.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers which we must include here
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/object.h" // the base class
|
||||
|
||||
#include "wx/cursor.h" // we have member variables of these classes
|
||||
#include "wx/font.h" // so we can't do without them
|
||||
#include "wx/colour.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/palette.h"
|
||||
|
||||
#include "wx/list.h" // we use wxList in inline functions
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// type which should be used (whenever possible, i.e. as long as it doesn't
|
||||
// break compatibility) for screen coordinates
|
||||
typedef int wxCoord;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern int) wxPageNumber;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxDC is the device context - object on which any drawing is done
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxDCBase : public wxObject
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxDCBase)
|
||||
|
||||
public:
|
||||
wxDCBase()
|
||||
{
|
||||
m_clipping = FALSE;
|
||||
m_ok = TRUE;
|
||||
|
||||
m_minX = m_minY = m_maxX = m_maxY = 0;
|
||||
|
||||
m_signX = m_signY = 1;
|
||||
|
||||
m_logicalOriginX = m_logicalOriginY =
|
||||
m_deviceOriginX = m_deviceOriginY = 0;
|
||||
|
||||
m_logicalScaleX = m_logicalScaleY =
|
||||
m_userScaleX = m_userScaleY =
|
||||
m_scaleX = m_scaleY = 1.0;
|
||||
|
||||
m_logicalFunction = -1;
|
||||
|
||||
m_backgroundMode = wxTRANSPARENT;
|
||||
|
||||
m_mappingMode = wxMM_TEXT;
|
||||
|
||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
||||
|
||||
m_textForegroundColour = *wxBLACK;
|
||||
m_textBackgroundColour = *wxWHITE;
|
||||
|
||||
m_colour = wxColourDisplay();
|
||||
}
|
||||
|
||||
~wxDCBase() { }
|
||||
|
||||
virtual void BeginDrawing() { }
|
||||
virtual void EndDrawing() { }
|
||||
|
||||
// graphic primitives
|
||||
// ------------------
|
||||
|
||||
void FloodFill(long x, long y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE)
|
||||
{ DoFloodFill(x, y, col, style); }
|
||||
void FloodFill(const wxPoint& pt, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE)
|
||||
{ DoFloodFill(pt.x, pt.y, col, style); }
|
||||
|
||||
bool GetPixel(long x, long y, wxColour *col) const
|
||||
{ return DoGetPixel(x, y, col); }
|
||||
bool GetPixel(const wxPoint& pt, wxColour *col) const
|
||||
{ return DoGetPixel(pt.x, pt.y, col); }
|
||||
|
||||
void DrawLine(long x1, long y1, long x2, long y2)
|
||||
{ DoDrawLine(x1, y1, x2, y2); }
|
||||
void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
||||
{ DoDrawLine(pt1.x, pt1.y, pt2.x, pt2.y); }
|
||||
|
||||
void CrossHair(long x, long y)
|
||||
{ DoCrossHair(x, y); }
|
||||
void CrossHair(const wxPoint& pt)
|
||||
{ DoCrossHair(pt.x, pt.y); }
|
||||
|
||||
void DrawArc(long x1, long y1, long x2, long y2, long xc, long yc)
|
||||
{ DoDrawArc(x1, y1, x2, y2, xc, yc); }
|
||||
void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
|
||||
{ DoDrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y); }
|
||||
|
||||
void DrawEllipticArc(long x, long y, long w, long h, double sa, double ea)
|
||||
{ DoDrawEllipticArc(x, y, x, y, sa, ea); }
|
||||
void DrawEllipticArc(const wxPoint& pt, const wxSize& sz,
|
||||
double sa, double ea)
|
||||
{ DoDrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea); }
|
||||
|
||||
void DrawPoint(long x, long y)
|
||||
{ DoDrawPoint(x, y); }
|
||||
void DrawPoint(const wxPoint& pt)
|
||||
{ DoDrawPoint(pt.x, pt.y); }
|
||||
|
||||
void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0)
|
||||
{ DoDrawLines(n, points, xoffset, yoffset); }
|
||||
void DrawLines(const wxList *list, long xoffset = 0, long yoffset = 0)
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i].y = point->y;
|
||||
}
|
||||
|
||||
DoDrawLines(n, points, xoffset, yoffset);
|
||||
|
||||
delete [] points;
|
||||
}
|
||||
|
||||
void DrawPolygon(int n, wxPoint points[],
|
||||
long xoffset = 0, long yoffset = 0,
|
||||
int fillStyle = wxODDEVEN_RULE)
|
||||
{ DoDrawPolygon(n, points, xoffset, yoffset, fillStyle); }
|
||||
|
||||
void DrawPolygon(const wxList *list,
|
||||
long xoffset = 0, long yoffset = 0,
|
||||
int fillStyle = wxODDEVEN_RULE)
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for ( wxNode *node = list->First(); node; node = node->Next(), i++ )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i].y = point->y;
|
||||
}
|
||||
|
||||
DoDrawPolygon(n, points, xoffset, yoffset, fillStyle);
|
||||
|
||||
delete [] points;
|
||||
}
|
||||
|
||||
void DrawRectangle(long x, long y, long width, long height)
|
||||
{ DoDrawRectangle(x, y, width, height); }
|
||||
void DrawRectangle(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoDrawRectangle(pt.x, pt.y, sz.x, sz.y); }
|
||||
void DrawRectangle(const wxRect& rect)
|
||||
{ DoDrawRectangle(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawRoundedRectangle(long x, long y, long width, long height,
|
||||
double radius)
|
||||
{ DoDrawRoundedRectangle(x, y, width, height, radius); }
|
||||
void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz,
|
||||
double radius)
|
||||
{ DoDrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius); }
|
||||
void DrawRoundedRectangle(const wxRect& r, double radius)
|
||||
{ DoDrawRoundedRectangle(r.x, r.y, r.width, r.height, radius); }
|
||||
|
||||
void DrawEllipse(long x, long y, long width, long height)
|
||||
{ DoDrawEllipse(x, y, width, height); }
|
||||
void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoDrawEllipse(pt.x, pt.y, sz.x, sz.y); }
|
||||
void DrawEllipse(const wxRect& rect)
|
||||
{ DoDrawEllipse(rect.x, rect.y, rect.width, rect.height); }
|
||||
|
||||
void DrawIcon(const wxIcon& icon, long x, long y)
|
||||
{ DoDrawIcon(icon, x, y); }
|
||||
void DrawIcon(const wxIcon& icon, const wxPoint& pt)
|
||||
{ DoDrawIcon(icon, pt.x, pt.y); }
|
||||
|
||||
void DrawBitmap(const wxBitmap &bmp, long x, long y, bool useMask = FALSE)
|
||||
{ DoDrawBitmap(bmp, x, y, useMask); }
|
||||
void DrawBitmap(const wxBitmap &bmp, const wxPoint& pt,
|
||||
bool useMask = FALSE)
|
||||
{ DoDrawBitmap(bmp, pt.x, pt.y, useMask); }
|
||||
|
||||
void DrawText(const wxString& text, long x, long y)
|
||||
{ DoDrawText(text, x, y); }
|
||||
void DrawText(const wxString& text, const wxPoint& pt)
|
||||
{ DoDrawText(text, pt.x, pt.y); }
|
||||
|
||||
bool Blit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE)
|
||||
{
|
||||
return DoBlit(xdest, ydest, width, height,
|
||||
source, xsrc, ysrc, rop, useMask);
|
||||
}
|
||||
bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||
wxDC *source, const wxPoint& srcPt,
|
||||
int rop = wxCOPY, bool useMask = FALSE)
|
||||
{
|
||||
return DoBlit(destPt.x, destPt.y, sz.x, sz.y,
|
||||
source, srcPt.x, srcPt.y, rop, useMask);
|
||||
}
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
// TODO: this API needs fixing (wxPointList, why (!const) "wxList *"?)
|
||||
void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3)
|
||||
{
|
||||
wxList point_list;
|
||||
|
||||
wxPoint *point1 = new wxPoint;
|
||||
point1->x = x1; point1->y = y1;
|
||||
point_list.Append((wxObject*)point1);
|
||||
|
||||
wxPoint *point2 = new wxPoint;
|
||||
point2->x = x2; point2->y = y2;
|
||||
point_list.Append((wxObject*)point2);
|
||||
|
||||
wxPoint *point3 = new wxPoint;
|
||||
point3->x = x3; point3->y = y3;
|
||||
point_list.Append((wxObject*)point3);
|
||||
|
||||
DrawSpline(&point_list);
|
||||
|
||||
for( wxNode *node = point_list.First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *p = (wxPoint *)node->Data();
|
||||
delete p;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSpline(int n, wxPoint points[])
|
||||
{
|
||||
wxList list;
|
||||
for (int i =0; i < n; i++)
|
||||
{
|
||||
list.Append((wxObject*)&points[i]);
|
||||
}
|
||||
|
||||
DrawSpline(&list);
|
||||
}
|
||||
|
||||
void DrawSpline(wxList *points) { DoDrawSpline(points); }
|
||||
#endif // wxUSE_SPLINES
|
||||
|
||||
// global DC operations
|
||||
// --------------------
|
||||
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual bool StartDoc(const wxString& message) = 0;
|
||||
virtual void EndDoc() = 0;
|
||||
|
||||
virtual void StartPage() = 0;
|
||||
virtual void EndPage() = 0;
|
||||
|
||||
// set objects to use for drawing
|
||||
// ------------------------------
|
||||
|
||||
virtual void SetFont(const wxFont& font) = 0;
|
||||
virtual void SetPen(const wxPen& pen) = 0;
|
||||
virtual void SetBrush(const wxBrush& brush) = 0;
|
||||
virtual void SetBackground(const wxBrush& brush) = 0;
|
||||
virtual void SetBackgroundMode(int mode) = 0;
|
||||
virtual void SetPalette(const wxPalette& palette) = 0;
|
||||
|
||||
// clipping region
|
||||
// ---------------
|
||||
|
||||
void SetClippingRegion(long x, long y, long width, long height)
|
||||
{ DoSetClippingRegion(x, y, width, height); }
|
||||
void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
|
||||
{ DoSetClippingRegion(pt.x, pt.y, sz.x, sz.y); }
|
||||
void SetClippingRegion(const wxRect& rect)
|
||||
{ DoSetClippingRegion(rect.x, rect.y, rect.width, rect.height); }
|
||||
void SetClippingRegion(const wxRegion& region)
|
||||
{ DoSetClippingRegionAsRegion(region); }
|
||||
|
||||
virtual void DestroyClippingRegion() = 0;
|
||||
|
||||
void GetClippingBox(long *x, long *y, long *w, long *h) const
|
||||
{ DoGetClippingBox(x, y, w, h); }
|
||||
void GetClippingBox(wxRect& rect) const
|
||||
{ DoGetClippingBox(&rect.x, &rect.y, &rect.width, &rect.height); }
|
||||
|
||||
// text extent
|
||||
// -----------
|
||||
|
||||
virtual long GetCharHeight() const = 0;
|
||||
virtual long GetCharWidth() const = 0;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
long *x, long *y,
|
||||
long *descent = NULL,
|
||||
long *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const = 0;
|
||||
|
||||
// size and resolution
|
||||
// -------------------
|
||||
|
||||
// in device units
|
||||
void GetSize(int *width, int *height) const
|
||||
{ DoGetSize(width, height); }
|
||||
wxSize GetSize() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSize(&w, &h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// in mm
|
||||
void GetSizeMM(int* width, int* height) const
|
||||
{ DoGetSizeMM(width, height); }
|
||||
wxSize GetSizeMM() const
|
||||
{
|
||||
int w, h;
|
||||
DoGetSizeMM(&w, &h);
|
||||
|
||||
return wxSize(w, h);
|
||||
}
|
||||
|
||||
// coordinates conversions
|
||||
// -----------------------
|
||||
|
||||
// This group of functions does actual conversion of the input, as you'd
|
||||
// expect.
|
||||
long DeviceToLogicalX(long x) const;
|
||||
long DeviceToLogicalY(long y) const;
|
||||
long DeviceToLogicalXRel(long x) const;
|
||||
long DeviceToLogicalYRel(long y) const;
|
||||
long LogicalToDeviceX(long x) const;
|
||||
long LogicalToDeviceY(long y) const;
|
||||
long LogicalToDeviceXRel(long x) const;
|
||||
long LogicalToDeviceYRel(long y) const;
|
||||
|
||||
// query DC capabilities
|
||||
// ---------------------
|
||||
|
||||
virtual bool CanDrawBitmap() const = 0;
|
||||
virtual bool CanGetTextExtent() const = 0;
|
||||
|
||||
// colour depth
|
||||
virtual int GetDepth() const = 0;
|
||||
|
||||
// Resolution in Pixels per inch
|
||||
virtual wxSize GetPPI() const = 0;
|
||||
|
||||
virtual bool Ok() const { return m_ok; }
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// const...
|
||||
const wxBrush& GetBackground() const { return m_backgroundBrush; }
|
||||
const wxBrush& GetBrush() const { return m_brush; }
|
||||
const wxFont& GetFont() const { return m_font; }
|
||||
const wxPen& GetPen() const { return m_pen; }
|
||||
const wxColour& GetTextBackground() const { return m_textBackgroundColour; }
|
||||
const wxColour& GetTextForeground() const { return m_textForegroundColour; }
|
||||
|
||||
// ... and non const
|
||||
wxBrush& GetBackground() { return m_backgroundBrush; }
|
||||
wxBrush& GetBrush() { return m_brush; }
|
||||
wxFont& GetFont() { return m_font; }
|
||||
wxPen& GetPen() { return m_pen; }
|
||||
wxColour& GetTextBackground() { return m_textBackgroundColour; }
|
||||
wxColour& GetTextForeground() { return m_textForegroundColour; }
|
||||
|
||||
virtual void SetTextForeground(const wxColour& colour)
|
||||
{ m_textForegroundColour = colour; }
|
||||
virtual void SetTextBackground(const wxColour& colour)
|
||||
{ m_textBackgroundColour = colour; }
|
||||
|
||||
int GetMapMode() const { return m_mappingMode; }
|
||||
virtual void SetMapMode(int mode) = 0;
|
||||
|
||||
virtual void GetUserScale(double *x, double *y) const
|
||||
{
|
||||
if ( x ) *x = m_userScaleX;
|
||||
if ( y ) *y = m_userScaleY;
|
||||
}
|
||||
virtual void SetUserScale(double x, double y) = 0;
|
||||
|
||||
virtual void SetSystemScale(double x, double y) = 0;
|
||||
|
||||
virtual void GetLogicalScale(double *x, double *y)
|
||||
{
|
||||
if ( x ) *x = m_logicalScaleX;
|
||||
if ( y ) *y = m_logicalScaleY;
|
||||
}
|
||||
virtual void SetLogicalScale(double x, double y)
|
||||
{
|
||||
m_logicalScaleX = x;
|
||||
m_logicalScaleY = y;
|
||||
}
|
||||
|
||||
void GetLogicalOrigin(long *x, long *y) const
|
||||
{ DoGetLogicalOrigin(x, y); }
|
||||
wxPoint GetLogicalOrigin() const
|
||||
{ long x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
|
||||
virtual void SetLogicalOrigin(long x, long y) = 0;
|
||||
|
||||
void GetDeviceOrigin(long *x, long *y) const
|
||||
{ DoGetDeviceOrigin(x, y); }
|
||||
wxPoint GetDeviceOrigin() const
|
||||
{ long x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
|
||||
virtual void SetDeviceOrigin(long x, long y) = 0;
|
||||
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0;
|
||||
|
||||
int GetLogicalFunction() const { return m_logicalFunction; }
|
||||
virtual void SetLogicalFunction(int function) = 0;
|
||||
|
||||
// Sometimes we need to override optimization, e.g. if other software is
|
||||
// drawing onto our surface and we can't be sure of who's done what.
|
||||
//
|
||||
// FIXME: is this (still) used?
|
||||
virtual void SetOptimization(bool WXUNUSED(opt)) { }
|
||||
virtual bool GetOptimization() { return FALSE; }
|
||||
|
||||
// bounding box
|
||||
// ------------
|
||||
|
||||
virtual void CalcBoundingBox(long x, long y)
|
||||
{
|
||||
if (x < m_minX) m_minX = x;
|
||||
if (y < m_minY) m_minY = y;
|
||||
if (x > m_maxX) m_maxX = x;
|
||||
if (y > m_maxY) m_maxY = y;
|
||||
}
|
||||
|
||||
// Get the final bounding box of the PostScript or Metafile picture.
|
||||
long MinX() const { return m_minX; }
|
||||
long MaxX() const { return m_maxX; }
|
||||
long MinY() const { return m_minY; }
|
||||
long MaxY() const { return m_maxY; }
|
||||
|
||||
// misc old functions
|
||||
// ------------------
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
virtual void SetColourMap(const wxPalette& palette) { SetPalette(palette); }
|
||||
void GetTextExtent(const wxString& string, float *x, float *y,
|
||||
float *descent = NULL, float *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
|
||||
void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
|
||||
void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
protected:
|
||||
// the pure virtual functions which should be implemented by wxDC
|
||||
virtual void DoFloodFill(long x, long y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE) = 0;
|
||||
|
||||
virtual bool DoGetPixel(long x, long y, wxColour *col) const = 0;
|
||||
|
||||
virtual void DoDrawPoint(long x, long y) = 0;
|
||||
virtual void DoDrawLine(long x1, long y1, long x2, long y2) = 0;
|
||||
|
||||
virtual void DoDrawArc(long x1, long y1,
|
||||
long x2, long y2,
|
||||
long xc, long yc) = 0;
|
||||
virtual void DoDrawEllipticArc(long x, long y, long w, long h,
|
||||
double sa, double ea) = 0;
|
||||
|
||||
virtual void DoDrawRectangle(long x, long y, long width, long height) = 0;
|
||||
virtual void DoDrawRoundedRectangle(long x, long y,
|
||||
long width, long height,
|
||||
double radius) = 0;
|
||||
virtual void DoDrawEllipse(long x, long y, long width, long height) = 0;
|
||||
|
||||
virtual void DoCrossHair(long x, long y) = 0;
|
||||
|
||||
virtual void DoDrawIcon(const wxIcon& icon, long x, long y) = 0;
|
||||
virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y,
|
||||
bool useMask = FALSE) = 0;
|
||||
|
||||
virtual void DoDrawText(const wxString& text, long x, long y) = 0;
|
||||
|
||||
virtual bool DoBlit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE) = 0;
|
||||
|
||||
virtual void DoGetSize(int *width, int *height) const = 0;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const = 0;
|
||||
|
||||
virtual void DoDrawLines(int n, wxPoint points[],
|
||||
long xoffset, long yoffset) = 0;
|
||||
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||
long xoffset, long yoffset,
|
||||
int fillStyle = wxODDEVEN_RULE) = 0;
|
||||
|
||||
virtual void DoSetClippingRegionAsRegion(const wxRegion& region) = 0;
|
||||
virtual void DoSetClippingRegion(long x, long y,
|
||||
long width, long height) = 0;
|
||||
virtual void DoGetClippingRegion(long *x, long *y,
|
||||
long *width, long *height) = 0;
|
||||
virtual void DoGetClippingBox(long *x, long *y,
|
||||
long *w, long *h) const
|
||||
{
|
||||
if ( m_clipping )
|
||||
{
|
||||
if ( x ) *x = m_clipX1;
|
||||
if ( y ) *y = m_clipY1;
|
||||
if ( w ) *w = m_clipX2 - m_clipX1;
|
||||
if ( h ) *h = m_clipY2 - m_clipY1;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *y = *w = *h = 0;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void DoGetLogicalOrigin(long *x, long *y) const
|
||||
{
|
||||
if ( x ) *x = m_logicalOriginX;
|
||||
if ( y ) *y = m_logicalOriginY;
|
||||
}
|
||||
|
||||
virtual void DoGetDeviceOrigin(long *x, long *y) const
|
||||
{
|
||||
if ( x ) *x = m_deviceOriginX;
|
||||
if ( y ) *y = m_deviceOriginY;
|
||||
}
|
||||
|
||||
virtual void DoDrawSpline(wxList *points) = 0;
|
||||
|
||||
protected:
|
||||
// flags
|
||||
bool m_colour:1;
|
||||
bool m_ok:1;
|
||||
bool m_clipping:1;
|
||||
bool m_isInteractive:1;
|
||||
|
||||
// coordinate system variables
|
||||
|
||||
// TODO short descriptions of what exactly they are would be nice...
|
||||
|
||||
long m_logicalOriginX, m_logicalOriginY;
|
||||
long m_deviceOriginX, m_deviceOriginY;
|
||||
|
||||
double m_logicalScaleX, m_logicalScaleY;
|
||||
double m_userScaleX, m_userScaleY;
|
||||
double m_scaleX, m_scaleY;
|
||||
|
||||
// Used by SetAxisOrientation() to invert the axes
|
||||
int m_signX, m_signY;
|
||||
|
||||
// bounding and clipping boxes
|
||||
long m_minX, m_minY, m_maxX, m_maxY;
|
||||
long m_clipX1, m_clipY1, m_clipX2, m_clipY2;
|
||||
|
||||
int m_logicalFunction;
|
||||
int m_backgroundMode;
|
||||
int m_mappingMode;
|
||||
|
||||
// GDI objects
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
wxBrush m_backgroundBrush;
|
||||
wxColour m_textForegroundColour;
|
||||
wxColour m_textBackgroundColour;
|
||||
wxFont m_font;
|
||||
wxPalette m_palette;
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxDCBase);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// now include the declaration of wxDC class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
#include "wx/msw/dc.h"
|
||||
#include "wx/msw/dc.h"
|
||||
#elif defined(__WXMOTIF__)
|
||||
#include "wx/motif/dc.h"
|
||||
#include "wx/motif/dc.h"
|
||||
#elif defined(__WXGTK__)
|
||||
#include "wx/gtk/dc.h"
|
||||
#include "wx/gtk/dc.h"
|
||||
#elif defined(__WXQT__)
|
||||
#include "wx/qt/dc.h"
|
||||
#include "wx/qt/dc.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dc.h"
|
||||
#include "wx/mac/dc.h"
|
||||
#elif defined(__WXSTUBS__)
|
||||
#include "wx/stubs/dc.h"
|
||||
#include "wx/stubs/dc.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -81,6 +81,8 @@
|
||||
#ifdef __VISUALC__
|
||||
# pragma warning(disable:4244) // conversion from double to float
|
||||
# pragma warning(disable:4100) // unreferenced formal parameter
|
||||
# pragma warning(disable:4511) // copy ctor couldn't be generated
|
||||
# pragma warning(disable:4512) // operator=() couldn't be generated
|
||||
#endif // __VISUALC__
|
||||
|
||||
// suppress some Salford C++ warnings
|
||||
@@ -1066,8 +1068,7 @@ typedef enum {
|
||||
|
||||
|
||||
#ifdef __WXMSW__
|
||||
/* Stand-ins for Windows types, to avoid
|
||||
* #including all of windows.h */
|
||||
// Stand-ins for Windows types, to avoid #including all of windows.h
|
||||
typedef unsigned long WXHWND;
|
||||
typedef unsigned long WXHANDLE;
|
||||
typedef unsigned long WXHICON;
|
||||
@@ -1095,15 +1096,17 @@ typedef void * WXMSG;
|
||||
typedef unsigned long WXHCONV;
|
||||
typedef unsigned long WXHKEY;
|
||||
typedef unsigned long WXHTREEITEM;
|
||||
|
||||
typedef void * WXDRAWITEMSTRUCT;
|
||||
typedef void * WXMEASUREITEMSTRUCT;
|
||||
typedef void * WXLPCREATESTRUCT;
|
||||
|
||||
#ifdef __GNUWIN32__
|
||||
typedef int (*WXFARPROC)();
|
||||
typedef int (*WXFARPROC)();
|
||||
#elif defined(__WIN32__)
|
||||
typedef int (__stdcall *WXFARPROC)();
|
||||
typedef int (__stdcall *WXFARPROC)();
|
||||
#else
|
||||
typedef int (*WXFARPROC)();
|
||||
typedef int (*WXFARPROC)();
|
||||
#endif
|
||||
|
||||
typedef WXHWND WXWidget;
|
||||
@@ -1198,5 +1201,14 @@ typedef GtkWidget *WXWidget;
|
||||
#endif
|
||||
// __WXMSW__
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macro to define a class without copy ctor nor assignment operator
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#define DECLARE_NO_COPY_CLASS(classname) \
|
||||
private: \
|
||||
classname(const classname&); \
|
||||
classname& operator=(const classname&)
|
||||
|
||||
#endif
|
||||
// _WX_DEFS_H_
|
||||
|
@@ -223,11 +223,13 @@ public:
|
||||
class WXDLLEXPORT wxRect
|
||||
{
|
||||
public:
|
||||
wxRect();
|
||||
wxRect(long x, long y, long w, long h);
|
||||
wxRect() { x = y = width = height = 0; }
|
||||
wxRect(long xx, long yy, long ww, long hh)
|
||||
{ x = xx; y = yy; width = ww; height = hh; }
|
||||
wxRect(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||
wxRect(const wxPoint& pos, const wxSize& size);
|
||||
wxRect(const wxRect& rect);
|
||||
|
||||
// default copy ctor and assignment operators ok
|
||||
|
||||
long GetX() const { return x; }
|
||||
void SetX(long xx) { x = xx; }
|
||||
@@ -249,9 +251,8 @@ public:
|
||||
long GetBottom() const { return y + height; }
|
||||
long GetRight() const { return x + width; }
|
||||
|
||||
wxRect& operator = (const wxRect& rect);
|
||||
bool operator == (const wxRect& rect);
|
||||
bool operator != (const wxRect& rect);
|
||||
bool operator == (const wxRect& rect) const;
|
||||
bool operator != (const wxRect& rect) const { return !(*this == rect); }
|
||||
|
||||
public:
|
||||
long x, y, width, height;
|
||||
|
@@ -15,15 +15,6 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -34,350 +25,134 @@ class wxDC;
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define MM_TEXT 0
|
||||
#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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern int wxPageNumber;
|
||||
#define MM_ANISOTROPIC 2
|
||||
#define MM_LOMETRIC 3
|
||||
#define MM_HIMETRIC 4
|
||||
#define MM_TWIPS 5
|
||||
#define MM_POINTS 6
|
||||
#define MM_METRIC 7
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxDC: public wxObject
|
||||
class wxDC : public wxDCBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||
|
||||
public:
|
||||
wxDC();
|
||||
~wxDC() { }
|
||||
|
||||
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;
|
||||
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
|
||||
{
|
||||
FloodFill(pt.x, pt.y, col, style);
|
||||
}
|
||||
virtual bool GetPixel( long x, long y, wxColour *col ) const = 0;
|
||||
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
|
||||
{
|
||||
return GetPixel(pt.x, pt.y, col);
|
||||
}
|
||||
|
||||
virtual void DrawLine( long x1, long y1, long x2, long y2 ) = 0;
|
||||
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
||||
{
|
||||
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
|
||||
}
|
||||
virtual void CrossHair( long x, long y ) = 0;
|
||||
inline void CrossHair(const wxPoint& pt)
|
||||
{
|
||||
CrossHair(pt.x, pt.y);
|
||||
}
|
||||
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
|
||||
inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
|
||||
{
|
||||
DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
|
||||
}
|
||||
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) = 0;
|
||||
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
|
||||
{
|
||||
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
|
||||
}
|
||||
virtual void DrawPoint( long x, long y ) = 0;
|
||||
inline void DrawPoint(const wxPoint& pt)
|
||||
{
|
||||
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,
|
||||
int fillStyle=wxODDEVEN_RULE ) = 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)
|
||||
{
|
||||
DrawRectangle(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void DrawRectangle(const wxRect& rect)
|
||||
{
|
||||
DrawRectangle(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ) = 0;
|
||||
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
|
||||
{
|
||||
DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
|
||||
}
|
||||
inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0)
|
||||
{
|
||||
DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
|
||||
}
|
||||
virtual void DrawEllipse( long x, long y, long width, long height ) = 0;
|
||||
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
||||
{
|
||||
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void DrawEllipse(const wxRect& rect)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
DrawIcon(icon, pt.x, pt.y);
|
||||
}
|
||||
virtual void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE ) = 0;
|
||||
inline void DrawBitmap( const wxBitmap& bitmap, const wxPoint& pt, bool useMask=FALSE )
|
||||
{
|
||||
DrawBitmap(bitmap, pt.x, pt.y, useMask );
|
||||
}
|
||||
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,
|
||||
const wxSize& sz,
|
||||
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);
|
||||
}
|
||||
|
||||
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ) = 0;
|
||||
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE )
|
||||
{
|
||||
DrawText(text, pt.x, pt.y, use16bit);
|
||||
}
|
||||
virtual bool CanGetTextExtent(void) const = 0;
|
||||
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;
|
||||
virtual long GetCharWidth(void) = 0;
|
||||
virtual long GetCharHeight(void) = 0;
|
||||
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual void SetFont( const wxFont &font ) = 0;
|
||||
virtual wxFont& GetFont() const { return (wxFont&)m_font; };
|
||||
|
||||
virtual void SetPen( const wxPen &pen ) = 0;
|
||||
virtual wxPen& GetPen() const { return (wxPen&)m_pen; };
|
||||
|
||||
virtual void SetBrush( const wxBrush &brush ) = 0;
|
||||
virtual wxBrush& GetBrush() const { return (wxBrush&)m_brush; };
|
||||
|
||||
virtual void SetBackground( const wxBrush &brush ) = 0;
|
||||
virtual wxBrush& GetBackground() const { return (wxBrush&)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); };
|
||||
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 ®ion ) = 0;
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
virtual long MinX() const { return m_minX; }
|
||||
virtual long MaxX() const { return m_maxX; }
|
||||
virtual long MinY() const { return m_minY; }
|
||||
virtual long MaxY() const { return m_maxY; }
|
||||
// Resolution in pixels per logical inch
|
||||
virtual wxSize GetPPI() const;
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize( int* width, int* height ) const;
|
||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc() { }
|
||||
virtual void StartPage() { }
|
||||
virtual void EndPage() { }
|
||||
|
||||
// Size in millimetres
|
||||
virtual void GetSizeMM( int* width, int* height ) const;
|
||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
virtual void SetMapMode( int mode );
|
||||
virtual void SetUserScale( double x, double y );
|
||||
virtual void SetLogicalScale( double x, double y );
|
||||
virtual void SetLogicalOrigin( long x, long y );
|
||||
virtual void SetDeviceOrigin( long x, long y );
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
virtual wxSize GetPPI(void) const;
|
||||
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc() {}
|
||||
virtual void StartPage() {}
|
||||
virtual void EndPage() {}
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
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;
|
||||
virtual long DeviceToLogicalYRel(long y) const;
|
||||
virtual long LogicalToDeviceX(long x) const;
|
||||
virtual long LogicalToDeviceY(long y) const;
|
||||
virtual long LogicalToDeviceXRel(long x) const;
|
||||
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);
|
||||
}
|
||||
|
||||
protected:
|
||||
// base class pure virtuals implemented here
|
||||
virtual void DoSetClippingRegion(long x, long y, long width, long height);
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const;
|
||||
|
||||
public:
|
||||
public:
|
||||
// GTK-specific member variables
|
||||
|
||||
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 ?
|
||||
bool m_autoSetting; // wxMSW only ?
|
||||
bool m_dontDelete; // wxMSW only ?
|
||||
bool m_optimize; // wxMSW only ?
|
||||
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
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
|
||||
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;
|
||||
};
|
||||
|
||||
#endif // __GTKDCH__
|
||||
|
@@ -230,6 +230,7 @@ public:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxWindow);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -15,15 +15,6 @@
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
#include "wx/object.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/gdicmn.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// classes
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -34,350 +25,134 @@ class wxDC;
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define MM_TEXT 0
|
||||
#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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
extern int wxPageNumber;
|
||||
#define MM_ANISOTROPIC 2
|
||||
#define MM_LOMETRIC 3
|
||||
#define MM_HIMETRIC 4
|
||||
#define MM_TWIPS 5
|
||||
#define MM_POINTS 6
|
||||
#define MM_METRIC 7
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxDC: public wxObject
|
||||
class wxDC : public wxDCBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||
|
||||
public:
|
||||
wxDC();
|
||||
~wxDC() { }
|
||||
|
||||
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;
|
||||
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
|
||||
{
|
||||
FloodFill(pt.x, pt.y, col, style);
|
||||
}
|
||||
virtual bool GetPixel( long x, long y, wxColour *col ) const = 0;
|
||||
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
|
||||
{
|
||||
return GetPixel(pt.x, pt.y, col);
|
||||
}
|
||||
|
||||
virtual void DrawLine( long x1, long y1, long x2, long y2 ) = 0;
|
||||
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
||||
{
|
||||
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
|
||||
}
|
||||
virtual void CrossHair( long x, long y ) = 0;
|
||||
inline void CrossHair(const wxPoint& pt)
|
||||
{
|
||||
CrossHair(pt.x, pt.y);
|
||||
}
|
||||
virtual void DrawArc( long x1, long y1, long x2, long y2, long xc, long yc );
|
||||
inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
|
||||
{
|
||||
DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
|
||||
}
|
||||
virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) = 0;
|
||||
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
|
||||
{
|
||||
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
|
||||
}
|
||||
virtual void DrawPoint( long x, long y ) = 0;
|
||||
inline void DrawPoint(const wxPoint& pt)
|
||||
{
|
||||
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,
|
||||
int fillStyle=wxODDEVEN_RULE ) = 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)
|
||||
{
|
||||
DrawRectangle(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void DrawRectangle(const wxRect& rect)
|
||||
{
|
||||
DrawRectangle(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ) = 0;
|
||||
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
|
||||
{
|
||||
DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
|
||||
}
|
||||
inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0)
|
||||
{
|
||||
DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
|
||||
}
|
||||
virtual void DrawEllipse( long x, long y, long width, long height ) = 0;
|
||||
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
||||
{
|
||||
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void DrawEllipse(const wxRect& rect)
|
||||
{
|
||||
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 )
|
||||
{
|
||||
DrawIcon(icon, pt.x, pt.y);
|
||||
}
|
||||
virtual void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE ) = 0;
|
||||
inline void DrawBitmap( const wxBitmap& bitmap, const wxPoint& pt, bool useMask=FALSE )
|
||||
{
|
||||
DrawBitmap(bitmap, pt.x, pt.y, useMask );
|
||||
}
|
||||
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,
|
||||
const wxSize& sz,
|
||||
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);
|
||||
}
|
||||
|
||||
virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ) = 0;
|
||||
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE )
|
||||
{
|
||||
DrawText(text, pt.x, pt.y, use16bit);
|
||||
}
|
||||
virtual bool CanGetTextExtent(void) const = 0;
|
||||
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;
|
||||
virtual long GetCharWidth(void) = 0;
|
||||
virtual long GetCharHeight(void) = 0;
|
||||
|
||||
virtual void Clear() = 0;
|
||||
|
||||
virtual void SetFont( const wxFont &font ) = 0;
|
||||
virtual wxFont& GetFont() const { return (wxFont&)m_font; };
|
||||
|
||||
virtual void SetPen( const wxPen &pen ) = 0;
|
||||
virtual wxPen& GetPen() const { return (wxPen&)m_pen; };
|
||||
|
||||
virtual void SetBrush( const wxBrush &brush ) = 0;
|
||||
virtual wxBrush& GetBrush() const { return (wxBrush&)m_brush; };
|
||||
|
||||
virtual void SetBackground( const wxBrush &brush ) = 0;
|
||||
virtual wxBrush& GetBackground() const { return (wxBrush&)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); };
|
||||
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 ®ion ) = 0;
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
virtual long MinX() const { return m_minX; }
|
||||
virtual long MaxX() const { return m_maxX; }
|
||||
virtual long MinY() const { return m_minY; }
|
||||
virtual long MaxY() const { return m_maxY; }
|
||||
// Resolution in pixels per logical inch
|
||||
virtual wxSize GetPPI() const;
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize( int* width, int* height ) const;
|
||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc() { }
|
||||
virtual void StartPage() { }
|
||||
virtual void EndPage() { }
|
||||
|
||||
// Size in millimetres
|
||||
virtual void GetSizeMM( int* width, int* height ) const;
|
||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
virtual void SetMapMode( int mode );
|
||||
virtual void SetUserScale( double x, double y );
|
||||
virtual void SetLogicalScale( double x, double y );
|
||||
virtual void SetLogicalOrigin( long x, long y );
|
||||
virtual void SetDeviceOrigin( long x, long y );
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
virtual wxSize GetPPI(void) const;
|
||||
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||
|
||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||
virtual void EndDoc() {}
|
||||
virtual void StartPage() {}
|
||||
virtual void EndPage() {}
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
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;
|
||||
virtual long DeviceToLogicalYRel(long y) const;
|
||||
virtual long LogicalToDeviceX(long x) const;
|
||||
virtual long LogicalToDeviceY(long y) const;
|
||||
virtual long LogicalToDeviceXRel(long x) const;
|
||||
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);
|
||||
}
|
||||
|
||||
protected:
|
||||
// base class pure virtuals implemented here
|
||||
virtual void DoSetClippingRegion(long x, long y, long width, long height);
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const;
|
||||
|
||||
public:
|
||||
public:
|
||||
// GTK-specific member variables
|
||||
|
||||
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 ?
|
||||
bool m_autoSetting; // wxMSW only ?
|
||||
bool m_dontDelete; // wxMSW only ?
|
||||
bool m_optimize; // wxMSW only ?
|
||||
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
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
|
||||
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;
|
||||
};
|
||||
|
||||
#endif // __GTKDCH__
|
||||
|
@@ -230,6 +230,7 @@ public:
|
||||
void Init();
|
||||
|
||||
private:
|
||||
DECLARE_NO_COPY_CLASS(wxWindow);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -57,11 +57,9 @@ public:
|
||||
|
||||
// MSW-specific
|
||||
|
||||
// Window procedure
|
||||
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
#ifdef __WIN95__
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
#endif // Win95
|
||||
|
||||
// For ownerdraw items
|
||||
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
||||
@@ -70,6 +68,8 @@ public:
|
||||
wxFunction GetCallback() { return m_callback; }
|
||||
wxList& GetSubcontrols() { return m_subControls; }
|
||||
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
|
||||
protected:
|
||||
wxFunction m_callback; // Callback associated with the window
|
||||
|
||||
|
@@ -6,397 +6,185 @@
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_DC_H_
|
||||
#define _WX_DC_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dc.h"
|
||||
#pragma interface "dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/pen.h"
|
||||
#include "wx/brush.h"
|
||||
#include "wx/icon.h"
|
||||
#include "wx/font.h"
|
||||
#include "wx/gdicmn.h"
|
||||
#include "wx/window.h"
|
||||
|
||||
// Clash with Windows header files
|
||||
#ifdef StartDoc
|
||||
#undef StartDoc
|
||||
#endif
|
||||
|
||||
#ifdef DrawText
|
||||
#undef DrawText
|
||||
#endif
|
||||
|
||||
#ifdef GetCharWidth
|
||||
#undef GetCharWidth
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxDC: public wxObject
|
||||
class WXDLLEXPORT wxDC : public wxDCBase
|
||||
{
|
||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||
protected:
|
||||
DECLARE_DYNAMIC_CLASS(wxDC)
|
||||
|
||||
public:
|
||||
wxDC(void);
|
||||
~wxDC(void);
|
||||
wxDC();
|
||||
~wxDC();
|
||||
|
||||
#ifdef WX_COMP_INLINE_NO_CLASS
|
||||
inline void BeginDrawing(void) {}
|
||||
inline void EndDrawing(void) {}
|
||||
#else
|
||||
inline void wxDC::BeginDrawing(void) {}
|
||||
inline void wxDC::EndDrawing(void) {}
|
||||
#endif
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual void FloodFill(long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE) ;
|
||||
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
|
||||
{
|
||||
FloodFill(pt.x, pt.y, col, style);
|
||||
}
|
||||
virtual void Clear();
|
||||
|
||||
virtual bool GetPixel(long x1, long y1, wxColour *col) const ;
|
||||
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
|
||||
{
|
||||
return GetPixel(pt.x, pt.y, col);
|
||||
}
|
||||
virtual bool StartDoc(const wxString& message);
|
||||
virtual void EndDoc();
|
||||
|
||||
virtual void DrawLine(long x1, long y1, long x2, long y2);
|
||||
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
||||
{
|
||||
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
|
||||
}
|
||||
virtual void StartPage();
|
||||
virtual void EndPage();
|
||||
|
||||
virtual void CrossHair(long x, long y) ;
|
||||
inline void CrossHair(const wxPoint& pt)
|
||||
{
|
||||
CrossHair(pt.x, pt.y);
|
||||
}
|
||||
virtual void SetFont(const wxFont& font);
|
||||
virtual void SetPen(const wxPen& pen);
|
||||
virtual void SetBrush(const wxBrush& brush);
|
||||
virtual void SetBackground(const wxBrush& brush);
|
||||
virtual void SetBackgroundMode(int mode);
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
|
||||
virtual void DrawArc(long x1,long y1,long x2,long y2,long xc, long yc);
|
||||
inline void DrawArc(const wxPoint& pt1, const wxPoint& pt2, const wxPoint& centre)
|
||||
{
|
||||
DrawArc(pt1.x, pt1.y, pt2.x, pt2.y, centre.x, centre.y);
|
||||
}
|
||||
virtual void DestroyClippingRegion();
|
||||
|
||||
virtual void DrawEllipticArc (long x, long y, long w, long h, double sa, double ea);
|
||||
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
|
||||
{
|
||||
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
|
||||
}
|
||||
virtual long GetCharHeight() const;
|
||||
virtual long GetCharWidth() const;
|
||||
virtual void GetTextExtent(const wxString& string,
|
||||
long *x, long *y,
|
||||
long *descent = NULL,
|
||||
long *externalLeading = NULL,
|
||||
wxFont *theFont = NULL) const;
|
||||
|
||||
virtual void DrawPoint(long x, long y);
|
||||
inline void DrawPoint(const wxPoint& pt)
|
||||
{
|
||||
DrawPoint(pt.x, pt.y);
|
||||
}
|
||||
virtual bool CanDrawBitmap() const;
|
||||
virtual bool CanGetTextExtent() const;
|
||||
virtual int GetDepth() const;
|
||||
virtual wxSize GetPPI() const;
|
||||
|
||||
virtual void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0);
|
||||
virtual void SetMapMode(int mode);
|
||||
virtual void SetUserScale(double x, double y);
|
||||
virtual void SetSystemScale(double x, double y);
|
||||
virtual void SetLogicalScale(double x, double y);
|
||||
virtual void SetLogicalOrigin(long x, long y);
|
||||
virtual void SetDeviceOrigin(long x, long y);
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||
virtual void SetLogicalFunction(int function);
|
||||
|
||||
virtual void DrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
||||
virtual void DrawRectangle(long x, long y, long width, long height);
|
||||
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
|
||||
{
|
||||
DrawRectangle(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void DrawRectangle(const wxRect& rect)
|
||||
{
|
||||
DrawRectangle(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
virtual void SetRop(WXHDC cdc);
|
||||
virtual void DoClipping(WXHDC cdc);
|
||||
virtual void SelectOldObjects(WXHDC dc);
|
||||
|
||||
virtual void DrawRoundedRectangle(long x, long y, long width, long height, double radius = 20.0);
|
||||
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
|
||||
{
|
||||
DrawRoundedRectangle(pt.x, pt.y, sz.x, sz.y, radius);
|
||||
}
|
||||
inline void DrawRoundedRectangle(const wxRect& rect, double radius = 20.0)
|
||||
{
|
||||
DrawRoundedRectangle(rect.x, rect.y, rect.width, rect.height, radius);
|
||||
}
|
||||
wxWindow *GetWindow() const { return m_canvas; }
|
||||
void SetWindow(wxWindow *win) { m_canvas = win; }
|
||||
|
||||
virtual void DrawEllipse(long x, long y, long width, long height);
|
||||
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
||||
{
|
||||
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void DrawEllipse(const wxRect& rect)
|
||||
{
|
||||
DrawEllipse(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
virtual void DrawIcon(const wxIcon& icon, long x, long y);
|
||||
inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
|
||||
{
|
||||
DrawIcon(icon, pt.x, pt.y);
|
||||
}
|
||||
|
||||
virtual void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE );
|
||||
|
||||
inline void DrawPoint(wxPoint& point) { DrawPoint(point.x, point.y); }
|
||||
virtual void DrawLines(wxList *list, long xoffset = 0, long yoffset = 0);
|
||||
virtual void DrawPolygon(wxList *list, long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
||||
|
||||
virtual void DrawText(const wxString& text, long x, long y, bool use16bit = FALSE);
|
||||
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
|
||||
{
|
||||
DrawText(text, pt.x, pt.y, use16bit);
|
||||
}
|
||||
|
||||
virtual bool Blit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE);
|
||||
inline bool Blit(const wxPoint& destPt, const wxSize& sz,
|
||||
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);
|
||||
}
|
||||
|
||||
#if wxUSE_SPLINES
|
||||
// Splines
|
||||
// 3-point spline
|
||||
virtual void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
|
||||
// Any number of control points - a list of pointers to wxPoints
|
||||
virtual void DrawSpline(wxList *points);
|
||||
virtual void DrawSpline(int n, wxPoint points[]);
|
||||
#endif
|
||||
virtual void Clear(void);
|
||||
virtual void SetFont(const wxFont& font);
|
||||
virtual void SetPen(const wxPen& pen);
|
||||
virtual void SetBrush(const wxBrush& brush);
|
||||
virtual void SetLogicalFunction(int function);
|
||||
virtual void SetBackground(const wxBrush& brush);
|
||||
virtual void SetBackgroundMode(int mode);
|
||||
|
||||
virtual void SetClippingRegion(long x, long y, long width, long height);
|
||||
inline void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
|
||||
{
|
||||
SetClippingRegion(pt.x, pt.y, sz.x, sz.y);
|
||||
}
|
||||
inline void SetClippingRegion(const wxRect& rect)
|
||||
{
|
||||
SetClippingRegion(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
virtual void SetClippingRegion(const wxRegion& region);
|
||||
|
||||
virtual void SetPalette(const wxPalette& palette);
|
||||
#if WXWIN_COMPATIBILITY
|
||||
virtual inline void SetColourMap(const wxPalette& palette) { SetPalette(palette); };
|
||||
#endif
|
||||
virtual void DestroyClippingRegion(void);
|
||||
virtual long GetCharHeight(void) const;
|
||||
virtual long GetCharWidth(void) const;
|
||||
virtual void GetTextExtent(const wxString& string, long *x, long *y,
|
||||
long *descent = NULL, long *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const;
|
||||
#if WXWIN_COMPATIBILITY
|
||||
void GetTextExtent(const wxString& string, float *x, float *y,
|
||||
float *descent = NULL, float *externalLeading = NULL,
|
||||
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
|
||||
#endif
|
||||
|
||||
// Size in device units
|
||||
virtual void GetSize(int* width, int* height) const;
|
||||
inline wxSize GetSize() const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Size in mm
|
||||
virtual void GetSizeMM(int* width, int* height) const ;
|
||||
inline wxSize GetSizeMM() const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
||||
|
||||
// Resolution in Pixels per inch
|
||||
virtual wxSize GetPPI(void) const ;
|
||||
|
||||
// Compatibility
|
||||
#if WXWIN_COMPATIBILITY
|
||||
inline void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
|
||||
inline void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
|
||||
#endif
|
||||
|
||||
virtual bool StartDoc(const wxString& message);
|
||||
virtual void EndDoc(void);
|
||||
virtual void StartPage(void);
|
||||
virtual void EndPage(void);
|
||||
virtual void SetMapMode(int mode);
|
||||
virtual void SetUserScale(double x, double y);
|
||||
virtual void SetSystemScale(double x, double y);
|
||||
virtual void SetLogicalOrigin(long x, long y);
|
||||
virtual void SetDeviceOrigin(long x, long y);
|
||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||
|
||||
// This group of functions does actual conversion
|
||||
// of the input, as you'd expect.
|
||||
|
||||
long DeviceToLogicalX(long x) const;
|
||||
long DeviceToLogicalY(long y) const;
|
||||
long DeviceToLogicalXRel(long x) const;
|
||||
long DeviceToLogicalYRel(long y) const;
|
||||
long LogicalToDeviceX(long x) const;
|
||||
long LogicalToDeviceY(long y) const;
|
||||
long LogicalToDeviceXRel(long x) const;
|
||||
long LogicalToDeviceYRel(long y) const;
|
||||
|
||||
// This group of functions may not do any conversion
|
||||
// if m_scaleGDI is TRUE, since the HDC does the
|
||||
// conversion automatically.
|
||||
// m_scaleGDI NOW OBSOLETE
|
||||
long ImplDeviceToLogicalX(long x) const;
|
||||
long ImplDeviceToLogicalY(long y) const;
|
||||
long ImplDeviceToLogicalXRel(long x) const;
|
||||
long ImplDeviceToLogicalYRel(long y) const;
|
||||
long ImplLogicalToDeviceX(long x) const;
|
||||
long ImplLogicalToDeviceY(long y) const;
|
||||
long ImplLogicalToDeviceXRel(long x) const;
|
||||
long ImplLogicalToDeviceYRel(long y) const;
|
||||
|
||||
virtual bool CanDrawBitmap(void) const;
|
||||
virtual bool CanGetTextExtent(void) const;
|
||||
|
||||
virtual void SetTextForeground(const wxColour& colour);
|
||||
virtual void SetTextBackground(const wxColour& colour);
|
||||
inline virtual bool Ok(void) const {return m_ok;};
|
||||
inline virtual int GetMapMode(void) const {return m_mappingMode;};
|
||||
|
||||
inline virtual wxBrush& GetBackground(void) const { return (wxBrush&) m_backgroundBrush ;}
|
||||
inline virtual wxBrush& GetBrush(void) const { return (wxBrush&) m_brush ;}
|
||||
inline virtual wxFont& GetFont(void) const { return (wxFont&) m_font ;}
|
||||
inline virtual int GetLogicalFunction(void) const { return m_logicalFunction ;}
|
||||
inline virtual wxPen& GetPen(void) const { return (wxPen&) m_pen ;}
|
||||
inline virtual wxColour&GetTextBackground(void) const { return (wxColour&) m_textBackgroundColour ;}
|
||||
inline virtual wxColour&GetTextForeground(void) const { return (wxColour&) m_textForegroundColour ;}
|
||||
|
||||
virtual void SetLogicalScale(double x, double y);
|
||||
virtual inline void GetUserScale(double* x, double *y) const { *x = m_userScaleX; *y = m_userScaleY; }
|
||||
virtual void CalcBoundingBox(long x, long y);
|
||||
// Get the final bounding box of the PostScript or Metafile picture.
|
||||
virtual inline long MinX(void) const { return m_minX; }
|
||||
virtual inline long MaxX(void) const { return m_maxX; }
|
||||
virtual inline long MinY(void) const { return m_minY; }
|
||||
virtual inline long MaxY(void) const { return m_maxY; }
|
||||
// Sometimes we need to override optimization, e.g.
|
||||
// if other software is drawing onto our surface and we
|
||||
// can't be sure of who's done what.
|
||||
virtual inline void SetOptimization(bool WXUNUSED(opt)) { }
|
||||
virtual inline bool GetOptimization(void) { return FALSE; }
|
||||
|
||||
virtual void GetClippingBox(long *x,long *y,long *w,long *h) const ;
|
||||
inline void GetClippingBox(wxRect& rect) const
|
||||
{
|
||||
long x, y, w, h;
|
||||
GetClippingBox(&x, &y, &w, &h); rect.x = x; rect.y = y; rect.width = w; rect.height = h;
|
||||
}
|
||||
|
||||
// This should probably be made available on other platforms
|
||||
#ifdef WX_COMP_INLINE_NO_CLASS
|
||||
int GetDepth(void) const ;
|
||||
#else
|
||||
int wxDC::GetDepth(void) const ;
|
||||
#endif
|
||||
|
||||
// Implementation
|
||||
virtual void SetRop(WXHDC cdc);
|
||||
virtual void DoClipping(WXHDC cdc);
|
||||
virtual void SelectOldObjects(WXHDC dc);
|
||||
|
||||
inline wxWindow *GetWindow(void) const { return m_canvas; }
|
||||
inline void SetWindow(wxWindow *win) { m_canvas = win; }
|
||||
inline WXHDC GetHDC(void) const { return m_hDC; }
|
||||
inline void SetHDC(WXHDC dc, bool bOwnsDC = FALSE) { m_hDC = dc; m_bOwnsDC = bOwnsDC; }
|
||||
WXHDC GetHDC() const { return m_hDC; }
|
||||
void SetHDC(WXHDC dc, bool bOwnsDC = FALSE)
|
||||
{
|
||||
m_hDC = dc;
|
||||
m_bOwnsDC = bOwnsDC;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool m_colour;
|
||||
bool m_ok;
|
||||
bool m_clipping;
|
||||
bool m_isInteractive;
|
||||
virtual void DoFloodFill(long x, long y, const wxColour& col,
|
||||
int style = wxFLOOD_SURFACE);
|
||||
|
||||
// Coordinate system variables
|
||||
long m_logicalOriginX;
|
||||
long m_logicalOriginY;
|
||||
virtual bool DoGetPixel(long x, long y, wxColour *col) const;
|
||||
|
||||
long m_deviceOriginX;
|
||||
long m_deviceOriginY;
|
||||
virtual void DoDrawPoint(long x, long y);
|
||||
virtual void DoDrawLine(long x1, long y1, long x2, long y2);
|
||||
|
||||
double m_logicalScaleX;
|
||||
double m_logicalScaleY;
|
||||
virtual void DoDrawArc(long x1, long y1,
|
||||
long x2, long y2,
|
||||
long xc, long yc);
|
||||
virtual void DoDrawEllipticArc(long x, long y, long w, long h,
|
||||
double sa, double ea);
|
||||
|
||||
double m_userScaleX;
|
||||
double m_userScaleY;
|
||||
virtual void DoDrawRectangle(long x, long y, long width, long height);
|
||||
virtual void DoDrawRoundedRectangle(long x, long y,
|
||||
long width, long height,
|
||||
double radius);
|
||||
virtual void DoDrawEllipse(long x, long y, long width, long height);
|
||||
|
||||
int m_signX; // Used by SetAxisOrientation() to
|
||||
int m_signY; // invert the axes
|
||||
virtual void DoCrossHair(long x, long y);
|
||||
|
||||
int m_mappingMode;
|
||||
virtual void DoDrawIcon(const wxIcon& icon, long x, long y);
|
||||
virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y,
|
||||
bool useMask = FALSE);
|
||||
|
||||
long m_minX; // bounding box
|
||||
long m_minY;
|
||||
long m_maxX;
|
||||
long m_maxY;
|
||||
virtual void DoDrawText(const wxString& text, long x, long y);
|
||||
|
||||
int m_logicalFunction;
|
||||
int m_backgroundMode;
|
||||
virtual bool DoBlit(long xdest, long ydest, long width, long height,
|
||||
wxDC *source, long xsrc, long ysrc,
|
||||
int rop = wxCOPY, bool useMask = FALSE);
|
||||
|
||||
wxPen m_pen;
|
||||
wxBrush m_brush;
|
||||
wxBrush m_backgroundBrush;
|
||||
wxColour m_textForegroundColour;
|
||||
wxColour m_textBackgroundColour;
|
||||
wxFont m_font;
|
||||
wxPalette m_palette;
|
||||
int m_clipX1;
|
||||
int m_clipY1;
|
||||
int m_clipX2;
|
||||
int m_clipY2;
|
||||
// bool m_dontDelete;
|
||||
int m_windowExtX;
|
||||
int m_windowExtY;
|
||||
double m_systemScaleX;
|
||||
double m_systemScaleY;
|
||||
// this is gnarly - we can't even call this function DoSetClippingRegion()
|
||||
// because of virtual function hiding
|
||||
virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
|
||||
virtual void DoSetClippingRegion(long x, long y,
|
||||
long width, long height);
|
||||
virtual void DoGetClippingRegion(long *x, long *y,
|
||||
long *width, long *height)
|
||||
{
|
||||
GetClippingBox(x, y, width, height);
|
||||
}
|
||||
|
||||
wxWindow * m_canvas;
|
||||
wxBitmap m_selectedBitmap;
|
||||
virtual void DoGetSize(int *width, int *height) const;
|
||||
virtual void DoGetSizeMM(int* width, int* height) const;
|
||||
|
||||
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
|
||||
bool m_bOwnsDC;
|
||||
virtual void DoDrawLines(int n, wxPoint points[],
|
||||
long xoffset, long yoffset);
|
||||
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||
long xoffset, long yoffset,
|
||||
int fillStyle = wxODDEVEN_RULE);
|
||||
|
||||
WXHDC m_hDC;
|
||||
int m_hDCCount;
|
||||
#if wxUSE_SPLINES
|
||||
virtual void DoDrawSpline(wxList *points);
|
||||
#endif // wxUSE_SPLINES
|
||||
|
||||
// Store all old GDI objects when do a SelectObject,
|
||||
// so we can select them back in (this unselecting user's
|
||||
// objects) so we can safely delete the DC.
|
||||
WXHBITMAP m_oldBitmap;
|
||||
WXHPEN m_oldPen;
|
||||
WXHBRUSH m_oldBrush;
|
||||
WXHFONT m_oldFont;
|
||||
WXHPALETTE m_oldPalette;
|
||||
// MSW-specific member variables
|
||||
int m_windowExtX;
|
||||
int m_windowExtY;
|
||||
|
||||
// Stores scaling, translation, rotation
|
||||
// wxTransformMatrix m_transformMatrix;
|
||||
// the window associated with this DC (may be NULL)
|
||||
wxWindow *m_canvas;
|
||||
|
||||
// Do we wish to scale GDI objects too, e.g. pen width?
|
||||
// bool m_scaleGDI;
|
||||
wxBitmap m_selectedBitmap;
|
||||
|
||||
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
|
||||
bool m_bOwnsDC:1;
|
||||
|
||||
// our HDC and its usage count: we only free it when the usage count drops
|
||||
// to 0
|
||||
WXHDC m_hDC;
|
||||
int m_hDCCount;
|
||||
|
||||
// Store all old GDI objects when do a SelectObject, so we can select them
|
||||
// back in (this unselecting user's objects) so we can safely delete the
|
||||
// DC.
|
||||
WXHBITMAP m_oldBitmap;
|
||||
WXHPEN m_oldPen;
|
||||
WXHBRUSH m_oldBrush;
|
||||
WXHFONT m_oldFont;
|
||||
WXHPALETTE m_oldPalette;
|
||||
};
|
||||
|
||||
// Logical to device
|
||||
// Absolute
|
||||
#define XLOG2DEV(x) ImplLogicalToDeviceX(x)
|
||||
|
||||
#define YLOG2DEV(y) ImplLogicalToDeviceY(y)
|
||||
#define XLOG2DEV(x) (x)
|
||||
#define YLOG2DEV(y) (y)
|
||||
|
||||
// Relative
|
||||
#define XLOG2DEVREL(x) ImplLogicalToDeviceXRel(x)
|
||||
#define YLOG2DEVREL(y) ImplLogicalToDeviceYRel(y)
|
||||
#define XLOG2DEVREL(x) (x)
|
||||
#define YLOG2DEVREL(y) (y)
|
||||
|
||||
// Device to logical
|
||||
// Absolute
|
||||
#define XDEV2LOG(x) ImplDeviceToLogicalX(x)
|
||||
#define XDEV2LOG(x) (x)
|
||||
|
||||
#define YDEV2LOG(y) ImplDeviceToLogicalY(y)
|
||||
#define YDEV2LOG(y) (y)
|
||||
|
||||
// Relative
|
||||
#define XDEV2LOGREL(x) ImplDeviceToLogicalXRel(x)
|
||||
#define YDEV2LOGREL(y) ImplDeviceToLogicalYRel(y)
|
||||
#define XDEV2LOGREL(x) (x)
|
||||
#define YDEV2LOGREL(y) (y)
|
||||
|
||||
/*
|
||||
* Have the same macros as for XView but not for every operation:
|
||||
@@ -426,8 +214,6 @@ protected:
|
||||
#define MM_POINTS 9
|
||||
#define MM_METRIC 10
|
||||
|
||||
extern int wxPageNumber;
|
||||
|
||||
// Conversion
|
||||
#define METRIC_CONVERSION_CONSTANT 0.0393700787
|
||||
|
||||
@@ -443,6 +229,5 @@ extern int wxPageNumber;
|
||||
|
||||
#define wx_round(a) (int)((a)+.5)
|
||||
|
||||
|
||||
#endif
|
||||
// _WX_DC_H_
|
||||
|
@@ -107,8 +107,9 @@ public:
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
// IMPLEMENTATION
|
||||
virtual bool MSWOnClose();
|
||||
// implementation
|
||||
// --------------
|
||||
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
@@ -124,6 +125,7 @@ protected:
|
||||
bool m_modalShowing;
|
||||
WXHWND m_hwndOldFocus; // the window which had focus before we were shown
|
||||
|
||||
private:
|
||||
#if wxUSE_TOOLTIPS
|
||||
WXHWND m_hwndToolTip;
|
||||
#endif // tooltips
|
||||
|
@@ -157,30 +157,40 @@ public:
|
||||
// event handlers
|
||||
bool MSWOnPaint();
|
||||
WXHICON MSWOnQueryDragIcon();
|
||||
void MSWOnSize(int x, int y, WXUINT flag);
|
||||
bool MSWOnSize(int x, int y, WXUINT flag);
|
||||
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
bool MSWOnClose();
|
||||
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||
bool MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||
bool MSWProcessMessage(WXMSG *msg);
|
||||
bool MSWTranslateMessage(WXMSG *msg);
|
||||
void MSWCreate(int id, wxWindow *parent, const char *wclass,
|
||||
bool MSWCreate(int id, wxWindow *parent, const char *wclass,
|
||||
wxWindow *wx_win, const char *title,
|
||||
int x, int y, int width, int height, long style);
|
||||
|
||||
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
|
||||
|
||||
// tooltip management
|
||||
#if wxUSE_TOOLTIPS
|
||||
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
||||
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
||||
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
||||
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
||||
#endif // tooltips
|
||||
|
||||
protected:
|
||||
void DoGetClientSize(int *width, int *height) const;
|
||||
void DoGetSize(int *width, int *height) const ;
|
||||
void DoGetPosition(int *x, int *y) const ;
|
||||
// override base class virtuals
|
||||
virtual void DoGetClientSize(int *width, int *height) const;
|
||||
virtual void DoGetSize(int *width, int *height) const ;
|
||||
virtual void DoGetPosition(int *x, int *y) const ;
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
// propagate our state change to all child frames
|
||||
void IconizeChildFrames(bool bIconize);
|
||||
|
||||
// window proc for the frames
|
||||
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
wxMenuBar * m_frameMenuBar;
|
||||
wxStatusBar * m_frameStatusBar;
|
||||
wxIcon m_icon;
|
||||
@@ -190,16 +200,11 @@ protected:
|
||||
|
||||
static bool m_useNativeStatusBar;
|
||||
|
||||
private:
|
||||
#if wxUSE_TOOLTIPS
|
||||
WXHWND m_hwndToolTip;
|
||||
#endif // tooltips
|
||||
|
||||
virtual void DoSetSize(int x, int y,
|
||||
int width, int height,
|
||||
int sizeFlags = wxSIZE_AUTO);
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -419,7 +419,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
||||
|
||||
// IMPLEMENTATION
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
// Recreate window - seems to be necessary when changing a style.
|
||||
void RecreateWindow();
|
||||
|
@@ -6,14 +6,14 @@
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MDI_H_
|
||||
#define _WX_MDI_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "mdi.h"
|
||||
#pragma interface "mdi.h"
|
||||
#endif
|
||||
|
||||
#include "wx/frame.h"
|
||||
@@ -24,185 +24,188 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
|
||||
class WXDLLEXPORT wxMDIClientWindow;
|
||||
class WXDLLEXPORT wxMDIChildFrame;
|
||||
|
||||
class WXDLLEXPORT wxMDIParentFrame: public wxFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMDIParentFrame : public wxFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||
|
||||
friend class WXDLLEXPORT wxMDIChildFrame;
|
||||
public:
|
||||
public:
|
||||
wxMDIParentFrame();
|
||||
wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
wxMDIParentFrame(void);
|
||||
inline wxMDIParentFrame(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
~wxMDIParentFrame();
|
||||
|
||||
~wxMDIParentFrame(void);
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
/*
|
||||
#if WXWIN_COMPATIBILITY
|
||||
virtual void OldOnActivate(bool flag);
|
||||
virtual void OldOnSize(int x, int y);
|
||||
#endif
|
||||
*/
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
// Get the active MDI child window (Windows only)
|
||||
wxMDIChildFrame *GetActiveChild() const ;
|
||||
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
// Get the client window
|
||||
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
||||
|
||||
// Get the active MDI child window (Windows only)
|
||||
wxMDIChildFrame *GetActiveChild(void) const ;
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient(void) ;
|
||||
|
||||
// Get the client window
|
||||
inline wxMDIClientWindow *GetClientWindow(void) const ;
|
||||
WXHMENU GetWindowMenu() const { return m_windowMenu; }
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
virtual wxMDIClientWindow *OnCreateClient(void) ;
|
||||
// MDI operations
|
||||
// --------------
|
||||
virtual void Cascade();
|
||||
virtual void Tile();
|
||||
virtual void ArrangeIcons();
|
||||
virtual void ActivateNext();
|
||||
virtual void ActivatePrevious();
|
||||
|
||||
inline WXHMENU GetWindowMenu(void) const ;
|
||||
// handlers
|
||||
// --------
|
||||
|
||||
// MDI operations
|
||||
virtual void Cascade(void);
|
||||
virtual void Tile(void);
|
||||
virtual void ArrangeIcons(void);
|
||||
virtual void ActivateNext(void);
|
||||
virtual void ActivatePrevious(void);
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
// Handlers
|
||||
void MSWOnSize(int x, int y, WXUINT flag);
|
||||
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||
bool MSWProcessMessage(WXMSG *msg);
|
||||
bool MSWTranslateMessage(WXMSG *msg);
|
||||
void MSWOnCreate(WXLPCREATESTRUCT cs);
|
||||
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
bool MSWOnEraseBkgnd(WXHDC pDC);
|
||||
bool MSWOnDestroy(void);
|
||||
bool MSWOnActivate(int state, bool minimized, WXHWND activate);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
virtual bool MSWOnActivate(int state, bool minimized, WXHWND activate);
|
||||
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
|
||||
protected:
|
||||
// Gets the size available for subwindows after menu size, toolbar size
|
||||
// and status bar size have been subtracted. If you want to manage your own
|
||||
// toolbar(s), don't call SetToolBar.
|
||||
void DoGetClientSize(int *width, int *height) const;
|
||||
// override window proc for MDI-specific message processing
|
||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
|
||||
virtual bool MSWProcessMessage(WXMSG* msg);
|
||||
virtual bool MSWTranslateMessage(WXMSG* msg);
|
||||
|
||||
protected:
|
||||
wxMDIClientWindow * m_clientWindow;
|
||||
wxMDIChildFrame * m_currentChild;
|
||||
WXHMENU m_windowMenu;
|
||||
bool m_parentFrameActive; // TRUE if MDI Frame is intercepting
|
||||
// commands, not child
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
// TRUE if MDI Frame is intercepting commands, not child
|
||||
bool m_parentFrameActive;
|
||||
|
||||
private:
|
||||
friend class WXDLLEXPORT wxMDIChildFrame;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// Inlines
|
||||
inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
|
||||
inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMDIChildFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMDIChildFrame: public wxFrame
|
||||
class WXDLLEXPORT wxMDIChildFrame : public wxFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||
|
||||
wxMDIChildFrame(void);
|
||||
inline wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
public:
|
||||
wxMDIChildFrame();
|
||||
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr)
|
||||
{
|
||||
Create(parent, id, title, pos, size, style, name);
|
||||
}
|
||||
|
||||
~wxMDIChildFrame(void);
|
||||
~wxMDIChildFrame();
|
||||
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
bool Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_FRAME_STYLE,
|
||||
const wxString& name = wxFrameNameStr);
|
||||
|
||||
// Set menu bar
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
// Set menu bar
|
||||
void SetMenuBar(wxMenuBar *menu_bar);
|
||||
|
||||
// MDI operations
|
||||
virtual void Maximize(void);
|
||||
virtual void Restore(void);
|
||||
virtual void Activate(void);
|
||||
// MDI operations
|
||||
virtual void Maximize();
|
||||
virtual void Restore();
|
||||
virtual void Activate();
|
||||
|
||||
// Handlers
|
||||
// Handlers
|
||||
|
||||
long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||
void MSWOnSize(int x, int y, WXUINT);
|
||||
void MSWOnWindowPosChanging(void *lpPos);
|
||||
bool MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||
bool MSWOnSize(int x, int y, WXUINT);
|
||||
bool MSWOnWindowPosChanging(void *lpPos);
|
||||
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
bool MSWProcessMessage(WXMSG *msg);
|
||||
bool MSWTranslateMessage(WXMSG *msg);
|
||||
void MSWDestroyWindow(void);
|
||||
void MSWDestroyWindow();
|
||||
|
||||
// Implementation
|
||||
bool ResetWindowStyle(void *vrect);
|
||||
|
||||
protected:
|
||||
void DoGetPosition(int *x, int *y) const ;
|
||||
void DoSetClientSize(int width, int height);
|
||||
virtual void DoGetPosition(int *x, int *y) const ;
|
||||
virtual void DoSetClientSize(int width, int height);
|
||||
};
|
||||
|
||||
class WXDLLEXPORT wxMDIClientWindow: public wxWindow
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMDIClientWindow
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxMDIClientWindow : public wxWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||
|
||||
wxMDIClientWindow(void) ;
|
||||
inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
public:
|
||||
wxMDIClientWindow();
|
||||
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||
{
|
||||
CreateClient(parent, style);
|
||||
}
|
||||
|
||||
~wxMDIClientWindow(void);
|
||||
~wxMDIClientWindow();
|
||||
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent, long style = wxVSCROLL | wxHSCROLL);
|
||||
// Note: this is virtual, to allow overridden behaviour.
|
||||
virtual bool CreateClient(wxMDIParentFrame *parent,
|
||||
long style = wxVSCROLL | wxHSCROLL);
|
||||
|
||||
// Explicitly call default scroll behaviour
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
// Explicitly call default scroll behaviour
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
|
||||
// Window procedure
|
||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
// Window procedure
|
||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
// Calls an appropriate default window procedure
|
||||
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
// Should hand the message to the default proc
|
||||
long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||
// Calls an appropriate default window procedure
|
||||
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
protected:
|
||||
int m_scrollX;
|
||||
int m_scrollY;
|
||||
DECLARE_EVENT_TABLE()
|
||||
int m_scrollX, m_scrollY;
|
||||
|
||||
private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -181,7 +181,7 @@ public:
|
||||
// base class virtuals
|
||||
// -------------------
|
||||
virtual void Command(wxCommandEvent& event);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual void SetConstraintSizes(bool recurse = TRUE);
|
||||
virtual bool DoPhase(int nPhase);
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: private.h
|
||||
// Purpose: Private declarations
|
||||
// Purpose: Private declarations: as this header is only included by
|
||||
// wxWindows itself, it may contain identifiers which don't start
|
||||
// with "wx".
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Created: 01/02/97
|
||||
@@ -12,18 +14,13 @@
|
||||
#ifndef _WX_PRIVATE_H_
|
||||
#define _WX_PRIVATE_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#define VIEWPORT_EXTENT 1000
|
||||
class WXDLLEXPORT wxFont;
|
||||
|
||||
class WXDLLEXPORT wxFont ;
|
||||
|
||||
WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font);
|
||||
WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos);
|
||||
WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
|
||||
WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos);
|
||||
// ---------------------------------------------------------------------------
|
||||
// standard icons from the resources
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT_DATA(extern HICON) wxSTD_FRAME_ICON;
|
||||
WXDLLEXPORT_DATA(extern HICON) wxSTD_MDIPARENTFRAME_ICON;
|
||||
@@ -33,11 +30,10 @@ WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDIPARENTFRAME_ICON;
|
||||
WXDLLEXPORT_DATA(extern HICON) wxDEFAULT_MDICHILDFRAME_ICON;
|
||||
WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
|
||||
|
||||
WXDLLEXPORT HINSTANCE wxGetInstance();
|
||||
WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
|
||||
WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, wxFont *font);
|
||||
WXDLLEXPORT wxFont wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNew = TRUE);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// this defines a CASTWNDPROC macro which casts a pointer to the type of a
|
||||
// window proc
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifdef __GNUWIN32__
|
||||
# define CASTWNDPROC (long unsigned)
|
||||
#else
|
||||
@@ -68,19 +64,26 @@ WXDLLEXPORT wxFont wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNe
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// some stuff for old Windows versions (FIXME: what does it do here??)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
|
||||
#define APIENTRY FAR PASCAL
|
||||
#define APIENTRY FAR PASCAL
|
||||
#endif
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define _EXPORT /**/
|
||||
#define _EXPORT
|
||||
#else
|
||||
#define _EXPORT _export
|
||||
typedef signed short int SHORT ;
|
||||
#define _EXPORT _export
|
||||
#endif
|
||||
|
||||
#ifndef __WIN32__
|
||||
typedef signed short int SHORT;
|
||||
#endif
|
||||
|
||||
#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
|
||||
#define DLGPROC FARPROC
|
||||
#define DLGPROC FARPROC
|
||||
#endif
|
||||
|
||||
#if wxUSE_PENWIN
|
||||
@@ -90,31 +93,18 @@ typedef signed short int SHORT ;
|
||||
#endif // wxUSE_PENWIN
|
||||
|
||||
#if wxUSE_ITSY_BITSY
|
||||
#define IBS_HORZCAPTION 0x4000L
|
||||
#define IBS_VERTCAPTION 0x8000L
|
||||
#define IBS_HORZCAPTION 0x4000L
|
||||
#define IBS_VERTCAPTION 0x8000L
|
||||
|
||||
UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
|
||||
UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
|
||||
LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
|
||||
VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||
#endif
|
||||
|
||||
/* When implementing a new item, be sure to:
|
||||
*
|
||||
* - add the item to the parent panel
|
||||
* - set window_parent to the parent
|
||||
* - NULL any extra child window pointers not created for this item
|
||||
* (e.g. label control that wasn't needed)
|
||||
* - delete any extra child windows in the destructor (e.g. label control)
|
||||
* - implement DoSetSize
|
||||
* - to find panel position if coordinates are (-1, -1), use GetPosition
|
||||
* - call AdvanceCursor after creation, for panel layout mechanism.
|
||||
*
|
||||
*/
|
||||
UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
|
||||
UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
|
||||
LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
|
||||
VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||
#endif // wxUSE_ITSY_BITSY
|
||||
|
||||
#if wxUSE_CTL3D
|
||||
#include <wx/msw/ctl3d/ctl3d.h>
|
||||
#endif
|
||||
#include "wx/msw/ctl3d/ctl3d.h"
|
||||
#endif // wxUSE_CTL3D
|
||||
|
||||
/*
|
||||
* Decide what window classes we're going to use
|
||||
@@ -139,6 +129,10 @@ VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||
#define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// misc macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#define MEANING_CHARACTER '0'
|
||||
#define DEFAULT_ITEM_WIDTH 200
|
||||
#define DEFAULT_ITEM_HEIGHT 80
|
||||
@@ -151,16 +145,78 @@ VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||
extern LONG APIENTRY _EXPORT
|
||||
wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
// Find maximum size of window/rectangle
|
||||
WXDLLEXPORT extern void wxFindMaxSize(WXHWND hwnd, RECT *rect);
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants which might miss from some compilers' headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if !defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
|
||||
#define WS_EX_CLIENTEDGE 0
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
|
||||
#define WS_EX_CLIENTEDGE 0x00000200L
|
||||
#endif
|
||||
|
||||
#ifndef ENDSESSION_LOGOFF
|
||||
#define ENDSESSION_LOGOFF 0x80000000
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// debug messages
|
||||
// ---------------------------------------------------------------------------
|
||||
#if defined(__WIN95__) && defined(__WXDEBUG__) && wxUSE_DBWIN32
|
||||
|
||||
#ifndef __TWIN32__
|
||||
#ifdef OutputDebugString
|
||||
#undef OutputDebugString
|
||||
#endif
|
||||
|
||||
#define OutputDebugString OutputDebugStringW95
|
||||
#endif // __TWIN32__
|
||||
|
||||
extern void OutputDebugStringW95(const wxChar*, ...);
|
||||
#endif // USE_DBWIN32
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// macros to make casting between WXFOO and FOO a bit easier
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#define GetHwnd() ((HWND)GetHWND())
|
||||
#define GetWinHwnd(win) ((HWND)((win)->GetHWND()))
|
||||
|
||||
#define GetHdc() ((HDC)GetHDC())
|
||||
|
||||
#define GetHaccel() ((HACCEL)GetHACCEL())
|
||||
#define GetTableHaccel(table) ((HACCEL)((table)->GetHACCEL()))
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global data
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// List of scrollbar controls
|
||||
WXDLLEXPORT_DATA(extern wxList) wxScrollBarList;
|
||||
// The MakeProcInstance version of the function wxSubclassedGenericControlProc
|
||||
WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc;
|
||||
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
|
||||
WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// global functions
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
WXDLLEXPORT HINSTANCE wxGetInstance();
|
||||
WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
|
||||
|
||||
WXDLLEXPORT wxWindow* wxFindWinFromHandle(WXHWND hWnd);
|
||||
|
||||
WXDLLEXPORT void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font);
|
||||
WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, wxFont *font);
|
||||
WXDLLEXPORT wxFont wxCreateFontFromLogFont(LOGFONT *logFont);
|
||||
|
||||
WXDLLEXPORT void wxSliderEvent(WXHWND control, WXWORD wParam, WXWORD pos);
|
||||
WXDLLEXPORT void wxScrollBarEvent(WXHWND hbar, WXWORD wParam, WXWORD pos);
|
||||
|
||||
// Find maximum size of window/rectangle
|
||||
WXDLLEXPORT extern void wxFindMaxSize(WXHWND hwnd, RECT *rect);
|
||||
|
||||
WXDLLEXPORT wxWindow* wxFindControlFromHandle(WXHWND hWnd);
|
||||
WXDLLEXPORT void wxAddControlHandle(WXHWND hWnd, wxWindow *item);
|
||||
|
||||
@@ -180,29 +236,5 @@ inline bool wxStyleHasBorder(long style)
|
||||
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
||||
}
|
||||
|
||||
#if !defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
|
||||
#define WS_EX_CLIENTEDGE 0
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32__) && !defined(WS_EX_CLIENTEDGE)
|
||||
#define WS_EX_CLIENTEDGE 0x00000200L
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// debug messages
|
||||
// ---------------------------------------------------------------------------
|
||||
#if defined(__WIN95__) && defined(__WXDEBUG__) && wxUSE_DBWIN32
|
||||
|
||||
#ifndef __TWIN32__
|
||||
#ifdef OutputDebugString
|
||||
#undef OutputDebugString
|
||||
#endif
|
||||
|
||||
#define OutputDebugString OutputDebugStringW95
|
||||
#endif // __TWIN32__
|
||||
|
||||
extern void OutputDebugStringW95(const wxChar*, ...);
|
||||
#endif // USE_DBWIN32
|
||||
|
||||
#endif
|
||||
// _WX_PRIVATE_H_
|
||||
|
@@ -23,68 +23,68 @@ WXDLLEXPORT_DATA(extern const char*) wxScrollBarNameStr;
|
||||
// Scrollbar item
|
||||
class WXDLLEXPORT wxScrollBar: public wxControl
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||
|
||||
public:
|
||||
inline wxScrollBar(void) { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
|
||||
~wxScrollBar(void);
|
||||
wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
|
||||
~wxScrollBar();
|
||||
|
||||
inline wxScrollBar(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr);
|
||||
wxScrollBar(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr)
|
||||
{
|
||||
Create(parent, id, pos, size, style, validator, name);
|
||||
}
|
||||
bool Create(wxWindow *parent, wxWindowID id,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSB_HORIZONTAL,
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxScrollBarNameStr);
|
||||
|
||||
int GetThumbPosition(void) const ;
|
||||
inline int GetThumbSize() const { return m_pageSize; }
|
||||
inline int GetPageSize() const { return m_viewSize; }
|
||||
inline int GetRange() const { return m_objectSize; }
|
||||
int GetThumbPosition() const ;
|
||||
int GetThumbSize() const { return m_pageSize; }
|
||||
int GetPageSize() const { return m_viewSize; }
|
||||
int GetRange() const { return m_objectSize; }
|
||||
|
||||
virtual void SetThumbPosition(int viewStart);
|
||||
virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
||||
bool refresh = TRUE);
|
||||
virtual void SetThumbPosition(int viewStart);
|
||||
virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
||||
bool refresh = TRUE);
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Backward compatibility
|
||||
inline int GetValue(void) const { return GetThumbPosition(); }
|
||||
inline void SetValue(int viewStart) { SetThumbPosition(viewStart); }
|
||||
void GetValues(int *viewStart, int *viewLength, int *objectLength,
|
||||
int *pageLength) const ;
|
||||
inline int GetViewLength() const { return m_viewSize; }
|
||||
inline int GetObjectLength() const { return m_objectSize; }
|
||||
// Backward compatibility
|
||||
int GetValue() const { return GetThumbPosition(); }
|
||||
void SetValue(int viewStart) { SetThumbPosition(viewStart); }
|
||||
void GetValues(int *viewStart, int *viewLength, int *objectLength,
|
||||
int *pageLength) const ;
|
||||
int GetViewLength() const { return m_viewSize; }
|
||||
int GetObjectLength() const { return m_objectSize; }
|
||||
|
||||
void SetPageSize(int pageLength);
|
||||
void SetObjectLength(int objectLength);
|
||||
void SetViewLength(int viewLength);
|
||||
void SetPageSize(int pageLength);
|
||||
void SetObjectLength(int objectLength);
|
||||
void SetViewLength(int viewLength);
|
||||
#endif
|
||||
|
||||
void Command(wxCommandEvent& event);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
void Command(wxCommandEvent& event);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control);
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
// Backward compatibility: generate an old-style scroll command
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
#endif
|
||||
// Backward compatibility: generate an old-style scroll command
|
||||
void OnScroll(wxScrollEvent& event);
|
||||
#endif // WXWIN_COMPATIBILITY
|
||||
|
||||
protected:
|
||||
int m_pageSize;
|
||||
int m_viewSize;
|
||||
int m_objectSize;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -87,8 +87,8 @@ public:
|
||||
void Command(wxCommandEvent& event);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control);
|
||||
|
||||
protected:
|
||||
WXHWND m_staticMin;
|
||||
|
@@ -87,8 +87,8 @@ public:
|
||||
void Command(wxCommandEvent& event);
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control);
|
||||
|
||||
protected:
|
||||
WXHWND m_staticMin;
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
* Public interface
|
||||
*/
|
||||
wxSpinButton();
|
||||
|
||||
|
||||
wxSpinButton(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
@@ -50,37 +50,36 @@ public:
|
||||
{
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
|
||||
virtual ~wxSpinButton();
|
||||
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id = -1,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
||||
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
||||
const wxString& name = "wxSpinButton");
|
||||
|
||||
|
||||
|
||||
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
int GetValue() const ;
|
||||
void SetValue(int val) ;
|
||||
void SetRange(int minVal, int maxVal);
|
||||
int GetMin() const { return m_min; }
|
||||
int GetMax() const { return m_max; }
|
||||
|
||||
|
||||
// Operations
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||
|
||||
|
||||
// IMPLEMENTATION
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
virtual void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
||||
|
||||
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control);
|
||||
|
||||
protected:
|
||||
int m_min;
|
||||
int m_max;
|
||||
@@ -89,7 +88,7 @@ protected:
|
||||
class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxSpinEvent)
|
||||
|
||||
|
||||
public:
|
||||
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||
};
|
||||
|
@@ -124,7 +124,7 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
|
||||
void Command(wxCommandEvent& event);
|
||||
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
@@ -83,7 +83,7 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
||||
|
||||
// IMPLEMENTATION
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
// Responds to colour changes
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
@@ -449,7 +449,7 @@ public:
|
||||
// --------------
|
||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
|
||||
protected:
|
||||
// SetImageList helper
|
||||
|
@@ -29,6 +29,13 @@
|
||||
#undef FindWindow
|
||||
#endif
|
||||
|
||||
// VZ: apparently some version of Windows send extra mouse move messages after
|
||||
// a mouse click. My tests under NT 4.0 and 95 didn't show it so I'm
|
||||
// tempted to think that it was just an effect of a poor mouse and so the
|
||||
// code to work around this is currently disabled - just define this as 1
|
||||
// to reenable it
|
||||
#define wxUSE_MOUSEEVENT_HACK 0
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// forward declarations
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -176,10 +183,6 @@ public:
|
||||
// event handlers
|
||||
// --------------
|
||||
void OnEraseBackground(wxEraseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// a window may have a default button
|
||||
@@ -199,11 +202,10 @@ public:
|
||||
// Windows subclassing
|
||||
void SubclassWin(WXHWND hWnd);
|
||||
void UnsubclassWin();
|
||||
virtual long Default();
|
||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||
|
||||
// returns TRUE if the event was processed
|
||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
||||
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
|
||||
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
||||
|
||||
virtual wxWindow *FindItem(int id) const;
|
||||
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
|
||||
@@ -219,10 +221,16 @@ public:
|
||||
|
||||
wxObject *GetChild(int number) const ;
|
||||
|
||||
void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
|
||||
int x, int y, int width, int height,
|
||||
WXDWORD style, const char *dialog_template = NULL,
|
||||
WXDWORD exendedStyle = 0);
|
||||
// returns TRUE if the window has been created
|
||||
bool MSWCreate(int id,
|
||||
wxWindow *parent,
|
||||
const char *wclass,
|
||||
wxWindow *wx_win,
|
||||
const char *title,
|
||||
int x, int y, int width, int height,
|
||||
WXDWORD style,
|
||||
const char *dialog_template = NULL,
|
||||
WXDWORD exendedStyle = 0);
|
||||
|
||||
// Actually defined in wx_canvs.cc since requires wxCanvas declaration
|
||||
virtual void MSWDeviceToLogical(float *x, float *y) const ;
|
||||
@@ -236,75 +244,66 @@ public:
|
||||
// Setup background and foreground colours correctly
|
||||
virtual void SetupColours();
|
||||
|
||||
// Saves the last message information before calling base version
|
||||
virtual bool ProcessEvent(wxEvent& event);
|
||||
// ------------------------------------------------------------------------
|
||||
// internal handlers for MSW messages: all handlers return a boolen value:
|
||||
// TRUE means that the handler processed the event and FALSE that it didn't
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
// Handlers
|
||||
virtual void MSWOnCreate(WXLPCREATESTRUCT cs);
|
||||
// TODO: all this should go away, overriding MSWWindowProc() is enough to
|
||||
// implement this functionality
|
||||
virtual bool MSWOnCreate(WXLPCREATESTRUCT cs, bool *mayCreate);
|
||||
virtual bool MSWOnPaint();
|
||||
virtual WXHICON MSWOnQueryDragIcon() { return 0; }
|
||||
virtual void MSWOnSize(int x, int y, WXUINT flag);
|
||||
virtual void MSWOnWindowPosChanging(void *lpPos);
|
||||
virtual void MSWOnHScroll(WXWORD nSBCode, WXWORD pos, WXHWND control);
|
||||
virtual void MSWOnVScroll(WXWORD nSBCode, WXWORD pos, WXHWND control);
|
||||
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
virtual long MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual long MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual WXHBRUSH MSWOnCtlColor(WXHDC dc, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual bool MSWOnColorChange(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
virtual long MSWOnPaletteChanged(WXHWND hWndPalChange);
|
||||
virtual long MSWOnQueryNewPalette();
|
||||
virtual bool MSWOnEraseBkgnd(WXHDC pDC);
|
||||
virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||
virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem);
|
||||
virtual bool MSWOnClose();
|
||||
// Return TRUE to end session, FALSE to veto end session.
|
||||
virtual bool MSWOnQueryEndSession(long logOff);
|
||||
virtual bool MSWOnSize(int x, int y, WXUINT flag);
|
||||
|
||||
virtual bool MSWOnQueryDragIcon(WXHICON *hIcon);
|
||||
virtual bool MSWOnWindowPosChanging(void *lpPos);
|
||||
|
||||
// both horizontal and vertical
|
||||
virtual bool MSWOnScroll(int orientation, WXWORD nSBCode,
|
||||
WXWORD pos, WXHWND control);
|
||||
|
||||
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||
virtual bool MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
#ifdef __WIN95__
|
||||
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
#endif // __WIN95__
|
||||
|
||||
virtual bool MSWOnCtlColor(WXHBRUSH *hBrush,
|
||||
WXHDC hdc,
|
||||
WXHWND hWnd,
|
||||
WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam);
|
||||
|
||||
virtual bool MSWOnPaletteChanged(WXHWND hWndPalChange);
|
||||
virtual bool MSWOnQueryNewPalette();
|
||||
|
||||
virtual bool MSWOnQueryEndSession(long logOff, bool *mayEnd);
|
||||
virtual bool MSWOnEndSession(bool endSession, long logOff);
|
||||
|
||||
virtual bool MSWOnDestroy();
|
||||
virtual bool MSWOnSetFocus(WXHWND wnd);
|
||||
virtual bool MSWOnKillFocus(WXHWND wnd);
|
||||
virtual void MSWOnDropFiles(WXWPARAM wParam);
|
||||
virtual bool MSWOnDropFiles(WXWPARAM wParam);
|
||||
virtual bool MSWOnInitDialog(WXHWND hWndFocus);
|
||||
virtual void MSWOnShow(bool show, int status);
|
||||
virtual bool MSWOnShow(bool show, int status);
|
||||
|
||||
// TODO: rationalise these functions into 1 or 2 which take the
|
||||
// event type as argument.
|
||||
virtual void MSWOnLButtonDown(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnLButtonUp(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnLButtonDClick(int x, int y, WXUINT flags);
|
||||
virtual bool MSWOnMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
|
||||
virtual bool MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||
|
||||
virtual void MSWOnMButtonDown(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnMButtonUp(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnMButtonDClick(int x, int y, WXUINT flags);
|
||||
|
||||
virtual void MSWOnRButtonDown(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnRButtonUp(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnRButtonDClick(int x, int y, WXUINT flags);
|
||||
|
||||
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnMouseEnter(int x, int y, WXUINT flags);
|
||||
virtual void MSWOnMouseLeave(int x, int y, WXUINT flags);
|
||||
|
||||
// These return TRUE if an event handler was found, FALSE otherwise (not processed)
|
||||
virtual bool MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE);
|
||||
virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam);
|
||||
virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam);
|
||||
|
||||
virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate);
|
||||
virtual long MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate);
|
||||
virtual bool MSWOnMDIActivate(long flag, WXHWND activate, WXHWND deactivate);
|
||||
|
||||
virtual bool MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item);
|
||||
virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *item);
|
||||
|
||||
virtual void MSWOnJoyDown(int joystick, int x, int y, WXUINT flags);
|
||||
virtual void MSWOnJoyUp(int joystick, int x, int y, WXUINT flags);
|
||||
virtual void MSWOnJoyMove(int joystick, int x, int y, WXUINT flags);
|
||||
virtual void MSWOnJoyZMove(int joystick, int z, WXUINT flags);
|
||||
|
||||
virtual long MSWGetDlgCode();
|
||||
|
||||
// Window procedure
|
||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||
|
||||
@@ -317,12 +316,14 @@ public:
|
||||
// Detach "Window" menu from menu bar so it doesn't get deleted
|
||||
void MSWDetachWindowMenu();
|
||||
|
||||
inline WXFARPROC MSWGetOldWndProc() const;
|
||||
inline void MSWSetOldWndProc(WXFARPROC proc);
|
||||
|
||||
// Define for each class of dialog and control
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||
// this function should return the brush to paint the window background
|
||||
// with or 0 for the default brush
|
||||
virtual WXHBRUSH OnCtlColor(WXHDC hDC,
|
||||
WXHWND hWnd,
|
||||
WXUINT nCtlColor,
|
||||
WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam);
|
||||
|
||||
#if WXWIN_COMPATIBILITY
|
||||
void SetShowing(bool show) { (void)Show(show); }
|
||||
@@ -332,13 +333,8 @@ public:
|
||||
// Responds to colour changes: passes event on to children.
|
||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||
|
||||
// remember the parameters of the last message
|
||||
void PushLastMessage(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
m_lastMsg = msg;
|
||||
m_lastWParam = wParam;
|
||||
m_lastLParam = lParam;
|
||||
}
|
||||
// initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX)
|
||||
void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags);
|
||||
|
||||
protected:
|
||||
// the window handle
|
||||
@@ -365,15 +361,12 @@ protected:
|
||||
int m_xThumbSize;
|
||||
int m_yThumbSize;
|
||||
|
||||
// the coordinates of the last mouse event and the typoe of it
|
||||
#if wxUSE_MOUSEEVENT_HACK
|
||||
// the coordinates of the last mouse event and the type of it
|
||||
long m_lastMouseX,
|
||||
m_lastMouseY;
|
||||
int m_lastMouseEvent;
|
||||
|
||||
// the parameters of the last message used in Default()
|
||||
WXUINT m_lastMsg;
|
||||
WXWPARAM m_lastWParam;
|
||||
WXLPARAM m_lastLParam;
|
||||
#endif // wxUSE_MOUSEEVENT_HACK
|
||||
|
||||
WXHMENU m_hMenu; // Menu, if any
|
||||
|
||||
@@ -396,6 +389,15 @@ private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// the (non-virtual) handlers for the events
|
||||
bool HandleMove(int x, int y);
|
||||
bool HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags);
|
||||
|
||||
#ifdef __WIN95__
|
||||
bool HandleNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||
#endif // __WIN95__
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxWindow);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -208,11 +208,6 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnIdle(wxIdleEvent& event);
|
||||
|
||||
// Required to force normal cursor-setting behaviour in Windows
|
||||
#ifdef __WXMSW__
|
||||
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
wxList m_tools;
|
||||
// int m_tilingDirection;
|
||||
|
@@ -723,10 +723,7 @@ private:
|
||||
// contains the last id generated by NewControlId
|
||||
static int ms_lastControlId;
|
||||
|
||||
// no copy ctor/assignment operator
|
||||
wxWindowBase(const wxWindowBase&);
|
||||
wxWindowBase& operator=(const wxWindowBase&);
|
||||
|
||||
DECLARE_NO_COPY_CLASS(wxWindowBase);
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
@@ -44,6 +44,8 @@
|
||||
// Windows (VC++) has broad TCHAR support
|
||||
#if defined(__VISUALC__) && defined(__WIN32__)
|
||||
|
||||
#define HAVE_WCSLEN 1
|
||||
|
||||
#include <tchar.h>
|
||||
#if wxUSE_UNICODE // temporary - preserve binary compatibility
|
||||
typedef _TCHAR wxChar;
|
||||
|
Reference in New Issue
Block a user