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:
Vadim Zeitlin
1999-05-13 21:21:04 +00:00
parent 60a040b3bb
commit a23fd0e1d1
50 changed files with 3606 additions and 4719 deletions

View File

@@ -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

View File

@@ -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_

View File

@@ -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;

View File

@@ -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
//-----------------------------------------------------------------------------
@@ -43,234 +34,42 @@ class wxDC;
#define MM_POINTS 6
#define MM_METRIC 7
//-----------------------------------------------------------------------------
// global variables
//-----------------------------------------------------------------------------
extern int wxPageNumber;
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
class wxDC: public wxObject
class wxDC : public wxDCBase
{
DECLARE_ABSTRACT_CLASS(wxDC)
public:
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); };
// the first two must be overridden and called
virtual void DestroyClippingRegion(void);
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void SetClippingRegion( const wxRegion &region ) = 0;
virtual long MinX() const { return m_minX; }
virtual long MaxX() const { return m_maxX; }
virtual long MinY() const { return m_minY; }
virtual long MaxY() const { return m_maxY; }
// 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); }
// 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 DestroyClippingRegion();
// Resolution in pixels per logical inch
virtual wxSize GetPPI(void) const;
virtual wxSize GetPPI() const;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
virtual void EndDoc() {}
virtual void StartPage() {}
virtual void EndPage() {}
virtual void EndDoc() { }
virtual void StartPage() { }
virtual void EndPage() { }
virtual void SetMapMode( int mode );
virtual int GetMapMode(void) const { return m_mappingMode; };
virtual void SetUserScale( double x, double y );
virtual void GetUserScale( double *x, double *y );
virtual void SetLogicalScale( double x, double y );
virtual void GetLogicalScale( double *x, double *y );
virtual void SetLogicalOrigin( long x, long y );
virtual void GetLogicalOrigin( long *x, long *y );
virtual void SetDeviceOrigin( long x, long y );
virtual void GetDeviceOrigin( long *x, long *y );
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {}
virtual bool GetOptimization() { return m_optimize; }
virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const;
virtual long DeviceToLogicalXRel(long x) const;
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
@@ -334,50 +133,26 @@ public:
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__

View File

@@ -230,6 +230,7 @@ public:
void Init();
private:
DECLARE_NO_COPY_CLASS(wxWindow);
DECLARE_EVENT_TABLE()
};

View File

@@ -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
//-----------------------------------------------------------------------------
@@ -43,234 +34,42 @@ class wxDC;
#define MM_POINTS 6
#define MM_METRIC 7
//-----------------------------------------------------------------------------
// global variables
//-----------------------------------------------------------------------------
extern int wxPageNumber;
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
class wxDC: public wxObject
class wxDC : public wxDCBase
{
DECLARE_ABSTRACT_CLASS(wxDC)
public:
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); };
// the first two must be overridden and called
virtual void DestroyClippingRegion(void);
virtual void SetClippingRegion( long x, long y, long width, long height );
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
virtual void SetClippingRegion( const wxRegion &region ) = 0;
virtual long MinX() const { return m_minX; }
virtual long MaxX() const { return m_maxX; }
virtual long MinY() const { return m_minY; }
virtual long MaxY() const { return m_maxY; }
// 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); }
// 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 DestroyClippingRegion();
// Resolution in pixels per logical inch
virtual wxSize GetPPI(void) const;
virtual wxSize GetPPI() const;
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
virtual void EndDoc() {}
virtual void StartPage() {}
virtual void EndPage() {}
virtual void EndDoc() { }
virtual void StartPage() { }
virtual void EndPage() { }
virtual void SetMapMode( int mode );
virtual int GetMapMode(void) const { return m_mappingMode; };
virtual void SetUserScale( double x, double y );
virtual void GetUserScale( double *x, double *y );
virtual void SetLogicalScale( double x, double y );
virtual void GetLogicalScale( double *x, double *y );
virtual void SetLogicalOrigin( long x, long y );
virtual void GetLogicalOrigin( long *x, long *y );
virtual void SetDeviceOrigin( long x, long y );
virtual void GetDeviceOrigin( long *x, long *y );
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
virtual void SetOptimization( bool WXUNUSED(optimize) ) {}
virtual bool GetOptimization() { return m_optimize; }
virtual long DeviceToLogicalX(long x) const;
virtual long DeviceToLogicalY(long y) const;
virtual long DeviceToLogicalXRel(long x) const;
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
@@ -334,50 +133,26 @@ public:
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__

View File

@@ -230,6 +230,7 @@ public:
void Init();
private:
DECLARE_NO_COPY_CLASS(wxWindow);
DECLARE_EVENT_TABLE()
};

View File

@@ -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

View File

@@ -13,390 +13,178 @@
#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 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 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 void DrawPoint(long x, long y);
inline void DrawPoint(const wxPoint& pt)
{
DrawPoint(pt.x, pt.y);
}
virtual void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0);
virtual void DrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
virtual void 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 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);
}
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); }
virtual void DestroyClippingRegion();
// 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); }
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;
// Resolution in Pixels per inch
virtual wxSize GetPPI(void) const ;
virtual bool CanDrawBitmap() const;
virtual bool CanGetTextExtent() const;
virtual int GetDepth() const;
virtual wxSize GetPPI() 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 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);
// This group of functions does actual conversion
// of the input, as you'd expect.
// implementation from now on
// --------------------------
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; }
wxWindow *GetWindow() const { return m_canvas; }
void SetWindow(wxWindow *win) { m_canvas = win; }
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;
// 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);
}
virtual void DoGetSize(int *width, int *height) const;
virtual void DoGetSizeMM(int* width, int* height) const;
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);
#if wxUSE_SPLINES
virtual void DoDrawSpline(wxList *points);
#endif // wxUSE_SPLINES
// MSW-specific member variables
int m_windowExtX;
int m_windowExtY;
double m_systemScaleX;
double m_systemScaleY;
wxWindow * m_canvas;
// the window associated with this DC (may be NULL)
wxWindow *m_canvas;
wxBitmap m_selectedBitmap;
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
bool m_bOwnsDC;
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.
// 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;
// Stores scaling, translation, rotation
// wxTransformMatrix m_transformMatrix;
// Do we wish to scale GDI objects too, e.g. pen width?
// bool m_scaleGDI;
};
// 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_

View File

@@ -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

View File

@@ -157,16 +157,17 @@ 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; }
@@ -174,13 +175,22 @@ public:
#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()
};

View File

@@ -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();

View File

@@ -13,7 +13,7 @@
#define _WX_MDI_H_
#ifdef __GNUG__
#pragma interface "mdi.h"
#pragma interface "mdi.h"
#endif
#include "wx/frame.h"
@@ -24,15 +24,17 @@ 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)
friend class WXDLLEXPORT wxMDIChildFrame;
public:
wxMDIParentFrame(void);
inline wxMDIParentFrame(wxWindow *parent,
public:
wxMDIParentFrame();
wxMDIParentFrame(wxWindow *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
@@ -43,7 +45,7 @@ class WXDLLEXPORT wxMDIParentFrame: public wxFrame
Create(parent, id, title, pos, size, style, name);
}
~wxMDIParentFrame(void);
~wxMDIParentFrame();
bool Create(wxWindow *parent,
wxWindowID id,
@@ -53,77 +55,75 @@ class WXDLLEXPORT wxMDIParentFrame: public wxFrame
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
const wxString& name = wxFrameNameStr);
/*
#if WXWIN_COMPATIBILITY
virtual void OldOnActivate(bool flag);
virtual void OldOnSize(int x, int y);
#endif
*/
void OnSize(wxSizeEvent& event);
void OnActivate(wxActivateEvent& event);
// accessors
// ---------
void SetMenuBar(wxMenuBar *menu_bar);
// Get the active MDI child window (Windows only)
wxMDIChildFrame *GetActiveChild(void) const ;
wxMDIChildFrame *GetActiveChild() const ;
// Get the client window
inline wxMDIClientWindow *GetClientWindow(void) const ;
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
// Create the client window class (don't Create the window,
// just return a new class)
virtual wxMDIClientWindow *OnCreateClient(void) ;
inline WXHMENU GetWindowMenu(void) const ;
WXHMENU GetWindowMenu() const { return m_windowMenu; }
// MDI operations
virtual void Cascade(void);
virtual void Tile(void);
virtual void ArrangeIcons(void);
virtual void ActivateNext(void);
virtual void ActivatePrevious(void);
// --------------
virtual void Cascade();
virtual void Tile();
virtual void ArrangeIcons();
virtual void ActivateNext();
virtual void ActivatePrevious();
// 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);
// handlers
// --------
// Responds to colour changes
void OnSysColourChanged(wxSysColourChangedEvent& event);
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;
void OnSize(wxSizeEvent& event);
void OnActivate(wxActivateEvent& event);
virtual bool MSWOnActivate(int state, bool minimized, WXHWND activate);
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
// 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:
wxMDIChildFrame(void);
inline wxMDIChildFrame(wxMDIParentFrame *parent,
public:
wxMDIChildFrame();
wxMDIChildFrame(wxMDIParentFrame *parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
@@ -134,7 +134,7 @@ class WXDLLEXPORT wxMDIChildFrame: public wxFrame
Create(parent, id, title, pos, size, style, name);
}
~wxMDIChildFrame(void);
~wxMDIChildFrame();
bool Create(wxMDIParentFrame *parent,
wxWindowID id,
@@ -148,44 +148,49 @@ class WXDLLEXPORT wxMDIChildFrame: public wxFrame
void SetMenuBar(wxMenuBar *menu_bar);
// MDI operations
virtual void Maximize(void);
virtual void Restore(void);
virtual void Activate(void);
virtual void Maximize();
virtual void Restore();
virtual void Activate();
// 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:
wxMDIClientWindow(void) ;
inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
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);
virtual bool CreateClient(wxMDIParentFrame *parent,
long style = wxVSCROLL | wxHSCROLL);
// Explicitly call default scroll behaviour
void OnScroll(wxScrollEvent& event);
@@ -196,13 +201,11 @@ class WXDLLEXPORT wxMDIClientWindow: public wxWindow
// 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);
protected:
int m_scrollX;
int m_scrollY;
DECLARE_EVENT_TABLE()
int m_scrollX, m_scrollY;
private:
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -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);

View File

@@ -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_

View File

@@ -26,10 +26,10 @@ class WXDLLEXPORT wxScrollBar: public wxControl
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,
wxScrollBar(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
@@ -45,10 +45,10 @@ public:
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,
@@ -56,12 +56,12 @@ public:
#if WXWIN_COMPATIBILITY
// Backward compatibility
inline int GetValue(void) const { return GetThumbPosition(); }
inline void SetValue(int viewStart) { SetThumbPosition(viewStart); }
int GetValue() const { return GetThumbPosition(); }
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; }
int GetViewLength() const { return m_viewSize; }
int GetObjectLength() const { return m_objectSize; }
void SetPageSize(int pageLength);
void SetObjectLength(int objectLength);
@@ -71,20 +71,20 @@ 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);
#if WXWIN_COMPATIBILITY
// Backward compatibility: generate an old-style scroll command
void OnScroll(wxScrollEvent& event);
#endif
#endif // WXWIN_COMPATIBILITY
protected:
int m_pageSize;
int m_viewSize;
int m_objectSize;
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
#endif

View File

@@ -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;

View File

@@ -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;

View File

@@ -77,9 +77,8 @@ public:
// 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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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,9 +221,15 @@ public:
wxObject *GetChild(int number) const ;
void MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
// 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 style,
const char *dialog_template = NULL,
WXDWORD exendedStyle = 0);
// Actually defined in wx_canvs.cc since requires wxCanvas declaration
@@ -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()
};

View File

@@ -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;

View File

@@ -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()
};

View File

@@ -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;

View File

@@ -20,6 +20,8 @@
#include "wx/image.h"
#include "wx/file.h"
// derived classes
class MyFrame;
@@ -103,22 +105,32 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
dc.DrawRectangle( 0, 0, 100, 100 );
dc.SelectObject( wxNullBitmap );
wxString dir("");
#ifdef __WXGTK__
dir = wxString("../");
#endif
// try to find the directory with our images
wxString dir;
if ( wxFile::Exists("./horse.png") )
dir = "./";
else if ( wxFile::Exists("../horse.png") )
dir = "../";
else
wxLogWarning("Can't find image files in either '.' or '..'!");
wxImage image( bitmap );
image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
if ( !image.SaveFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG ) )
wxLogError("Can't save file");
image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG );
if ( !image.LoadFile( dir + wxString("horse.png"), wxBITMAP_TYPE_PNG ) )
wxLogError("Can't load PNG image");
else
my_horse_png = new wxBitmap( image.ConvertToBitmap() );
image.LoadFile( dir + wxString("horse.jpg"), wxBITMAP_TYPE_JPEG );
if ( !image.LoadFile( dir + wxString("horse.jpg"), wxBITMAP_TYPE_JPEG ) )
wxLogError("Can't load JPG image");
else
my_horse_jpeg = new wxBitmap( image.ConvertToBitmap() );
image.LoadFile( dir + wxString("horse.gif"), wxBITMAP_TYPE_GIF );
if ( !image.LoadFile( dir + wxString("horse.gif"), wxBITMAP_TYPE_GIF ) )
wxLogError("Can't load GIF image");
else
my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );

View File

@@ -43,29 +43,16 @@
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
/*
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxRealPoint, wxObject)
*/
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
#endif
wxRect::wxRect()
{
x = 0; y = 0; width = 0; height = 0;
}
wxRect::wxRect(long xx, long yy, long w, long h)
{
x = xx; y = yy; width = w; height = h;
}
wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
{
x = topLeft.x;
@@ -92,21 +79,7 @@ wxRect::wxRect(const wxPoint& point, const wxSize& size)
width = size.x; height = size.y;
}
wxRect::wxRect(const wxRect& rect)
{
x = rect.x;
y = rect.y;
width = rect.width;
height = rect.height;
}
wxRect& wxRect::operator = (const wxRect& rect)
{
x = rect.x; y = rect.y; width = rect.width; height = rect.height;
return *this;
}
bool wxRect::operator == (const wxRect& rect)
bool wxRect::operator==(const wxRect& rect) const
{
return ((x == rect.x) &&
(y == rect.y) &&
@@ -114,16 +87,7 @@ bool wxRect::operator == (const wxRect& rect)
(height == rect.height));
}
bool wxRect::operator != (const wxRect& rect)
{
return ((x != rect.x) ||
(y != rect.y) ||
(width != rect.width) ||
(height != rect.height));
}
wxColourDatabase::wxColourDatabase (int type):
wxList (type)
wxColourDatabase::wxColourDatabase (int type) : wxList (type)
{
}
@@ -321,6 +285,8 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
wxString wxColourDatabase::FindName (const wxColour& colour) const
{
wxString name;
unsigned char red = colour.Red ();
unsigned char green = colour.Green ();
unsigned char blue = colour.Blue ();
@@ -332,12 +298,16 @@ wxString wxColourDatabase::FindName (const wxColour& colour) const
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
{
const wxChar *found = node->GetKeyString();
if (found)
return wxString(found);
}
}
return wxString(""); // Not Found
if ( found )
{
name = found;
break;
}
}
}
return name;
}
void wxInitializeStockLists () {

View File

@@ -768,12 +768,4 @@ void wxToolBarBase::DoToolbarUpdates()
}
}
#ifdef __WXMSW__
// Circumvent wxControl::MSWOnMouseMove which doesn't set the cursor.
void wxToolBarBase::MSWOnMouseMove(int x, int y, WXUINT flags)
{
wxWindow::MSWOnMouseMove(x, y, flags);
}
#endif
#endif

View File

@@ -244,15 +244,21 @@ bool wxWindowBase::Close(bool force)
bool wxWindowBase::DestroyChildren()
{
wxWindowList::Node *node;
while ( (node = GetChildren().GetFirst()) )
for ( ;; )
{
// we iterate until the list becomes empty
node = GetChildren().GetFirst();
if ( !node )
break;
wxWindow *child = node->GetData();
wxASSERT_MSG( child, "m_children contains empty nodes" );
wxASSERT_MSG( child, "children list contains empty nodes" );
delete child;
wxASSERT_MSG( !GetChildren().Find(child), "child didn't remove itself using RemoveChild()" );
wxASSERT_MSG( !GetChildren().Find(child),
"child didn't remove itself using RemoveChild()" );
}
return TRUE;

View File

@@ -9,7 +9,7 @@
#ifdef __GNUG__
#pragma implementation "dc.h"
#pragma implementation "dc.h"
#endif
#include "wx/dc.h"
@@ -32,134 +32,29 @@
// wxDC
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
wxDC::wxDC()
{
m_ok = FALSE;
m_optimize = FALSE;
m_autoSetting = FALSE;
m_colour = TRUE;
m_clipping = FALSE;
m_mm_to_pix_x = 1.0;
m_mm_to_pix_y = 1.0;
m_logicalOriginX = 0;
m_logicalOriginY = 0;
m_deviceOriginX = 0;
m_deviceOriginY = 0;
m_logicalScaleX = 1.0;
m_logicalScaleY = 1.0;
m_userScaleX = 1.0;
m_userScaleY = 1.0;
m_scaleX = 1.0;
m_scaleY = 1.0;
m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; /* not used yet */
m_needComputeScaleY = FALSE; /* not used yet */
m_signX = 1; /* default x-axis left to right */
m_signY = 1; /* default y-axis top down. -1 in postscript. */
m_maxX = 0;
m_maxY = 0;
m_minX = 0;
m_minY = 0;
m_logicalFunction = wxCOPY;
// m_textAlignment = wxALIGN_TOP_LEFT;
m_backgroundMode = wxTRANSPARENT;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
// m_palette = wxAPP_COLOURMAP; /* I'll learn to handle palettes later in my life */
}
wxDC::~wxDC()
{
}
bool wxDC::Ok() const
{
return m_ok;
}
void wxDC::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2),
long WXUNUSED(xc), long WXUNUSED(yc) )
{
}
void wxDC::DrawPoint( wxPoint& point )
{
DrawPoint( point.x, point.y );
}
void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
{
int n = list->Number();
wxPoint *points = new wxPoint[n];
int i = 0;
for( wxNode *node = list->First(); node; node = node->Next() )
{
wxPoint *point = (wxPoint *)node->Data();
points[i].x = point->x;
points[i++].y = point->y;
}
DrawPolygon( n, points, xoffset, yoffset, fillStyle );
delete[] points;
}
void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
{
int n = list->Number();
wxPoint *points = new wxPoint[n];
int i = 0;
for( wxNode *node = list->First(); node; node = node->Next() )
{
wxPoint *point = (wxPoint *)node->Data();
points[i].x = point->x;
points[i++].y = point->y;
}
DrawLines( n, points, xoffset, yoffset );
delete []points;
}
void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
{
wxList list;
list.Append( (wxObject*)new wxPoint(x1, y1) );
list.Append( (wxObject*)new wxPoint(x2, y2) );
list.Append( (wxObject*)new wxPoint(x3, y3) );
DrawSpline(&list);
wxNode *node = list.First();
while (node)
{
wxPoint *p = (wxPoint*)node->Data();
delete p;
node = node->Next();
}
}
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
DrawSpline( &list );
}
void wxDC::SetClippingRegion( long x, long y, long width, long height )
void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
{
m_clipping = TRUE;
m_clipX1 = x;
@@ -173,28 +68,17 @@ void wxDC::DestroyClippingRegion()
m_clipping = FALSE;
}
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
{
if (m_clipping)
{
if (x) *x = m_clipX1;
if (y) *y = m_clipY1;
if (width) *width = (m_clipX2 - m_clipX1);
if (height) *height = (m_clipY2 - m_clipY1);
}
else
{
*x = *y = *width = *height = 0;
}
}
// ---------------------------------------------------------------------------
// get DC capabilities
// ---------------------------------------------------------------------------
void wxDC::GetSize( int* width, int* height ) const
void wxDC::DoGetSize( int* width, int* height ) const
{
if (width) *width = m_maxX-m_minX;
if (height) *height = m_maxY-m_minY;
}
void wxDC::GetSizeMM( int* width, int* height ) const
void wxDC::DoGetSizeMM( int* width, int* height ) const
{
int w = 0;
int h = 0;
@@ -204,20 +88,37 @@ void wxDC::GetSizeMM( int* width, int* height ) const
}
// Resolution in pixels per logical inch
wxSize wxDC::GetPPI(void) const
wxSize wxDC::GetPPI() const
{
// TODO (should probably be pure virtual)
return wxSize(0, 0);
}
void wxDC::SetTextForeground( const wxColour &col )
{
m_textForegroundColour = col;
}
// ---------------------------------------------------------------------------
// set various DC parameters
// ---------------------------------------------------------------------------
void wxDC::SetTextBackground( const wxColour &col )
void wxDC::ComputeScaleAndOrigin()
{
m_textBackgroundColour = col;
// CMB: copy scale to see if it changes
double origScaleX = m_scaleX;
double origScaleY = m_scaleY;
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
// CMB: if scale has changed call SetPen to recalulate the line width
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
{
// this is a bit artificial, but we need to force wxDC to think
// the pen has changed
// It gives an Assert, Robert Roebling
/*
wxPen pen = m_pen;
m_pen = wxNullPen;
SetPen( pen );
*/
}
}
void wxDC::SetMapMode( int mode )
@@ -258,12 +159,6 @@ void wxDC::SetUserScale( double x, double y )
ComputeScaleAndOrigin();
}
void wxDC::GetUserScale( double *x, double *y )
{
if (x) *x = m_userScaleX;
if (y) *y = m_userScaleY;
}
void wxDC::SetLogicalScale( double x, double y )
{
// allow negative ?
@@ -272,12 +167,6 @@ void wxDC::SetLogicalScale( double x, double y )
ComputeScaleAndOrigin();
}
void wxDC::GetLogicalScale( double *x, double *y )
{
if (x) *x = m_logicalScaleX;
if (y) *y = m_logicalScaleY;
}
void wxDC::SetLogicalOrigin( long x, long y )
{
m_logicalOriginX = x * m_signX; // is this still correct ?
@@ -285,12 +174,6 @@ void wxDC::SetLogicalOrigin( long x, long y )
ComputeScaleAndOrigin();
}
void wxDC::GetLogicalOrigin( long *x, long *y )
{
if (x) *x = m_logicalOriginX;
if (y) *y = m_logicalOriginY;
}
void wxDC::SetDeviceOrigin( long x, long y )
{
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
@@ -299,12 +182,6 @@ void wxDC::SetDeviceOrigin( long x, long y )
ComputeScaleAndOrigin();
}
void wxDC::GetDeviceOrigin( long *x, long *y )
{
if (x) *x = m_deviceOriginX;
if (y) *y = m_deviceOriginY;
}
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
@@ -313,74 +190,47 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
ComputeScaleAndOrigin();
}
long wxDC::DeviceToLogicalX(long x) const
// ---------------------------------------------------------------------------
// coordinates transformations
// ---------------------------------------------------------------------------
long wxDCBase::DeviceToLogicalX(long x) const
{
return XDEV2LOG(x);
}
long wxDC::DeviceToLogicalY(long y) const
long wxDCBase::DeviceToLogicalY(long y) const
{
return YDEV2LOG(y);
}
long wxDC::DeviceToLogicalXRel(long x) const
long wxDCBase::DeviceToLogicalXRel(long x) const
{
return XDEV2LOGREL(x);
}
long wxDC::DeviceToLogicalYRel(long y) const
long wxDCBase::DeviceToLogicalYRel(long y) const
{
return YDEV2LOGREL(y);
}
long wxDC::LogicalToDeviceX(long x) const
long wxDCBase::LogicalToDeviceX(long x) const
{
return XLOG2DEV(x);
}
long wxDC::LogicalToDeviceY(long y) const
long wxDCBase::LogicalToDeviceY(long y) const
{
return YLOG2DEV(y);
}
long wxDC::LogicalToDeviceXRel(long x) const
long wxDCBase::LogicalToDeviceXRel(long x) const
{
return XLOG2DEVREL(x);
}
long wxDC::LogicalToDeviceYRel(long y) const
long wxDCBase::LogicalToDeviceYRel(long y) const
{
return YLOG2DEVREL(y);
}
void wxDC::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;
}
void wxDC::ComputeScaleAndOrigin()
{
// CMB: copy scale to see if it changes
double origScaleX = m_scaleX;
double origScaleY = m_scaleY;
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
// CMB: if scale has changed call SetPen to recalulate the line width
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
{
// this is a bit artificial, but we need to force wxDC to think
// the pen has changed
// It gives an Assert, Robert Roebling
/*
wxPen pen = m_pen;
m_pen = wxNullPen;
SetPen( pen );
*/
}
}

View File

@@ -9,7 +9,7 @@
#ifdef __GNUG__
#pragma implementation "dc.h"
#pragma implementation "dc.h"
#endif
#include "wx/dc.h"
@@ -32,134 +32,29 @@
// wxDC
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
wxDC::wxDC()
{
m_ok = FALSE;
m_optimize = FALSE;
m_autoSetting = FALSE;
m_colour = TRUE;
m_clipping = FALSE;
m_mm_to_pix_x = 1.0;
m_mm_to_pix_y = 1.0;
m_logicalOriginX = 0;
m_logicalOriginY = 0;
m_deviceOriginX = 0;
m_deviceOriginY = 0;
m_logicalScaleX = 1.0;
m_logicalScaleY = 1.0;
m_userScaleX = 1.0;
m_userScaleY = 1.0;
m_scaleX = 1.0;
m_scaleY = 1.0;
m_mappingMode = wxMM_TEXT;
m_needComputeScaleX = FALSE; /* not used yet */
m_needComputeScaleY = FALSE; /* not used yet */
m_signX = 1; /* default x-axis left to right */
m_signY = 1; /* default y-axis top down. -1 in postscript. */
m_maxX = 0;
m_maxY = 0;
m_minX = 0;
m_minY = 0;
m_logicalFunction = wxCOPY;
// m_textAlignment = wxALIGN_TOP_LEFT;
m_backgroundMode = wxTRANSPARENT;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
// m_palette = wxAPP_COLOURMAP; /* I'll learn to handle palettes later in my life */
}
wxDC::~wxDC()
{
}
bool wxDC::Ok() const
{
return m_ok;
}
void wxDC::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2),
long WXUNUSED(xc), long WXUNUSED(yc) )
{
}
void wxDC::DrawPoint( wxPoint& point )
{
DrawPoint( point.x, point.y );
}
void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
{
int n = list->Number();
wxPoint *points = new wxPoint[n];
int i = 0;
for( wxNode *node = list->First(); node; node = node->Next() )
{
wxPoint *point = (wxPoint *)node->Data();
points[i].x = point->x;
points[i++].y = point->y;
}
DrawPolygon( n, points, xoffset, yoffset, fillStyle );
delete[] points;
}
void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
{
int n = list->Number();
wxPoint *points = new wxPoint[n];
int i = 0;
for( wxNode *node = list->First(); node; node = node->Next() )
{
wxPoint *point = (wxPoint *)node->Data();
points[i].x = point->x;
points[i++].y = point->y;
}
DrawLines( n, points, xoffset, yoffset );
delete []points;
}
void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
{
wxList list;
list.Append( (wxObject*)new wxPoint(x1, y1) );
list.Append( (wxObject*)new wxPoint(x2, y2) );
list.Append( (wxObject*)new wxPoint(x3, y3) );
DrawSpline(&list);
wxNode *node = list.First();
while (node)
{
wxPoint *p = (wxPoint*)node->Data();
delete p;
node = node->Next();
}
}
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
DrawSpline( &list );
}
void wxDC::SetClippingRegion( long x, long y, long width, long height )
void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
{
m_clipping = TRUE;
m_clipX1 = x;
@@ -173,28 +68,17 @@ void wxDC::DestroyClippingRegion()
m_clipping = FALSE;
}
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
{
if (m_clipping)
{
if (x) *x = m_clipX1;
if (y) *y = m_clipY1;
if (width) *width = (m_clipX2 - m_clipX1);
if (height) *height = (m_clipY2 - m_clipY1);
}
else
{
*x = *y = *width = *height = 0;
}
}
// ---------------------------------------------------------------------------
// get DC capabilities
// ---------------------------------------------------------------------------
void wxDC::GetSize( int* width, int* height ) const
void wxDC::DoGetSize( int* width, int* height ) const
{
if (width) *width = m_maxX-m_minX;
if (height) *height = m_maxY-m_minY;
}
void wxDC::GetSizeMM( int* width, int* height ) const
void wxDC::DoGetSizeMM( int* width, int* height ) const
{
int w = 0;
int h = 0;
@@ -204,20 +88,37 @@ void wxDC::GetSizeMM( int* width, int* height ) const
}
// Resolution in pixels per logical inch
wxSize wxDC::GetPPI(void) const
wxSize wxDC::GetPPI() const
{
// TODO (should probably be pure virtual)
return wxSize(0, 0);
}
void wxDC::SetTextForeground( const wxColour &col )
{
m_textForegroundColour = col;
}
// ---------------------------------------------------------------------------
// set various DC parameters
// ---------------------------------------------------------------------------
void wxDC::SetTextBackground( const wxColour &col )
void wxDC::ComputeScaleAndOrigin()
{
m_textBackgroundColour = col;
// CMB: copy scale to see if it changes
double origScaleX = m_scaleX;
double origScaleY = m_scaleY;
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
// CMB: if scale has changed call SetPen to recalulate the line width
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
{
// this is a bit artificial, but we need to force wxDC to think
// the pen has changed
// It gives an Assert, Robert Roebling
/*
wxPen pen = m_pen;
m_pen = wxNullPen;
SetPen( pen );
*/
}
}
void wxDC::SetMapMode( int mode )
@@ -258,12 +159,6 @@ void wxDC::SetUserScale( double x, double y )
ComputeScaleAndOrigin();
}
void wxDC::GetUserScale( double *x, double *y )
{
if (x) *x = m_userScaleX;
if (y) *y = m_userScaleY;
}
void wxDC::SetLogicalScale( double x, double y )
{
// allow negative ?
@@ -272,12 +167,6 @@ void wxDC::SetLogicalScale( double x, double y )
ComputeScaleAndOrigin();
}
void wxDC::GetLogicalScale( double *x, double *y )
{
if (x) *x = m_logicalScaleX;
if (y) *y = m_logicalScaleY;
}
void wxDC::SetLogicalOrigin( long x, long y )
{
m_logicalOriginX = x * m_signX; // is this still correct ?
@@ -285,12 +174,6 @@ void wxDC::SetLogicalOrigin( long x, long y )
ComputeScaleAndOrigin();
}
void wxDC::GetLogicalOrigin( long *x, long *y )
{
if (x) *x = m_logicalOriginX;
if (y) *y = m_logicalOriginY;
}
void wxDC::SetDeviceOrigin( long x, long y )
{
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
@@ -299,12 +182,6 @@ void wxDC::SetDeviceOrigin( long x, long y )
ComputeScaleAndOrigin();
}
void wxDC::GetDeviceOrigin( long *x, long *y )
{
if (x) *x = m_deviceOriginX;
if (y) *y = m_deviceOriginY;
}
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
@@ -313,74 +190,47 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
ComputeScaleAndOrigin();
}
long wxDC::DeviceToLogicalX(long x) const
// ---------------------------------------------------------------------------
// coordinates transformations
// ---------------------------------------------------------------------------
long wxDCBase::DeviceToLogicalX(long x) const
{
return XDEV2LOG(x);
}
long wxDC::DeviceToLogicalY(long y) const
long wxDCBase::DeviceToLogicalY(long y) const
{
return YDEV2LOG(y);
}
long wxDC::DeviceToLogicalXRel(long x) const
long wxDCBase::DeviceToLogicalXRel(long x) const
{
return XDEV2LOGREL(x);
}
long wxDC::DeviceToLogicalYRel(long y) const
long wxDCBase::DeviceToLogicalYRel(long y) const
{
return YDEV2LOGREL(y);
}
long wxDC::LogicalToDeviceX(long x) const
long wxDCBase::LogicalToDeviceX(long x) const
{
return XLOG2DEV(x);
}
long wxDC::LogicalToDeviceY(long y) const
long wxDCBase::LogicalToDeviceY(long y) const
{
return YLOG2DEV(y);
}
long wxDC::LogicalToDeviceXRel(long x) const
long wxDCBase::LogicalToDeviceXRel(long x) const
{
return XLOG2DEVREL(x);
}
long wxDC::LogicalToDeviceYRel(long y) const
long wxDCBase::LogicalToDeviceYRel(long y) const
{
return YLOG2DEVREL(y);
}
void wxDC::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;
}
void wxDC::ComputeScaleAndOrigin()
{
// CMB: copy scale to see if it changes
double origScaleX = m_scaleX;
double origScaleY = m_scaleY;
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
// CMB: if scale has changed call SetPen to recalulate the line width
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
{
// this is a bit artificial, but we need to force wxDC to think
// the pen has changed
// It gives an Assert, Robert Roebling
/*
wxPen pen = m_pen;
m_pen = wxNullPen;
SetPen( pen );
*/
}
}

View File

@@ -365,7 +365,7 @@ void wxCheckListBox::OnChar(wxKeyEvent& event)
if ( event.KeyCode() == WXK_SPACE )
GetItem(GetSelection())->Toggle();
else
wxListBox::OnChar(event);
event.Skip();
}
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)

View File

@@ -119,136 +119,54 @@ void wxFindMaxSize(WXHWND wnd, RECT *rect)
}
/*
// Not currently used
void wxConvertDialogToPixels(wxWindow *control, int *x, int *y)
{
if (control->m_windowParent && control->m_windowParent->is_dialog)
{
DWORD word = GetDialogBaseUnits();
int xs = LOWORD(word);
int ys = HIWORD(word);
*x = (int)(*x * xs/4);
*y = (int)(*y * ys/8);
}
else
{
*x = *x;
*y = *y;
}
}
*/
void wxControl::MSWOnMouseMove(int x, int y, WXUINT flags)
{
/*
// Trouble with this is that it sets the cursor for controls too :-(
if (m_windowCursor.Ok() && !wxIsBusy())
::SetCursor(m_windowCursor.GetHCURSOR());
*/
if (!m_mouseInWindow)
{
// Generate an ENTER event
m_mouseInWindow = TRUE;
MSWOnMouseEnter(x, y, flags);
}
wxMouseEvent event(wxEVT_MOTION);
event.m_x = x; event.m_y = y;
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
event.m_controlDown = ((flags & MK_CONTROL) != 0);
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
event.SetTimestamp(wxApp::sm_lastMessageTime);
event.SetEventObject( this );
// Window gets a click down message followed by a mouse move
// message even if position isn't changed! We want to discard
// the trailing move event if x and y are the same.
if ((m_lastMouseEvent == wxEVT_RIGHT_DOWN || m_lastMouseEvent == wxEVT_LEFT_DOWN ||
m_lastMouseEvent == wxEVT_MIDDLE_DOWN) &&
(m_lastMouseX == event.GetX() && m_lastMouseY == event.GetY()))
{
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
m_lastMouseEvent = wxEVT_MOTION;
return;
}
m_lastMouseEvent = wxEVT_MOTION;
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
if (!GetEventHandler()->ProcessEvent(event))
Default();
}
bool wxControl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam,
#ifdef __WIN95__
bool wxControl::MSWOnNotify(int idCtrl,
WXLPARAM lParam,
WXLPARAM* result)
{
#if defined(__WIN95__)
wxCommandEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
NMHDR *hdr1 = (NMHDR*) lParam;
switch ( hdr1->code )
{
case NM_CLICK:
{
eventType = wxEVT_COMMAND_LEFT_CLICK;
break;
}
case NM_DBLCLK:
{
eventType = wxEVT_COMMAND_LEFT_DCLICK;
break;
}
case NM_RCLICK:
{
eventType = wxEVT_COMMAND_RIGHT_CLICK;
break;
}
case NM_RDBLCLK:
{
eventType = wxEVT_COMMAND_RIGHT_DCLICK;
break;
}
case NM_SETFOCUS:
{
eventType = wxEVT_COMMAND_SET_FOCUS;
break;
}
case NM_KILLFOCUS:
{
eventType = wxEVT_COMMAND_KILL_FOCUS;
break;
}
case NM_RETURN:
{
eventType = wxEVT_COMMAND_ENTER;
break;
}
/* Not implemented
case NM_OUTOFMEMORY:
{
eventType = wxEVT_COMMAND_OUT_OF_MEMORY;
break;
}
*/
default:
return wxWindow::MSWNotify(wParam, lParam, result);
return wxWindow::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventType(eventType);
event.SetEventObject(this);
if ( !GetEventHandler()->ProcessEvent(event) )
return FALSE;
return TRUE;
#else // !Win95
return FALSE;
#endif
return GetEventHandler()->ProcessEvent(event);
}
#endif // Win95
void wxControl::ProcessCommand (wxCommandEvent & event)
{

File diff suppressed because it is too large Load Diff

View File

@@ -40,8 +40,8 @@
// Lists to keep track of windows, so we can disable/enable them
// for modal dialogs
wxList wxModalDialogs;
wxList wxModelessWindows; // Frames and modeless dialogs
wxWindowList wxModalDialogs;
wxWindowList wxModelessWindows; // Frames and modeless dialogs
extern wxList WXDLLEXPORT wxPendingDelete;
#if !USE_SHARED_LIBRARY
@@ -58,12 +58,7 @@ extern wxList WXDLLEXPORT wxPendingDelete;
END_EVENT_TABLE()
#endif
bool wxDialog::MSWOnClose(void)
{
return Close();
}
wxDialog::wxDialog(void)
wxDialog::wxDialog()
{
m_isShown = FALSE;
m_modalShowing = FALSE;
@@ -235,7 +230,7 @@ void wxDialog::OnPaint(wxPaintEvent& event)
// wxWindow::OnPaint(event);
}
void wxDialog::Fit(void)
void wxDialog::Fit()
{
wxWindow::Fit();
}
@@ -245,7 +240,7 @@ void wxDialog::Iconize(bool WXUNUSED(iconize))
// Windows dialog boxes can't be iconized
}
bool wxDialog::IsIconized(void) const
bool wxDialog::IsIconized() const
{
return FALSE;
}
@@ -282,7 +277,7 @@ void wxDialog::GetPosition(int *x, int *y) const
*y = rect.top;
}
bool wxDialog::IsShown(void) const
bool wxDialog::IsShown() const
{
return m_isShown;
}
@@ -299,13 +294,13 @@ bool wxDialog::Show(bool show)
#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
if (!modal) {
if (show) {
if (!wxModelessWindows.Member(this))
if (!wxModelessWindows.Find(this))
wxModelessWindows.Append(this);
} else
wxModelessWindows.DeleteObject(this);
}
if (show) {
if (!wxTopLevelWindows.Member(this))
if (!wxTopLevelWindows.Find(this))
wxTopLevelWindows.Append(this);
} else
wxTopLevelWindows.DeleteObject(this);
@@ -355,13 +350,13 @@ bool wxDialog::Show(bool show)
EnableWindow((HWND) GetHWND(), TRUE);
BringWindowToTop((HWND) GetHWND());
if (!wxModalDialogs.Member(this))
if ( !wxModalDialogs.Find(this) )
wxModalDialogs.Append(this);
MSG msg;
// Must test whether this dialog still exists: we may not process
// a message before the deletion.
while (wxModalDialogs.Member(this) && m_modalShowing && GetMessage(&msg, NULL, 0, 0))
while (wxModalDialogs.Find(this) && m_modalShowing && GetMessage(&msg, NULL, 0, 0))
{
if ( m_acceleratorTable.Ok() &&
::TranslateAccelerator((HWND)GetHWND(),
@@ -394,7 +389,7 @@ bool wxDialog::Show(bool show)
node=disabledWindows.First();
while(node) {
wxWindow* win = (wxWindow*) node->Data();
if (wxModalDialogs.Member(win) || wxModelessWindows.Member(win))
if (wxModalDialogs.Find(win) || wxModelessWindows.Find(win))
{
HWND hWnd = (HWND) win->GetHWND();
if (::IsWindow(hWnd))
@@ -480,7 +475,7 @@ void wxDialog::SetTitle(const wxString& title)
SetWindowText((HWND) GetHWND(), (const char *)title);
}
wxString wxDialog::GetTitle(void) const
wxString wxDialog::GetTitle() const
{
GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
return wxString(wxBuffer);
@@ -516,7 +511,7 @@ void wxDialog::Centre(int direction)
}
// Replacement for Show(TRUE) for modal dialogs - returns return code
int wxDialog::ShowModal(void)
int wxDialog::ShowModal()
{
m_windowStyle |= wxDIALOG_MODAL;
Show(TRUE);
@@ -605,7 +600,7 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
}
// Destroy the window (delayed, if a managed window)
bool wxDialog::Destroy(void)
bool wxDialog::Destroy()
{
if (!wxPendingDelete.Member(this))
wxPendingDelete.Append(this);
@@ -616,7 +611,8 @@ void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
{
// if we're using constraints - do use them
#if wxUSE_CONSTRAINTS
if ( GetAutoLayout() ) {
if ( GetAutoLayout() )
{
Layout();
}
#endif

View File

@@ -45,7 +45,7 @@
#include <wx/msw/statbr95.h>
#endif
extern wxList wxModelessWindows;
extern wxWindowList wxModelessWindows;
extern wxList WXDLLEXPORT wxPendingDelete;
extern char wxFrameClassName[];
extern wxMenu *wxCurrentPopupMenu;
@@ -552,7 +552,7 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
*
*/
void wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
bool wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
int x, int y, int width, int height, long style)
{
@@ -611,12 +611,16 @@ void wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *
extendedStyle |= WS_EX_TOPMOST;
m_iconized = FALSE;
wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
msflags, NULL, extendedStyle);
if ( !wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
msflags, NULL, extendedStyle) )
return FALSE;
// Seems to be necessary if we use WS_POPUP
// style instead of WS_OVERLAPPED
if (width > -1 && height > -1)
::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
return TRUE;
}
bool wxFrame::MSWOnPaint()
@@ -673,9 +677,11 @@ WXHICON wxFrame::MSWOnQueryDragIcon()
return m_defaultIcon;
}
void wxFrame::MSWOnSize(int x, int y, WXUINT id)
bool wxFrame::MSWOnSize(int x, int y, WXUINT id)
{
switch (id)
bool processed = FALSE;
switch ( id )
{
case SIZENORMAL:
// only do it it if we were iconized before, otherwise resizing the
@@ -701,7 +707,7 @@ void wxFrame::MSWOnSize(int x, int y, WXUINT id)
break;
}
if (!m_iconized)
if ( !m_iconized )
{
// forward WM_SIZE to status bar control
#if wxUSE_NATIVE_STATUSBAR
@@ -712,21 +718,17 @@ void wxFrame::MSWOnSize(int x, int y, WXUINT id)
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
}
#endif
#endif // wxUSE_NATIVE_STATUSBAR
PositionStatusBar();
PositionToolBar();
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(event))
Default();
processed = GetEventHandler()->ProcessEvent(event);
}
}
bool wxFrame::MSWOnClose()
{
return Close();
return processed;
}
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
@@ -758,22 +760,6 @@ bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
return wxWindow::MSWOnCommand(id, cmd, control);
}
void wxFrame::MSWOnMenuHighlight(WXWORD nItem, WXWORD nFlags, WXHMENU hSysMenu)
{
if (nFlags == 0xFFFF && hSysMenu == 0)
{
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, -1);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
{
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
}
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
{
return FALSE;
@@ -788,17 +774,18 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
return FALSE;
}
// Default resizing behaviour - if only ONE subwindow,
// resize to client rectangle size
// Default resizing behaviour - if only ONE subwindow, resize to client
// rectangle size
void wxFrame::OnSize(wxSizeEvent& event)
{
// if we're using constraints - do use them
#if wxUSE_CONSTRAINTS
if ( GetAutoLayout() ) {
#if wxUSE_CONSTRAINTS
if ( GetAutoLayout() )
{
Layout();
return;
}
#endif
#endif
// do we have _exactly_ one child?
wxWindow *child = NULL;
@@ -1031,14 +1018,79 @@ void wxFrame::PositionToolBar()
}
}
// propagate our state change to all child frames
// propagate our state change to all child frames: this allows us to emulate X
// Windows behaviour where child frames float independently of the parent one
// on the desktop, but are iconized/restored with it
void wxFrame::IconizeChildFrames(bool bIconize)
{
for ( wxNode *node = GetChildren().First(); node; node = node->Next() ) {
wxWindow *win = (wxWindow *)node->Data();
if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
for ( wxWindowList::Node *node = GetChildren().GetFirst();
node;
node = node->GetNext() )
{
wxWindow *win = node->GetData();
if ( win->IsKindOf(CLASSINFO(wxFrame)) )
{
((wxFrame *)win)->Iconize(bIconize);
}
}
}
// ===========================================================================
// our private (non virtual) message handlers
// ===========================================================================
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu)
{
int item;
if ( nFlags == 0xFFFF && hMenu == 0 )
{
// FIXME: what does this do? does it ever happen?
item = -1;
}
else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
{
item = nItem;
}
else
{
return FALSE;
}
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
event.SetEventObject( this );
return GetEventHandler()->ProcessEvent(event);
}
// ---------------------------------------------------------------------------
// the window proc for wxFrame
// ---------------------------------------------------------------------------
long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
long rc = 0;
bool processed = FALSE;
switch ( message )
{
case WM_MENUSELECT:
{
WORD item = (WORD)wParam;
#ifdef __WIN32__
WORD flags = HIWORD(wParam);
HMENU sysmenu = (HMENU)lParam;
#else
WORD flags = LOWORD(lParam);
HMENU sysmenu = (HMENU)HIWORD(lParam);
#endif
processed = HandleMenuSelect(item, flags, (WXHMENU)sysmenu);
}
break;
}
if ( !processed )
rc = wxWindow::MSWWindowProc(message, wParam, lParam);
return rc;
}

View File

@@ -83,9 +83,6 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
// list box control implementation
// ============================================================================
// this macro is dangerous but still better than tons of (HWND)GetHWND()
#define hwnd (HWND)GetHWND()
bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
{
/*
@@ -213,7 +210,7 @@ bool wxListBox::Create(wxWindow *parent,
#if wxUSE_CTL3D
if (want3D)
{
Ctl3dSubclassCtl(hwnd);
Ctl3dSubclassCtl(GetHwnd());
m_useCtl3D = TRUE;
}
#endif
@@ -227,7 +224,7 @@ bool wxListBox::Create(wxWindow *parent,
}
if ( (m_windowStyle & wxLB_MULTIPLE) == 0 )
SendMessage(hwnd, LB_SETCURSEL, 0, 0);
SendMessage(GetHwnd(), LB_SETCURSEL, 0, 0);
SetFont(parent->GetFont());
@@ -259,7 +256,7 @@ void wxListBox::SetFirstItem(int N)
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetFirstItem" );
SendMessage(hwnd,LB_SETTOPINDEX,(WPARAM)N,(LPARAM)0) ;
SendMessage(GetHwnd(),LB_SETTOPINDEX,(WPARAM)N,(LPARAM)0) ;
}
void wxListBox::SetFirstItem(const wxString& s)
@@ -275,7 +272,7 @@ void wxListBox::Delete(int N)
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::Delete" );
SendMessage(hwnd, LB_DELETESTRING, N, 0);
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
m_noItems--;
SetHorizontalExtent("");
@@ -283,7 +280,7 @@ void wxListBox::Delete(int N)
void wxListBox::Append(const wxString& item)
{
int index = ListBox_AddString(hwnd, item);
int index = ListBox_AddString(GetHwnd(), item);
m_noItems ++;
#if wxUSE_OWNER_DRAWN
@@ -291,7 +288,7 @@ void wxListBox::Append(const wxString& item)
wxOwnerDrawn *pNewItem = CreateItem(index); // dummy argument
pNewItem->SetName(item);
m_aItems.Add(pNewItem);
ListBox_SetItemData(hwnd, index, pNewItem);
ListBox_SetItemData(GetHwnd(), index, pNewItem);
}
#endif
@@ -300,7 +297,7 @@ void wxListBox::Append(const wxString& item)
void wxListBox::Append(const wxString& item, char *Client_data)
{
int index = ListBox_AddString(hwnd, item);
int index = ListBox_AddString(GetHwnd(), item);
m_noItems ++;
#if wxUSE_OWNER_DRAWN
@@ -312,21 +309,21 @@ void wxListBox::Append(const wxString& item, char *Client_data)
else
#endif
ListBox_SetItemData(hwnd, index, Client_data);
ListBox_SetItemData(GetHwnd(), index, Client_data);
SetHorizontalExtent(item);
}
void wxListBox::Set(int n, const wxString *choices, char** clientData)
{
ShowWindow(hwnd, SW_HIDE);
ListBox_ResetContent(hwnd);
ShowWindow(GetHwnd(), SW_HIDE);
ListBox_ResetContent(GetHwnd());
int i;
for (i = 0; i < n; i++)
{
ListBox_AddString(hwnd, choices[i]);
ListBox_AddString(GetHwnd(), choices[i]);
if ( clientData )
ListBox_SetItemData(hwnd, i, clientData[i]);
ListBox_SetItemData(GetHwnd(), i, clientData[i]);
}
m_noItems = n;
@@ -344,7 +341,7 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData)
wxOwnerDrawn *pNewItem = CreateItem(ui);
pNewItem->SetName(choices[ui]);
m_aItems.Add(pNewItem);
ListBox_SetItemData(hwnd, ui, pNewItem);
ListBox_SetItemData(GetHwnd(), ui, pNewItem);
wxASSERT_MSG(clientData[ui] == NULL,
"Can't use client data with owner-drawn listboxes");
@@ -353,12 +350,12 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData)
#endif
SetHorizontalExtent("");
ShowWindow(hwnd, SW_SHOW);
ShowWindow(GetHwnd(), SW_SHOW);
}
int wxListBox::FindString(const wxString& s) const
{
int pos = ListBox_FindStringExact(hwnd, (WPARAM)-1, s);
int pos = ListBox_FindStringExact(GetHwnd(), (WPARAM)-1, s);
if (pos == LB_ERR)
return -1;
else
@@ -367,7 +364,7 @@ int wxListBox::FindString(const wxString& s) const
void wxListBox::Clear()
{
ListBox_ResetContent(hwnd);
ListBox_ResetContent(GetHwnd());
#if wxUSE_OWNER_DRAWN
size_t uiCount = m_aItems.Count();
@@ -379,7 +376,7 @@ void wxListBox::Clear()
#endif // wxUSE_OWNER_DRAWN
m_noItems = 0;
ListBox_GetHorizontalExtent(hwnd);
ListBox_GetHorizontalExtent(GetHwnd());
}
void wxListBox::SetSelection(int N, bool select)
@@ -388,13 +385,13 @@ void wxListBox::SetSelection(int N, bool select)
"invalid index in wxListBox::SetSelection" );
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
SendMessage(hwnd, LB_SETSEL, select, N);
SendMessage(GetHwnd(), LB_SETSEL, select, N);
else
{
int N1 = N;
if (!select)
N1 = -1;
SendMessage(hwnd, LB_SETCURSEL, N1, 0);
SendMessage(GetHwnd(), LB_SETCURSEL, N1, 0);
}
}
@@ -403,7 +400,7 @@ bool wxListBox::Selected(int N) const
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
"invalid index in wxListBox::Selected" );
return SendMessage(hwnd, LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
}
void wxListBox::Deselect(int N)
@@ -412,7 +409,7 @@ void wxListBox::Deselect(int N)
"invalid index in wxListBox::Deselect" );
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
SendMessage(hwnd, LB_SETSEL, FALSE, N);
SendMessage(GetHwnd(), LB_SETSEL, FALSE, N);
}
char *wxListBox::GetClientData(int N) const
@@ -420,7 +417,7 @@ char *wxListBox::GetClientData(int N) const
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
"invalid index in wxListBox::GetClientData" );
return (char *)SendMessage(hwnd, LB_GETITEMDATA, N, 0);
return (char *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0);
}
void wxListBox::SetClientData(int N, char *Client_data)
@@ -428,7 +425,7 @@ void wxListBox::SetClientData(int N, char *Client_data)
wxCHECK_RET( N >= 0 && N < m_noItems,
"invalid index in wxListBox::SetClientData" );
if ( ListBox_SetItemData(hwnd, N, Client_data) == LB_ERR )
if ( ListBox_SetItemData(GetHwnd(), N, Client_data) == LB_ERR )
wxLogDebug("LB_SETITEMDATA failed");
}
@@ -439,10 +436,10 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
{
int no_sel = ListBox_GetSelCount(hwnd);
int no_sel = ListBox_GetSelCount(GetHwnd());
if (no_sel != 0) {
int *selections = new int[no_sel];
if ( ListBox_GetSelItems(hwnd, no_sel, selections) == LB_ERR ) {
if ( ListBox_GetSelItems(GetHwnd(), no_sel, selections) == LB_ERR ) {
wxFAIL_MSG("This listbox can't have single-selection style!");
}
@@ -457,7 +454,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
}
else // single-selection listbox
{
aSelections.Add(ListBox_GetCurSel(hwnd));
aSelections.Add(ListBox_GetCurSel(GetHwnd()));
return 1;
}
@@ -472,7 +469,7 @@ int wxListBox::GetSelection() const
"GetSelection() can't be used with multiple-selection "
"listboxes, use GetSelections() instead." );
return ListBox_GetCurSel(hwnd);
return ListBox_GetCurSel(GetHwnd());
}
// Find string for position
@@ -481,11 +478,11 @@ wxString wxListBox::GetString(int N) const
wxCHECK_MSG( N >= 0 && N < m_noItems, "",
"invalid index in wxListBox::GetClientData" );
int len = ListBox_GetTextLen(hwnd, N);
int len = ListBox_GetTextLen(GetHwnd(), N);
// +1 for terminating NUL
wxString result;
ListBox_GetText(hwnd, N, result.GetWriteBuf(len + 1));
ListBox_GetText(GetHwnd(), N, result.GetWriteBuf(len + 1));
result.UngetWriteBuf();
return result;
@@ -540,7 +537,7 @@ void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
if (control_width <= 0)
control_width = (float)DEFAULT_ITEM_WIDTH;
MoveWindow(hwnd,
MoveWindow(GetHwnd(),
(int)control_x, (int)control_y,
(int)control_width, (int)control_height,
TRUE);
@@ -560,8 +557,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
if (s != "")
{
int existingExtent = (int)SendMessage(hwnd, LB_GETHORIZONTALEXTENT, 0, 0L);
HDC dc = GetWindowDC(hwnd);
int existingExtent = (int)SendMessage(GetHwnd(), LB_GETHORIZONTALEXTENT, 0, 0L);
HDC dc = GetWindowDC(GetHwnd());
HFONT oldFont = 0;
if (GetFont().Ok() && GetFont().GetResourceHandle())
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
@@ -574,15 +571,15 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
if (oldFont)
::SelectObject(dc, oldFont);
ReleaseDC(hwnd, dc);
ReleaseDC(GetHwnd(), dc);
if (extentX > existingExtent)
SendMessage(hwnd, LB_SETHORIZONTALEXTENT, LOWORD(extentX), 0L);
SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(extentX), 0L);
return;
}
else
{
int largestExtent = 0;
HDC dc = GetWindowDC(hwnd);
HDC dc = GetWindowDC(GetHwnd());
HFONT oldFont = 0;
if (GetFont().Ok() && GetFont().GetResourceHandle())
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
@@ -591,7 +588,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
int i;
for (i = 0; i < m_noItems; i++)
{
int len = (int)SendMessage(hwnd, LB_GETTEXT, i, (LONG)wxBuffer);
int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer);
wxBuffer[len] = 0;
SIZE extentXY;
::GetTextExtentPoint(dc, (LPSTR)wxBuffer, len, &extentXY);
@@ -602,8 +599,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
if (oldFont)
::SelectObject(dc, oldFont);
ReleaseDC(hwnd, dc);
SendMessage(hwnd, LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
ReleaseDC(GetHwnd(), dc);
SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
}
}
@@ -615,7 +612,7 @@ wxListBox::InsertItems(int nItems, const wxString items[], int pos)
int i;
for (i = 0; i < nItems; i++)
ListBox_InsertString(hwnd, i + pos, items[i]);
ListBox_InsertString(GetHwnd(), i + pos, items[i]);
m_noItems += nItems;
SetHorizontalExtent("");
@@ -632,13 +629,13 @@ void wxListBox::SetString(int N, const wxString& s)
char *oldData = (char *)wxListBox::GetClientData(N);
SendMessage(hwnd, LB_DELETESTRING, N, 0);
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
int newN = N;
if (N == (m_noItems - 1))
newN = -1;
SendMessage(hwnd, LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
if (oldData)
wxListBox::SetClientData(N, oldData);
@@ -769,7 +766,7 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item;
long data = ListBox_GetItemData(hwnd, pStruct->itemID);
long data = ListBox_GetItemData(GetHwnd(), pStruct->itemID);
wxCHECK( data && (data != LB_ERR), FALSE );

View File

@@ -1157,7 +1157,7 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id)
else return FALSE;
}
bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
wxListEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
@@ -1275,7 +1275,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
}
default :
return wxControl::MSWNotify(wParam, lParam, result);
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventObject( this );

View File

@@ -9,61 +9,88 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ===========================================================================
// declarations
// ===========================================================================
// ---------------------------------------------------------------------------
// headers
// ---------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "mdi.h"
#pragma implementation "mdi.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/frame.h"
#include "wx/menu.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/statusbr.h"
#include "wx/settings.h"
#include "wx/setup.h"
#include "wx/frame.h"
#include "wx/menu.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/statusbr.h"
#include "wx/settings.h"
#endif
#include "wx/mdi.h"
#include "wx/msw/private.h"
#if wxUSE_NATIVE_STATUSBAR
#include <wx/msw/statbr95.h>
#include <wx/msw/statbr95.h>
#endif
#include <string.h>
extern wxList wxModelessWindows;
// ---------------------------------------------------------------------------
// global variables
// ---------------------------------------------------------------------------
extern wxWindowList wxModelessWindows; // from dialog.cpp
extern wxMenu *wxCurrentPopupMenu;
#define IDM_WINDOWTILE 4001
#define IDM_WINDOWCASCADE 4002
#define IDM_WINDOWICONS 4003
#define IDM_WINDOWNEXT 4004
// This range gives a maximum of 500
// MDI children. Should be enough :-)
#define wxFIRST_MDI_CHILD 4100
#define wxLAST_MDI_CHILD 4600
// Status border dimensions
#define wxTHICK_LINE_BORDER 3
#define wxTHICK_LINE_WIDTH 1
extern char wxMDIFrameClassName[];
extern char wxMDIChildFrameClassName[];
extern wxWindow *wxWndHook;
extern wxWindow *wxWndHook; // from window.cpp
extern wxList *wxWinHandleList;
// ---------------------------------------------------------------------------
// constants
// ---------------------------------------------------------------------------
static const int IDM_WINDOWTILE = 4001;
static const int IDM_WINDOWCASCADE = 4002;
static const int IDM_WINDOWICONS = 4003;
static const int IDM_WINDOWNEXT = 4004;
// This range gives a maximum of 500 MDI children. Should be enough :-)
static const int wxFIRST_MDI_CHILD = 4100;
static const int wxLAST_MDI_CHILD = 4600;
// Status border dimensions
static const int wxTHICK_LINE_BORDER = 3;
static const int wxTHICK_LINE_WIDTH = 1;
// ===========================================================================
// implementation
// ===========================================================================
// ---------------------------------------------------------------------------
// wxWin macros
// ---------------------------------------------------------------------------
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
#endif // USE_SHARED_LIBRARY
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
EVT_SIZE(wxMDIParentFrame::OnSize)
@@ -75,7 +102,9 @@ BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
EVT_SCROLL(wxMDIClientWindow::OnScroll)
END_EVENT_TABLE()
#endif
// ---------------------------------------------------------------------------
// wxMDIParentFrame
// ---------------------------------------------------------------------------
wxMDIParentFrame::wxMDIParentFrame()
{
@@ -163,30 +192,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
delete m_clientWindow;
}
// Get size *available for subwindows* i.e. excluding menu bar.
void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
{
RECT rect;
::GetClientRect((HWND) GetHWND(), &rect);
int cwidth = rect.right;
int cheight = rect.bottom;
if ( GetStatusBar() )
{
int sw, sh;
GetStatusBar()->GetSize(&sw, &sh);
cheight -= sh;
}
wxPoint pt(GetClientAreaOrigin());
cheight -= pt.y;
cwidth -= pt.x;
*x = cwidth;
*y = cheight;
}
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
{
if (!menu_bar)
@@ -246,9 +251,13 @@ void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
{
#if wxUSE_CONSTRAINTS
if (GetAutoLayout())
if ( GetAutoLayout() )
{
Layout();
#endif
return;
}
#endif // wxUSE_CONSTRAINTS
int x = 0;
int y = 0;
int width, height;
@@ -256,15 +265,6 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
if ( GetClientWindow() )
GetClientWindow()->SetSize(x, y, width, height);
/* Already done in MSWOnSize
// forward WM_SIZE to status bar control
#if wxUSE_NATIVE_STATUSBAR
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
#endif
*/
}
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
@@ -275,19 +275,19 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
// Returns the active MDI child window
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
{
// HWND hWnd = (HWND)LOWORD(SendMessage((HWND) GetClientWindow()->GetHWND(), WM_MDIGETACTIVE, 0, 0L));
HWND hWnd = (HWND)SendMessage((HWND) GetClientWindow()->GetHWND(), WM_MDIGETACTIVE, 0, 0L);
if (hWnd == 0)
HWND hWnd = (HWND)::SendMessage(GetWinHwnd(GetClientWindow()),
WM_MDIGETACTIVE, 0, 0L);
if ( hWnd == 0 )
return NULL;
else
return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd);
}
// Create the client window class (don't Create the window,
// just return a new class)
// Create the client window class (don't Create the window, just return a new
// class)
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
{
return new wxMDIClientWindow ;
return new wxMDIClientWindow;
}
// Responds to colour changes, and passes event on to children.
@@ -314,100 +314,110 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
// MDI operations
void wxMDIParentFrame::Cascade()
{
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDICASCADE, 0, 0);
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0);
}
void wxMDIParentFrame::Tile()
{
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDITILE, MDITILE_HORIZONTAL, 0);
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, MDITILE_HORIZONTAL, 0);
}
void wxMDIParentFrame::ArrangeIcons()
{
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDIICONARRANGE, 0, 0);
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDIICONARRANGE, 0, 0);
}
void wxMDIParentFrame::ActivateNext()
{
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDINEXT, 0, 0);
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 0);
}
void wxMDIParentFrame::ActivatePrevious()
{
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDINEXT, 0, 1);
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 1);
}
/*
// Returns a style for the client window - usually 0
// or, for example, wxHSCROLL | wxVSCROLL
long wxMDIParentFrame::GetClientStyle() const
// the MDI parent frame window proc
long wxMDIParentFrame::MSWWindowProc(WXUINT message,
WXWPARAM wParam,
WXLPARAM lParam)
{
return wxHSCROLL | wxVSCROLL ;
}
*/
long rc = 0;
bool processed = FALSE;
bool wxMDIParentFrame::MSWOnDestroy()
{
return FALSE;
}
void wxMDIParentFrame::MSWOnCreate(WXLPCREATESTRUCT WXUNUSED(cs))
{
switch ( message )
{
case WM_CREATE:
m_clientWindow = OnCreateClient();
// Uses own style for client style
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
}
void wxMDIParentFrame::MSWOnSize(int x, int y, WXUINT id)
{
switch (id)
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
{
case SIZEFULLSCREEN:
case SIZENORMAL:
m_iconized = FALSE;
break;
case SIZEICONIC:
m_iconized = TRUE;
break;
wxLogMessage(_("Failed to create MDI parent frame."));
rc = -1;
}
if (!m_iconized)
{
// forward WM_SIZE to status bar control
#if wxUSE_NATIVE_STATUSBAR
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
{
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
event.SetEventObject( m_frameStatusBar );
processed = TRUE;
break;
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
}
case WM_ERASEBKGND:
processed = TRUE;
// we erase background ourselves
rc = TRUE;
break;
case WM_MENUSELECT:
{
WORD item = (WORD)wParam;
#ifdef __WIN32__
WORD flags = HIWORD(wParam);
HMENU menu = (HMENU)lParam;
#else
WORD flags = LOWORD(lParam);
HMENU menu = (HMENU)HIWORD(lParam);
#endif
PositionStatusBar();
PositionToolBar();
wxSizeEvent event(wxSize(x, y), m_windowId);
event.SetEventObject( this );
if (!GetEventHandler()->ProcessEvent(event))
Default();
if ( m_parentFrameActive )
{
processed = HandleMenuSelect(item, flags, (WXHMENU)menu);
}
else if (m_currentChild)
{
processed = m_currentChild->
HandleMenuSelect(item, flags, (WXHMENU)menu);
}
}
break;
}
if ( !processed )
rc = wxFrame::MSWWindowProc(message, wParam, lParam);
return rc;
}
bool wxMDIParentFrame::MSWOnActivate(int state, bool minimized, WXHWND activate)
{
wxWindow::MSWOnActivate(state, minimized, activate);
bool processed = FALSE;
if ( wxWindow::MSWOnActivate(state, minimized, activate) )
{
// already processed
processed = TRUE;
}
// If this window is an MDI parent, we must also send an OnActivate message
// to the current child.
if ((m_currentChild != NULL) && ((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)))
if ( (m_currentChild != NULL) &&
((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)) )
{
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
event.SetEventObject( m_currentChild );
m_currentChild->GetEventHandler()->ProcessEvent(event);
if ( m_currentChild->GetEventHandler()->ProcessEvent(event) )
processed = TRUE;
}
return 0;
return processed;
}
bool wxMDIParentFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
@@ -495,29 +505,6 @@ bool wxMDIParentFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
return wxWindow::MSWOnCommand(id, cmd, control);
}
void wxMDIParentFrame::MSWOnMenuHighlight(WXWORD nItem, WXWORD nFlags, WXHMENU hSysMenu)
{
if (m_parentFrameActive)
{
if (nFlags == 0xFFFF && hSysMenu == (WXHMENU) NULL)
{
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, -1);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
else if (nFlags != MF_SEPARATOR)
{
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
}
else if (m_currentChild)
{
m_currentChild->MSWOnMenuHighlight(nItem, nFlags, hSysMenu);
}
}
long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
{
WXHWND clientWnd;
@@ -526,45 +513,45 @@ long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARA
else
clientWnd = 0;
return DefFrameProc((HWND) GetHWND(), (HWND) clientWnd, message, wParam, lParam);
return DefFrameProc(GetHwnd(), (HWND)clientWnd, message, wParam, lParam);
}
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
{
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
return TRUE;
return FALSE;
return m_currentChild && m_currentChild->GetHWND() &&
m_currentChild->MSWProcessMessage(msg);
}
bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
{
MSG *pMsg = (MSG *)msg;
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWTranslateMessage(msg))
return TRUE;
if (m_acceleratorTable.Ok() &&
::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), pMsg))
return TRUE;
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
if ( m_currentChild && m_currentChild->GetHWND() &&
m_currentChild->MSWTranslateMessage(msg) )
{
if (::TranslateMDISysAccel((HWND) GetClientWindow()->GetHWND(), pMsg))
return TRUE;
}
if ( m_acceleratorTable.Ok() &&
::TranslateAccelerator(GetHwnd(),
GetTableHaccel(&m_acceleratorTable),
pMsg) )
{
return TRUE;
}
if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN )
{
if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg))
return TRUE;
}
return FALSE;
}
bool wxMDIParentFrame::MSWOnEraseBkgnd(WXHDC WXUNUSED(pDC))
{
return TRUE;
}
extern wxWindow *wxWndHook;
extern wxList *wxWinHandleList;
// ---------------------------------------------------------------------------
// wxMDIChildFrame
// ---------------------------------------------------------------------------
wxMDIChildFrame::wxMDIChildFrame()
{
@@ -797,23 +784,22 @@ void wxMDIChildFrame::Activate()
}
static HWND invalidHandle = 0;
void wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
bool wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
{
if (!GetHWND()) return;
HWND hwnd = GetHwnd();
if (invalidHandle == (HWND) GetHWND())
if ( !hwnd || hwnd == invalidHandle )
{
return;
return FALSE;
}
(void)MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
switch (id)
{
case SIZEFULLSCREEN:
case SIZENORMAL:
m_iconized = FALSE;
break;
case SIZEICONIC:
m_iconized = TRUE;
break;
@@ -835,7 +821,11 @@ void wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
PositionStatusBar();
PositionToolBar();
wxWindow::MSWOnSize(x, y, id);
return wxWindow::MSWOnSize(x, y, id);
}
else
{
return FALSE;
}
}
@@ -895,7 +885,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
return FALSE;
}
long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHWND WXUNUSED(two))
bool wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHWND WXUNUSED(two))
{
wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
HMENU parent_menu = (HMENU) parent->GetWinMenu();
@@ -922,7 +912,7 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
}
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
return GetEventHandler()->ProcessEvent(event);
}
else
{
@@ -931,7 +921,8 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, m_windowId);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
if ( GetEventHandler()->ProcessEvent(event) )
return TRUE;
// m_active = FALSE;
if (parent_menu)
@@ -953,8 +944,7 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
bool flag = (activate != 0);
wxActivateEvent event(wxEVT_ACTIVATE, flag, m_windowId);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
return 0;
return GetEventHandler()->ProcessEvent(event);
}
void wxMDIChildFrame::MSWDestroyWindow()
@@ -1021,7 +1011,7 @@ bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
#endif
}
void wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
bool wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
{
WINDOWPOS *lpPos = (WINDOWPOS *)pos;
#if defined(__WIN95__)
@@ -1045,7 +1035,8 @@ void wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
}
}
#endif
Default();
return FALSE;
}
// Client window
@@ -1123,10 +1114,3 @@ void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
Default();
}
// Should hand the message to the default proc
long wxMDIClientWindow::MSWOnMDIActivate(long bActivate, WXHWND, WXHWND)
{
return Default();
}

View File

@@ -464,7 +464,7 @@ void wxNotebook::Command(wxCommandEvent& event)
wxFAIL_MSG("wxNotebook::Command not implemented");
}
bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
{
wxNotebookEvent event(wxEVT_NULL, m_windowId);
@@ -479,13 +479,13 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
break;
default:
return wxControl::MSWNotify(wParam, lParam, result);
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
event.SetOldSelection(m_nSelection);
event.SetEventObject(this);
event.SetInt(LOWORD(wParam)); // ctrl id
event.SetInt(idCtrl);
bool processed = GetEventHandler()->ProcessEvent(event);
*result = !event.IsAllowed();

View File

@@ -28,9 +28,6 @@
#include "wx/scrolbar.h"
#include "wx/msw/private.h"
// extern wxList wxScrollBarList;
extern void wxFindMaxSize(HWND hwnd, RECT *rect);
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
@@ -116,18 +113,20 @@ wxScrollBar::~wxScrollBar(void)
{
}
void wxScrollBar::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
bool wxScrollBar::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
WXWORD pos, WXHWND control)
{
int position = ::GetScrollPos((HWND) control, SB_CTL);
int minPos, maxPos;
::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
#if defined(__WIN95__)
// A page size greater than one has the effect of reducing the
// effective range, therefore the range has already been
// boosted artificially - so reduce it again.
// A page size greater than one has the effect of reducing the effective
// range, therefore the range has already been boosted artificially - so
// reduce it again.
if ( m_pageSize > 1 )
maxPos -= (m_pageSize - 1);
#endif
#endif // __WIN95__
wxEventType scrollEvent = wxEVT_NULL;
@@ -174,8 +173,12 @@ void wxScrollBar::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
nScrollInc = 0;
}
if (nScrollInc != 0)
if ( nScrollInc == 0 )
{
// no event to process, so don't process it
return FALSE;
}
int new_pos = position + nScrollInc;
if (new_pos < 0)
@@ -187,13 +190,8 @@ void wxScrollBar::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
wxScrollEvent event(scrollEvent, m_windowId);
event.SetPosition(new_pos);
event.SetEventObject( this );
GetEventHandler()->ProcessEvent(event);
}
}
void wxScrollBar::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
{
MSWOnVScroll(wParam, pos, control);
return GetEventHandler()->ProcessEvent(event);
}
void wxScrollBar::SetThumbPosition(int viewStart)

View File

@@ -186,7 +186,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
return TRUE;
}
void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
WXWORD pos, WXHWND control)
{
int position = 0; // Dummy - not used in this mode
@@ -228,22 +229,29 @@ void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
case SB_THUMBPOSITION:
#ifdef __WIN32__
nScrollInc = (signed short)pos - position;
#else
#else // Win16
nScrollInc = pos - position;
#endif
#endif // Win32/16
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
break;
default:
nScrollInc = 0;
return;
}
if ( nScrollInc == 0 )
{
// no event...
return FALSE;
}
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
if (!(newPos < GetMin() || newPos > GetMax()))
if ( (newPos < GetMin()) || (newPos > GetMax()) )
{
// out of range - but we did process it
return TRUE;
}
SetValue(newPos);
wxScrollEvent event(scrollEvent, m_windowId);
@@ -253,15 +261,8 @@ void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
cevent.SetEventObject( this );
GetEventHandler()->ProcessEvent( cevent );
}
}
}
void wxSlider95::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
{
MSWOnVScroll(wParam, pos, control);
return GetEventHandler()->ProcessEvent( cevent );
}
wxSlider95::~wxSlider95()

View File

@@ -156,7 +156,8 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
return TRUE;
}
void wxSliderMSW::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
bool wxSliderMSW::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
WXWORD pos, WXHWND control)
{
int position = ::GetScrollPos((HWND)control, SB_CTL);
@@ -206,16 +207,22 @@ void wxSliderMSW::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
default:
nScrollInc = 0;
return;
}
if (nScrollInc != 0)
if (nScrollInc == 0)
{
// no event...
return FALSE;
}
int newPos = position + nScrollInc;
if (!(newPos < GetMin() || newPos > GetMax()))
if ( (newPos < GetMin()) || (newPos > GetMax()) )
{
// out of range - but we did process it
return TRUE;
}
SetValue(newPos);
wxScrollEvent event(scrollEvent, m_windowId);
@@ -225,14 +232,8 @@ void wxSliderMSW::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
cevent.SetEventObject( this );
GetEventHandler()->ProcessEvent( cevent );
}
}
}
void wxSliderMSW::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
{
MSWOnVScroll(wParam, pos, control);
return GetEventHandler()->ProcessEvent( cevent );
}
wxSliderMSW::~wxSliderMSW()

View File

@@ -10,18 +10,18 @@
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "spinbutt.h"
#pragma implementation "spinbutt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/wx.h"
#endif
// Can't resolve reference to CreateUpDownControl in
@@ -33,14 +33,14 @@
#include "wx/msw/private.h"
#if !defined(__GNUWIN32__) || defined(__TWIN32__)
#include <commctrl.h>
#include <commctrl.h>
#endif
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
#endif
wxSpinButton::wxSpinButton(void)
wxSpinButton::wxSpinButton()
{
m_min = 0;
m_max = 100;
@@ -108,14 +108,14 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
return TRUE;
}
wxSpinButton::~wxSpinButton(void)
wxSpinButton::~wxSpinButton()
{
}
// Attributes
////////////////////////////////////////////////////////////////////////////
int wxSpinButton::GetValue(void) const
int wxSpinButton::GetValue() const
{
return (int) ::SendMessage((HWND) GetHWND(), UDM_GETPOS, 0, 0);
}
@@ -133,14 +133,16 @@ void wxSpinButton::SetRange(int minVal, int maxVal)
(LPARAM) MAKELONG((short)maxVal, (short)minVal));
}
void wxSpinButton::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
bool wxSpinButton::MSWOnScroll(int orientation, WXWORD wParam,
WXWORD pos, WXHWND control)
{
if (control)
{
if ( !control )
return FALSE;
wxSpinEvent event(wxEVT_NULL, m_windowId);
event.SetPosition(pos);
event.SetOrientation(wxVERTICAL);
event.SetEventObject( this );
event.SetOrientation(orientation);
event.SetEventObject(this);
switch ( wParam )
{
@@ -174,61 +176,10 @@ void wxSpinButton::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
break;
default:
return;
break;
return FALSE;
}
if (!GetEventHandler()->ProcessEvent(event))
Default();
}
}
void wxSpinButton::MSWOnHScroll( WXWORD wParam, WXWORD pos, WXHWND control)
{
if (control)
{
wxSpinEvent event(wxEVT_NULL, m_windowId);
event.SetPosition(pos);
event.SetOrientation(wxHORIZONTAL);
event.SetEventObject( this );
switch ( wParam )
{
case SB_TOP:
event.m_eventType = wxEVT_SCROLL_TOP;
break;
case SB_BOTTOM:
event.m_eventType = wxEVT_SCROLL_BOTTOM;
break;
case SB_LINEUP:
event.m_eventType = wxEVT_SCROLL_LINEUP;
break;
case SB_LINEDOWN:
event.m_eventType = wxEVT_SCROLL_LINEDOWN;
break;
case SB_PAGEUP:
event.m_eventType = wxEVT_SCROLL_PAGEUP;
break;
case SB_PAGEDOWN:
event.m_eventType = wxEVT_SCROLL_PAGEDOWN;
break;
case SB_THUMBTRACK:
case SB_THUMBPOSITION:
event.m_eventType = wxEVT_SCROLL_THUMBTRACK;
break;
default:
return;
break;
}
if (!GetEventHandler()->ProcessEvent(event))
Default();
}
return GetEventHandler()->ProcessEvent(event);
}
bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
@@ -237,34 +188,12 @@ bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
return FALSE;
}
bool wxSpinButton::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
{
NMHDR* hdr1 = (NMHDR*) lParam;
switch ( hdr1->code )
{
/* We don't process this message, currently */
case UDN_DELTAPOS:
default :
return wxControl::MSWNotify(wParam, lParam, result);
break;
}
/*
event.eventObject = this;
event.SetEventType(eventType);
if ( !GetEventHandler()->ProcessEvent(event) )
return FALSE;
*/
return TRUE;
}
// Spin event
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
wxScrollEvent(commandType, id)
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id)
: wxScrollEvent(commandType, id)
{
}
#endif
#endif // __WIN95__

View File

@@ -148,7 +148,7 @@ bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
return FALSE;
}
bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
wxTabEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
@@ -171,12 +171,12 @@ bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
}
default :
return wxControl::MSWNotify(wParam, lParam, result);
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventObject( this );
event.SetEventType(eventType);
event.SetInt( (int) LOWORD(wParam) ) ;
event.SetInt(idCtrl) ;
return ProcessEvent(event);
}

View File

@@ -346,7 +346,7 @@ bool wxToolBar95::MSWCommand(WXUINT cmd, WXWORD id)
return TRUE;
}
bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam),
bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
WXLPARAM lParam,
WXLPARAM *result)
{

View File

@@ -1234,7 +1234,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
// For Rich Edit controls. Do we need it?
#if 0
#if wxUSE_RICHEDIT
bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
bool wxTextCtrl::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
{
wxCommandEvent event(0, m_windowId);
int eventType = 0;
@@ -1243,7 +1243,7 @@ bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
{
// Insert case code here
default :
return wxControl::MSWNotify(wParam, lParam);
return wxControl::MSWOnNotify(wParam, lParam);
break;
}

View File

@@ -914,7 +914,7 @@ bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id)
}
// process WM_NOTIFY Windows message
bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
{
wxTreeEvent event(wxEVT_NULL, m_windowId);
wxEventType eventType = wxEVT_NULL;
@@ -1050,7 +1050,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
}
default:
return wxControl::MSWNotify(wParam, lParam, result);
return wxControl::MSWOnNotify(idCtrl, lParam, result);
}
event.SetEventObject(this);

File diff suppressed because it is too large Load Diff