1. MSW message handling simplifications
2. wxDC split into wxDC and wxDCBase 3. Several minor bug fixes, many major new bugs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
598
include/wx/dc.h
598
include/wx/dc.h
@@ -1,18 +1,604 @@
|
|||||||
#ifndef _WX_DC_H_BASE_
|
#ifndef _WX_DC_H_BASE_
|
||||||
#define _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__)
|
#if defined(__WXMSW__)
|
||||||
#include "wx/msw/dc.h"
|
#include "wx/msw/dc.h"
|
||||||
#elif defined(__WXMOTIF__)
|
#elif defined(__WXMOTIF__)
|
||||||
#include "wx/motif/dc.h"
|
#include "wx/motif/dc.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
#include "wx/gtk/dc.h"
|
#include "wx/gtk/dc.h"
|
||||||
#elif defined(__WXQT__)
|
#elif defined(__WXQT__)
|
||||||
#include "wx/qt/dc.h"
|
#include "wx/qt/dc.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include "wx/mac/dc.h"
|
#include "wx/mac/dc.h"
|
||||||
#elif defined(__WXSTUBS__)
|
#elif defined(__WXSTUBS__)
|
||||||
#include "wx/stubs/dc.h"
|
#include "wx/stubs/dc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -81,6 +81,8 @@
|
|||||||
#ifdef __VISUALC__
|
#ifdef __VISUALC__
|
||||||
# pragma warning(disable:4244) // conversion from double to float
|
# pragma warning(disable:4244) // conversion from double to float
|
||||||
# pragma warning(disable:4100) // unreferenced formal parameter
|
# 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__
|
#endif // __VISUALC__
|
||||||
|
|
||||||
// suppress some Salford C++ warnings
|
// suppress some Salford C++ warnings
|
||||||
@@ -1066,8 +1068,7 @@ typedef enum {
|
|||||||
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
/* Stand-ins for Windows types, to avoid
|
// Stand-ins for Windows types, to avoid #including all of windows.h
|
||||||
* #including all of windows.h */
|
|
||||||
typedef unsigned long WXHWND;
|
typedef unsigned long WXHWND;
|
||||||
typedef unsigned long WXHANDLE;
|
typedef unsigned long WXHANDLE;
|
||||||
typedef unsigned long WXHICON;
|
typedef unsigned long WXHICON;
|
||||||
@@ -1095,15 +1096,17 @@ typedef void * WXMSG;
|
|||||||
typedef unsigned long WXHCONV;
|
typedef unsigned long WXHCONV;
|
||||||
typedef unsigned long WXHKEY;
|
typedef unsigned long WXHKEY;
|
||||||
typedef unsigned long WXHTREEITEM;
|
typedef unsigned long WXHTREEITEM;
|
||||||
|
|
||||||
typedef void * WXDRAWITEMSTRUCT;
|
typedef void * WXDRAWITEMSTRUCT;
|
||||||
typedef void * WXMEASUREITEMSTRUCT;
|
typedef void * WXMEASUREITEMSTRUCT;
|
||||||
typedef void * WXLPCREATESTRUCT;
|
typedef void * WXLPCREATESTRUCT;
|
||||||
|
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
typedef int (*WXFARPROC)();
|
typedef int (*WXFARPROC)();
|
||||||
#elif defined(__WIN32__)
|
#elif defined(__WIN32__)
|
||||||
typedef int (__stdcall *WXFARPROC)();
|
typedef int (__stdcall *WXFARPROC)();
|
||||||
#else
|
#else
|
||||||
typedef int (*WXFARPROC)();
|
typedef int (*WXFARPROC)();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef WXHWND WXWidget;
|
typedef WXHWND WXWidget;
|
||||||
@@ -1198,5 +1201,14 @@ typedef GtkWidget *WXWidget;
|
|||||||
#endif
|
#endif
|
||||||
// __WXMSW__
|
// __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
|
#endif
|
||||||
// _WX_DEFS_H_
|
// _WX_DEFS_H_
|
||||||
|
@@ -223,11 +223,13 @@ public:
|
|||||||
class WXDLLEXPORT wxRect
|
class WXDLLEXPORT wxRect
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRect();
|
wxRect() { x = y = width = height = 0; }
|
||||||
wxRect(long x, long y, long w, long h);
|
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& topLeft, const wxPoint& bottomRight);
|
||||||
wxRect(const wxPoint& pos, const wxSize& size);
|
wxRect(const wxPoint& pos, const wxSize& size);
|
||||||
wxRect(const wxRect& rect);
|
|
||||||
|
// default copy ctor and assignment operators ok
|
||||||
|
|
||||||
long GetX() const { return x; }
|
long GetX() const { return x; }
|
||||||
void SetX(long xx) { x = xx; }
|
void SetX(long xx) { x = xx; }
|
||||||
@@ -249,9 +251,8 @@ public:
|
|||||||
long GetBottom() const { return y + height; }
|
long GetBottom() const { return y + height; }
|
||||||
long GetRight() const { return x + width; }
|
long GetRight() const { return x + width; }
|
||||||
|
|
||||||
wxRect& operator = (const wxRect& rect);
|
bool operator == (const wxRect& rect) const;
|
||||||
bool operator == (const wxRect& rect);
|
bool operator != (const wxRect& rect) const { return !(*this == rect); }
|
||||||
bool operator != (const wxRect& rect);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
long x, y, width, height;
|
long x, y, width, height;
|
||||||
|
@@ -15,15 +15,6 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#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
|
// classes
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -34,350 +25,134 @@ class wxDC;
|
|||||||
// constants
|
// constants
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define MM_TEXT 0
|
#define MM_TEXT 0
|
||||||
#define MM_ISOTROPIC 1
|
#define MM_ISOTROPIC 1
|
||||||
#define MM_ANISOTROPIC 2
|
#define MM_ANISOTROPIC 2
|
||||||
#define MM_LOMETRIC 3
|
#define MM_LOMETRIC 3
|
||||||
#define MM_HIMETRIC 4
|
#define MM_HIMETRIC 4
|
||||||
#define MM_TWIPS 5
|
#define MM_TWIPS 5
|
||||||
#define MM_POINTS 6
|
#define MM_POINTS 6
|
||||||
#define MM_METRIC 7
|
#define MM_METRIC 7
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// global variables
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern int wxPageNumber;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDC
|
// wxDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxDC: public wxObject
|
class wxDC : public wxDCBase
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
wxDC();
|
||||||
|
~wxDC() { }
|
||||||
|
|
||||||
wxDC();
|
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
|
||||||
~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
|
// the first two must be overridden and called
|
||||||
virtual void DestroyClippingRegion(void);
|
virtual void DestroyClippingRegion();
|
||||||
virtual void SetClippingRegion( long x, long y, long width, long height );
|
|
||||||
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
|
|
||||||
virtual void SetClippingRegion( const wxRegion ®ion ) = 0;
|
|
||||||
|
|
||||||
virtual long MinX() const { return m_minX; }
|
// Resolution in pixels per logical inch
|
||||||
virtual long MaxX() const { return m_maxX; }
|
virtual wxSize GetPPI() const;
|
||||||
virtual long MinY() const { return m_minY; }
|
|
||||||
virtual long MaxY() const { return m_maxY; }
|
|
||||||
|
|
||||||
// Size in device units
|
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||||
virtual void GetSize( int* width, int* height ) const;
|
virtual void EndDoc() { }
|
||||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
virtual void StartPage() { }
|
||||||
|
virtual void EndPage() { }
|
||||||
|
|
||||||
// Size in millimetres
|
virtual void SetMapMode( int mode );
|
||||||
virtual void GetSizeMM( int* width, int* height ) const;
|
virtual void SetUserScale( double x, double y );
|
||||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
virtual void SetLogicalScale( double x, double y );
|
||||||
|
virtual void SetLogicalOrigin( long x, long y );
|
||||||
|
virtual void SetDeviceOrigin( long x, long y );
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||||
virtual wxSize GetPPI(void) const;
|
|
||||||
|
|
||||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
// implementation
|
||||||
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();
|
void ComputeScaleAndOrigin();
|
||||||
|
|
||||||
long XDEV2LOG(long x) const
|
long XDEV2LOG(long x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_deviceOriginX;
|
long new_x = x - m_deviceOriginX;
|
||||||
if (new_x > 0)
|
if (new_x > 0)
|
||||||
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
||||||
}
|
}
|
||||||
long XDEV2LOGREL(long x) const
|
long XDEV2LOGREL(long x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
return (long)((double)(x) / m_scaleX + 0.5);
|
return (long)((double)(x) / m_scaleX + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(x) / m_scaleX - 0.5);
|
return (long)((double)(x) / m_scaleX - 0.5);
|
||||||
}
|
}
|
||||||
long YDEV2LOG(long y) const
|
long YDEV2LOG(long y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_deviceOriginY;
|
long new_y = y - m_deviceOriginY;
|
||||||
if (new_y > 0)
|
if (new_y > 0)
|
||||||
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
||||||
}
|
}
|
||||||
long YDEV2LOGREL(long y) const
|
long YDEV2LOGREL(long y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
if (y > 0)
|
||||||
return (long)((double)(y) / m_scaleY + 0.5);
|
return (long)((double)(y) / m_scaleY + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(y) / m_scaleY - 0.5);
|
return (long)((double)(y) / m_scaleY - 0.5);
|
||||||
}
|
}
|
||||||
long XLOG2DEV(long x) const
|
long XLOG2DEV(long x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
long new_x = x - m_logicalOriginX;
|
||||||
if (new_x > 0)
|
if (new_x > 0)
|
||||||
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
||||||
}
|
}
|
||||||
long XLOG2DEVREL(long x) const
|
long XLOG2DEVREL(long x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
return (long)((double)(x) * m_scaleX + 0.5);
|
return (long)((double)(x) * m_scaleX + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(x) * m_scaleX - 0.5);
|
return (long)((double)(x) * m_scaleX - 0.5);
|
||||||
}
|
}
|
||||||
long YLOG2DEV(long y) const
|
long YLOG2DEV(long y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY;
|
long new_y = y - m_logicalOriginY;
|
||||||
if (new_y > 0)
|
if (new_y > 0)
|
||||||
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
||||||
}
|
}
|
||||||
long YLOG2DEVREL(long y) const
|
long YLOG2DEVREL(long y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
if (y > 0)
|
||||||
return (long)((double)(y) * m_scaleY + 0.5);
|
return (long)((double)(y) * m_scaleY + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(y) * m_scaleY - 0.5);
|
return (long)((double)(y) * m_scaleY - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_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?
|
bool m_needComputeScaleX,
|
||||||
double m_mm_to_pix_x,m_mm_to_pix_y;
|
m_needComputeScaleY; // not yet used
|
||||||
|
|
||||||
long m_deviceOriginX,m_deviceOriginY;
|
|
||||||
|
|
||||||
long m_logicalOriginX,m_logicalOriginY; // User defined.
|
|
||||||
|
|
||||||
double m_scaleX,m_scaleY;
|
|
||||||
double m_logicalScaleX,m_logicalScaleY;
|
|
||||||
double m_userScaleX,m_userScaleY;
|
|
||||||
long m_signX,m_signY;
|
|
||||||
|
|
||||||
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
|
|
||||||
|
|
||||||
float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
|
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__
|
#endif // __GTKDCH__
|
||||||
|
@@ -230,6 +230,7 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DECLARE_NO_COPY_CLASS(wxWindow);
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -15,15 +15,6 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#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
|
// classes
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -34,350 +25,134 @@ class wxDC;
|
|||||||
// constants
|
// constants
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define MM_TEXT 0
|
#define MM_TEXT 0
|
||||||
#define MM_ISOTROPIC 1
|
#define MM_ISOTROPIC 1
|
||||||
#define MM_ANISOTROPIC 2
|
#define MM_ANISOTROPIC 2
|
||||||
#define MM_LOMETRIC 3
|
#define MM_LOMETRIC 3
|
||||||
#define MM_HIMETRIC 4
|
#define MM_HIMETRIC 4
|
||||||
#define MM_TWIPS 5
|
#define MM_TWIPS 5
|
||||||
#define MM_POINTS 6
|
#define MM_POINTS 6
|
||||||
#define MM_METRIC 7
|
#define MM_METRIC 7
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// global variables
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
extern int wxPageNumber;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDC
|
// wxDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxDC: public wxObject
|
class wxDC : public wxDCBase
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
DECLARE_ABSTRACT_CLASS(wxDC)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
wxDC();
|
||||||
|
~wxDC() { }
|
||||||
|
|
||||||
wxDC();
|
void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
|
||||||
~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
|
// the first two must be overridden and called
|
||||||
virtual void DestroyClippingRegion(void);
|
virtual void DestroyClippingRegion();
|
||||||
virtual void SetClippingRegion( long x, long y, long width, long height );
|
|
||||||
virtual void GetClippingBox( long *x, long *y, long *width, long *height ) const;
|
|
||||||
virtual void SetClippingRegion( const wxRegion ®ion ) = 0;
|
|
||||||
|
|
||||||
virtual long MinX() const { return m_minX; }
|
// Resolution in pixels per logical inch
|
||||||
virtual long MaxX() const { return m_maxX; }
|
virtual wxSize GetPPI() const;
|
||||||
virtual long MinY() const { return m_minY; }
|
|
||||||
virtual long MaxY() const { return m_maxY; }
|
|
||||||
|
|
||||||
// Size in device units
|
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
||||||
virtual void GetSize( int* width, int* height ) const;
|
virtual void EndDoc() { }
|
||||||
inline wxSize GetSize(void) const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
virtual void StartPage() { }
|
||||||
|
virtual void EndPage() { }
|
||||||
|
|
||||||
// Size in millimetres
|
virtual void SetMapMode( int mode );
|
||||||
virtual void GetSizeMM( int* width, int* height ) const;
|
virtual void SetUserScale( double x, double y );
|
||||||
inline wxSize GetSizeMM(void) const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
virtual void SetLogicalScale( double x, double y );
|
||||||
|
virtual void SetLogicalOrigin( long x, long y );
|
||||||
|
virtual void SetDeviceOrigin( long x, long y );
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
|
||||||
virtual wxSize GetPPI(void) const;
|
|
||||||
|
|
||||||
virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
|
// implementation
|
||||||
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();
|
void ComputeScaleAndOrigin();
|
||||||
|
|
||||||
long XDEV2LOG(long x) const
|
long XDEV2LOG(long x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_deviceOriginX;
|
long new_x = x - m_deviceOriginX;
|
||||||
if (new_x > 0)
|
if (new_x > 0)
|
||||||
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
|
||||||
}
|
}
|
||||||
long XDEV2LOGREL(long x) const
|
long XDEV2LOGREL(long x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
return (long)((double)(x) / m_scaleX + 0.5);
|
return (long)((double)(x) / m_scaleX + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(x) / m_scaleX - 0.5);
|
return (long)((double)(x) / m_scaleX - 0.5);
|
||||||
}
|
}
|
||||||
long YDEV2LOG(long y) const
|
long YDEV2LOG(long y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_deviceOriginY;
|
long new_y = y - m_deviceOriginY;
|
||||||
if (new_y > 0)
|
if (new_y > 0)
|
||||||
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
|
||||||
}
|
}
|
||||||
long YDEV2LOGREL(long y) const
|
long YDEV2LOGREL(long y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
if (y > 0)
|
||||||
return (long)((double)(y) / m_scaleY + 0.5);
|
return (long)((double)(y) / m_scaleY + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(y) / m_scaleY - 0.5);
|
return (long)((double)(y) / m_scaleY - 0.5);
|
||||||
}
|
}
|
||||||
long XLOG2DEV(long x) const
|
long XLOG2DEV(long x) const
|
||||||
{
|
{
|
||||||
long new_x = x - m_logicalOriginX;
|
long new_x = x - m_logicalOriginX;
|
||||||
if (new_x > 0)
|
if (new_x > 0)
|
||||||
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
|
||||||
}
|
}
|
||||||
long XLOG2DEVREL(long x) const
|
long XLOG2DEVREL(long x) const
|
||||||
{
|
{
|
||||||
if (x > 0)
|
if (x > 0)
|
||||||
return (long)((double)(x) * m_scaleX + 0.5);
|
return (long)((double)(x) * m_scaleX + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(x) * m_scaleX - 0.5);
|
return (long)((double)(x) * m_scaleX - 0.5);
|
||||||
}
|
}
|
||||||
long YLOG2DEV(long y) const
|
long YLOG2DEV(long y) const
|
||||||
{
|
{
|
||||||
long new_y = y - m_logicalOriginY;
|
long new_y = y - m_logicalOriginY;
|
||||||
if (new_y > 0)
|
if (new_y > 0)
|
||||||
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
|
||||||
else
|
else
|
||||||
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
|
||||||
}
|
}
|
||||||
long YLOG2DEVREL(long y) const
|
long YLOG2DEVREL(long y) const
|
||||||
{
|
{
|
||||||
if (y > 0)
|
if (y > 0)
|
||||||
return (long)((double)(y) * m_scaleY + 0.5);
|
return (long)((double)(y) * m_scaleY + 0.5);
|
||||||
else
|
else
|
||||||
return (long)((double)(y) * m_scaleY - 0.5);
|
return (long)((double)(y) * m_scaleY - 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_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?
|
bool m_needComputeScaleX,
|
||||||
double m_mm_to_pix_x,m_mm_to_pix_y;
|
m_needComputeScaleY; // not yet used
|
||||||
|
|
||||||
long m_deviceOriginX,m_deviceOriginY;
|
|
||||||
|
|
||||||
long m_logicalOriginX,m_logicalOriginY; // User defined.
|
|
||||||
|
|
||||||
double m_scaleX,m_scaleY;
|
|
||||||
double m_logicalScaleX,m_logicalScaleY;
|
|
||||||
double m_userScaleX,m_userScaleY;
|
|
||||||
long m_signX,m_signY;
|
|
||||||
|
|
||||||
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
|
|
||||||
|
|
||||||
float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
|
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__
|
#endif // __GTKDCH__
|
||||||
|
@@ -230,6 +230,7 @@ public:
|
|||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
DECLARE_NO_COPY_CLASS(wxWindow);
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -57,11 +57,9 @@ public:
|
|||||||
|
|
||||||
// MSW-specific
|
// MSW-specific
|
||||||
|
|
||||||
// Window procedure
|
#ifdef __WIN95__
|
||||||
virtual void MSWOnMouseMove(int x, int y, WXUINT flags);
|
virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result);
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
#endif // Win95
|
||||||
|
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
|
||||||
|
|
||||||
// For ownerdraw items
|
// For ownerdraw items
|
||||||
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *WXUNUSED(item)) { return FALSE; };
|
||||||
@@ -70,6 +68,8 @@ public:
|
|||||||
wxFunction GetCallback() { return m_callback; }
|
wxFunction GetCallback() { return m_callback; }
|
||||||
wxList& GetSubcontrols() { return m_subControls; }
|
wxList& GetSubcontrols() { return m_subControls; }
|
||||||
|
|
||||||
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxFunction m_callback; // Callback associated with the window
|
wxFunction m_callback; // Callback associated with the window
|
||||||
|
|
||||||
|
@@ -6,397 +6,185 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_DC_H_
|
#ifndef _WX_DC_H_
|
||||||
#define _WX_DC_H_
|
#define _WX_DC_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "dc.h"
|
#pragma interface "dc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/pen.h"
|
class WXDLLEXPORT wxDC : public wxDCBase
|
||||||
#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
|
|
||||||
{
|
{
|
||||||
DECLARE_ABSTRACT_CLASS(wxDC)
|
DECLARE_DYNAMIC_CLASS(wxDC)
|
||||||
protected:
|
|
||||||
public:
|
public:
|
||||||
wxDC(void);
|
wxDC();
|
||||||
~wxDC(void);
|
~wxDC();
|
||||||
|
|
||||||
#ifdef WX_COMP_INLINE_NO_CLASS
|
// implement base class pure virtuals
|
||||||
inline void BeginDrawing(void) {}
|
// ----------------------------------
|
||||||
inline void EndDrawing(void) {}
|
|
||||||
#else
|
|
||||||
inline void wxDC::BeginDrawing(void) {}
|
|
||||||
inline void wxDC::EndDrawing(void) {}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual void FloodFill(long x1, long y1, const wxColour& col, int style=wxFLOOD_SURFACE) ;
|
virtual void Clear();
|
||||||
inline void FloodFill(const wxPoint& pt, const wxColour& col, int style=wxFLOOD_SURFACE)
|
|
||||||
{
|
|
||||||
FloodFill(pt.x, pt.y, col, style);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool GetPixel(long x1, long y1, wxColour *col) const ;
|
virtual bool StartDoc(const wxString& message);
|
||||||
inline bool GetPixel(const wxPoint& pt, wxColour *col) const
|
virtual void EndDoc();
|
||||||
{
|
|
||||||
return GetPixel(pt.x, pt.y, col);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void DrawLine(long x1, long y1, long x2, long y2);
|
virtual void StartPage();
|
||||||
inline void DrawLine(const wxPoint& pt1, const wxPoint& pt2)
|
virtual void EndPage();
|
||||||
{
|
|
||||||
DrawLine(pt1.x, pt1.y, pt2.x, pt2.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void CrossHair(long x, long y) ;
|
virtual void SetFont(const wxFont& font);
|
||||||
inline void CrossHair(const wxPoint& pt)
|
virtual void SetPen(const wxPen& pen);
|
||||||
{
|
virtual void SetBrush(const wxBrush& brush);
|
||||||
CrossHair(pt.x, pt.y);
|
virtual void SetBackground(const wxBrush& brush);
|
||||||
}
|
virtual void SetBackgroundMode(int mode);
|
||||||
|
virtual void SetPalette(const wxPalette& palette);
|
||||||
|
|
||||||
virtual void DrawArc(long x1,long y1,long x2,long y2,long xc, long yc);
|
virtual void DestroyClippingRegion();
|
||||||
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 long GetCharHeight() const;
|
||||||
virtual void DrawEllipticArc (const wxPoint& pt, const wxSize& sz, double sa, double ea)
|
virtual long GetCharWidth() const;
|
||||||
{
|
virtual void GetTextExtent(const wxString& string,
|
||||||
DrawEllipticArc(pt.x, pt.y, sz.x, sz.y, sa, ea);
|
long *x, long *y,
|
||||||
}
|
long *descent = NULL,
|
||||||
|
long *externalLeading = NULL,
|
||||||
|
wxFont *theFont = NULL) const;
|
||||||
|
|
||||||
virtual void DrawPoint(long x, long y);
|
virtual bool CanDrawBitmap() const;
|
||||||
inline void DrawPoint(const wxPoint& pt)
|
virtual bool CanGetTextExtent() const;
|
||||||
{
|
virtual int GetDepth() const;
|
||||||
DrawPoint(pt.x, pt.y);
|
virtual wxSize GetPPI() const;
|
||||||
}
|
|
||||||
|
|
||||||
virtual void DrawLines(int n, wxPoint points[], long xoffset = 0, long yoffset = 0);
|
virtual void SetMapMode(int mode);
|
||||||
|
virtual void SetUserScale(double x, double y);
|
||||||
|
virtual void SetSystemScale(double x, double y);
|
||||||
|
virtual void SetLogicalScale(double x, double y);
|
||||||
|
virtual void SetLogicalOrigin(long x, long y);
|
||||||
|
virtual void SetDeviceOrigin(long x, long y);
|
||||||
|
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
||||||
|
virtual void SetLogicalFunction(int function);
|
||||||
|
|
||||||
virtual void DrawPolygon(int n, wxPoint points[], long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
// implementation from now on
|
||||||
|
// --------------------------
|
||||||
|
|
||||||
virtual void DrawRectangle(long x, long y, long width, long height);
|
virtual void SetRop(WXHDC cdc);
|
||||||
inline void DrawRectangle(const wxPoint& pt, const wxSize& sz)
|
virtual void DoClipping(WXHDC cdc);
|
||||||
{
|
virtual void SelectOldObjects(WXHDC dc);
|
||||||
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);
|
wxWindow *GetWindow() const { return m_canvas; }
|
||||||
inline void DrawRoundedRectangle(const wxPoint& pt, const wxSize& sz, double radius = 20.0)
|
void SetWindow(wxWindow *win) { m_canvas = win; }
|
||||||
{
|
|
||||||
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);
|
WXHDC GetHDC() const { return m_hDC; }
|
||||||
inline void DrawEllipse(const wxPoint& pt, const wxSize& sz)
|
void SetHDC(WXHDC dc, bool bOwnsDC = FALSE)
|
||||||
{
|
{
|
||||||
DrawEllipse(pt.x, pt.y, sz.x, sz.y);
|
m_hDC = dc;
|
||||||
}
|
m_bOwnsDC = bOwnsDC;
|
||||||
inline void DrawEllipse(const wxRect& rect)
|
}
|
||||||
{
|
|
||||||
DrawEllipse(rect.x, rect.y, rect.width, rect.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void DrawIcon(const wxIcon& icon, long x, long y);
|
|
||||||
inline void DrawIcon(const wxIcon& icon, const wxPoint& pt)
|
|
||||||
{
|
|
||||||
DrawIcon(icon, pt.x, pt.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void DrawBitmap( const wxBitmap &bmp, long x, long y, bool useMask=FALSE );
|
|
||||||
|
|
||||||
inline void DrawPoint(wxPoint& point) { DrawPoint(point.x, point.y); }
|
|
||||||
virtual void DrawLines(wxList *list, long xoffset = 0, long yoffset = 0);
|
|
||||||
virtual void DrawPolygon(wxList *list, long xoffset = 0, long yoffset = 0, int fillStyle=wxODDEVEN_RULE);
|
|
||||||
|
|
||||||
virtual void DrawText(const wxString& text, long x, long y, bool use16bit = FALSE);
|
|
||||||
inline void DrawText(const wxString& text, const wxPoint& pt, bool use16bit = FALSE)
|
|
||||||
{
|
|
||||||
DrawText(text, pt.x, pt.y, use16bit);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool Blit(long xdest, long ydest, long width, long height,
|
|
||||||
wxDC *source, long xsrc, long ysrc, int rop = wxCOPY, bool useMask = FALSE);
|
|
||||||
inline bool Blit(const wxPoint& destPt, const wxSize& sz,
|
|
||||||
wxDC *source, const wxPoint& srcPt, int rop = wxCOPY, bool useMask = FALSE)
|
|
||||||
{
|
|
||||||
return Blit(destPt.x, destPt.y, sz.x, sz.y, source, srcPt.x, srcPt.y, rop, useMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxUSE_SPLINES
|
|
||||||
// Splines
|
|
||||||
// 3-point spline
|
|
||||||
virtual void DrawSpline(long x1, long y1, long x2, long y2, long x3, long y3);
|
|
||||||
// Any number of control points - a list of pointers to wxPoints
|
|
||||||
virtual void DrawSpline(wxList *points);
|
|
||||||
virtual void DrawSpline(int n, wxPoint points[]);
|
|
||||||
#endif
|
|
||||||
virtual void Clear(void);
|
|
||||||
virtual void SetFont(const wxFont& font);
|
|
||||||
virtual void SetPen(const wxPen& pen);
|
|
||||||
virtual void SetBrush(const wxBrush& brush);
|
|
||||||
virtual void SetLogicalFunction(int function);
|
|
||||||
virtual void SetBackground(const wxBrush& brush);
|
|
||||||
virtual void SetBackgroundMode(int mode);
|
|
||||||
|
|
||||||
virtual void SetClippingRegion(long x, long y, long width, long height);
|
|
||||||
inline void SetClippingRegion(const wxPoint& pt, const wxSize& sz)
|
|
||||||
{
|
|
||||||
SetClippingRegion(pt.x, pt.y, sz.x, sz.y);
|
|
||||||
}
|
|
||||||
inline void SetClippingRegion(const wxRect& rect)
|
|
||||||
{
|
|
||||||
SetClippingRegion(rect.x, rect.y, rect.width, rect.height);
|
|
||||||
}
|
|
||||||
virtual void SetClippingRegion(const wxRegion& region);
|
|
||||||
|
|
||||||
virtual void SetPalette(const wxPalette& palette);
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
virtual inline void SetColourMap(const wxPalette& palette) { SetPalette(palette); };
|
|
||||||
#endif
|
|
||||||
virtual void DestroyClippingRegion(void);
|
|
||||||
virtual long GetCharHeight(void) const;
|
|
||||||
virtual long GetCharWidth(void) const;
|
|
||||||
virtual void GetTextExtent(const wxString& string, long *x, long *y,
|
|
||||||
long *descent = NULL, long *externalLeading = NULL,
|
|
||||||
wxFont *theFont = NULL, bool use16bit = FALSE) const;
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
void GetTextExtent(const wxString& string, float *x, float *y,
|
|
||||||
float *descent = NULL, float *externalLeading = NULL,
|
|
||||||
wxFont *theFont = NULL, bool use16bit = FALSE) const ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Size in device units
|
|
||||||
virtual void GetSize(int* width, int* height) const;
|
|
||||||
inline wxSize GetSize() const { int w, h; GetSize(&w, &h); return wxSize(w, h); }
|
|
||||||
|
|
||||||
// Size in mm
|
|
||||||
virtual void GetSizeMM(int* width, int* height) const ;
|
|
||||||
inline wxSize GetSizeMM() const { int w, h; GetSizeMM(&w, &h); return wxSize(w, h); }
|
|
||||||
|
|
||||||
// Resolution in Pixels per inch
|
|
||||||
virtual wxSize GetPPI(void) const ;
|
|
||||||
|
|
||||||
// Compatibility
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
inline void GetSize(float* width, float* height) const { int w, h; GetSize(& w, & h); *width = w; *height = h; }
|
|
||||||
inline void GetSizeMM(float *width, float *height) const { long w, h; GetSizeMM(& w, & h); *width = (float) w; *height = (float) h; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
virtual bool StartDoc(const wxString& message);
|
|
||||||
virtual void EndDoc(void);
|
|
||||||
virtual void StartPage(void);
|
|
||||||
virtual void EndPage(void);
|
|
||||||
virtual void SetMapMode(int mode);
|
|
||||||
virtual void SetUserScale(double x, double y);
|
|
||||||
virtual void SetSystemScale(double x, double y);
|
|
||||||
virtual void SetLogicalOrigin(long x, long y);
|
|
||||||
virtual void SetDeviceOrigin(long x, long y);
|
|
||||||
virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
|
|
||||||
|
|
||||||
// This group of functions does actual conversion
|
|
||||||
// of the input, as you'd expect.
|
|
||||||
|
|
||||||
long DeviceToLogicalX(long x) const;
|
|
||||||
long DeviceToLogicalY(long y) const;
|
|
||||||
long DeviceToLogicalXRel(long x) const;
|
|
||||||
long DeviceToLogicalYRel(long y) const;
|
|
||||||
long LogicalToDeviceX(long x) const;
|
|
||||||
long LogicalToDeviceY(long y) const;
|
|
||||||
long LogicalToDeviceXRel(long x) const;
|
|
||||||
long LogicalToDeviceYRel(long y) const;
|
|
||||||
|
|
||||||
// This group of functions may not do any conversion
|
|
||||||
// if m_scaleGDI is TRUE, since the HDC does the
|
|
||||||
// conversion automatically.
|
|
||||||
// m_scaleGDI NOW OBSOLETE
|
|
||||||
long ImplDeviceToLogicalX(long x) const;
|
|
||||||
long ImplDeviceToLogicalY(long y) const;
|
|
||||||
long ImplDeviceToLogicalXRel(long x) const;
|
|
||||||
long ImplDeviceToLogicalYRel(long y) const;
|
|
||||||
long ImplLogicalToDeviceX(long x) const;
|
|
||||||
long ImplLogicalToDeviceY(long y) const;
|
|
||||||
long ImplLogicalToDeviceXRel(long x) const;
|
|
||||||
long ImplLogicalToDeviceYRel(long y) const;
|
|
||||||
|
|
||||||
virtual bool CanDrawBitmap(void) const;
|
|
||||||
virtual bool CanGetTextExtent(void) const;
|
|
||||||
|
|
||||||
virtual void SetTextForeground(const wxColour& colour);
|
|
||||||
virtual void SetTextBackground(const wxColour& colour);
|
|
||||||
inline virtual bool Ok(void) const {return m_ok;};
|
|
||||||
inline virtual int GetMapMode(void) const {return m_mappingMode;};
|
|
||||||
|
|
||||||
inline virtual wxBrush& GetBackground(void) const { return (wxBrush&) m_backgroundBrush ;}
|
|
||||||
inline virtual wxBrush& GetBrush(void) const { return (wxBrush&) m_brush ;}
|
|
||||||
inline virtual wxFont& GetFont(void) const { return (wxFont&) m_font ;}
|
|
||||||
inline virtual int GetLogicalFunction(void) const { return m_logicalFunction ;}
|
|
||||||
inline virtual wxPen& GetPen(void) const { return (wxPen&) m_pen ;}
|
|
||||||
inline virtual wxColour&GetTextBackground(void) const { return (wxColour&) m_textBackgroundColour ;}
|
|
||||||
inline virtual wxColour&GetTextForeground(void) const { return (wxColour&) m_textForegroundColour ;}
|
|
||||||
|
|
||||||
virtual void SetLogicalScale(double x, double y);
|
|
||||||
virtual inline void GetUserScale(double* x, double *y) const { *x = m_userScaleX; *y = m_userScaleY; }
|
|
||||||
virtual void CalcBoundingBox(long x, long y);
|
|
||||||
// Get the final bounding box of the PostScript or Metafile picture.
|
|
||||||
virtual inline long MinX(void) const { return m_minX; }
|
|
||||||
virtual inline long MaxX(void) const { return m_maxX; }
|
|
||||||
virtual inline long MinY(void) const { return m_minY; }
|
|
||||||
virtual inline long MaxY(void) const { return m_maxY; }
|
|
||||||
// Sometimes we need to override optimization, e.g.
|
|
||||||
// if other software is drawing onto our surface and we
|
|
||||||
// can't be sure of who's done what.
|
|
||||||
virtual inline void SetOptimization(bool WXUNUSED(opt)) { }
|
|
||||||
virtual inline bool GetOptimization(void) { return FALSE; }
|
|
||||||
|
|
||||||
virtual void GetClippingBox(long *x,long *y,long *w,long *h) const ;
|
|
||||||
inline void GetClippingBox(wxRect& rect) const
|
|
||||||
{
|
|
||||||
long x, y, w, h;
|
|
||||||
GetClippingBox(&x, &y, &w, &h); rect.x = x; rect.y = y; rect.width = w; rect.height = h;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This should probably be made available on other platforms
|
|
||||||
#ifdef WX_COMP_INLINE_NO_CLASS
|
|
||||||
int GetDepth(void) const ;
|
|
||||||
#else
|
|
||||||
int wxDC::GetDepth(void) const ;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Implementation
|
|
||||||
virtual void SetRop(WXHDC cdc);
|
|
||||||
virtual void DoClipping(WXHDC cdc);
|
|
||||||
virtual void SelectOldObjects(WXHDC dc);
|
|
||||||
|
|
||||||
inline wxWindow *GetWindow(void) const { return m_canvas; }
|
|
||||||
inline void SetWindow(wxWindow *win) { m_canvas = win; }
|
|
||||||
inline WXHDC GetHDC(void) const { return m_hDC; }
|
|
||||||
inline void SetHDC(WXHDC dc, bool bOwnsDC = FALSE) { m_hDC = dc; m_bOwnsDC = bOwnsDC; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_colour;
|
virtual void DoFloodFill(long x, long y, const wxColour& col,
|
||||||
bool m_ok;
|
int style = wxFLOOD_SURFACE);
|
||||||
bool m_clipping;
|
|
||||||
bool m_isInteractive;
|
|
||||||
|
|
||||||
// Coordinate system variables
|
virtual bool DoGetPixel(long x, long y, wxColour *col) const;
|
||||||
long m_logicalOriginX;
|
|
||||||
long m_logicalOriginY;
|
|
||||||
|
|
||||||
long m_deviceOriginX;
|
virtual void DoDrawPoint(long x, long y);
|
||||||
long m_deviceOriginY;
|
virtual void DoDrawLine(long x1, long y1, long x2, long y2);
|
||||||
|
|
||||||
double m_logicalScaleX;
|
virtual void DoDrawArc(long x1, long y1,
|
||||||
double m_logicalScaleY;
|
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;
|
virtual void DoDrawRectangle(long x, long y, long width, long height);
|
||||||
double m_userScaleY;
|
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
|
virtual void DoCrossHair(long x, long y);
|
||||||
int m_signY; // invert the axes
|
|
||||||
|
|
||||||
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
|
virtual void DoDrawText(const wxString& text, long x, long y);
|
||||||
long m_minY;
|
|
||||||
long m_maxX;
|
|
||||||
long m_maxY;
|
|
||||||
|
|
||||||
int m_logicalFunction;
|
virtual bool DoBlit(long xdest, long ydest, long width, long height,
|
||||||
int m_backgroundMode;
|
wxDC *source, long xsrc, long ysrc,
|
||||||
|
int rop = wxCOPY, bool useMask = FALSE);
|
||||||
|
|
||||||
wxPen m_pen;
|
// this is gnarly - we can't even call this function DoSetClippingRegion()
|
||||||
wxBrush m_brush;
|
// because of virtual function hiding
|
||||||
wxBrush m_backgroundBrush;
|
virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
|
||||||
wxColour m_textForegroundColour;
|
virtual void DoSetClippingRegion(long x, long y,
|
||||||
wxColour m_textBackgroundColour;
|
long width, long height);
|
||||||
wxFont m_font;
|
virtual void DoGetClippingRegion(long *x, long *y,
|
||||||
wxPalette m_palette;
|
long *width, long *height)
|
||||||
int m_clipX1;
|
{
|
||||||
int m_clipY1;
|
GetClippingBox(x, y, width, height);
|
||||||
int m_clipX2;
|
}
|
||||||
int m_clipY2;
|
|
||||||
// bool m_dontDelete;
|
|
||||||
int m_windowExtX;
|
|
||||||
int m_windowExtY;
|
|
||||||
double m_systemScaleX;
|
|
||||||
double m_systemScaleY;
|
|
||||||
|
|
||||||
wxWindow * m_canvas;
|
virtual void DoGetSize(int *width, int *height) const;
|
||||||
wxBitmap m_selectedBitmap;
|
virtual void DoGetSizeMM(int* width, int* height) const;
|
||||||
|
|
||||||
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
|
virtual void DoDrawLines(int n, wxPoint points[],
|
||||||
bool m_bOwnsDC;
|
long xoffset, long yoffset);
|
||||||
|
virtual void DoDrawPolygon(int n, wxPoint points[],
|
||||||
|
long xoffset, long yoffset,
|
||||||
|
int fillStyle = wxODDEVEN_RULE);
|
||||||
|
|
||||||
WXHDC m_hDC;
|
#if wxUSE_SPLINES
|
||||||
int m_hDCCount;
|
virtual void DoDrawSpline(wxList *points);
|
||||||
|
#endif // wxUSE_SPLINES
|
||||||
|
|
||||||
// Store all old GDI objects when do a SelectObject,
|
// MSW-specific member variables
|
||||||
// so we can select them back in (this unselecting user's
|
int m_windowExtX;
|
||||||
// objects) so we can safely delete the DC.
|
int m_windowExtY;
|
||||||
WXHBITMAP m_oldBitmap;
|
|
||||||
WXHPEN m_oldPen;
|
|
||||||
WXHBRUSH m_oldBrush;
|
|
||||||
WXHFONT m_oldFont;
|
|
||||||
WXHPALETTE m_oldPalette;
|
|
||||||
|
|
||||||
// Stores scaling, translation, rotation
|
// the window associated with this DC (may be NULL)
|
||||||
// wxTransformMatrix m_transformMatrix;
|
wxWindow *m_canvas;
|
||||||
|
|
||||||
// Do we wish to scale GDI objects too, e.g. pen width?
|
wxBitmap m_selectedBitmap;
|
||||||
// bool m_scaleGDI;
|
|
||||||
|
// TRUE => DeleteDC() in dtor, FALSE => only ReleaseDC() it
|
||||||
|
bool m_bOwnsDC:1;
|
||||||
|
|
||||||
|
// our HDC and its usage count: we only free it when the usage count drops
|
||||||
|
// to 0
|
||||||
|
WXHDC m_hDC;
|
||||||
|
int m_hDCCount;
|
||||||
|
|
||||||
|
// Store all old GDI objects when do a SelectObject, so we can select them
|
||||||
|
// back in (this unselecting user's objects) so we can safely delete the
|
||||||
|
// DC.
|
||||||
|
WXHBITMAP m_oldBitmap;
|
||||||
|
WXHPEN m_oldPen;
|
||||||
|
WXHBRUSH m_oldBrush;
|
||||||
|
WXHFONT m_oldFont;
|
||||||
|
WXHPALETTE m_oldPalette;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Logical to device
|
// Logical to device
|
||||||
// Absolute
|
// Absolute
|
||||||
#define XLOG2DEV(x) ImplLogicalToDeviceX(x)
|
#define XLOG2DEV(x) (x)
|
||||||
|
#define YLOG2DEV(y) (y)
|
||||||
#define YLOG2DEV(y) ImplLogicalToDeviceY(y)
|
|
||||||
|
|
||||||
// Relative
|
// Relative
|
||||||
#define XLOG2DEVREL(x) ImplLogicalToDeviceXRel(x)
|
#define XLOG2DEVREL(x) (x)
|
||||||
#define YLOG2DEVREL(y) ImplLogicalToDeviceYRel(y)
|
#define YLOG2DEVREL(y) (y)
|
||||||
|
|
||||||
// Device to logical
|
// Device to logical
|
||||||
// Absolute
|
// Absolute
|
||||||
#define XDEV2LOG(x) ImplDeviceToLogicalX(x)
|
#define XDEV2LOG(x) (x)
|
||||||
|
|
||||||
#define YDEV2LOG(y) ImplDeviceToLogicalY(y)
|
#define YDEV2LOG(y) (y)
|
||||||
|
|
||||||
// Relative
|
// Relative
|
||||||
#define XDEV2LOGREL(x) ImplDeviceToLogicalXRel(x)
|
#define XDEV2LOGREL(x) (x)
|
||||||
#define YDEV2LOGREL(y) ImplDeviceToLogicalYRel(y)
|
#define YDEV2LOGREL(y) (y)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Have the same macros as for XView but not for every operation:
|
* Have the same macros as for XView but not for every operation:
|
||||||
@@ -426,8 +214,6 @@ protected:
|
|||||||
#define MM_POINTS 9
|
#define MM_POINTS 9
|
||||||
#define MM_METRIC 10
|
#define MM_METRIC 10
|
||||||
|
|
||||||
extern int wxPageNumber;
|
|
||||||
|
|
||||||
// Conversion
|
// Conversion
|
||||||
#define METRIC_CONVERSION_CONSTANT 0.0393700787
|
#define METRIC_CONVERSION_CONSTANT 0.0393700787
|
||||||
|
|
||||||
@@ -443,6 +229,5 @@ extern int wxPageNumber;
|
|||||||
|
|
||||||
#define wx_round(a) (int)((a)+.5)
|
#define wx_round(a) (int)((a)+.5)
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_DC_H_
|
// _WX_DC_H_
|
||||||
|
@@ -107,8 +107,9 @@ public:
|
|||||||
// Responds to colour changes
|
// Responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// implementation
|
||||||
virtual bool MSWOnClose();
|
// --------------
|
||||||
|
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ protected:
|
|||||||
bool m_modalShowing;
|
bool m_modalShowing;
|
||||||
WXHWND m_hwndOldFocus; // the window which had focus before we were shown
|
WXHWND m_hwndOldFocus; // the window which had focus before we were shown
|
||||||
|
|
||||||
|
private:
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
WXHWND m_hwndToolTip;
|
WXHWND m_hwndToolTip;
|
||||||
#endif // tooltips
|
#endif // tooltips
|
||||||
|
@@ -157,30 +157,40 @@ public:
|
|||||||
// event handlers
|
// event handlers
|
||||||
bool MSWOnPaint();
|
bool MSWOnPaint();
|
||||||
WXHICON MSWOnQueryDragIcon();
|
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 MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||||
bool MSWOnClose();
|
bool MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
||||||
void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
|
||||||
bool MSWProcessMessage(WXMSG *msg);
|
bool MSWProcessMessage(WXMSG *msg);
|
||||||
bool MSWTranslateMessage(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,
|
wxWindow *wx_win, const char *title,
|
||||||
int x, int y, int width, int height, long style);
|
int x, int y, int width, int height, long style);
|
||||||
|
|
||||||
|
bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
|
||||||
|
|
||||||
// tooltip management
|
// tooltip management
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
|
||||||
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
|
||||||
#endif // tooltips
|
#endif // tooltips
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DoGetClientSize(int *width, int *height) const;
|
// override base class virtuals
|
||||||
void DoGetSize(int *width, int *height) const ;
|
virtual void DoGetClientSize(int *width, int *height) const;
|
||||||
void DoGetPosition(int *x, int *y) 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
|
// propagate our state change to all child frames
|
||||||
void IconizeChildFrames(bool bIconize);
|
void IconizeChildFrames(bool bIconize);
|
||||||
|
|
||||||
|
// window proc for the frames
|
||||||
|
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
wxMenuBar * m_frameMenuBar;
|
wxMenuBar * m_frameMenuBar;
|
||||||
wxStatusBar * m_frameStatusBar;
|
wxStatusBar * m_frameStatusBar;
|
||||||
wxIcon m_icon;
|
wxIcon m_icon;
|
||||||
@@ -190,16 +200,11 @@ protected:
|
|||||||
|
|
||||||
static bool m_useNativeStatusBar;
|
static bool m_useNativeStatusBar;
|
||||||
|
|
||||||
|
private:
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
WXHWND m_hwndToolTip;
|
WXHWND m_hwndToolTip;
|
||||||
#endif // tooltips
|
#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()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -419,7 +419,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
|
|||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
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.
|
// Recreate window - seems to be necessary when changing a style.
|
||||||
void RecreateWindow();
|
void RecreateWindow();
|
||||||
|
@@ -6,14 +6,14 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MDI_H_
|
#ifndef _WX_MDI_H_
|
||||||
#define _WX_MDI_H_
|
#define _WX_MDI_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "mdi.h"
|
#pragma interface "mdi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
@@ -24,185 +24,188 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
|
|||||||
class WXDLLEXPORT wxMDIClientWindow;
|
class WXDLLEXPORT wxMDIClientWindow;
|
||||||
class WXDLLEXPORT wxMDIChildFrame;
|
class WXDLLEXPORT wxMDIChildFrame;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMDIParentFrame: public wxFrame
|
// ---------------------------------------------------------------------------
|
||||||
|
// wxMDIParentFrame
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxMDIParentFrame : public wxFrame
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
|
||||||
|
|
||||||
friend class WXDLLEXPORT wxMDIChildFrame;
|
public:
|
||||||
public:
|
wxMDIParentFrame();
|
||||||
|
wxMDIParentFrame(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
|
const wxString& name = wxFrameNameStr)
|
||||||
|
{
|
||||||
|
Create(parent, id, title, pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
wxMDIParentFrame(void);
|
~wxMDIParentFrame();
|
||||||
inline wxMDIParentFrame(wxWindow *parent,
|
|
||||||
wxWindowID id,
|
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
|
||||||
const wxString& name = wxFrameNameStr)
|
|
||||||
{
|
|
||||||
Create(parent, id, title, pos, size, style, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
~wxMDIParentFrame(void);
|
bool Create(wxWindow *parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& title,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
||||||
|
const wxString& name = wxFrameNameStr);
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
// accessors
|
||||||
wxWindowID id,
|
// ---------
|
||||||
const wxString& title,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
|
|
||||||
const wxString& name = wxFrameNameStr);
|
|
||||||
|
|
||||||
/*
|
void SetMenuBar(wxMenuBar *menu_bar);
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
virtual void OldOnActivate(bool flag);
|
|
||||||
virtual void OldOnSize(int x, int y);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
void OnSize(wxSizeEvent& event);
|
// Get the active MDI child window (Windows only)
|
||||||
void OnActivate(wxActivateEvent& event);
|
wxMDIChildFrame *GetActiveChild() const ;
|
||||||
|
|
||||||
void SetMenuBar(wxMenuBar *menu_bar);
|
// Get the client window
|
||||||
|
wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
|
||||||
|
|
||||||
// Get the active MDI child window (Windows only)
|
// Create the client window class (don't Create the window,
|
||||||
wxMDIChildFrame *GetActiveChild(void) const ;
|
// just return a new class)
|
||||||
|
virtual wxMDIClientWindow *OnCreateClient(void) ;
|
||||||
|
|
||||||
// Get the client window
|
WXHMENU GetWindowMenu() const { return m_windowMenu; }
|
||||||
inline wxMDIClientWindow *GetClientWindow(void) const ;
|
|
||||||
|
|
||||||
// Create the client window class (don't Create the window,
|
// MDI operations
|
||||||
// just return a new class)
|
// --------------
|
||||||
virtual wxMDIClientWindow *OnCreateClient(void) ;
|
virtual void Cascade();
|
||||||
|
virtual void Tile();
|
||||||
|
virtual void ArrangeIcons();
|
||||||
|
virtual void ActivateNext();
|
||||||
|
virtual void ActivatePrevious();
|
||||||
|
|
||||||
inline WXHMENU GetWindowMenu(void) const ;
|
// handlers
|
||||||
|
// --------
|
||||||
|
|
||||||
// MDI operations
|
// Responds to colour changes
|
||||||
virtual void Cascade(void);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
virtual void Tile(void);
|
|
||||||
virtual void ArrangeIcons(void);
|
|
||||||
virtual void ActivateNext(void);
|
|
||||||
virtual void ActivatePrevious(void);
|
|
||||||
|
|
||||||
// Handlers
|
void OnSize(wxSizeEvent& event);
|
||||||
void MSWOnSize(int x, int y, WXUINT flag);
|
void OnActivate(wxActivateEvent& event);
|
||||||
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);
|
|
||||||
|
|
||||||
// Responds to colour changes
|
virtual bool MSWOnActivate(int state, bool minimized, WXHWND activate);
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
virtual bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||||
|
|
||||||
protected:
|
// override window proc for MDI-specific message processing
|
||||||
// Gets the size available for subwindows after menu size, toolbar size
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
// 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;
|
|
||||||
|
|
||||||
|
virtual long MSWDefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
|
||||||
|
virtual bool MSWProcessMessage(WXMSG* msg);
|
||||||
|
virtual bool MSWTranslateMessage(WXMSG* msg);
|
||||||
|
|
||||||
|
protected:
|
||||||
wxMDIClientWindow * m_clientWindow;
|
wxMDIClientWindow * m_clientWindow;
|
||||||
wxMDIChildFrame * m_currentChild;
|
wxMDIChildFrame * m_currentChild;
|
||||||
WXHMENU m_windowMenu;
|
WXHMENU m_windowMenu;
|
||||||
bool m_parentFrameActive; // TRUE if MDI Frame is intercepting
|
|
||||||
// commands, not child
|
// TRUE if MDI Frame is intercepting commands, not child
|
||||||
DECLARE_EVENT_TABLE()
|
bool m_parentFrameActive;
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class WXDLLEXPORT wxMDIChildFrame;
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
// Inlines
|
// ---------------------------------------------------------------------------
|
||||||
inline wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const { return m_clientWindow; }
|
// wxMDIChildFrame
|
||||||
inline WXHMENU wxMDIParentFrame::GetWindowMenu(void) const { return m_windowMenu; }
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxMDIChildFrame: public wxFrame
|
class WXDLLEXPORT wxMDIChildFrame : public wxFrame
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
|
||||||
public:
|
|
||||||
|
|
||||||
wxMDIChildFrame(void);
|
public:
|
||||||
inline wxMDIChildFrame(wxMDIParentFrame *parent,
|
wxMDIChildFrame();
|
||||||
wxWindowID id,
|
wxMDIChildFrame(wxMDIParentFrame *parent,
|
||||||
const wxString& title,
|
wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxString& title,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
const wxSize& size = wxDefaultSize,
|
||||||
const wxString& name = wxFrameNameStr)
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
{
|
const wxString& name = wxFrameNameStr)
|
||||||
Create(parent, id, title, pos, size, style, name);
|
{
|
||||||
}
|
Create(parent, id, title, pos, size, style, name);
|
||||||
|
}
|
||||||
|
|
||||||
~wxMDIChildFrame(void);
|
~wxMDIChildFrame();
|
||||||
|
|
||||||
bool Create(wxMDIParentFrame *parent,
|
bool Create(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxDEFAULT_FRAME_STYLE,
|
long style = wxDEFAULT_FRAME_STYLE,
|
||||||
const wxString& name = wxFrameNameStr);
|
const wxString& name = wxFrameNameStr);
|
||||||
|
|
||||||
// Set menu bar
|
// Set menu bar
|
||||||
void SetMenuBar(wxMenuBar *menu_bar);
|
void SetMenuBar(wxMenuBar *menu_bar);
|
||||||
|
|
||||||
// MDI operations
|
// MDI operations
|
||||||
virtual void Maximize(void);
|
virtual void Maximize();
|
||||||
virtual void Restore(void);
|
virtual void Restore();
|
||||||
virtual void Activate(void);
|
virtual void Activate();
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
|
|
||||||
long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
|
bool MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
|
||||||
void MSWOnSize(int x, int y, WXUINT);
|
bool MSWOnSize(int x, int y, WXUINT);
|
||||||
void MSWOnWindowPosChanging(void *lpPos);
|
bool MSWOnWindowPosChanging(void *lpPos);
|
||||||
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
bool MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control);
|
||||||
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
long MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
bool MSWProcessMessage(WXMSG *msg);
|
bool MSWProcessMessage(WXMSG *msg);
|
||||||
bool MSWTranslateMessage(WXMSG *msg);
|
bool MSWTranslateMessage(WXMSG *msg);
|
||||||
void MSWDestroyWindow(void);
|
void MSWDestroyWindow();
|
||||||
|
|
||||||
// Implementation
|
// Implementation
|
||||||
bool ResetWindowStyle(void *vrect);
|
bool ResetWindowStyle(void *vrect);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DoGetPosition(int *x, int *y) const ;
|
virtual void DoGetPosition(int *x, int *y) const ;
|
||||||
void DoSetClientSize(int width, int height);
|
virtual void DoSetClientSize(int width, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxMDIClientWindow: public wxWindow
|
// ---------------------------------------------------------------------------
|
||||||
|
// wxMDIClientWindow
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxMDIClientWindow : public wxWindow
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
|
||||||
public:
|
|
||||||
|
|
||||||
wxMDIClientWindow(void) ;
|
public:
|
||||||
inline wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
wxMDIClientWindow();
|
||||||
{
|
wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
|
||||||
CreateClient(parent, style);
|
{
|
||||||
}
|
CreateClient(parent, style);
|
||||||
|
}
|
||||||
|
|
||||||
~wxMDIClientWindow(void);
|
~wxMDIClientWindow();
|
||||||
|
|
||||||
// Note: this is virtual, to allow overridden behaviour.
|
// 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
|
// Explicitly call default scroll behaviour
|
||||||
void OnScroll(wxScrollEvent& event);
|
void OnScroll(wxScrollEvent& event);
|
||||||
|
|
||||||
// Window procedure
|
// Window procedure
|
||||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
// Calls an appropriate default window procedure
|
// Calls an appropriate default window procedure
|
||||||
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
// Should hand the message to the default proc
|
|
||||||
long MSWOnMDIActivate(long bActivate, WXHWND, WXHWND);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_scrollX;
|
int m_scrollX, m_scrollY;
|
||||||
int m_scrollY;
|
|
||||||
DECLARE_EVENT_TABLE()
|
private:
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -181,7 +181,7 @@ public:
|
|||||||
// base class virtuals
|
// base class virtuals
|
||||||
// -------------------
|
// -------------------
|
||||||
virtual void Command(wxCommandEvent& event);
|
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 void SetConstraintSizes(bool recurse = TRUE);
|
||||||
virtual bool DoPhase(int nPhase);
|
virtual bool DoPhase(int nPhase);
|
||||||
|
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: private.h
|
// 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
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -12,18 +14,13 @@
|
|||||||
#ifndef _WX_PRIVATE_H_
|
#ifndef _WX_PRIVATE_H_
|
||||||
#define _WX_PRIVATE_H_
|
#define _WX_PRIVATE_H_
|
||||||
|
|
||||||
#include "wx/defs.h"
|
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#define VIEWPORT_EXTENT 1000
|
class WXDLLEXPORT wxFont;
|
||||||
|
|
||||||
class WXDLLEXPORT wxFont ;
|
// ---------------------------------------------------------------------------
|
||||||
|
// standard icons from the resources
|
||||||
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);
|
|
||||||
|
|
||||||
WXDLLEXPORT_DATA(extern HICON) wxSTD_FRAME_ICON;
|
WXDLLEXPORT_DATA(extern HICON) wxSTD_FRAME_ICON;
|
||||||
WXDLLEXPORT_DATA(extern HICON) wxSTD_MDIPARENTFRAME_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 HICON) wxDEFAULT_MDICHILDFRAME_ICON;
|
||||||
WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
|
WXDLLEXPORT_DATA(extern HFONT) wxSTATUS_LINE_FONT;
|
||||||
|
|
||||||
WXDLLEXPORT HINSTANCE wxGetInstance();
|
// ---------------------------------------------------------------------------
|
||||||
WXDLLEXPORT void wxSetInstance(HINSTANCE hInst);
|
// this defines a CASTWNDPROC macro which casts a pointer to the type of a
|
||||||
WXDLLEXPORT void wxFillLogFont(LOGFONT *logFont, wxFont *font);
|
// window proc
|
||||||
WXDLLEXPORT wxFont wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNew = TRUE);
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUWIN32__
|
#ifdef __GNUWIN32__
|
||||||
# define CASTWNDPROC (long unsigned)
|
# define CASTWNDPROC (long unsigned)
|
||||||
#else
|
#else
|
||||||
@@ -68,19 +64,26 @@ WXDLLEXPORT wxFont wxCreateFontFromLogFont(LOGFONT *logFont); // , bool createNe
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// some stuff for old Windows versions (FIXME: what does it do here??)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
|
#if !defined(APIENTRY) // NT defines APIENTRY, 3.x not
|
||||||
#define APIENTRY FAR PASCAL
|
#define APIENTRY FAR PASCAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
#define _EXPORT /**/
|
#define _EXPORT
|
||||||
#else
|
#else
|
||||||
#define _EXPORT _export
|
#define _EXPORT _export
|
||||||
typedef signed short int SHORT ;
|
#endif
|
||||||
|
|
||||||
|
#ifndef __WIN32__
|
||||||
|
typedef signed short int SHORT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
|
#if !defined(__WIN32__) // 3.x uses FARPROC for dialogs
|
||||||
#define DLGPROC FARPROC
|
#define DLGPROC FARPROC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_PENWIN
|
#if wxUSE_PENWIN
|
||||||
@@ -90,31 +93,18 @@ typedef signed short int SHORT ;
|
|||||||
#endif // wxUSE_PENWIN
|
#endif // wxUSE_PENWIN
|
||||||
|
|
||||||
#if wxUSE_ITSY_BITSY
|
#if wxUSE_ITSY_BITSY
|
||||||
#define IBS_HORZCAPTION 0x4000L
|
#define IBS_HORZCAPTION 0x4000L
|
||||||
#define IBS_VERTCAPTION 0x8000L
|
#define IBS_VERTCAPTION 0x8000L
|
||||||
|
|
||||||
UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
|
UINT WINAPI ibGetCaptionSize( HWND hWnd ) ;
|
||||||
UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
|
UINT WINAPI ibSetCaptionSize( HWND hWnd, UINT nSize ) ;
|
||||||
LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
|
LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lParam ) ;
|
||||||
VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
||||||
#endif
|
#endif // wxUSE_ITSY_BITSY
|
||||||
|
|
||||||
/* 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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if wxUSE_CTL3D
|
#if wxUSE_CTL3D
|
||||||
#include <wx/msw/ctl3d/ctl3d.h>
|
#include "wx/msw/ctl3d/ctl3d.h"
|
||||||
#endif
|
#endif // wxUSE_CTL3D
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decide what window classes we're going to use
|
* 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)
|
#define BITRADIO_FLAGS (FC_BUTTONDRAW|FB_BITMAP|FC_RADIO|WS_CHILD|WS_VISIBLE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// misc macros
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
#define MEANING_CHARACTER '0'
|
#define MEANING_CHARACTER '0'
|
||||||
#define DEFAULT_ITEM_WIDTH 200
|
#define DEFAULT_ITEM_WIDTH 200
|
||||||
#define DEFAULT_ITEM_HEIGHT 80
|
#define DEFAULT_ITEM_HEIGHT 80
|
||||||
@@ -151,16 +145,78 @@ VOID WINAPI ibAdjustWindowRect( HWND hWnd, LPRECT lprc ) ;
|
|||||||
extern LONG APIENTRY _EXPORT
|
extern LONG APIENTRY _EXPORT
|
||||||
wxSubclassedGenericControlProc(WXHWND hWnd, WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
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
|
// The MakeProcInstance version of the function wxSubclassedGenericControlProc
|
||||||
WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc;
|
WXDLLEXPORT_DATA(extern FARPROC) wxGenericControlSubClassProc;
|
||||||
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
|
WXDLLEXPORT_DATA(extern wxChar*) wxBuffer;
|
||||||
WXDLLEXPORT_DATA(extern HINSTANCE) wxhInstance;
|
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 wxWindow* wxFindControlFromHandle(WXHWND hWnd);
|
||||||
WXDLLEXPORT void wxAddControlHandle(WXHWND hWnd, wxWindow *item);
|
WXDLLEXPORT void wxAddControlHandle(WXHWND hWnd, wxWindow *item);
|
||||||
|
|
||||||
@@ -180,29 +236,5 @@ inline bool wxStyleHasBorder(long style)
|
|||||||
wxSUNKEN_BORDER | wxDOUBLE_BORDER)) != 0;
|
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
|
#endif
|
||||||
// _WX_PRIVATE_H_
|
// _WX_PRIVATE_H_
|
||||||
|
@@ -23,68 +23,68 @@ WXDLLEXPORT_DATA(extern const char*) wxScrollBarNameStr;
|
|||||||
// Scrollbar item
|
// Scrollbar item
|
||||||
class WXDLLEXPORT wxScrollBar: public wxControl
|
class WXDLLEXPORT wxScrollBar: public wxControl
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
DECLARE_DYNAMIC_CLASS(wxScrollBar)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline wxScrollBar(void) { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
|
wxScrollBar() { m_pageSize = 0; m_viewSize = 0; m_objectSize = 0; }
|
||||||
~wxScrollBar(void);
|
~wxScrollBar();
|
||||||
|
|
||||||
inline wxScrollBar(wxWindow *parent, wxWindowID id,
|
wxScrollBar(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxSB_HORIZONTAL,
|
long style = wxSB_HORIZONTAL,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxScrollBarNameStr)
|
const wxString& name = wxScrollBarNameStr)
|
||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, validator, name);
|
Create(parent, id, pos, size, style, validator, name);
|
||||||
}
|
}
|
||||||
bool Create(wxWindow *parent, wxWindowID id,
|
bool Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxSB_HORIZONTAL,
|
long style = wxSB_HORIZONTAL,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxScrollBarNameStr);
|
const wxString& name = wxScrollBarNameStr);
|
||||||
|
|
||||||
int GetThumbPosition(void) const ;
|
int GetThumbPosition() const ;
|
||||||
inline int GetThumbSize() const { return m_pageSize; }
|
int GetThumbSize() const { return m_pageSize; }
|
||||||
inline int GetPageSize() const { return m_viewSize; }
|
int GetPageSize() const { return m_viewSize; }
|
||||||
inline int GetRange() const { return m_objectSize; }
|
int GetRange() const { return m_objectSize; }
|
||||||
|
|
||||||
virtual void SetThumbPosition(int viewStart);
|
virtual void SetThumbPosition(int viewStart);
|
||||||
virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
virtual void SetScrollbar(int position, int thumbSize, int range, int pageSize,
|
||||||
bool refresh = TRUE);
|
bool refresh = TRUE);
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
// Backward compatibility
|
// Backward compatibility
|
||||||
inline int GetValue(void) const { return GetThumbPosition(); }
|
int GetValue() const { return GetThumbPosition(); }
|
||||||
inline void SetValue(int viewStart) { SetThumbPosition(viewStart); }
|
void SetValue(int viewStart) { SetThumbPosition(viewStart); }
|
||||||
void GetValues(int *viewStart, int *viewLength, int *objectLength,
|
void GetValues(int *viewStart, int *viewLength, int *objectLength,
|
||||||
int *pageLength) const ;
|
int *pageLength) const ;
|
||||||
inline int GetViewLength() const { return m_viewSize; }
|
int GetViewLength() const { return m_viewSize; }
|
||||||
inline int GetObjectLength() const { return m_objectSize; }
|
int GetObjectLength() const { return m_objectSize; }
|
||||||
|
|
||||||
void SetPageSize(int pageLength);
|
void SetPageSize(int pageLength);
|
||||||
void SetObjectLength(int objectLength);
|
void SetObjectLength(int objectLength);
|
||||||
void SetViewLength(int viewLength);
|
void SetViewLength(int viewLength);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
WXWORD pos, WXHWND control);
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
// Backward compatibility: generate an old-style scroll command
|
// Backward compatibility: generate an old-style scroll command
|
||||||
void OnScroll(wxScrollEvent& event);
|
void OnScroll(wxScrollEvent& event);
|
||||||
#endif
|
#endif // WXWIN_COMPATIBILITY
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_pageSize;
|
int m_pageSize;
|
||||||
int m_viewSize;
|
int m_viewSize;
|
||||||
int m_objectSize;
|
int m_objectSize;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -87,8 +87,8 @@ public:
|
|||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
WXWORD pos, WXHWND control);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WXHWND m_staticMin;
|
WXHWND m_staticMin;
|
||||||
|
@@ -87,8 +87,8 @@ public:
|
|||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
||||||
void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||||
void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
WXWORD pos, WXHWND control);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WXHWND m_staticMin;
|
WXHWND m_staticMin;
|
||||||
|
@@ -40,7 +40,7 @@ public:
|
|||||||
* Public interface
|
* Public interface
|
||||||
*/
|
*/
|
||||||
wxSpinButton();
|
wxSpinButton();
|
||||||
|
|
||||||
wxSpinButton(wxWindow *parent,
|
wxSpinButton(wxWindow *parent,
|
||||||
wxWindowID id = -1,
|
wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
@@ -50,37 +50,36 @@ public:
|
|||||||
{
|
{
|
||||||
Create(parent, id, pos, size, style, name);
|
Create(parent, id, pos, size, style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~wxSpinButton();
|
virtual ~wxSpinButton();
|
||||||
|
|
||||||
bool Create(wxWindow *parent,
|
bool Create(wxWindow *parent,
|
||||||
wxWindowID id = -1,
|
wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
|
||||||
const wxString& name = "wxSpinButton");
|
const wxString& name = "wxSpinButton");
|
||||||
|
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int GetValue() const ;
|
int GetValue() const ;
|
||||||
void SetValue(int val) ;
|
void SetValue(int val) ;
|
||||||
void SetRange(int minVal, int maxVal);
|
void SetRange(int minVal, int maxVal);
|
||||||
int GetMin() const { return m_min; }
|
int GetMin() const { return m_min; }
|
||||||
int GetMax() const { return m_max; }
|
int GetMax() const { return m_max; }
|
||||||
|
|
||||||
// Operations
|
// Operations
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
virtual bool MSWOnScroll(int orientation, WXWORD wParam,
|
||||||
virtual void MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
WXWORD pos, WXHWND control);
|
||||||
virtual void MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_min;
|
int m_min;
|
||||||
int m_max;
|
int m_max;
|
||||||
@@ -89,7 +88,7 @@ protected:
|
|||||||
class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
|
class WXDLLEXPORT wxSpinEvent: public wxScrollEvent
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxSpinEvent)
|
DECLARE_DYNAMIC_CLASS(wxSpinEvent)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
|
||||||
};
|
};
|
||||||
|
@@ -124,7 +124,7 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
|
|||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
|
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
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
|
// Responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
@@ -83,7 +83,7 @@ class WXDLLEXPORT wxToolBar95: public wxToolBarBase
|
|||||||
|
|
||||||
// IMPLEMENTATION
|
// IMPLEMENTATION
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
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
|
// Responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
@@ -449,7 +449,7 @@ public:
|
|||||||
// --------------
|
// --------------
|
||||||
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
void Command(wxCommandEvent& event) { ProcessCommand(event); };
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
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:
|
protected:
|
||||||
// SetImageList helper
|
// SetImageList helper
|
||||||
|
@@ -29,6 +29,13 @@
|
|||||||
#undef FindWindow
|
#undef FindWindow
|
||||||
#endif
|
#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
|
// forward declarations
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
@@ -176,10 +183,6 @@ public:
|
|||||||
// event handlers
|
// event handlers
|
||||||
// --------------
|
// --------------
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
void OnKeyDown(wxKeyEvent& event);
|
|
||||||
void OnKeyUp(wxKeyEvent& event);
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
|
||||||
void OnChar(wxKeyEvent& event);
|
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
|
|
||||||
// a window may have a default button
|
// a window may have a default button
|
||||||
@@ -199,11 +202,10 @@ public:
|
|||||||
// Windows subclassing
|
// Windows subclassing
|
||||||
void SubclassWin(WXHWND hWnd);
|
void SubclassWin(WXHWND hWnd);
|
||||||
void UnsubclassWin();
|
void UnsubclassWin();
|
||||||
virtual long Default();
|
|
||||||
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
virtual bool MSWCommand(WXUINT param, WXWORD id);
|
||||||
|
|
||||||
// returns TRUE if the event was processed
|
WXFARPROC MSWGetOldWndProc() const { return m_oldWndProc; }
|
||||||
virtual bool MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result);
|
void MSWSetOldWndProc(WXFARPROC proc) { m_oldWndProc = proc; }
|
||||||
|
|
||||||
virtual wxWindow *FindItem(int id) const;
|
virtual wxWindow *FindItem(int id) const;
|
||||||
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
|
virtual wxWindow *FindItemByHWND(WXHWND hWnd, bool controlOnly = FALSE) const ;
|
||||||
@@ -219,10 +221,16 @@ public:
|
|||||||
|
|
||||||
wxObject *GetChild(int number) const ;
|
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
|
||||||
int x, int y, int width, int height,
|
bool MSWCreate(int id,
|
||||||
WXDWORD style, const char *dialog_template = NULL,
|
wxWindow *parent,
|
||||||
WXDWORD exendedStyle = 0);
|
const char *wclass,
|
||||||
|
wxWindow *wx_win,
|
||||||
|
const char *title,
|
||||||
|
int x, int y, int width, int height,
|
||||||
|
WXDWORD style,
|
||||||
|
const char *dialog_template = NULL,
|
||||||
|
WXDWORD exendedStyle = 0);
|
||||||
|
|
||||||
// Actually defined in wx_canvs.cc since requires wxCanvas declaration
|
// Actually defined in wx_canvs.cc since requires wxCanvas declaration
|
||||||
virtual void MSWDeviceToLogical(float *x, float *y) const ;
|
virtual void MSWDeviceToLogical(float *x, float *y) const ;
|
||||||
@@ -236,75 +244,66 @@ public:
|
|||||||
// Setup background and foreground colours correctly
|
// Setup background and foreground colours correctly
|
||||||
virtual void SetupColours();
|
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
|
// TODO: all this should go away, overriding MSWWindowProc() is enough to
|
||||||
virtual void MSWOnCreate(WXLPCREATESTRUCT cs);
|
// implement this functionality
|
||||||
|
virtual bool MSWOnCreate(WXLPCREATESTRUCT cs, bool *mayCreate);
|
||||||
virtual bool MSWOnPaint();
|
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 bool MSWOnEraseBkgnd(WXHDC pDC);
|
||||||
virtual void MSWOnMenuHighlight(WXWORD item, WXWORD flags, WXHMENU sysmenu);
|
virtual bool MSWOnSize(int x, int y, WXUINT flag);
|
||||||
virtual void MSWOnInitMenuPopup(WXHMENU menu, int pos, bool isSystem);
|
|
||||||
virtual bool MSWOnClose();
|
virtual bool MSWOnQueryDragIcon(WXHICON *hIcon);
|
||||||
// Return TRUE to end session, FALSE to veto end session.
|
virtual bool MSWOnWindowPosChanging(void *lpPos);
|
||||||
virtual bool MSWOnQueryEndSession(long logOff);
|
|
||||||
|
// 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 MSWOnEndSession(bool endSession, long logOff);
|
||||||
|
|
||||||
virtual bool MSWOnDestroy();
|
virtual bool MSWOnDestroy();
|
||||||
virtual bool MSWOnSetFocus(WXHWND wnd);
|
virtual bool MSWOnSetFocus(WXHWND wnd);
|
||||||
virtual bool MSWOnKillFocus(WXHWND wnd);
|
virtual bool MSWOnKillFocus(WXHWND wnd);
|
||||||
virtual void MSWOnDropFiles(WXWPARAM wParam);
|
virtual bool MSWOnDropFiles(WXWPARAM wParam);
|
||||||
virtual bool MSWOnInitDialog(WXHWND hWndFocus);
|
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
|
virtual bool MSWOnMouseEvent(WXUINT msg, int x, int y, WXUINT flags);
|
||||||
// event type as argument.
|
virtual bool MSWOnMouseMove(int x, int y, WXUINT flags);
|
||||||
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 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 MSWOnChar(WXWORD wParam, WXLPARAM lParam, bool isASCII = FALSE);
|
||||||
virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam);
|
virtual bool MSWOnKeyDown(WXWORD wParam, WXLPARAM lParam);
|
||||||
virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam);
|
virtual bool MSWOnKeyUp(WXWORD wParam, WXLPARAM lParam);
|
||||||
|
|
||||||
virtual bool MSWOnActivate(int flag, bool minimized, WXHWND activate);
|
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 MSWOnDrawItem(int id, WXDRAWITEMSTRUCT *item);
|
||||||
virtual bool MSWOnMeasureItem(int id, WXMEASUREITEMSTRUCT *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
|
// Window procedure
|
||||||
virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
|
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
|
// Detach "Window" menu from menu bar so it doesn't get deleted
|
||||||
void MSWDetachWindowMenu();
|
void MSWDetachWindowMenu();
|
||||||
|
|
||||||
inline WXFARPROC MSWGetOldWndProc() const;
|
// this function should return the brush to paint the window background
|
||||||
inline void MSWSetOldWndProc(WXFARPROC proc);
|
// with or 0 for the default brush
|
||||||
|
virtual WXHBRUSH OnCtlColor(WXHDC hDC,
|
||||||
// Define for each class of dialog and control
|
WXHWND hWnd,
|
||||||
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
WXUINT message,
|
||||||
|
WXWPARAM wParam,
|
||||||
|
WXLPARAM lParam);
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
void SetShowing(bool show) { (void)Show(show); }
|
void SetShowing(bool show) { (void)Show(show); }
|
||||||
@@ -332,13 +333,8 @@ public:
|
|||||||
// Responds to colour changes: passes event on to children.
|
// Responds to colour changes: passes event on to children.
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
// remember the parameters of the last message
|
// initialize various fields of wxMouseEvent (common part of MSWOnMouseXXX)
|
||||||
void PushLastMessage(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
|
void InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags);
|
||||||
{
|
|
||||||
m_lastMsg = msg;
|
|
||||||
m_lastWParam = wParam;
|
|
||||||
m_lastLParam = lParam;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// the window handle
|
// the window handle
|
||||||
@@ -365,15 +361,12 @@ protected:
|
|||||||
int m_xThumbSize;
|
int m_xThumbSize;
|
||||||
int m_yThumbSize;
|
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,
|
long m_lastMouseX,
|
||||||
m_lastMouseY;
|
m_lastMouseY;
|
||||||
int m_lastMouseEvent;
|
int m_lastMouseEvent;
|
||||||
|
#endif // wxUSE_MOUSEEVENT_HACK
|
||||||
// the parameters of the last message used in Default()
|
|
||||||
WXUINT m_lastMsg;
|
|
||||||
WXWPARAM m_lastWParam;
|
|
||||||
WXLPARAM m_lastLParam;
|
|
||||||
|
|
||||||
WXHMENU m_hMenu; // Menu, if any
|
WXHMENU m_hMenu; // Menu, if any
|
||||||
|
|
||||||
@@ -396,6 +389,15 @@ private:
|
|||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
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()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -208,11 +208,6 @@ class WXDLLEXPORT wxToolBarBase : public wxControl
|
|||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnIdle(wxIdleEvent& 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:
|
protected:
|
||||||
wxList m_tools;
|
wxList m_tools;
|
||||||
// int m_tilingDirection;
|
// int m_tilingDirection;
|
||||||
|
@@ -723,10 +723,7 @@ private:
|
|||||||
// contains the last id generated by NewControlId
|
// contains the last id generated by NewControlId
|
||||||
static int ms_lastControlId;
|
static int ms_lastControlId;
|
||||||
|
|
||||||
// no copy ctor/assignment operator
|
DECLARE_NO_COPY_CLASS(wxWindowBase);
|
||||||
wxWindowBase(const wxWindowBase&);
|
|
||||||
wxWindowBase& operator=(const wxWindowBase&);
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -44,6 +44,8 @@
|
|||||||
// Windows (VC++) has broad TCHAR support
|
// Windows (VC++) has broad TCHAR support
|
||||||
#if defined(__VISUALC__) && defined(__WIN32__)
|
#if defined(__VISUALC__) && defined(__WIN32__)
|
||||||
|
|
||||||
|
#define HAVE_WCSLEN 1
|
||||||
|
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#if wxUSE_UNICODE // temporary - preserve binary compatibility
|
#if wxUSE_UNICODE // temporary - preserve binary compatibility
|
||||||
typedef _TCHAR wxChar;
|
typedef _TCHAR wxChar;
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "wx/image.h"
|
#include "wx/image.h"
|
||||||
|
|
||||||
|
#include "wx/file.h"
|
||||||
|
|
||||||
// derived classes
|
// derived classes
|
||||||
|
|
||||||
class MyFrame;
|
class MyFrame;
|
||||||
@@ -103,23 +105,33 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
dc.DrawRectangle( 0, 0, 100, 100 );
|
dc.DrawRectangle( 0, 0, 100, 100 );
|
||||||
dc.SelectObject( wxNullBitmap );
|
dc.SelectObject( wxNullBitmap );
|
||||||
|
|
||||||
wxString dir("");
|
// try to find the directory with our images
|
||||||
|
wxString dir;
|
||||||
#ifdef __WXGTK__
|
if ( wxFile::Exists("./horse.png") )
|
||||||
dir = wxString("../");
|
dir = "./";
|
||||||
#endif
|
else if ( wxFile::Exists("../horse.png") )
|
||||||
|
dir = "../";
|
||||||
|
else
|
||||||
|
wxLogWarning("Can't find image files in either '.' or '..'!");
|
||||||
|
|
||||||
wxImage image( bitmap );
|
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 ) )
|
||||||
my_horse_png = new wxBitmap( image.ConvertToBitmap() );
|
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 ) )
|
||||||
my_horse_jpeg = new wxBitmap( image.ConvertToBitmap() );
|
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 ) )
|
||||||
my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
|
wxLogError("Can't load GIF image");
|
||||||
|
else
|
||||||
|
my_horse_gif = new wxBitmap( image.ConvertToBitmap() );
|
||||||
|
|
||||||
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
image.LoadFile( dir + wxString("test.png"), wxBITMAP_TYPE_PNG );
|
||||||
my_square = new wxBitmap( image.ConvertToBitmap() );
|
my_square = new wxBitmap( image.ConvertToBitmap() );
|
||||||
|
@@ -43,29 +43,16 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_CLASS(wxColourDatabase, wxList)
|
IMPLEMENT_CLASS(wxColourDatabase, wxList)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
|
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
|
||||||
/*
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRealPoint, wxObject)
|
|
||||||
*/
|
|
||||||
#endif
|
#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)
|
wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
|
||||||
{
|
{
|
||||||
x = topLeft.x;
|
x = topLeft.x;
|
||||||
@@ -92,21 +79,7 @@ wxRect::wxRect(const wxPoint& point, const wxSize& size)
|
|||||||
width = size.x; height = size.y;
|
width = size.x; height = size.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect::wxRect(const wxRect& rect)
|
bool wxRect::operator==(const wxRect& rect) const
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
return ((x == rect.x) &&
|
return ((x == rect.x) &&
|
||||||
(y == rect.y) &&
|
(y == rect.y) &&
|
||||||
@@ -114,16 +87,7 @@ bool wxRect::operator == (const wxRect& rect)
|
|||||||
(height == rect.height));
|
(height == rect.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRect::operator != (const wxRect& rect)
|
wxColourDatabase::wxColourDatabase (int type) : wxList (type)
|
||||||
{
|
|
||||||
return ((x != rect.x) ||
|
|
||||||
(y != rect.y) ||
|
|
||||||
(width != rect.width) ||
|
|
||||||
(height != rect.height));
|
|
||||||
}
|
|
||||||
|
|
||||||
wxColourDatabase::wxColourDatabase (int type):
|
|
||||||
wxList (type)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,23 +285,29 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
|
|||||||
|
|
||||||
wxString wxColourDatabase::FindName (const wxColour& colour) const
|
wxString wxColourDatabase::FindName (const wxColour& colour) const
|
||||||
{
|
{
|
||||||
unsigned char red = colour.Red ();
|
wxString name;
|
||||||
unsigned char green = colour.Green ();
|
|
||||||
unsigned char blue = colour.Blue ();
|
|
||||||
|
|
||||||
for (wxNode * node = First (); node; node = node->Next ())
|
unsigned char red = colour.Red ();
|
||||||
{
|
unsigned char green = colour.Green ();
|
||||||
wxColour *col = (wxColour *) node->Data ();
|
unsigned char blue = colour.Blue ();
|
||||||
|
|
||||||
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
|
for (wxNode * node = First (); node; node = node->Next ())
|
||||||
|
{
|
||||||
|
wxColour *col = (wxColour *) node->Data ();
|
||||||
|
|
||||||
|
if (col->Red () == red && col->Green () == green && col->Blue () == blue)
|
||||||
{
|
{
|
||||||
const wxChar *found = node->GetKeyString();
|
const wxChar *found = node->GetKeyString();
|
||||||
if (found)
|
if ( found )
|
||||||
return wxString(found);
|
{
|
||||||
}
|
name = found;
|
||||||
}
|
|
||||||
return wxString(""); // Not Found
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxInitializeStockLists () {
|
void wxInitializeStockLists () {
|
||||||
|
@@ -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
|
#endif
|
||||||
|
@@ -178,7 +178,7 @@ wxWindowBase::~wxWindowBase()
|
|||||||
// Just in case we've loaded a top-level window via LoadNativeDialog but
|
// Just in case we've loaded a top-level window via LoadNativeDialog but
|
||||||
// we weren't a dialog class
|
// we weren't a dialog class
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
|
|
||||||
wxASSERT_MSG( GetChildren().GetCount() == 0, "children not destroyed" );
|
wxASSERT_MSG( GetChildren().GetCount() == 0, "children not destroyed" );
|
||||||
|
|
||||||
if ( m_windowValidator )
|
if ( m_windowValidator )
|
||||||
@@ -244,15 +244,21 @@ bool wxWindowBase::Close(bool force)
|
|||||||
bool wxWindowBase::DestroyChildren()
|
bool wxWindowBase::DestroyChildren()
|
||||||
{
|
{
|
||||||
wxWindowList::Node *node;
|
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();
|
wxWindow *child = node->GetData();
|
||||||
|
|
||||||
wxASSERT_MSG( child, "m_children contains empty nodes" );
|
wxASSERT_MSG( child, "children list contains empty nodes" );
|
||||||
|
|
||||||
delete child;
|
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;
|
return TRUE;
|
||||||
|
264
src/gtk/dc.cpp
264
src/gtk/dc.cpp
@@ -4,12 +4,12 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling, Markus Holzem
|
// Copyright: (c) 1998 Robert Roebling, Markus Holzem
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "dc.h"
|
#pragma implementation "dc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
@@ -21,145 +21,40 @@
|
|||||||
// constants
|
// constants
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define mm2inches 0.0393700787402
|
#define mm2inches 0.0393700787402
|
||||||
#define inches2mm 25.4
|
#define inches2mm 25.4
|
||||||
#define mm2twips 56.6929133859
|
#define mm2twips 56.6929133859
|
||||||
#define twips2mm 0.0176388888889
|
#define twips2mm 0.0176388888889
|
||||||
#define mm2pt 2.83464566929
|
#define mm2pt 2.83464566929
|
||||||
#define pt2mm 0.352777777778
|
#define pt2mm 0.352777777778
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDC
|
// wxDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
|
||||||
|
|
||||||
wxDC::wxDC()
|
wxDC::wxDC()
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
|
|
||||||
m_optimize = FALSE;
|
m_optimize = FALSE;
|
||||||
m_autoSetting = FALSE;
|
m_autoSetting = FALSE;
|
||||||
m_colour = TRUE;
|
|
||||||
m_clipping = FALSE;
|
|
||||||
|
|
||||||
m_mm_to_pix_x = 1.0;
|
m_mm_to_pix_x = 1.0;
|
||||||
m_mm_to_pix_y = 1.0;
|
m_mm_to_pix_y = 1.0;
|
||||||
|
|
||||||
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_needComputeScaleX = FALSE; /* not used yet */
|
||||||
m_needComputeScaleY = 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_logicalFunction = wxCOPY;
|
||||||
// m_textAlignment = wxALIGN_TOP_LEFT;
|
|
||||||
m_backgroundMode = wxTRANSPARENT;
|
|
||||||
|
|
||||||
m_textForegroundColour = *wxBLACK;
|
|
||||||
m_textBackgroundColour = *wxWHITE;
|
|
||||||
m_pen = *wxBLACK_PEN;
|
m_pen = *wxBLACK_PEN;
|
||||||
m_font = *wxNORMAL_FONT;
|
m_font = *wxNORMAL_FONT;
|
||||||
m_brush = *wxTRANSPARENT_BRUSH;
|
m_brush = *wxTRANSPARENT_BRUSH;
|
||||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
|
||||||
|
|
||||||
// m_palette = wxAPP_COLOURMAP; /* I'll learn to handle palettes later in my life */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC::~wxDC()
|
void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
m_clipping = TRUE;
|
m_clipping = TRUE;
|
||||||
m_clipX1 = x;
|
m_clipX1 = x;
|
||||||
@@ -173,28 +68,17 @@ void wxDC::DestroyClippingRegion()
|
|||||||
m_clipping = FALSE;
|
m_clipping = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
|
// ---------------------------------------------------------------------------
|
||||||
{
|
// get DC capabilities
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDC::GetSize( int* width, int* height ) const
|
void wxDC::DoGetSize( int* width, int* height ) const
|
||||||
{
|
{
|
||||||
if (width) *width = m_maxX-m_minX;
|
if (width) *width = m_maxX-m_minX;
|
||||||
if (height) *height = m_maxY-m_minY;
|
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 w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
@@ -204,25 +88,42 @@ void wxDC::GetSizeMM( int* width, int* height ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
// Resolution in pixels per logical inch
|
||||||
wxSize wxDC::GetPPI(void) const
|
wxSize wxDC::GetPPI() const
|
||||||
{
|
{
|
||||||
// TODO (should probably be pure virtual)
|
// TODO (should probably be pure virtual)
|
||||||
return wxSize(0, 0);
|
return wxSize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetTextForeground( const wxColour &col )
|
// ---------------------------------------------------------------------------
|
||||||
{
|
// set various DC parameters
|
||||||
m_textForegroundColour = col;
|
// ---------------------------------------------------------------------------
|
||||||
}
|
|
||||||
|
|
||||||
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 )
|
void wxDC::SetMapMode( int mode )
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case wxMM_TWIPS:
|
case wxMM_TWIPS:
|
||||||
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
||||||
@@ -258,12 +159,6 @@ void wxDC::SetUserScale( double x, double y )
|
|||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetLogicalScale( double x, double y )
|
||||||
{
|
{
|
||||||
// allow negative ?
|
// allow negative ?
|
||||||
@@ -272,12 +167,6 @@ void wxDC::SetLogicalScale( double x, double y )
|
|||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetLogicalOrigin( long x, long y )
|
||||||
{
|
{
|
||||||
m_logicalOriginX = x * m_signX; // is this still correct ?
|
m_logicalOriginX = x * m_signX; // is this still correct ?
|
||||||
@@ -285,26 +174,14 @@ void wxDC::SetLogicalOrigin( long x, long y )
|
|||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetDeviceOrigin( long x, long y )
|
||||||
{
|
{
|
||||||
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
|
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
|
||||||
m_deviceOriginX = x;
|
m_deviceOriginX = x;
|
||||||
m_deviceOriginY = y;
|
m_deviceOriginY = y;
|
||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||||
{
|
{
|
||||||
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
|
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
|
||||||
@@ -313,74 +190,47 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
|||||||
ComputeScaleAndOrigin();
|
ComputeScaleAndOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalX(long x) const
|
// ---------------------------------------------------------------------------
|
||||||
|
// coordinates transformations
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
long wxDCBase::DeviceToLogicalX(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOG(x);
|
return XDEV2LOG(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalY(long y) const
|
long wxDCBase::DeviceToLogicalY(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOG(y);
|
return YDEV2LOG(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalXRel(long x) const
|
long wxDCBase::DeviceToLogicalXRel(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOGREL(x);
|
return XDEV2LOGREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalYRel(long y) const
|
long wxDCBase::DeviceToLogicalYRel(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOGREL(y);
|
return YDEV2LOGREL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceX(long x) const
|
long wxDCBase::LogicalToDeviceX(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEV(x);
|
return XLOG2DEV(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceY(long y) const
|
long wxDCBase::LogicalToDeviceY(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEV(y);
|
return YLOG2DEV(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceXRel(long x) const
|
long wxDCBase::LogicalToDeviceXRel(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEVREL(x);
|
return XLOG2DEVREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceYRel(long y) const
|
long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEVREL(y);
|
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 );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
264
src/gtk1/dc.cpp
264
src/gtk1/dc.cpp
@@ -4,12 +4,12 @@
|
|||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1998 Robert Roebling, Markus Holzem
|
// Copyright: (c) 1998 Robert Roebling, Markus Holzem
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "dc.h"
|
#pragma implementation "dc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
@@ -21,145 +21,40 @@
|
|||||||
// constants
|
// constants
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define mm2inches 0.0393700787402
|
#define mm2inches 0.0393700787402
|
||||||
#define inches2mm 25.4
|
#define inches2mm 25.4
|
||||||
#define mm2twips 56.6929133859
|
#define mm2twips 56.6929133859
|
||||||
#define twips2mm 0.0176388888889
|
#define twips2mm 0.0176388888889
|
||||||
#define mm2pt 2.83464566929
|
#define mm2pt 2.83464566929
|
||||||
#define pt2mm 0.352777777778
|
#define pt2mm 0.352777777778
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxDC
|
// wxDC
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
|
||||||
|
|
||||||
wxDC::wxDC()
|
wxDC::wxDC()
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
|
|
||||||
m_optimize = FALSE;
|
m_optimize = FALSE;
|
||||||
m_autoSetting = FALSE;
|
m_autoSetting = FALSE;
|
||||||
m_colour = TRUE;
|
|
||||||
m_clipping = FALSE;
|
|
||||||
|
|
||||||
m_mm_to_pix_x = 1.0;
|
m_mm_to_pix_x = 1.0;
|
||||||
m_mm_to_pix_y = 1.0;
|
m_mm_to_pix_y = 1.0;
|
||||||
|
|
||||||
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_needComputeScaleX = FALSE; /* not used yet */
|
||||||
m_needComputeScaleY = 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_logicalFunction = wxCOPY;
|
||||||
// m_textAlignment = wxALIGN_TOP_LEFT;
|
|
||||||
m_backgroundMode = wxTRANSPARENT;
|
|
||||||
|
|
||||||
m_textForegroundColour = *wxBLACK;
|
|
||||||
m_textBackgroundColour = *wxWHITE;
|
|
||||||
m_pen = *wxBLACK_PEN;
|
m_pen = *wxBLACK_PEN;
|
||||||
m_font = *wxNORMAL_FONT;
|
m_font = *wxNORMAL_FONT;
|
||||||
m_brush = *wxTRANSPARENT_BRUSH;
|
m_brush = *wxTRANSPARENT_BRUSH;
|
||||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
|
||||||
|
|
||||||
// m_palette = wxAPP_COLOURMAP; /* I'll learn to handle palettes later in my life */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDC::~wxDC()
|
void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
m_clipping = TRUE;
|
m_clipping = TRUE;
|
||||||
m_clipX1 = x;
|
m_clipX1 = x;
|
||||||
@@ -173,28 +68,17 @@ void wxDC::DestroyClippingRegion()
|
|||||||
m_clipping = FALSE;
|
m_clipping = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
|
// ---------------------------------------------------------------------------
|
||||||
{
|
// get DC capabilities
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxDC::GetSize( int* width, int* height ) const
|
void wxDC::DoGetSize( int* width, int* height ) const
|
||||||
{
|
{
|
||||||
if (width) *width = m_maxX-m_minX;
|
if (width) *width = m_maxX-m_minX;
|
||||||
if (height) *height = m_maxY-m_minY;
|
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 w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
@@ -204,25 +88,42 @@ void wxDC::GetSizeMM( int* width, int* height ) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
// Resolution in pixels per logical inch
|
||||||
wxSize wxDC::GetPPI(void) const
|
wxSize wxDC::GetPPI() const
|
||||||
{
|
{
|
||||||
// TODO (should probably be pure virtual)
|
// TODO (should probably be pure virtual)
|
||||||
return wxSize(0, 0);
|
return wxSize(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetTextForeground( const wxColour &col )
|
// ---------------------------------------------------------------------------
|
||||||
{
|
// set various DC parameters
|
||||||
m_textForegroundColour = col;
|
// ---------------------------------------------------------------------------
|
||||||
}
|
|
||||||
|
|
||||||
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 )
|
void wxDC::SetMapMode( int mode )
|
||||||
{
|
{
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case wxMM_TWIPS:
|
case wxMM_TWIPS:
|
||||||
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
|
||||||
@@ -258,12 +159,6 @@ void wxDC::SetUserScale( double x, double y )
|
|||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetLogicalScale( double x, double y )
|
||||||
{
|
{
|
||||||
// allow negative ?
|
// allow negative ?
|
||||||
@@ -272,12 +167,6 @@ void wxDC::SetLogicalScale( double x, double y )
|
|||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetLogicalOrigin( long x, long y )
|
||||||
{
|
{
|
||||||
m_logicalOriginX = x * m_signX; // is this still correct ?
|
m_logicalOriginX = x * m_signX; // is this still correct ?
|
||||||
@@ -285,26 +174,14 @@ void wxDC::SetLogicalOrigin( long x, long y )
|
|||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetDeviceOrigin( long x, long y )
|
||||||
{
|
{
|
||||||
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
|
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
|
||||||
m_deviceOriginX = x;
|
m_deviceOriginX = x;
|
||||||
m_deviceOriginY = y;
|
m_deviceOriginY = y;
|
||||||
ComputeScaleAndOrigin();
|
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 )
|
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||||
{
|
{
|
||||||
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
|
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
|
||||||
@@ -313,74 +190,47 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
|||||||
ComputeScaleAndOrigin();
|
ComputeScaleAndOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalX(long x) const
|
// ---------------------------------------------------------------------------
|
||||||
|
// coordinates transformations
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
long wxDCBase::DeviceToLogicalX(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOG(x);
|
return XDEV2LOG(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalY(long y) const
|
long wxDCBase::DeviceToLogicalY(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOG(y);
|
return YDEV2LOG(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalXRel(long x) const
|
long wxDCBase::DeviceToLogicalXRel(long x) const
|
||||||
{
|
{
|
||||||
return XDEV2LOGREL(x);
|
return XDEV2LOGREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::DeviceToLogicalYRel(long y) const
|
long wxDCBase::DeviceToLogicalYRel(long y) const
|
||||||
{
|
{
|
||||||
return YDEV2LOGREL(y);
|
return YDEV2LOGREL(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceX(long x) const
|
long wxDCBase::LogicalToDeviceX(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEV(x);
|
return XLOG2DEV(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceY(long y) const
|
long wxDCBase::LogicalToDeviceY(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEV(y);
|
return YLOG2DEV(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceXRel(long x) const
|
long wxDCBase::LogicalToDeviceXRel(long x) const
|
||||||
{
|
{
|
||||||
return XLOG2DEVREL(x);
|
return XLOG2DEVREL(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxDC::LogicalToDeviceYRel(long y) const
|
long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||||
{
|
{
|
||||||
return YLOG2DEVREL(y);
|
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 );
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -365,7 +365,7 @@ void wxCheckListBox::OnChar(wxKeyEvent& event)
|
|||||||
if ( event.KeyCode() == WXK_SPACE )
|
if ( event.KeyCode() == WXK_SPACE )
|
||||||
GetItem(GetSelection())->Toggle();
|
GetItem(GetSelection())->Toggle();
|
||||||
else
|
else
|
||||||
wxListBox::OnChar(event);
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
|
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxControl, wxWindow)
|
BEGIN_EVENT_TABLE(wxControl, wxWindow)
|
||||||
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
|
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -119,136 +119,54 @@ void wxFindMaxSize(WXHWND wnd, RECT *rect)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#ifdef __WIN95__
|
||||||
// Not currently used
|
bool wxControl::MSWOnNotify(int idCtrl,
|
||||||
void wxConvertDialogToPixels(wxWindow *control, int *x, int *y)
|
WXLPARAM lParam,
|
||||||
|
WXLPARAM* result)
|
||||||
{
|
{
|
||||||
if (control->m_windowParent && control->m_windowParent->is_dialog)
|
wxCommandEvent event(wxEVT_NULL, m_windowId);
|
||||||
{
|
wxEventType eventType = wxEVT_NULL;
|
||||||
DWORD word = GetDialogBaseUnits();
|
NMHDR *hdr1 = (NMHDR*) lParam;
|
||||||
int xs = LOWORD(word);
|
switch ( hdr1->code )
|
||||||
int ys = HIWORD(word);
|
{
|
||||||
*x = (int)(*x * xs/4);
|
case NM_CLICK:
|
||||||
*y = (int)(*y * ys/8);
|
eventType = wxEVT_COMMAND_LEFT_CLICK;
|
||||||
}
|
break;
|
||||||
else
|
|
||||||
{
|
|
||||||
*x = *x;
|
|
||||||
*y = *y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void wxControl::MSWOnMouseMove(int x, int y, WXUINT flags)
|
case NM_DBLCLK:
|
||||||
{
|
eventType = wxEVT_COMMAND_LEFT_DCLICK;
|
||||||
/*
|
break;
|
||||||
// Trouble with this is that it sets the cursor for controls too :-(
|
|
||||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
|
||||||
::SetCursor(m_windowCursor.GetHCURSOR());
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!m_mouseInWindow)
|
case NM_RCLICK:
|
||||||
{
|
eventType = wxEVT_COMMAND_RIGHT_CLICK;
|
||||||
// Generate an ENTER event
|
break;
|
||||||
m_mouseInWindow = TRUE;
|
|
||||||
MSWOnMouseEnter(x, y, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxMouseEvent event(wxEVT_MOTION);
|
case NM_RDBLCLK:
|
||||||
|
eventType = wxEVT_COMMAND_RIGHT_DCLICK;
|
||||||
|
break;
|
||||||
|
|
||||||
event.m_x = x; event.m_y = y;
|
case NM_SETFOCUS:
|
||||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
eventType = wxEVT_COMMAND_SET_FOCUS;
|
||||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
break;
|
||||||
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
|
case NM_KILLFOCUS:
|
||||||
// message even if position isn't changed! We want to discard
|
eventType = wxEVT_COMMAND_KILL_FOCUS;
|
||||||
// the trailing move event if x and y are the same.
|
break;
|
||||||
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;
|
case NM_RETURN:
|
||||||
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
|
eventType = wxEVT_COMMAND_ENTER;
|
||||||
|
break;
|
||||||
|
|
||||||
if (!GetEventHandler()->ProcessEvent(event))
|
default:
|
||||||
Default();
|
return wxWindow::MSWOnNotify(idCtrl, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxControl::MSWNotify(WXWPARAM wParam, 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
event.SetEventType(eventType);
|
event.SetEventType(eventType);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
if ( !GetEventHandler()->ProcessEvent(event) )
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
return FALSE;
|
|
||||||
return TRUE;
|
|
||||||
#else // !Win95
|
|
||||||
return FALSE;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif // Win95
|
||||||
|
|
||||||
void wxControl::ProcessCommand (wxCommandEvent & event)
|
void wxControl::ProcessCommand (wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
|
1075
src/msw/dc.cpp
1075
src/msw/dc.cpp
File diff suppressed because it is too large
Load Diff
@@ -40,8 +40,8 @@
|
|||||||
|
|
||||||
// Lists to keep track of windows, so we can disable/enable them
|
// Lists to keep track of windows, so we can disable/enable them
|
||||||
// for modal dialogs
|
// for modal dialogs
|
||||||
wxList wxModalDialogs;
|
wxWindowList wxModalDialogs;
|
||||||
wxList wxModelessWindows; // Frames and modeless dialogs
|
wxWindowList wxModelessWindows; // Frames and modeless dialogs
|
||||||
extern wxList WXDLLEXPORT wxPendingDelete;
|
extern wxList WXDLLEXPORT wxPendingDelete;
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
@@ -58,12 +58,7 @@ extern wxList WXDLLEXPORT wxPendingDelete;
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool wxDialog::MSWOnClose(void)
|
wxDialog::wxDialog()
|
||||||
{
|
|
||||||
return Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
wxDialog::wxDialog(void)
|
|
||||||
{
|
{
|
||||||
m_isShown = FALSE;
|
m_isShown = FALSE;
|
||||||
m_modalShowing = FALSE;
|
m_modalShowing = FALSE;
|
||||||
@@ -235,7 +230,7 @@ void wxDialog::OnPaint(wxPaintEvent& event)
|
|||||||
// wxWindow::OnPaint(event);
|
// wxWindow::OnPaint(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDialog::Fit(void)
|
void wxDialog::Fit()
|
||||||
{
|
{
|
||||||
wxWindow::Fit();
|
wxWindow::Fit();
|
||||||
}
|
}
|
||||||
@@ -245,7 +240,7 @@ void wxDialog::Iconize(bool WXUNUSED(iconize))
|
|||||||
// Windows dialog boxes can't be iconized
|
// Windows dialog boxes can't be iconized
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDialog::IsIconized(void) const
|
bool wxDialog::IsIconized() const
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -282,7 +277,7 @@ void wxDialog::GetPosition(int *x, int *y) const
|
|||||||
*y = rect.top;
|
*y = rect.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDialog::IsShown(void) const
|
bool wxDialog::IsShown() const
|
||||||
{
|
{
|
||||||
return m_isShown;
|
return m_isShown;
|
||||||
}
|
}
|
||||||
@@ -299,13 +294,13 @@ bool wxDialog::Show(bool show)
|
|||||||
#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
|
#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
|
||||||
if (!modal) {
|
if (!modal) {
|
||||||
if (show) {
|
if (show) {
|
||||||
if (!wxModelessWindows.Member(this))
|
if (!wxModelessWindows.Find(this))
|
||||||
wxModelessWindows.Append(this);
|
wxModelessWindows.Append(this);
|
||||||
} else
|
} else
|
||||||
wxModelessWindows.DeleteObject(this);
|
wxModelessWindows.DeleteObject(this);
|
||||||
}
|
}
|
||||||
if (show) {
|
if (show) {
|
||||||
if (!wxTopLevelWindows.Member(this))
|
if (!wxTopLevelWindows.Find(this))
|
||||||
wxTopLevelWindows.Append(this);
|
wxTopLevelWindows.Append(this);
|
||||||
} else
|
} else
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
@@ -355,13 +350,13 @@ bool wxDialog::Show(bool show)
|
|||||||
EnableWindow((HWND) GetHWND(), TRUE);
|
EnableWindow((HWND) GetHWND(), TRUE);
|
||||||
BringWindowToTop((HWND) GetHWND());
|
BringWindowToTop((HWND) GetHWND());
|
||||||
|
|
||||||
if (!wxModalDialogs.Member(this))
|
if ( !wxModalDialogs.Find(this) )
|
||||||
wxModalDialogs.Append(this);
|
wxModalDialogs.Append(this);
|
||||||
|
|
||||||
MSG msg;
|
MSG msg;
|
||||||
// Must test whether this dialog still exists: we may not process
|
// Must test whether this dialog still exists: we may not process
|
||||||
// a message before the deletion.
|
// 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() &&
|
if ( m_acceleratorTable.Ok() &&
|
||||||
::TranslateAccelerator((HWND)GetHWND(),
|
::TranslateAccelerator((HWND)GetHWND(),
|
||||||
@@ -394,7 +389,7 @@ bool wxDialog::Show(bool show)
|
|||||||
node=disabledWindows.First();
|
node=disabledWindows.First();
|
||||||
while(node) {
|
while(node) {
|
||||||
wxWindow* win = (wxWindow*) node->Data();
|
wxWindow* win = (wxWindow*) node->Data();
|
||||||
if (wxModalDialogs.Member(win) || wxModelessWindows.Member(win))
|
if (wxModalDialogs.Find(win) || wxModelessWindows.Find(win))
|
||||||
{
|
{
|
||||||
HWND hWnd = (HWND) win->GetHWND();
|
HWND hWnd = (HWND) win->GetHWND();
|
||||||
if (::IsWindow(hWnd))
|
if (::IsWindow(hWnd))
|
||||||
@@ -480,7 +475,7 @@ void wxDialog::SetTitle(const wxString& title)
|
|||||||
SetWindowText((HWND) GetHWND(), (const char *)title);
|
SetWindowText((HWND) GetHWND(), (const char *)title);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxDialog::GetTitle(void) const
|
wxString wxDialog::GetTitle() const
|
||||||
{
|
{
|
||||||
GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
|
GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
|
||||||
return wxString(wxBuffer);
|
return wxString(wxBuffer);
|
||||||
@@ -516,7 +511,7 @@ void wxDialog::Centre(int direction)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
||||||
int wxDialog::ShowModal(void)
|
int wxDialog::ShowModal()
|
||||||
{
|
{
|
||||||
m_windowStyle |= wxDIALOG_MODAL;
|
m_windowStyle |= wxDIALOG_MODAL;
|
||||||
Show(TRUE);
|
Show(TRUE);
|
||||||
@@ -605,7 +600,7 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Destroy the window (delayed, if a managed window)
|
// Destroy the window (delayed, if a managed window)
|
||||||
bool wxDialog::Destroy(void)
|
bool wxDialog::Destroy()
|
||||||
{
|
{
|
||||||
if (!wxPendingDelete.Member(this))
|
if (!wxPendingDelete.Member(this))
|
||||||
wxPendingDelete.Append(this);
|
wxPendingDelete.Append(this);
|
||||||
@@ -616,7 +611,8 @@ void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
// if we're using constraints - do use them
|
// if we're using constraints - do use them
|
||||||
#if wxUSE_CONSTRAINTS
|
#if wxUSE_CONSTRAINTS
|
||||||
if ( GetAutoLayout() ) {
|
if ( GetAutoLayout() )
|
||||||
|
{
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -45,7 +45,7 @@
|
|||||||
#include <wx/msw/statbr95.h>
|
#include <wx/msw/statbr95.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern wxList wxModelessWindows;
|
extern wxWindowList wxModelessWindows;
|
||||||
extern wxList WXDLLEXPORT wxPendingDelete;
|
extern wxList WXDLLEXPORT wxPendingDelete;
|
||||||
extern char wxFrameClassName[];
|
extern char wxFrameClassName[];
|
||||||
extern wxMenu *wxCurrentPopupMenu;
|
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)
|
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;
|
extendedStyle |= WS_EX_TOPMOST;
|
||||||
|
|
||||||
m_iconized = FALSE;
|
m_iconized = FALSE;
|
||||||
wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
|
if ( !wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
|
||||||
msflags, NULL, extendedStyle);
|
msflags, NULL, extendedStyle) )
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
// Seems to be necessary if we use WS_POPUP
|
// Seems to be necessary if we use WS_POPUP
|
||||||
// style instead of WS_OVERLAPPED
|
// style instead of WS_OVERLAPPED
|
||||||
if (width > -1 && height > -1)
|
if (width > -1 && height > -1)
|
||||||
::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
|
::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFrame::MSWOnPaint()
|
bool wxFrame::MSWOnPaint()
|
||||||
@@ -673,60 +677,58 @@ WXHICON wxFrame::MSWOnQueryDragIcon()
|
|||||||
return m_defaultIcon;
|
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;
|
||||||
{
|
|
||||||
case SIZENORMAL:
|
|
||||||
// only do it it if we were iconized before, otherwise resizing the
|
|
||||||
// parent frame has a curious side effect of bringing it under it's
|
|
||||||
// children
|
|
||||||
if ( !m_iconized )
|
|
||||||
break;
|
|
||||||
|
|
||||||
// restore all child frames too
|
switch ( id )
|
||||||
IconizeChildFrames(FALSE);
|
{
|
||||||
|
case SIZENORMAL:
|
||||||
|
// only do it it if we were iconized before, otherwise resizing the
|
||||||
|
// parent frame has a curious side effect of bringing it under it's
|
||||||
|
// children
|
||||||
|
if ( !m_iconized )
|
||||||
|
break;
|
||||||
|
|
||||||
// fall through
|
// restore all child frames too
|
||||||
|
IconizeChildFrames(FALSE);
|
||||||
|
|
||||||
case SIZEFULLSCREEN:
|
// fall through
|
||||||
m_iconized = FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SIZEICONIC:
|
case SIZEFULLSCREEN:
|
||||||
// iconize all child frames too
|
m_iconized = FALSE;
|
||||||
IconizeChildFrames(TRUE);
|
break;
|
||||||
|
|
||||||
m_iconized = TRUE;
|
case SIZEICONIC:
|
||||||
break;
|
// iconize all child frames too
|
||||||
}
|
IconizeChildFrames(TRUE);
|
||||||
|
|
||||||
if (!m_iconized)
|
m_iconized = TRUE;
|
||||||
{
|
break;
|
||||||
// forward WM_SIZE to status bar control
|
}
|
||||||
|
|
||||||
|
if ( !m_iconized )
|
||||||
|
{
|
||||||
|
// forward WM_SIZE to status bar control
|
||||||
#if wxUSE_NATIVE_STATUSBAR
|
#if wxUSE_NATIVE_STATUSBAR
|
||||||
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
|
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
|
||||||
{
|
{
|
||||||
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
|
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
|
||||||
event.SetEventObject( m_frameStatusBar );
|
event.SetEventObject( m_frameStatusBar );
|
||||||
|
|
||||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // wxUSE_NATIVE_STATUSBAR
|
||||||
|
|
||||||
PositionStatusBar();
|
PositionStatusBar();
|
||||||
PositionToolBar();
|
PositionToolBar();
|
||||||
|
|
||||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
if (!GetEventHandler()->ProcessEvent(event))
|
processed = GetEventHandler()->ProcessEvent(event);
|
||||||
Default();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxFrame::MSWOnClose()
|
return processed;
|
||||||
{
|
|
||||||
return Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
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);
|
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)
|
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -788,44 +774,45 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default resizing behaviour - if only ONE subwindow,
|
// Default resizing behaviour - if only ONE subwindow, resize to client
|
||||||
// resize to client rectangle size
|
// rectangle size
|
||||||
void wxFrame::OnSize(wxSizeEvent& event)
|
void wxFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
// if we're using constraints - do use them
|
// if we're using constraints - do use them
|
||||||
#if wxUSE_CONSTRAINTS
|
#if wxUSE_CONSTRAINTS
|
||||||
if ( GetAutoLayout() ) {
|
if ( GetAutoLayout() )
|
||||||
Layout();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// do we have _exactly_ one child?
|
|
||||||
wxWindow *child = NULL;
|
|
||||||
for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
|
|
||||||
{
|
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
|
||||||
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
|
|
||||||
!win->IsKindOf(CLASSINFO(wxDialog)) &&
|
|
||||||
(win != GetStatusBar()) &&
|
|
||||||
(win != GetToolBar()) )
|
|
||||||
{
|
{
|
||||||
if ( child )
|
Layout();
|
||||||
return; // it's our second subwindow - nothing to do
|
return;
|
||||||
child = win;
|
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
|
|
||||||
if ( child ) {
|
// do we have _exactly_ one child?
|
||||||
// we have exactly one child - set it's size to fill the whole frame
|
wxWindow *child = NULL;
|
||||||
int clientW, clientH;
|
for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
|
||||||
GetClientSize(&clientW, &clientH);
|
{
|
||||||
|
wxWindow *win = (wxWindow *)node->Data();
|
||||||
|
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||||
|
!win->IsKindOf(CLASSINFO(wxDialog)) &&
|
||||||
|
(win != GetStatusBar()) &&
|
||||||
|
(win != GetToolBar()) )
|
||||||
|
{
|
||||||
|
if ( child )
|
||||||
|
return; // it's our second subwindow - nothing to do
|
||||||
|
child = win;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int x = 0;
|
if ( child ) {
|
||||||
int y = 0;
|
// we have exactly one child - set it's size to fill the whole frame
|
||||||
|
int clientW, clientH;
|
||||||
|
GetClientSize(&clientW, &clientH);
|
||||||
|
|
||||||
child->SetSize(x, y, clientW, clientH);
|
int x = 0;
|
||||||
}
|
int y = 0;
|
||||||
|
|
||||||
|
child->SetSize(x, y, clientW, clientH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default activation behaviour - set the focus for the first child
|
// Default activation behaviour - set the focus for the first child
|
||||||
@@ -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)
|
void wxFrame::IconizeChildFrames(bool bIconize)
|
||||||
{
|
{
|
||||||
for ( wxNode *node = GetChildren().First(); node; node = node->Next() ) {
|
for ( wxWindowList::Node *node = GetChildren().GetFirst();
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
node;
|
||||||
if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
|
node = node->GetNext() )
|
||||||
((wxFrame *)win)->Iconize(bIconize);
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
@@ -83,9 +83,6 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
|
|||||||
// list box control implementation
|
// 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))
|
bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -213,7 +210,7 @@ bool wxListBox::Create(wxWindow *parent,
|
|||||||
#if wxUSE_CTL3D
|
#if wxUSE_CTL3D
|
||||||
if (want3D)
|
if (want3D)
|
||||||
{
|
{
|
||||||
Ctl3dSubclassCtl(hwnd);
|
Ctl3dSubclassCtl(GetHwnd());
|
||||||
m_useCtl3D = TRUE;
|
m_useCtl3D = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -227,7 +224,7 @@ bool wxListBox::Create(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( (m_windowStyle & wxLB_MULTIPLE) == 0 )
|
if ( (m_windowStyle & wxLB_MULTIPLE) == 0 )
|
||||||
SendMessage(hwnd, LB_SETCURSEL, 0, 0);
|
SendMessage(GetHwnd(), LB_SETCURSEL, 0, 0);
|
||||||
|
|
||||||
SetFont(parent->GetFont());
|
SetFont(parent->GetFont());
|
||||||
|
|
||||||
@@ -259,7 +256,7 @@ void wxListBox::SetFirstItem(int N)
|
|||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
"invalid index in wxListBox::SetFirstItem" );
|
"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)
|
void wxListBox::SetFirstItem(const wxString& s)
|
||||||
@@ -275,7 +272,7 @@ void wxListBox::Delete(int N)
|
|||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
"invalid index in wxListBox::Delete" );
|
"invalid index in wxListBox::Delete" );
|
||||||
|
|
||||||
SendMessage(hwnd, LB_DELETESTRING, N, 0);
|
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||||
m_noItems--;
|
m_noItems--;
|
||||||
|
|
||||||
SetHorizontalExtent("");
|
SetHorizontalExtent("");
|
||||||
@@ -283,7 +280,7 @@ void wxListBox::Delete(int N)
|
|||||||
|
|
||||||
void wxListBox::Append(const wxString& item)
|
void wxListBox::Append(const wxString& item)
|
||||||
{
|
{
|
||||||
int index = ListBox_AddString(hwnd, item);
|
int index = ListBox_AddString(GetHwnd(), item);
|
||||||
m_noItems ++;
|
m_noItems ++;
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -291,7 +288,7 @@ void wxListBox::Append(const wxString& item)
|
|||||||
wxOwnerDrawn *pNewItem = CreateItem(index); // dummy argument
|
wxOwnerDrawn *pNewItem = CreateItem(index); // dummy argument
|
||||||
pNewItem->SetName(item);
|
pNewItem->SetName(item);
|
||||||
m_aItems.Add(pNewItem);
|
m_aItems.Add(pNewItem);
|
||||||
ListBox_SetItemData(hwnd, index, pNewItem);
|
ListBox_SetItemData(GetHwnd(), index, pNewItem);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -300,7 +297,7 @@ void wxListBox::Append(const wxString& item)
|
|||||||
|
|
||||||
void wxListBox::Append(const wxString& item, char *Client_data)
|
void wxListBox::Append(const wxString& item, char *Client_data)
|
||||||
{
|
{
|
||||||
int index = ListBox_AddString(hwnd, item);
|
int index = ListBox_AddString(GetHwnd(), item);
|
||||||
m_noItems ++;
|
m_noItems ++;
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -312,21 +309,21 @@ void wxListBox::Append(const wxString& item, char *Client_data)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ListBox_SetItemData(hwnd, index, Client_data);
|
ListBox_SetItemData(GetHwnd(), index, Client_data);
|
||||||
|
|
||||||
SetHorizontalExtent(item);
|
SetHorizontalExtent(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
||||||
{
|
{
|
||||||
ShowWindow(hwnd, SW_HIDE);
|
ShowWindow(GetHwnd(), SW_HIDE);
|
||||||
ListBox_ResetContent(hwnd);
|
ListBox_ResetContent(GetHwnd());
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
ListBox_AddString(hwnd, choices[i]);
|
ListBox_AddString(GetHwnd(), choices[i]);
|
||||||
if ( clientData )
|
if ( clientData )
|
||||||
ListBox_SetItemData(hwnd, i, clientData[i]);
|
ListBox_SetItemData(GetHwnd(), i, clientData[i]);
|
||||||
}
|
}
|
||||||
m_noItems = n;
|
m_noItems = n;
|
||||||
|
|
||||||
@@ -344,7 +341,7 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
|||||||
wxOwnerDrawn *pNewItem = CreateItem(ui);
|
wxOwnerDrawn *pNewItem = CreateItem(ui);
|
||||||
pNewItem->SetName(choices[ui]);
|
pNewItem->SetName(choices[ui]);
|
||||||
m_aItems.Add(pNewItem);
|
m_aItems.Add(pNewItem);
|
||||||
ListBox_SetItemData(hwnd, ui, pNewItem);
|
ListBox_SetItemData(GetHwnd(), ui, pNewItem);
|
||||||
|
|
||||||
wxASSERT_MSG(clientData[ui] == NULL,
|
wxASSERT_MSG(clientData[ui] == NULL,
|
||||||
"Can't use client data with owner-drawn listboxes");
|
"Can't use client data with owner-drawn listboxes");
|
||||||
@@ -353,12 +350,12 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SetHorizontalExtent("");
|
SetHorizontalExtent("");
|
||||||
ShowWindow(hwnd, SW_SHOW);
|
ShowWindow(GetHwnd(), SW_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::FindString(const wxString& s) const
|
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)
|
if (pos == LB_ERR)
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
@@ -367,7 +364,7 @@ int wxListBox::FindString(const wxString& s) const
|
|||||||
|
|
||||||
void wxListBox::Clear()
|
void wxListBox::Clear()
|
||||||
{
|
{
|
||||||
ListBox_ResetContent(hwnd);
|
ListBox_ResetContent(GetHwnd());
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
size_t uiCount = m_aItems.Count();
|
size_t uiCount = m_aItems.Count();
|
||||||
@@ -379,7 +376,7 @@ void wxListBox::Clear()
|
|||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
|
|
||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
ListBox_GetHorizontalExtent(hwnd);
|
ListBox_GetHorizontalExtent(GetHwnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetSelection(int N, bool select)
|
void wxListBox::SetSelection(int N, bool select)
|
||||||
@@ -388,13 +385,13 @@ void wxListBox::SetSelection(int N, bool select)
|
|||||||
"invalid index in wxListBox::SetSelection" );
|
"invalid index in wxListBox::SetSelection" );
|
||||||
|
|
||||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
||||||
SendMessage(hwnd, LB_SETSEL, select, N);
|
SendMessage(GetHwnd(), LB_SETSEL, select, N);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int N1 = N;
|
int N1 = N;
|
||||||
if (!select)
|
if (!select)
|
||||||
N1 = -1;
|
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,
|
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
|
||||||
"invalid index in wxListBox::Selected" );
|
"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)
|
void wxListBox::Deselect(int N)
|
||||||
@@ -412,7 +409,7 @@ void wxListBox::Deselect(int N)
|
|||||||
"invalid index in wxListBox::Deselect" );
|
"invalid index in wxListBox::Deselect" );
|
||||||
|
|
||||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
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
|
char *wxListBox::GetClientData(int N) const
|
||||||
@@ -420,7 +417,7 @@ char *wxListBox::GetClientData(int N) const
|
|||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
|
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
|
||||||
"invalid index in wxListBox::GetClientData" );
|
"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)
|
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,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
"invalid index in wxListBox::SetClientData" );
|
"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");
|
wxLogDebug("LB_SETITEMDATA failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,10 +436,10 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
|||||||
|
|
||||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
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) {
|
if (no_sel != 0) {
|
||||||
int *selections = new int[no_sel];
|
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!");
|
wxFAIL_MSG("This listbox can't have single-selection style!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,7 +454,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
|||||||
}
|
}
|
||||||
else // single-selection listbox
|
else // single-selection listbox
|
||||||
{
|
{
|
||||||
aSelections.Add(ListBox_GetCurSel(hwnd));
|
aSelections.Add(ListBox_GetCurSel(GetHwnd()));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -472,7 +469,7 @@ int wxListBox::GetSelection() const
|
|||||||
"GetSelection() can't be used with multiple-selection "
|
"GetSelection() can't be used with multiple-selection "
|
||||||
"listboxes, use GetSelections() instead." );
|
"listboxes, use GetSelections() instead." );
|
||||||
|
|
||||||
return ListBox_GetCurSel(hwnd);
|
return ListBox_GetCurSel(GetHwnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find string for position
|
// Find string for position
|
||||||
@@ -481,11 +478,11 @@ wxString wxListBox::GetString(int N) const
|
|||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, "",
|
wxCHECK_MSG( N >= 0 && N < m_noItems, "",
|
||||||
"invalid index in wxListBox::GetClientData" );
|
"invalid index in wxListBox::GetClientData" );
|
||||||
|
|
||||||
int len = ListBox_GetTextLen(hwnd, N);
|
int len = ListBox_GetTextLen(GetHwnd(), N);
|
||||||
|
|
||||||
// +1 for terminating NUL
|
// +1 for terminating NUL
|
||||||
wxString result;
|
wxString result;
|
||||||
ListBox_GetText(hwnd, N, result.GetWriteBuf(len + 1));
|
ListBox_GetText(GetHwnd(), N, result.GetWriteBuf(len + 1));
|
||||||
result.UngetWriteBuf();
|
result.UngetWriteBuf();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -540,7 +537,7 @@ void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
if (control_width <= 0)
|
if (control_width <= 0)
|
||||||
control_width = (float)DEFAULT_ITEM_WIDTH;
|
control_width = (float)DEFAULT_ITEM_WIDTH;
|
||||||
|
|
||||||
MoveWindow(hwnd,
|
MoveWindow(GetHwnd(),
|
||||||
(int)control_x, (int)control_y,
|
(int)control_x, (int)control_y,
|
||||||
(int)control_width, (int)control_height,
|
(int)control_width, (int)control_height,
|
||||||
TRUE);
|
TRUE);
|
||||||
@@ -560,8 +557,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
|
|
||||||
if (s != "")
|
if (s != "")
|
||||||
{
|
{
|
||||||
int existingExtent = (int)SendMessage(hwnd, LB_GETHORIZONTALEXTENT, 0, 0L);
|
int existingExtent = (int)SendMessage(GetHwnd(), LB_GETHORIZONTALEXTENT, 0, 0L);
|
||||||
HDC dc = GetWindowDC(hwnd);
|
HDC dc = GetWindowDC(GetHwnd());
|
||||||
HFONT oldFont = 0;
|
HFONT oldFont = 0;
|
||||||
if (GetFont().Ok() && GetFont().GetResourceHandle())
|
if (GetFont().Ok() && GetFont().GetResourceHandle())
|
||||||
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
||||||
@@ -574,15 +571,15 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
if (oldFont)
|
if (oldFont)
|
||||||
::SelectObject(dc, oldFont);
|
::SelectObject(dc, oldFont);
|
||||||
|
|
||||||
ReleaseDC(hwnd, dc);
|
ReleaseDC(GetHwnd(), dc);
|
||||||
if (extentX > existingExtent)
|
if (extentX > existingExtent)
|
||||||
SendMessage(hwnd, LB_SETHORIZONTALEXTENT, LOWORD(extentX), 0L);
|
SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(extentX), 0L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int largestExtent = 0;
|
int largestExtent = 0;
|
||||||
HDC dc = GetWindowDC(hwnd);
|
HDC dc = GetWindowDC(GetHwnd());
|
||||||
HFONT oldFont = 0;
|
HFONT oldFont = 0;
|
||||||
if (GetFont().Ok() && GetFont().GetResourceHandle())
|
if (GetFont().Ok() && GetFont().GetResourceHandle())
|
||||||
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
||||||
@@ -591,7 +588,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < m_noItems; 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;
|
wxBuffer[len] = 0;
|
||||||
SIZE extentXY;
|
SIZE extentXY;
|
||||||
::GetTextExtentPoint(dc, (LPSTR)wxBuffer, len, &extentXY);
|
::GetTextExtentPoint(dc, (LPSTR)wxBuffer, len, &extentXY);
|
||||||
@@ -602,8 +599,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
|||||||
if (oldFont)
|
if (oldFont)
|
||||||
::SelectObject(dc, oldFont);
|
::SelectObject(dc, oldFont);
|
||||||
|
|
||||||
ReleaseDC(hwnd, dc);
|
ReleaseDC(GetHwnd(), dc);
|
||||||
SendMessage(hwnd, LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
|
SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,7 +612,7 @@ wxListBox::InsertItems(int nItems, const wxString items[], int pos)
|
|||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < nItems; i++)
|
for (i = 0; i < nItems; i++)
|
||||||
ListBox_InsertString(hwnd, i + pos, items[i]);
|
ListBox_InsertString(GetHwnd(), i + pos, items[i]);
|
||||||
m_noItems += nItems;
|
m_noItems += nItems;
|
||||||
|
|
||||||
SetHorizontalExtent("");
|
SetHorizontalExtent("");
|
||||||
@@ -632,13 +629,13 @@ void wxListBox::SetString(int N, const wxString& s)
|
|||||||
|
|
||||||
char *oldData = (char *)wxListBox::GetClientData(N);
|
char *oldData = (char *)wxListBox::GetClientData(N);
|
||||||
|
|
||||||
SendMessage(hwnd, LB_DELETESTRING, N, 0);
|
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||||
|
|
||||||
int newN = N;
|
int newN = N;
|
||||||
if (N == (m_noItems - 1))
|
if (N == (m_noItems - 1))
|
||||||
newN = -1;
|
newN = -1;
|
||||||
|
|
||||||
SendMessage(hwnd, LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
|
SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
|
||||||
if (oldData)
|
if (oldData)
|
||||||
wxListBox::SetClientData(N, oldData);
|
wxListBox::SetClientData(N, oldData);
|
||||||
|
|
||||||
@@ -769,7 +766,7 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
|||||||
|
|
||||||
DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)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 );
|
wxCHECK( data && (data != LB_ERR), FALSE );
|
||||||
|
|
||||||
|
@@ -1157,7 +1157,7 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
else return FALSE;
|
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);
|
wxListEvent event(wxEVT_NULL, m_windowId);
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
@@ -1275,7 +1275,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return wxControl::MSWNotify(wParam, lParam, result);
|
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
|
474
src/msw/mdi.cpp
474
src/msw/mdi.cpp
@@ -9,73 +9,102 @@
|
|||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
// declarations
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// headers
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "mdi.h"
|
#pragma implementation "mdi.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/setup.h"
|
#include "wx/setup.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/statusbr.h"
|
#include "wx/statusbr.h"
|
||||||
#include "wx/settings.h"
|
#include "wx/settings.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/mdi.h"
|
#include "wx/mdi.h"
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
#if wxUSE_NATIVE_STATUSBAR
|
#if wxUSE_NATIVE_STATUSBAR
|
||||||
#include <wx/msw/statbr95.h>
|
#include <wx/msw/statbr95.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
extern wxList wxModelessWindows;
|
// ---------------------------------------------------------------------------
|
||||||
|
// global variables
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
extern wxWindowList wxModelessWindows; // from dialog.cpp
|
||||||
extern wxMenu *wxCurrentPopupMenu;
|
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 wxMDIFrameClassName[];
|
||||||
extern char wxMDIChildFrameClassName[];
|
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
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
|
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
|
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
||||||
|
#endif // USE_SHARED_LIBRARY
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||||
EVT_SIZE(wxMDIParentFrame::OnSize)
|
EVT_SIZE(wxMDIParentFrame::OnSize)
|
||||||
EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
|
EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
|
||||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
||||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#endif
|
// ---------------------------------------------------------------------------
|
||||||
|
// wxMDIParentFrame
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
wxMDIParentFrame::wxMDIParentFrame()
|
wxMDIParentFrame::wxMDIParentFrame()
|
||||||
{
|
{
|
||||||
@@ -86,12 +115,12 @@ wxMDIParentFrame::wxMDIParentFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON : wxDEFAULT_MDIPARENTFRAME_ICON);
|
m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON : wxDEFAULT_MDIPARENTFRAME_ICON);
|
||||||
|
|
||||||
@@ -163,30 +192,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
|||||||
delete m_clientWindow;
|
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)
|
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||||
{
|
{
|
||||||
if (!menu_bar)
|
if (!menu_bar)
|
||||||
@@ -246,9 +251,13 @@ void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
|||||||
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
#if wxUSE_CONSTRAINTS
|
#if wxUSE_CONSTRAINTS
|
||||||
if (GetAutoLayout())
|
if ( GetAutoLayout() )
|
||||||
Layout();
|
{
|
||||||
#endif
|
Layout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif // wxUSE_CONSTRAINTS
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int width, height;
|
int width, height;
|
||||||
@@ -256,15 +265,6 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
|||||||
|
|
||||||
if ( GetClientWindow() )
|
if ( GetClientWindow() )
|
||||||
GetClientWindow()->SetSize(x, y, width, height);
|
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)
|
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||||
@@ -275,19 +275,19 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
|||||||
// Returns the active MDI child window
|
// Returns the active MDI child window
|
||||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||||
{
|
{
|
||||||
// HWND hWnd = (HWND)LOWORD(SendMessage((HWND) GetClientWindow()->GetHWND(), WM_MDIGETACTIVE, 0, 0L));
|
HWND hWnd = (HWND)::SendMessage(GetWinHwnd(GetClientWindow()),
|
||||||
HWND hWnd = (HWND)SendMessage((HWND) GetClientWindow()->GetHWND(), WM_MDIGETACTIVE, 0, 0L);
|
WM_MDIGETACTIVE, 0, 0L);
|
||||||
if (hWnd == 0)
|
if ( hWnd == 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
else
|
else
|
||||||
return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd);
|
return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the client window class (don't Create the window,
|
// Create the client window class (don't Create the window, just return a new
|
||||||
// just return a new class)
|
// class)
|
||||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||||
{
|
{
|
||||||
return new wxMDIClientWindow ;
|
return new wxMDIClientWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responds to colour changes, and passes event on to children.
|
// Responds to colour changes, and passes event on to children.
|
||||||
@@ -314,100 +314,110 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
|||||||
// MDI operations
|
// MDI operations
|
||||||
void wxMDIParentFrame::Cascade()
|
void wxMDIParentFrame::Cascade()
|
||||||
{
|
{
|
||||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDICASCADE, 0, 0);
|
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::Tile()
|
void wxMDIParentFrame::Tile()
|
||||||
{
|
{
|
||||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDITILE, MDITILE_HORIZONTAL, 0);
|
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, MDITILE_HORIZONTAL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ArrangeIcons()
|
void wxMDIParentFrame::ArrangeIcons()
|
||||||
{
|
{
|
||||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDIICONARRANGE, 0, 0);
|
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDIICONARRANGE, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ActivateNext()
|
void wxMDIParentFrame::ActivateNext()
|
||||||
{
|
{
|
||||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDINEXT, 0, 0);
|
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::ActivatePrevious()
|
void wxMDIParentFrame::ActivatePrevious()
|
||||||
{
|
{
|
||||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDINEXT, 0, 1);
|
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the MDI parent frame window proc
|
||||||
/*
|
long wxMDIParentFrame::MSWWindowProc(WXUINT message,
|
||||||
// Returns a style for the client window - usually 0
|
WXWPARAM wParam,
|
||||||
// or, for example, wxHSCROLL | wxVSCROLL
|
WXLPARAM lParam)
|
||||||
long wxMDIParentFrame::GetClientStyle() const
|
|
||||||
{
|
{
|
||||||
return wxHSCROLL | wxVSCROLL ;
|
long rc = 0;
|
||||||
}
|
bool processed = FALSE;
|
||||||
*/
|
|
||||||
|
|
||||||
bool wxMDIParentFrame::MSWOnDestroy()
|
switch ( message )
|
||||||
{
|
{
|
||||||
return FALSE;
|
case WM_CREATE:
|
||||||
}
|
m_clientWindow = OnCreateClient();
|
||||||
|
// Uses own style for client style
|
||||||
|
if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) )
|
||||||
|
{
|
||||||
|
wxLogMessage(_("Failed to create MDI parent frame."));
|
||||||
|
|
||||||
void wxMDIParentFrame::MSWOnCreate(WXLPCREATESTRUCT WXUNUSED(cs))
|
rc = -1;
|
||||||
{
|
}
|
||||||
m_clientWindow = OnCreateClient();
|
|
||||||
// Uses own style for client style
|
|
||||||
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxMDIParentFrame::MSWOnSize(int x, int y, WXUINT id)
|
processed = TRUE;
|
||||||
{
|
break;
|
||||||
switch (id)
|
|
||||||
{
|
|
||||||
case SIZEFULLSCREEN:
|
|
||||||
case SIZENORMAL:
|
|
||||||
m_iconized = FALSE;
|
|
||||||
break;
|
|
||||||
case SIZEICONIC:
|
|
||||||
m_iconized = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_iconized)
|
case WM_ERASEBKGND:
|
||||||
{
|
processed = TRUE;
|
||||||
// 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 );
|
|
||||||
|
|
||||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
// 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
|
#endif
|
||||||
|
if ( m_parentFrameActive )
|
||||||
|
{
|
||||||
|
processed = HandleMenuSelect(item, flags, (WXHMENU)menu);
|
||||||
|
}
|
||||||
|
else if (m_currentChild)
|
||||||
|
{
|
||||||
|
processed = m_currentChild->
|
||||||
|
HandleMenuSelect(item, flags, (WXHMENU)menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
PositionStatusBar();
|
if ( !processed )
|
||||||
PositionToolBar();
|
rc = wxFrame::MSWWindowProc(message, wParam, lParam);
|
||||||
|
|
||||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
return rc;
|
||||||
event.SetEventObject( this );
|
|
||||||
if (!GetEventHandler()->ProcessEvent(event))
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::MSWOnActivate(int state, bool minimized, WXHWND activate)
|
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
|
// If this window is an MDI parent, we must also send an OnActivate message
|
||||||
// to the current child.
|
// 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());
|
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
|
||||||
event.SetEventObject( m_currentChild );
|
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)
|
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);
|
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)
|
long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
WXHWND clientWnd;
|
WXHWND clientWnd;
|
||||||
@@ -526,45 +513,45 @@ long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARA
|
|||||||
else
|
else
|
||||||
clientWnd = 0;
|
clientWnd = 0;
|
||||||
|
|
||||||
return DefFrameProc((HWND) GetHWND(), (HWND) clientWnd, message, wParam, lParam);
|
return DefFrameProc(GetHwnd(), (HWND)clientWnd, message, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
|
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
|
||||||
{
|
{
|
||||||
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
|
return m_currentChild && m_currentChild->GetHWND() &&
|
||||||
return TRUE;
|
m_currentChild->MSWProcessMessage(msg);
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
||||||
{
|
{
|
||||||
MSG *pMsg = (MSG *)msg;
|
MSG *pMsg = (MSG *)msg;
|
||||||
|
|
||||||
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWTranslateMessage(msg))
|
if ( m_currentChild && m_currentChild->GetHWND() &&
|
||||||
return TRUE;
|
m_currentChild->MSWTranslateMessage(msg) )
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_acceleratorTable.Ok() &&
|
if ( m_acceleratorTable.Ok() &&
|
||||||
::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), pMsg))
|
::TranslateAccelerator(GetHwnd(),
|
||||||
return TRUE;
|
GetTableHaccel(&m_acceleratorTable),
|
||||||
|
pMsg) )
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
|
if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN )
|
||||||
{
|
{
|
||||||
if (::TranslateMDISysAccel((HWND) GetClientWindow()->GetHWND(), pMsg))
|
if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
bool wxMDIParentFrame::MSWOnEraseBkgnd(WXHDC WXUNUSED(pDC))
|
// wxMDIChildFrame
|
||||||
{
|
// ---------------------------------------------------------------------------
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern wxWindow *wxWndHook;
|
|
||||||
extern wxList *wxWinHandleList;
|
|
||||||
|
|
||||||
wxMDIChildFrame::wxMDIChildFrame()
|
wxMDIChildFrame::wxMDIChildFrame()
|
||||||
{
|
{
|
||||||
@@ -572,12 +559,12 @@ wxMDIChildFrame::wxMDIChildFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_defaultIcon = (WXHICON) (wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON : wxDEFAULT_MDICHILDFRAME_ICON);
|
m_defaultIcon = (WXHICON) (wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON : wxDEFAULT_MDICHILDFRAME_ICON);
|
||||||
|
|
||||||
@@ -797,46 +784,49 @@ void wxMDIChildFrame::Activate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static HWND invalidHandle = 0;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
(void)MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
|
|
||||||
|
|
||||||
switch (id)
|
|
||||||
{
|
|
||||||
case SIZEFULLSCREEN:
|
|
||||||
case SIZENORMAL:
|
|
||||||
m_iconized = FALSE;
|
|
||||||
break;
|
|
||||||
case SIZEICONIC:
|
|
||||||
m_iconized = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
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());
|
return FALSE;
|
||||||
event.SetEventObject( m_frameStatusBar );
|
|
||||||
|
|
||||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (id)
|
||||||
|
{
|
||||||
|
case SIZEFULLSCREEN:
|
||||||
|
case SIZENORMAL:
|
||||||
|
m_iconized = FALSE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SIZEICONIC:
|
||||||
|
m_iconized = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 );
|
||||||
|
|
||||||
|
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PositionStatusBar();
|
PositionStatusBar();
|
||||||
PositionToolBar();
|
PositionToolBar();
|
||||||
|
|
||||||
wxWindow::MSWOnSize(x, y, id);
|
return wxWindow::MSWOnSize(x, y, id);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIChildFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
bool wxMDIChildFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||||
@@ -895,7 +885,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
|
|||||||
return FALSE;
|
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();
|
wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
|
||||||
HMENU parent_menu = (HMENU) parent->GetWinMenu();
|
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);
|
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent(event);
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -931,7 +921,8 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
|
|||||||
|
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, m_windowId);
|
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent(event);
|
if ( GetEventHandler()->ProcessEvent(event) )
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
// m_active = FALSE;
|
// m_active = FALSE;
|
||||||
if (parent_menu)
|
if (parent_menu)
|
||||||
@@ -953,8 +944,7 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
|
|||||||
bool flag = (activate != 0);
|
bool flag = (activate != 0);
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, flag, m_windowId);
|
wxActivateEvent event(wxEVT_ACTIVATE, flag, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent(event);
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIChildFrame::MSWDestroyWindow()
|
void wxMDIChildFrame::MSWDestroyWindow()
|
||||||
@@ -1021,7 +1011,7 @@ bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
|
bool wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
|
||||||
{
|
{
|
||||||
WINDOWPOS *lpPos = (WINDOWPOS *)pos;
|
WINDOWPOS *lpPos = (WINDOWPOS *)pos;
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
@@ -1045,7 +1035,8 @@ void wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Default();
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client window
|
// Client window
|
||||||
@@ -1123,10 +1114,3 @@ void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
|
|||||||
|
|
||||||
Default();
|
Default();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should hand the message to the default proc
|
|
||||||
long wxMDIClientWindow::MSWOnMDIActivate(long bActivate, WXHWND, WXHWND)
|
|
||||||
{
|
|
||||||
return Default();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -464,7 +464,7 @@ void wxNotebook::Command(wxCommandEvent& event)
|
|||||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
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);
|
wxNotebookEvent event(wxEVT_NULL, m_windowId);
|
||||||
|
|
||||||
@@ -479,13 +479,13 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return wxControl::MSWNotify(wParam, lParam, result);
|
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
|
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
|
||||||
event.SetOldSelection(m_nSelection);
|
event.SetOldSelection(m_nSelection);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetInt(LOWORD(wParam)); // ctrl id
|
event.SetInt(idCtrl);
|
||||||
|
|
||||||
bool processed = GetEventHandler()->ProcessEvent(event);
|
bool processed = GetEventHandler()->ProcessEvent(event);
|
||||||
*result = !event.IsAllowed();
|
*result = !event.IsAllowed();
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -28,9 +28,6 @@
|
|||||||
#include "wx/scrolbar.h"
|
#include "wx/scrolbar.h"
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
// extern wxList wxScrollBarList;
|
|
||||||
extern void wxFindMaxSize(HWND hwnd, RECT *rect);
|
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
||||||
|
|
||||||
@@ -53,16 +50,16 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
SetName(name);
|
SetName(name);
|
||||||
SetValidator(validator);
|
SetValidator(validator);
|
||||||
|
|
||||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
int x = pos.x;
|
int x = pos.x;
|
||||||
int y = pos.y;
|
int y = pos.y;
|
||||||
@@ -116,84 +113,85 @@ 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 position = ::GetScrollPos((HWND) control, SB_CTL);
|
||||||
int minPos, maxPos;
|
int minPos, maxPos;
|
||||||
::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
|
::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
#if defined(__WIN95__)
|
||||||
// A page size greater than one has the effect of reducing the
|
// A page size greater than one has the effect of reducing the effective
|
||||||
// effective range, therefore the range has already been
|
// range, therefore the range has already been boosted artificially - so
|
||||||
// boosted artificially - so reduce it again.
|
// reduce it again.
|
||||||
if ( m_pageSize > 1 )
|
if ( m_pageSize > 1 )
|
||||||
maxPos -= (m_pageSize - 1);
|
maxPos -= (m_pageSize - 1);
|
||||||
#endif
|
#endif // __WIN95__
|
||||||
|
|
||||||
wxEventType scrollEvent = wxEVT_NULL;
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
|
|
||||||
int nScrollInc;
|
int nScrollInc;
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
{
|
{
|
||||||
case SB_TOP:
|
case SB_TOP:
|
||||||
nScrollInc = maxPos - position;
|
nScrollInc = maxPos - position;
|
||||||
scrollEvent = wxEVT_SCROLL_TOP;
|
scrollEvent = wxEVT_SCROLL_TOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_BOTTOM:
|
case SB_BOTTOM:
|
||||||
nScrollInc = - position;
|
nScrollInc = - position;
|
||||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
nScrollInc = -1;
|
nScrollInc = -1;
|
||||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
nScrollInc = 1;
|
nScrollInc = 1;
|
||||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
nScrollInc = -GetPageSize();
|
nScrollInc = -GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
nScrollInc = GetPageSize();
|
nScrollInc = GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_THUMBTRACK:
|
case SB_THUMBTRACK:
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
nScrollInc = pos - position;
|
nScrollInc = pos - position;
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nScrollInc = 0;
|
nScrollInc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nScrollInc != 0)
|
if ( nScrollInc == 0 )
|
||||||
{
|
{
|
||||||
int new_pos = position + nScrollInc;
|
// no event to process, so don't process it
|
||||||
|
return FALSE;
|
||||||
if (new_pos < 0)
|
|
||||||
new_pos = 0;
|
|
||||||
if (new_pos > maxPos)
|
|
||||||
new_pos = maxPos;
|
|
||||||
|
|
||||||
SetThumbPosition(new_pos);
|
|
||||||
wxScrollEvent event(scrollEvent, m_windowId);
|
|
||||||
event.SetPosition(new_pos);
|
|
||||||
event.SetEventObject( this );
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxScrollBar::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
int new_pos = position + nScrollInc;
|
||||||
{
|
|
||||||
MSWOnVScroll(wParam, pos, control);
|
if (new_pos < 0)
|
||||||
|
new_pos = 0;
|
||||||
|
if (new_pos > maxPos)
|
||||||
|
new_pos = maxPos;
|
||||||
|
|
||||||
|
SetThumbPosition(new_pos);
|
||||||
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
|
event.SetPosition(new_pos);
|
||||||
|
event.SetEventObject( this );
|
||||||
|
|
||||||
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxScrollBar::SetThumbPosition(int viewStart)
|
void wxScrollBar::SetThumbPosition(int viewStart)
|
||||||
@@ -233,7 +231,7 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
|
|||||||
// (see comment for SetPageLength)
|
// (see comment for SetPageLength)
|
||||||
if ( m_pageSize > 1 )
|
if ( m_pageSize > 1 )
|
||||||
{
|
{
|
||||||
range1 += (m_pageSize - 1);
|
range1 += (m_pageSize - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCROLLINFO info;
|
SCROLLINFO info;
|
||||||
@@ -291,7 +289,7 @@ void wxScrollBar::SetObjectLength(int objectLength)
|
|||||||
// (see comment for SetPageLength)
|
// (see comment for SetPageLength)
|
||||||
if ( m_pageSize > 1 )
|
if ( m_pageSize > 1 )
|
||||||
{
|
{
|
||||||
range += (m_pageSize - 1);
|
range += (m_pageSize - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCROLLINFO info;
|
SCROLLINFO info;
|
||||||
@@ -324,7 +322,7 @@ void wxScrollBar::GetValues(int *viewStart, int *viewLength, int *objectLength,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -75,9 +75,9 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_tickFreq = 0;
|
m_tickFreq = 0;
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
int x = pos.x;
|
int x = pos.x;
|
||||||
int y = pos.y;
|
int y = pos.y;
|
||||||
@@ -113,23 +113,23 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
msStyle = TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
msStyle = TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
||||||
|
|
||||||
if ( m_windowStyle & wxSL_AUTOTICKS )
|
if ( m_windowStyle & wxSL_AUTOTICKS )
|
||||||
msStyle |= TBS_AUTOTICKS ;
|
msStyle |= TBS_AUTOTICKS ;
|
||||||
|
|
||||||
if ( m_windowStyle & wxSL_LEFT )
|
if ( m_windowStyle & wxSL_LEFT )
|
||||||
msStyle |= TBS_LEFT;
|
msStyle |= TBS_LEFT;
|
||||||
else if ( m_windowStyle & wxSL_RIGHT )
|
else if ( m_windowStyle & wxSL_RIGHT )
|
||||||
msStyle |= TBS_RIGHT;
|
msStyle |= TBS_RIGHT;
|
||||||
else if ( m_windowStyle & wxSL_TOP )
|
else if ( m_windowStyle & wxSL_TOP )
|
||||||
msStyle |= TBS_TOP;
|
msStyle |= TBS_TOP;
|
||||||
else if ( m_windowStyle & wxSL_BOTTOM )
|
else if ( m_windowStyle & wxSL_BOTTOM )
|
||||||
msStyle |= TBS_BOTTOM;
|
msStyle |= TBS_BOTTOM;
|
||||||
else if ( m_windowStyle & wxSL_BOTH )
|
else if ( m_windowStyle & wxSL_BOTH )
|
||||||
msStyle |= TBS_BOTH;
|
msStyle |= TBS_BOTH;
|
||||||
else if ( ! (m_windowStyle & wxSL_AUTOTICKS) )
|
else if ( ! (m_windowStyle & wxSL_AUTOTICKS) )
|
||||||
msStyle |= TBS_NOTICKS;
|
msStyle |= TBS_NOTICKS;
|
||||||
|
|
||||||
if ( m_windowStyle & wxSL_SELRANGE )
|
if ( m_windowStyle & wxSL_SELRANGE )
|
||||||
msStyle |= TBS_ENABLESELRANGE ;
|
msStyle |= TBS_ENABLESELRANGE ;
|
||||||
|
|
||||||
HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxBuffer,
|
HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxBuffer,
|
||||||
msStyle,
|
msStyle,
|
||||||
@@ -167,14 +167,14 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
if (GetFont().GetResourceHandle())
|
if (GetFont().GetResourceHandle())
|
||||||
{
|
{
|
||||||
if ( m_staticMin )
|
if ( m_staticMin )
|
||||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||||
if ( m_staticMax )
|
if ( m_staticMax )
|
||||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
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
|
int position = 0; // Dummy - not used in this mode
|
||||||
|
|
||||||
@@ -194,74 +195,74 @@ void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
|||||||
wxEventType scrollEvent = wxEVT_NULL;
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
{
|
{
|
||||||
case SB_TOP:
|
case SB_TOP:
|
||||||
nScrollInc = m_rangeMax - position;
|
nScrollInc = m_rangeMax - position;
|
||||||
scrollEvent = wxEVT_SCROLL_TOP;
|
scrollEvent = wxEVT_SCROLL_TOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_BOTTOM:
|
case SB_BOTTOM:
|
||||||
nScrollInc = - position;
|
nScrollInc = - position;
|
||||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
nScrollInc = - GetLineSize();
|
nScrollInc = - GetLineSize();
|
||||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
nScrollInc = GetLineSize();
|
nScrollInc = GetLineSize();
|
||||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
nScrollInc = -GetPageSize();
|
nScrollInc = -GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
nScrollInc = GetPageSize();
|
nScrollInc = GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_THUMBTRACK:
|
case SB_THUMBTRACK:
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
nScrollInc = (signed short)pos - position;
|
nScrollInc = (signed short)pos - position;
|
||||||
#else
|
#else // Win16
|
||||||
nScrollInc = pos - position;
|
nScrollInc = pos - position;
|
||||||
#endif
|
#endif // Win32/16
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nScrollInc = 0;
|
nScrollInc = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( nScrollInc == 0 )
|
||||||
{
|
{
|
||||||
|
// no event...
|
||||||
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
|
return FALSE;
|
||||||
if (!(newPos < GetMin() || newPos > GetMax()))
|
|
||||||
{
|
|
||||||
SetValue(newPos);
|
|
||||||
|
|
||||||
wxScrollEvent event(scrollEvent, m_windowId);
|
|
||||||
event.SetPosition(newPos);
|
|
||||||
event.SetEventObject( this );
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
|
|
||||||
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
|
|
||||||
cevent.SetEventObject( this );
|
|
||||||
GetEventHandler()->ProcessEvent( cevent );
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxSlider95::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
|
||||||
{
|
if ( (newPos < GetMin()) || (newPos > GetMax()) )
|
||||||
MSWOnVScroll(wParam, pos, control);
|
{
|
||||||
|
// out of range - but we did process it
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetValue(newPos);
|
||||||
|
|
||||||
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
|
event.SetPosition(newPos);
|
||||||
|
event.SetEventObject( this );
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
|
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
|
||||||
|
cevent.SetEventObject( this );
|
||||||
|
|
||||||
|
return GetEventHandler()->ProcessEvent( cevent );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSlider95::~wxSlider95()
|
wxSlider95::~wxSlider95()
|
||||||
@@ -372,8 +373,8 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
|
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
|
||||||
{
|
{
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
{
|
{
|
||||||
int min_len = 0;
|
int min_len = 0;
|
||||||
|
|
||||||
GetWindowText((HWND) m_staticMin, buf, 300);
|
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||||
@@ -386,15 +387,15 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
{
|
{
|
||||||
int new_width = (int)(wxMax(min_len, max_len));
|
int new_width = (int)(wxMax(min_len, max_len));
|
||||||
int valueHeight = (int)cyf;
|
int valueHeight = (int)cyf;
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
// For some reason, under Win95, the text edit control has
|
// For some reason, under Win95, the text edit control has
|
||||||
// a lot of space before the first character
|
// a lot of space before the first character
|
||||||
new_width += 3*cx;
|
new_width += 3*cx;
|
||||||
#endif
|
#endif
|
||||||
// The height needs to be a bit bigger under Win95 if using native
|
// The height needs to be a bit bigger under Win95 if using native
|
||||||
// 3D effects.
|
// 3D effects.
|
||||||
valueHeight = (int) (valueHeight * 1.5) ;
|
valueHeight = (int) (valueHeight * 1.5) ;
|
||||||
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||||
x_offset += new_width + cx;
|
x_offset += new_width + cx;
|
||||||
}
|
}
|
||||||
@@ -405,8 +406,8 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
int slider_length = (int)(w1 - x_offset - max_len - cx);
|
int slider_length = (int)(w1 - x_offset - max_len - cx);
|
||||||
|
|
||||||
int slider_height = h1;
|
int slider_height = h1;
|
||||||
if (slider_height < 0 )
|
if (slider_height < 0 )
|
||||||
slider_height = 20;
|
slider_height = 20;
|
||||||
|
|
||||||
// Slider must have a minimum/default length/height
|
// Slider must have a minimum/default length/height
|
||||||
if (slider_length < 100)
|
if (slider_length < 100)
|
||||||
@@ -417,25 +418,25 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No labels
|
// No labels
|
||||||
// If we're prepared to use the existing size, then...
|
// If we're prepared to use the existing size, then...
|
||||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||||
{
|
{
|
||||||
GetSize(&w1, &h1);
|
GetSize(&w1, &h1);
|
||||||
}
|
}
|
||||||
if ( w1 < 0 )
|
if ( w1 < 0 )
|
||||||
w1 = 200;
|
w1 = 200;
|
||||||
if ( h1 < 0 )
|
if ( h1 < 0 )
|
||||||
h1 = 20;
|
h1 = 20;
|
||||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
{
|
{
|
||||||
int min_len;
|
int min_len;
|
||||||
GetWindowText((HWND) m_staticMin, buf, 300);
|
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||||
GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & this->GetFont());
|
GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & this->GetFont());
|
||||||
@@ -447,7 +448,7 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
{
|
{
|
||||||
int new_width = (int)(wxMax(min_len, max_len));
|
int new_width = (int)(wxMax(min_len, max_len));
|
||||||
int valueHeight = (int)cyf;
|
int valueHeight = (int)cyf;
|
||||||
/*** Suggested change by George Tasker - remove this block...
|
/*** Suggested change by George Tasker - remove this block...
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
// For some reason, under Win95, the text edit control has
|
// For some reason, under Win95, the text edit control has
|
||||||
@@ -458,8 +459,8 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
new_width += cx;
|
new_width += cx;
|
||||||
|
|
||||||
// The height needs to be a bit bigger under Win95 if using native
|
// The height needs to be a bit bigger under Win95 if using native
|
||||||
// 3D effects.
|
// 3D effects.
|
||||||
valueHeight = (int) (valueHeight * 1.5) ;
|
valueHeight = (int) (valueHeight * 1.5) ;
|
||||||
|
|
||||||
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||||
y_offset += valueHeight;
|
y_offset += valueHeight;
|
||||||
@@ -471,8 +472,8 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
int slider_length = (int)(h1 - y_offset - cy - cy);
|
int slider_length = (int)(h1 - y_offset - cy - cy);
|
||||||
|
|
||||||
int slider_width = w1;
|
int slider_width = w1;
|
||||||
if (slider_width < 0 )
|
if (slider_width < 0 )
|
||||||
slider_width = 20;
|
slider_width = 20;
|
||||||
|
|
||||||
// Slider must have a minimum/default length
|
// Slider must have a minimum/default length
|
||||||
if (slider_length < 100)
|
if (slider_length < 100)
|
||||||
@@ -483,20 +484,20 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No labels
|
// No labels
|
||||||
// If we're prepared to use the existing size, then...
|
// If we're prepared to use the existing size, then...
|
||||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||||
{
|
{
|
||||||
GetSize(&w1, &h1);
|
GetSize(&w1, &h1);
|
||||||
}
|
}
|
||||||
if ( w1 < 0 )
|
if ( w1 < 0 )
|
||||||
w1 = 20;
|
w1 = 20;
|
||||||
if ( h1 < 0 )
|
if ( h1 < 0 )
|
||||||
h1 = 200;
|
h1 = 200;
|
||||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,8 +511,8 @@ void wxSlider95::SetRange(int minValue, int maxValue)
|
|||||||
char buf[40];
|
char buf[40];
|
||||||
if ( m_staticMin )
|
if ( m_staticMin )
|
||||||
{
|
{
|
||||||
sprintf(buf, "%d", m_rangeMin);
|
sprintf(buf, "%d", m_rangeMin);
|
||||||
SetWindowText((HWND) m_staticMin, buf);
|
SetWindowText((HWND) m_staticMin, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_staticMax )
|
if ( m_staticMax )
|
||||||
@@ -522,10 +523,10 @@ void wxSlider95::SetRange(int minValue, int maxValue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxSlider95::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
WXHBRUSH wxSlider95::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Otherwise, it's a static
|
// Otherwise, it's a static
|
||||||
if (GetParent()->GetTransparentBackground())
|
if (GetParent()->GetTransparentBackground())
|
||||||
@@ -611,7 +612,7 @@ void wxSlider95::SetTick(int tickPos)
|
|||||||
|
|
||||||
bool wxSlider95::ContainsHWND(WXHWND hWnd) const
|
bool wxSlider95::ContainsHWND(WXHWND hWnd) const
|
||||||
{
|
{
|
||||||
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider95::Command (wxCommandEvent & event)
|
void wxSlider95::Command (wxCommandEvent & event)
|
||||||
@@ -622,7 +623,7 @@ void wxSlider95::Command (wxCommandEvent & event)
|
|||||||
|
|
||||||
bool wxSlider95::Show(bool show)
|
bool wxSlider95::Show(bool show)
|
||||||
{
|
{
|
||||||
wxWindow::Show(show);
|
wxWindow::Show(show);
|
||||||
|
|
||||||
int cshow;
|
int cshow;
|
||||||
if (show)
|
if (show)
|
||||||
@@ -631,11 +632,11 @@ bool wxSlider95::Show(bool show)
|
|||||||
cshow = SW_HIDE;
|
cshow = SW_HIDE;
|
||||||
|
|
||||||
if(m_staticValue)
|
if(m_staticValue)
|
||||||
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||||
if(m_staticMin)
|
if(m_staticMin)
|
||||||
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||||
if(m_staticMax)
|
if(m_staticMax)
|
||||||
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -69,9 +69,9 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_tickFreq = 0;
|
m_tickFreq = 0;
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
m_windowId = (int)NewControlId();
|
m_windowId = (int)NewControlId();
|
||||||
else
|
else
|
||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
int x = pos.x;
|
int x = pos.x;
|
||||||
int y = pos.y;
|
int y = pos.y;
|
||||||
@@ -138,14 +138,14 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
|||||||
// GetFont()->RealizeResource();
|
// GetFont()->RealizeResource();
|
||||||
if (GetFont().GetResourceHandle())
|
if (GetFont().GetResourceHandle())
|
||||||
{
|
{
|
||||||
if ( m_staticMin )
|
if ( m_staticMin )
|
||||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||||
if ( m_staticMax )
|
if ( m_staticMax )
|
||||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,8 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
|||||||
return TRUE;
|
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);
|
int position = ::GetScrollPos((HWND)control, SB_CTL);
|
||||||
|
|
||||||
@@ -164,75 +165,75 @@ void wxSliderMSW::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
|||||||
wxEventType scrollEvent = wxEVT_NULL;
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
{
|
{
|
||||||
case SB_TOP:
|
case SB_TOP:
|
||||||
nScrollInc = m_rangeMax - position;
|
nScrollInc = m_rangeMax - position;
|
||||||
scrollEvent = wxEVT_SCROLL_TOP;
|
scrollEvent = wxEVT_SCROLL_TOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_BOTTOM:
|
case SB_BOTTOM:
|
||||||
nScrollInc = - position;
|
nScrollInc = - position;
|
||||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
nScrollInc = - GetLineSize();
|
nScrollInc = - GetLineSize();
|
||||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
nScrollInc = GetLineSize();
|
nScrollInc = GetLineSize();
|
||||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
nScrollInc = -GetPageSize();
|
nScrollInc = -GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
nScrollInc = GetPageSize();
|
nScrollInc = GetPageSize();
|
||||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_THUMBTRACK:
|
case SB_THUMBTRACK:
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
nScrollInc = (signed short)pos - position;
|
nScrollInc = (signed short)pos - position;
|
||||||
#else
|
#else
|
||||||
nScrollInc = pos - position;
|
nScrollInc = pos - position;
|
||||||
#endif
|
#endif
|
||||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
nScrollInc = 0;
|
nScrollInc = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nScrollInc != 0)
|
if (nScrollInc == 0)
|
||||||
{
|
{
|
||||||
|
// no event...
|
||||||
int newPos = position + nScrollInc;
|
return FALSE;
|
||||||
|
|
||||||
if (!(newPos < GetMin() || newPos > GetMax()))
|
|
||||||
{
|
|
||||||
SetValue(newPos);
|
|
||||||
|
|
||||||
wxScrollEvent event(scrollEvent, m_windowId);
|
|
||||||
event.SetPosition(newPos);
|
|
||||||
event.SetEventObject( this );
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
|
|
||||||
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
|
|
||||||
cevent.SetEventObject( this );
|
|
||||||
GetEventHandler()->ProcessEvent( cevent );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void wxSliderMSW::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
int newPos = position + nScrollInc;
|
||||||
{
|
|
||||||
MSWOnVScroll(wParam, pos, control);
|
if ( (newPos < GetMin()) || (newPos > GetMax()) )
|
||||||
|
{
|
||||||
|
// out of range - but we did process it
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetValue(newPos);
|
||||||
|
|
||||||
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
|
event.SetPosition(newPos);
|
||||||
|
event.SetEventObject( this );
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
|
||||||
|
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
|
||||||
|
cevent.SetEventObject( this );
|
||||||
|
|
||||||
|
return GetEventHandler()->ProcessEvent( cevent );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSliderMSW::~wxSliderMSW()
|
wxSliderMSW::~wxSliderMSW()
|
||||||
@@ -343,8 +344,8 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
|
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
|
||||||
{
|
{
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
{
|
{
|
||||||
int min_len = 0;
|
int min_len = 0;
|
||||||
|
|
||||||
GetWindowText((HWND) m_staticMin, buf, 300);
|
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||||
@@ -357,7 +358,7 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
{
|
{
|
||||||
int new_width = (int)(wxMax(min_len, max_len));
|
int new_width = (int)(wxMax(min_len, max_len));
|
||||||
int valueHeight = (int)cyf;
|
int valueHeight = (int)cyf;
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
// For some reason, under Win95, the text edit control has
|
// For some reason, under Win95, the text edit control has
|
||||||
// a lot of space before the first character
|
// a lot of space before the first character
|
||||||
@@ -383,20 +384,20 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No labels
|
// No labels
|
||||||
if ( w1 < 0 )
|
if ( w1 < 0 )
|
||||||
w1 = 200;
|
w1 = 200;
|
||||||
if ( h1 < 0 )
|
if ( h1 < 0 )
|
||||||
h1 = 20;
|
h1 = 20;
|
||||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
{
|
{
|
||||||
int min_len;
|
int min_len;
|
||||||
GetWindowText((HWND) m_staticMin, buf, 300);
|
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||||
GetTextExtent(buf, &min_len, &cyf,NULL,NULL,& this->GetFont());
|
GetTextExtent(buf, &min_len, &cyf,NULL,NULL,& this->GetFont());
|
||||||
@@ -408,7 +409,7 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
{
|
{
|
||||||
int new_width = (int)(wxMax(min_len, max_len));
|
int new_width = (int)(wxMax(min_len, max_len));
|
||||||
int valueHeight = (int)cyf;
|
int valueHeight = (int)cyf;
|
||||||
/*** Suggested change by George Tasker - remove this block...
|
/*** Suggested change by George Tasker - remove this block...
|
||||||
#ifdef __WIN32__
|
#ifdef __WIN32__
|
||||||
// For some reason, under Win95, the text edit control has
|
// For some reason, under Win95, the text edit control has
|
||||||
@@ -439,15 +440,15 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
|||||||
|
|
||||||
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No labels
|
// No labels
|
||||||
if ( w1 < 0 )
|
if ( w1 < 0 )
|
||||||
w1 = 20;
|
w1 = 20;
|
||||||
if ( h1 < 0 )
|
if ( h1 < 0 )
|
||||||
h1 = 200;
|
h1 = 200;
|
||||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,8 +461,8 @@ void wxSliderMSW::SetRange(int minValue, int maxValue)
|
|||||||
char buf[40];
|
char buf[40];
|
||||||
if ( m_staticMin )
|
if ( m_staticMin )
|
||||||
{
|
{
|
||||||
sprintf(buf, "%d", m_rangeMin);
|
sprintf(buf, "%d", m_rangeMin);
|
||||||
SetWindowText((HWND) m_staticMin, buf);
|
SetWindowText((HWND) m_staticMin, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_staticMax )
|
if ( m_staticMax )
|
||||||
@@ -472,10 +473,10 @@ void wxSliderMSW::SetRange(int minValue, int maxValue)
|
|||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxSliderMSW::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
WXHBRUSH wxSliderMSW::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Otherwise, it's a static
|
// Otherwise, it's a static
|
||||||
if (GetParent()->GetTransparentBackground())
|
if (GetParent()->GetTransparentBackground())
|
||||||
@@ -553,7 +554,7 @@ void wxSliderMSW::SetTick(int tickPos)
|
|||||||
|
|
||||||
bool wxSliderMSW::ContainsHWND(WXHWND hWnd) const
|
bool wxSliderMSW::ContainsHWND(WXHWND hWnd) const
|
||||||
{
|
{
|
||||||
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSliderMSW::Command (wxCommandEvent & event)
|
void wxSliderMSW::Command (wxCommandEvent & event)
|
||||||
@@ -564,7 +565,7 @@ void wxSliderMSW::Command (wxCommandEvent & event)
|
|||||||
|
|
||||||
bool wxSliderMSW::Show(bool show)
|
bool wxSliderMSW::Show(bool show)
|
||||||
{
|
{
|
||||||
wxWindow::Show(show);
|
wxWindow::Show(show);
|
||||||
|
|
||||||
int cshow;
|
int cshow;
|
||||||
if (show)
|
if (show)
|
||||||
@@ -573,11 +574,11 @@ bool wxSliderMSW::Show(bool show)
|
|||||||
cshow = SW_HIDE;
|
cshow = SW_HIDE;
|
||||||
|
|
||||||
if(m_staticValue)
|
if(m_staticValue)
|
||||||
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||||
if(m_staticMin)
|
if(m_staticMin)
|
||||||
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||||
if(m_staticMax)
|
if(m_staticMax)
|
||||||
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,22 +6,22 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "spinbutt.h"
|
#pragma implementation "spinbutt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Can't resolve reference to CreateUpDownControl in
|
// Can't resolve reference to CreateUpDownControl in
|
||||||
@@ -33,17 +33,17 @@
|
|||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
#if !defined(__GNUWIN32__) || defined(__TWIN32__)
|
#if !defined(__GNUWIN32__) || defined(__TWIN32__)
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxSpinButton::wxSpinButton(void)
|
wxSpinButton::wxSpinButton()
|
||||||
{
|
{
|
||||||
m_min = 0;
|
m_min = 0;
|
||||||
m_max = 100;
|
m_max = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
||||||
@@ -81,11 +81,11 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
|
DWORD wstyle = WS_VISIBLE | WS_CHILD | WS_TABSTOP;
|
||||||
|
|
||||||
if ( m_windowStyle & wxSP_HORIZONTAL )
|
if ( m_windowStyle & wxSP_HORIZONTAL )
|
||||||
wstyle |= UDS_HORZ;
|
wstyle |= UDS_HORZ;
|
||||||
if ( m_windowStyle & wxSP_ARROW_KEYS )
|
if ( m_windowStyle & wxSP_ARROW_KEYS )
|
||||||
wstyle |= UDS_ARROWKEYS;
|
wstyle |= UDS_ARROWKEYS;
|
||||||
if ( m_windowStyle & wxSP_WRAP )
|
if ( m_windowStyle & wxSP_WRAP )
|
||||||
wstyle |= UDS_WRAP;
|
wstyle |= UDS_WRAP;
|
||||||
|
|
||||||
// Create the ListView control.
|
// Create the ListView control.
|
||||||
HWND hWndListControl = CreateUpDownControl(wstyle,
|
HWND hWndListControl = CreateUpDownControl(wstyle,
|
||||||
@@ -94,177 +94,106 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
m_windowId,
|
m_windowId,
|
||||||
wxGetInstance(),
|
wxGetInstance(),
|
||||||
0,
|
0,
|
||||||
m_min, m_max, m_min);
|
m_min, m_max, m_min);
|
||||||
|
|
||||||
m_hWnd = (WXHWND) hWndListControl;
|
m_hWnd = (WXHWND) hWndListControl;
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
// TODO: have this for all controls.
|
// TODO: have this for all controls.
|
||||||
if ( !m_hWnd )
|
if ( !m_hWnd )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
SubclassWin((WXHWND) m_hWnd);
|
SubclassWin((WXHWND) m_hWnd);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSpinButton::~wxSpinButton(void)
|
wxSpinButton::~wxSpinButton()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attributes
|
// Attributes
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
int wxSpinButton::GetValue(void) const
|
int wxSpinButton::GetValue() const
|
||||||
{
|
{
|
||||||
return (int) ::SendMessage((HWND) GetHWND(), UDM_GETPOS, 0, 0);
|
return (int) ::SendMessage((HWND) GetHWND(), UDM_GETPOS, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::SetValue(int val)
|
void wxSpinButton::SetValue(int val)
|
||||||
{
|
{
|
||||||
::SendMessage((HWND) GetHWND(), UDM_SETPOS, 0, (LPARAM) MAKELONG((short) val, 0));
|
::SendMessage((HWND) GetHWND(), UDM_SETPOS, 0, (LPARAM) MAKELONG((short) val, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSpinButton::SetRange(int minVal, int maxVal)
|
void wxSpinButton::SetRange(int minVal, int maxVal)
|
||||||
{
|
{
|
||||||
m_min = minVal;
|
m_min = minVal;
|
||||||
m_max = maxVal;
|
m_max = maxVal;
|
||||||
::SendMessage((HWND) GetHWND(), UDM_SETRANGE, 0,
|
::SendMessage((HWND) GetHWND(), UDM_SETRANGE, 0,
|
||||||
(LPARAM) MAKELONG((short)maxVal, (short)minVal));
|
(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);
|
wxSpinEvent event(wxEVT_NULL, m_windowId);
|
||||||
event.SetPosition(pos);
|
event.SetPosition(pos);
|
||||||
event.SetOrientation(wxVERTICAL);
|
event.SetOrientation(orientation);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject(this);
|
||||||
|
|
||||||
switch ( wParam )
|
switch ( wParam )
|
||||||
{
|
{
|
||||||
case SB_TOP:
|
case SB_TOP:
|
||||||
event.m_eventType = wxEVT_SCROLL_TOP;
|
event.m_eventType = wxEVT_SCROLL_TOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_BOTTOM:
|
case SB_BOTTOM:
|
||||||
event.m_eventType = wxEVT_SCROLL_BOTTOM;
|
event.m_eventType = wxEVT_SCROLL_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEUP:
|
case SB_LINEUP:
|
||||||
event.m_eventType = wxEVT_SCROLL_LINEUP;
|
event.m_eventType = wxEVT_SCROLL_LINEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_LINEDOWN:
|
case SB_LINEDOWN:
|
||||||
event.m_eventType = wxEVT_SCROLL_LINEDOWN;
|
event.m_eventType = wxEVT_SCROLL_LINEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEUP:
|
case SB_PAGEUP:
|
||||||
event.m_eventType = wxEVT_SCROLL_PAGEUP;
|
event.m_eventType = wxEVT_SCROLL_PAGEUP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_PAGEDOWN:
|
case SB_PAGEDOWN:
|
||||||
event.m_eventType = wxEVT_SCROLL_PAGEDOWN;
|
event.m_eventType = wxEVT_SCROLL_PAGEDOWN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SB_THUMBTRACK:
|
case SB_THUMBTRACK:
|
||||||
case SB_THUMBPOSITION:
|
case SB_THUMBPOSITION:
|
||||||
event.m_eventType = wxEVT_SCROLL_THUMBTRACK;
|
event.m_eventType = wxEVT_SCROLL_THUMBTRACK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
return FALSE;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
if (!GetEventHandler()->ProcessEvent(event))
|
|
||||||
Default();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxSpinButton::MSWOnHScroll( WXWORD wParam, WXWORD pos, WXHWND control)
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
||||||
{
|
{
|
||||||
// No command messages
|
// No command messages
|
||||||
return FALSE;
|
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
|
// Spin event
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
||||||
|
|
||||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id)
|
||||||
wxScrollEvent(commandType, id)
|
: wxScrollEvent(commandType, id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // __WIN95__
|
||||||
|
@@ -148,7 +148,7 @@ bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
return FALSE;
|
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);
|
wxTabEvent event(wxEVT_NULL, m_windowId);
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
@@ -171,12 +171,12 @@ bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return wxControl::MSWNotify(wParam, lParam, result);
|
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
event.SetEventType(eventType);
|
event.SetEventType(eventType);
|
||||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
event.SetInt(idCtrl) ;
|
||||||
|
|
||||||
return ProcessEvent(event);
|
return ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
@@ -346,7 +346,7 @@ bool wxToolBar95::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam),
|
bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
|
||||||
WXLPARAM lParam,
|
WXLPARAM lParam,
|
||||||
WXLPARAM *result)
|
WXLPARAM *result)
|
||||||
{
|
{
|
||||||
|
@@ -1234,7 +1234,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
|||||||
// For Rich Edit controls. Do we need it?
|
// For Rich Edit controls. Do we need it?
|
||||||
#if 0
|
#if 0
|
||||||
#if wxUSE_RICHEDIT
|
#if wxUSE_RICHEDIT
|
||||||
bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
bool wxTextCtrl::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
wxCommandEvent event(0, m_windowId);
|
wxCommandEvent event(0, m_windowId);
|
||||||
int eventType = 0;
|
int eventType = 0;
|
||||||
@@ -1243,7 +1243,7 @@ bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
{
|
{
|
||||||
// Insert case code here
|
// Insert case code here
|
||||||
default :
|
default :
|
||||||
return wxControl::MSWNotify(wParam, lParam);
|
return wxControl::MSWOnNotify(wParam, lParam);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -914,7 +914,7 @@ bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// process WM_NOTIFY Windows message
|
// 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);
|
wxTreeEvent event(wxEVT_NULL, m_windowId);
|
||||||
wxEventType eventType = wxEVT_NULL;
|
wxEventType eventType = wxEVT_NULL;
|
||||||
@@ -1050,7 +1050,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return wxControl::MSWNotify(wParam, lParam, result);
|
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
2053
src/msw/window.cpp
2053
src/msw/window.cpp
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user