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:
@@ -43,29 +43,16 @@
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_CLASS(wxColourDatabase, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
|
||||
/*
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxRealPoint, wxObject)
|
||||
*/
|
||||
IMPLEMENT_CLASS(wxColourDatabase, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxResourceCache, wxList)
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
|
||||
#endif
|
||||
|
||||
wxRect::wxRect()
|
||||
{
|
||||
x = 0; y = 0; width = 0; height = 0;
|
||||
}
|
||||
|
||||
wxRect::wxRect(long xx, long yy, long w, long h)
|
||||
{
|
||||
x = xx; y = yy; width = w; height = h;
|
||||
}
|
||||
|
||||
wxRect::wxRect(const wxPoint& topLeft, const wxPoint& bottomRight)
|
||||
{
|
||||
x = topLeft.x;
|
||||
@@ -92,21 +79,7 @@ wxRect::wxRect(const wxPoint& point, const wxSize& size)
|
||||
width = size.x; height = size.y;
|
||||
}
|
||||
|
||||
wxRect::wxRect(const wxRect& rect)
|
||||
{
|
||||
x = rect.x;
|
||||
y = rect.y;
|
||||
width = rect.width;
|
||||
height = rect.height;
|
||||
}
|
||||
|
||||
wxRect& wxRect::operator = (const wxRect& rect)
|
||||
{
|
||||
x = rect.x; y = rect.y; width = rect.width; height = rect.height;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool wxRect::operator == (const wxRect& rect)
|
||||
bool wxRect::operator==(const wxRect& rect) const
|
||||
{
|
||||
return ((x == rect.x) &&
|
||||
(y == rect.y) &&
|
||||
@@ -114,16 +87,7 @@ bool wxRect::operator == (const wxRect& rect)
|
||||
(height == rect.height));
|
||||
}
|
||||
|
||||
bool wxRect::operator != (const wxRect& rect)
|
||||
{
|
||||
return ((x != rect.x) ||
|
||||
(y != rect.y) ||
|
||||
(width != rect.width) ||
|
||||
(height != rect.height));
|
||||
}
|
||||
|
||||
wxColourDatabase::wxColourDatabase (int type):
|
||||
wxList (type)
|
||||
wxColourDatabase::wxColourDatabase (int type) : wxList (type)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -321,23 +285,29 @@ wxColour *wxColourDatabase::FindColour(const wxString& colour)
|
||||
|
||||
wxString wxColourDatabase::FindName (const wxColour& colour) const
|
||||
{
|
||||
unsigned char red = colour.Red ();
|
||||
unsigned char green = colour.Green ();
|
||||
unsigned char blue = colour.Blue ();
|
||||
wxString name;
|
||||
|
||||
for (wxNode * node = First (); node; node = node->Next ())
|
||||
{
|
||||
wxColour *col = (wxColour *) node->Data ();
|
||||
unsigned char red = colour.Red ();
|
||||
unsigned char green = colour.Green ();
|
||||
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();
|
||||
if (found)
|
||||
return wxString(found);
|
||||
}
|
||||
}
|
||||
return wxString(""); // Not Found
|
||||
const wxChar *found = node->GetKeyString();
|
||||
if ( found )
|
||||
{
|
||||
name = found;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
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
|
||||
|
@@ -178,7 +178,7 @@ wxWindowBase::~wxWindowBase()
|
||||
// Just in case we've loaded a top-level window via LoadNativeDialog but
|
||||
// we weren't a dialog class
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
|
||||
|
||||
wxASSERT_MSG( GetChildren().GetCount() == 0, "children not destroyed" );
|
||||
|
||||
if ( m_windowValidator )
|
||||
@@ -244,15 +244,21 @@ bool wxWindowBase::Close(bool force)
|
||||
bool wxWindowBase::DestroyChildren()
|
||||
{
|
||||
wxWindowList::Node *node;
|
||||
while ( (node = GetChildren().GetFirst()) )
|
||||
for ( ;; )
|
||||
{
|
||||
// we iterate until the list becomes empty
|
||||
node = GetChildren().GetFirst();
|
||||
if ( !node )
|
||||
break;
|
||||
|
||||
wxWindow *child = node->GetData();
|
||||
|
||||
wxASSERT_MSG( child, "m_children contains empty nodes" );
|
||||
|
||||
|
||||
wxASSERT_MSG( child, "children list contains empty nodes" );
|
||||
|
||||
delete child;
|
||||
|
||||
wxASSERT_MSG( !GetChildren().Find(child), "child didn't remove itself using RemoveChild()" );
|
||||
|
||||
wxASSERT_MSG( !GetChildren().Find(child),
|
||||
"child didn't remove itself using RemoveChild()" );
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
264
src/gtk/dc.cpp
264
src/gtk/dc.cpp
@@ -4,12 +4,12 @@
|
||||
// Author: Robert Roebling
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dc.h"
|
||||
#pragma implementation "dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
@@ -21,145 +21,40 @@
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define mm2inches 0.0393700787402
|
||||
#define inches2mm 25.4
|
||||
#define mm2twips 56.6929133859
|
||||
#define twips2mm 0.0176388888889
|
||||
#define mm2pt 2.83464566929
|
||||
#define pt2mm 0.352777777778
|
||||
#define mm2inches 0.0393700787402
|
||||
#define inches2mm 25.4
|
||||
#define mm2twips 56.6929133859
|
||||
#define twips2mm 0.0176388888889
|
||||
#define mm2pt 2.83464566929
|
||||
#define pt2mm 0.352777777778
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
|
||||
|
||||
wxDC::wxDC()
|
||||
{
|
||||
m_ok = FALSE;
|
||||
|
||||
m_optimize = FALSE;
|
||||
m_autoSetting = FALSE;
|
||||
m_colour = TRUE;
|
||||
m_clipping = FALSE;
|
||||
|
||||
|
||||
m_mm_to_pix_x = 1.0;
|
||||
m_mm_to_pix_y = 1.0;
|
||||
|
||||
m_logicalOriginX = 0;
|
||||
m_logicalOriginY = 0;
|
||||
m_deviceOriginX = 0;
|
||||
m_deviceOriginY = 0;
|
||||
|
||||
m_logicalScaleX = 1.0;
|
||||
m_logicalScaleY = 1.0;
|
||||
m_userScaleX = 1.0;
|
||||
m_userScaleY = 1.0;
|
||||
m_scaleX = 1.0;
|
||||
m_scaleY = 1.0;
|
||||
|
||||
m_mappingMode = wxMM_TEXT;
|
||||
|
||||
m_needComputeScaleX = FALSE; /* not used yet */
|
||||
m_needComputeScaleY = FALSE; /* not used yet */
|
||||
|
||||
m_signX = 1; /* default x-axis left to right */
|
||||
m_signY = 1; /* default y-axis top down. -1 in postscript. */
|
||||
|
||||
m_maxX = 0;
|
||||
m_maxY = 0;
|
||||
m_minX = 0;
|
||||
m_minY = 0;
|
||||
|
||||
m_logicalFunction = wxCOPY;
|
||||
// m_textAlignment = wxALIGN_TOP_LEFT;
|
||||
m_backgroundMode = wxTRANSPARENT;
|
||||
|
||||
m_textForegroundColour = *wxBLACK;
|
||||
m_textBackgroundColour = *wxWHITE;
|
||||
|
||||
m_pen = *wxBLACK_PEN;
|
||||
m_font = *wxNORMAL_FONT;
|
||||
m_brush = *wxTRANSPARENT_BRUSH;
|
||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
||||
|
||||
// m_palette = wxAPP_COLOURMAP; /* I'll learn to handle palettes later in my life */
|
||||
}
|
||||
|
||||
wxDC::~wxDC()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxDC::Ok() const
|
||||
{
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
void wxDC::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2),
|
||||
long WXUNUSED(xc), long WXUNUSED(yc) )
|
||||
{
|
||||
}
|
||||
|
||||
void wxDC::DrawPoint( wxPoint& point )
|
||||
{
|
||||
DrawPoint( point.x, point.y );
|
||||
}
|
||||
|
||||
void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for( wxNode *node = list->First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i++].y = point->y;
|
||||
}
|
||||
|
||||
DrawPolygon( n, points, xoffset, yoffset, fillStyle );
|
||||
delete[] points;
|
||||
}
|
||||
|
||||
void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for( wxNode *node = list->First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i++].y = point->y;
|
||||
}
|
||||
|
||||
DrawLines( n, points, xoffset, yoffset );
|
||||
delete []points;
|
||||
}
|
||||
|
||||
void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
|
||||
{
|
||||
wxList list;
|
||||
list.Append( (wxObject*)new wxPoint(x1, y1) );
|
||||
list.Append( (wxObject*)new wxPoint(x2, y2) );
|
||||
list.Append( (wxObject*)new wxPoint(x3, y3) );
|
||||
DrawSpline(&list);
|
||||
wxNode *node = list.First();
|
||||
while (node)
|
||||
{
|
||||
wxPoint *p = (wxPoint*)node->Data();
|
||||
delete p;
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxDC::DrawSpline( int n, wxPoint points[] )
|
||||
{
|
||||
wxList list;
|
||||
for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
|
||||
DrawSpline( &list );
|
||||
}
|
||||
|
||||
void wxDC::SetClippingRegion( long x, long y, long width, long height )
|
||||
void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipX1 = x;
|
||||
@@ -173,28 +68,17 @@ void wxDC::DestroyClippingRegion()
|
||||
m_clipping = FALSE;
|
||||
}
|
||||
|
||||
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
|
||||
{
|
||||
if (m_clipping)
|
||||
{
|
||||
if (x) *x = m_clipX1;
|
||||
if (y) *y = m_clipY1;
|
||||
if (width) *width = (m_clipX2 - m_clipX1);
|
||||
if (height) *height = (m_clipY2 - m_clipY1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// get DC capabilities
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxDC::GetSize( int* width, int* height ) const
|
||||
void wxDC::DoGetSize( int* width, int* height ) const
|
||||
{
|
||||
if (width) *width = m_maxX-m_minX;
|
||||
if (height) *height = m_maxY-m_minY;
|
||||
}
|
||||
|
||||
void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
void wxDC::DoGetSizeMM( int* width, int* height ) const
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
@@ -204,25 +88,42 @@ void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxDC::GetPPI(void) const
|
||||
wxSize wxDC::GetPPI() const
|
||||
{
|
||||
// TODO (should probably be pure virtual)
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
|
||||
void wxDC::SetTextForeground( const wxColour &col )
|
||||
{
|
||||
m_textForegroundColour = col;
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// set various DC parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxDC::SetTextBackground( const wxColour &col )
|
||||
void wxDC::ComputeScaleAndOrigin()
|
||||
{
|
||||
m_textBackgroundColour = col;
|
||||
// CMB: copy scale to see if it changes
|
||||
double origScaleX = m_scaleX;
|
||||
double origScaleY = m_scaleY;
|
||||
|
||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
||||
|
||||
// CMB: if scale has changed call SetPen to recalulate the line width
|
||||
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
||||
{
|
||||
// this is a bit artificial, but we need to force wxDC to think
|
||||
// the pen has changed
|
||||
// It gives an Assert, Robert Roebling
|
||||
/*
|
||||
wxPen pen = m_pen;
|
||||
m_pen = wxNullPen;
|
||||
SetPen( pen );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void wxDC::SetMapMode( int mode )
|
||||
{
|
||||
switch (mode)
|
||||
switch (mode)
|
||||
{
|
||||
case wxMM_TWIPS:
|
||||
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();
|
||||
}
|
||||
|
||||
void wxDC::GetUserScale( double *x, double *y )
|
||||
{
|
||||
if (x) *x = m_userScaleX;
|
||||
if (y) *y = m_userScaleY;
|
||||
}
|
||||
|
||||
void wxDC::SetLogicalScale( double x, double y )
|
||||
{
|
||||
// allow negative ?
|
||||
@@ -272,12 +167,6 @@ void wxDC::SetLogicalScale( double x, double y )
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
void wxDC::GetLogicalScale( double *x, double *y )
|
||||
{
|
||||
if (x) *x = m_logicalScaleX;
|
||||
if (y) *y = m_logicalScaleY;
|
||||
}
|
||||
|
||||
void wxDC::SetLogicalOrigin( long x, long y )
|
||||
{
|
||||
m_logicalOriginX = x * m_signX; // is this still correct ?
|
||||
@@ -285,26 +174,14 @@ void wxDC::SetLogicalOrigin( long x, long y )
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
void wxDC::GetLogicalOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_logicalOriginX;
|
||||
if (y) *y = m_logicalOriginY;
|
||||
}
|
||||
|
||||
void wxDC::SetDeviceOrigin( long x, long y )
|
||||
{
|
||||
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
|
||||
m_deviceOriginX = x;
|
||||
m_deviceOriginX = x;
|
||||
m_deviceOriginY = y;
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
void wxDC::GetDeviceOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_deviceOriginX;
|
||||
if (y) *y = m_deviceOriginY;
|
||||
}
|
||||
|
||||
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||
{
|
||||
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
|
||||
@@ -313,74 +190,47 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalX(long x) const
|
||||
// ---------------------------------------------------------------------------
|
||||
// coordinates transformations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
long wxDCBase::DeviceToLogicalX(long x) const
|
||||
{
|
||||
return XDEV2LOG(x);
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalY(long y) const
|
||||
long wxDCBase::DeviceToLogicalY(long y) const
|
||||
{
|
||||
return YDEV2LOG(y);
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalXRel(long x) const
|
||||
long wxDCBase::DeviceToLogicalXRel(long x) const
|
||||
{
|
||||
return XDEV2LOGREL(x);
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalYRel(long y) const
|
||||
long wxDCBase::DeviceToLogicalYRel(long y) const
|
||||
{
|
||||
return YDEV2LOGREL(y);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceX(long x) const
|
||||
long wxDCBase::LogicalToDeviceX(long x) const
|
||||
{
|
||||
return XLOG2DEV(x);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceY(long y) const
|
||||
long wxDCBase::LogicalToDeviceY(long y) const
|
||||
{
|
||||
return YLOG2DEV(y);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceXRel(long x) const
|
||||
long wxDCBase::LogicalToDeviceXRel(long x) const
|
||||
{
|
||||
return XLOG2DEVREL(x);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceYRel(long y) const
|
||||
long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||
{
|
||||
return YLOG2DEVREL(y);
|
||||
}
|
||||
|
||||
void wxDC::CalcBoundingBox( long x, long y )
|
||||
{
|
||||
if (x < m_minX) m_minX = x;
|
||||
if (y < m_minY) m_minY = y;
|
||||
if (x > m_maxX) m_maxX = x;
|
||||
if (y > m_maxY) m_maxY = y;
|
||||
}
|
||||
|
||||
void wxDC::ComputeScaleAndOrigin()
|
||||
{
|
||||
// CMB: copy scale to see if it changes
|
||||
double origScaleX = m_scaleX;
|
||||
double origScaleY = m_scaleY;
|
||||
|
||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
||||
|
||||
// CMB: if scale has changed call SetPen to recalulate the line width
|
||||
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
||||
{
|
||||
// this is a bit artificial, but we need to force wxDC to think
|
||||
// the pen has changed
|
||||
// It gives an Assert, Robert Roebling
|
||||
/*
|
||||
wxPen pen = m_pen;
|
||||
m_pen = wxNullPen;
|
||||
SetPen( pen );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
264
src/gtk1/dc.cpp
264
src/gtk1/dc.cpp
@@ -4,12 +4,12 @@
|
||||
// Author: Robert Roebling
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling, Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "dc.h"
|
||||
#pragma implementation "dc.h"
|
||||
#endif
|
||||
|
||||
#include "wx/dc.h"
|
||||
@@ -21,145 +21,40 @@
|
||||
// constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define mm2inches 0.0393700787402
|
||||
#define inches2mm 25.4
|
||||
#define mm2twips 56.6929133859
|
||||
#define twips2mm 0.0176388888889
|
||||
#define mm2pt 2.83464566929
|
||||
#define pt2mm 0.352777777778
|
||||
#define mm2inches 0.0393700787402
|
||||
#define inches2mm 25.4
|
||||
#define mm2twips 56.6929133859
|
||||
#define twips2mm 0.0176388888889
|
||||
#define mm2pt 2.83464566929
|
||||
#define pt2mm 0.352777777778
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxDC
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
|
||||
|
||||
wxDC::wxDC()
|
||||
{
|
||||
m_ok = FALSE;
|
||||
|
||||
m_optimize = FALSE;
|
||||
m_autoSetting = FALSE;
|
||||
m_colour = TRUE;
|
||||
m_clipping = FALSE;
|
||||
|
||||
|
||||
m_mm_to_pix_x = 1.0;
|
||||
m_mm_to_pix_y = 1.0;
|
||||
|
||||
m_logicalOriginX = 0;
|
||||
m_logicalOriginY = 0;
|
||||
m_deviceOriginX = 0;
|
||||
m_deviceOriginY = 0;
|
||||
|
||||
m_logicalScaleX = 1.0;
|
||||
m_logicalScaleY = 1.0;
|
||||
m_userScaleX = 1.0;
|
||||
m_userScaleY = 1.0;
|
||||
m_scaleX = 1.0;
|
||||
m_scaleY = 1.0;
|
||||
|
||||
m_mappingMode = wxMM_TEXT;
|
||||
|
||||
m_needComputeScaleX = FALSE; /* not used yet */
|
||||
m_needComputeScaleY = FALSE; /* not used yet */
|
||||
|
||||
m_signX = 1; /* default x-axis left to right */
|
||||
m_signY = 1; /* default y-axis top down. -1 in postscript. */
|
||||
|
||||
m_maxX = 0;
|
||||
m_maxY = 0;
|
||||
m_minX = 0;
|
||||
m_minY = 0;
|
||||
|
||||
m_logicalFunction = wxCOPY;
|
||||
// m_textAlignment = wxALIGN_TOP_LEFT;
|
||||
m_backgroundMode = wxTRANSPARENT;
|
||||
|
||||
m_textForegroundColour = *wxBLACK;
|
||||
m_textBackgroundColour = *wxWHITE;
|
||||
|
||||
m_pen = *wxBLACK_PEN;
|
||||
m_font = *wxNORMAL_FONT;
|
||||
m_brush = *wxTRANSPARENT_BRUSH;
|
||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
||||
|
||||
// m_palette = wxAPP_COLOURMAP; /* I'll learn to handle palettes later in my life */
|
||||
}
|
||||
|
||||
wxDC::~wxDC()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxDC::Ok() const
|
||||
{
|
||||
return m_ok;
|
||||
}
|
||||
|
||||
void wxDC::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2),
|
||||
long WXUNUSED(xc), long WXUNUSED(yc) )
|
||||
{
|
||||
}
|
||||
|
||||
void wxDC::DrawPoint( wxPoint& point )
|
||||
{
|
||||
DrawPoint( point.x, point.y );
|
||||
}
|
||||
|
||||
void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for( wxNode *node = list->First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i++].y = point->y;
|
||||
}
|
||||
|
||||
DrawPolygon( n, points, xoffset, yoffset, fillStyle );
|
||||
delete[] points;
|
||||
}
|
||||
|
||||
void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
|
||||
{
|
||||
int n = list->Number();
|
||||
wxPoint *points = new wxPoint[n];
|
||||
|
||||
int i = 0;
|
||||
for( wxNode *node = list->First(); node; node = node->Next() )
|
||||
{
|
||||
wxPoint *point = (wxPoint *)node->Data();
|
||||
points[i].x = point->x;
|
||||
points[i++].y = point->y;
|
||||
}
|
||||
|
||||
DrawLines( n, points, xoffset, yoffset );
|
||||
delete []points;
|
||||
}
|
||||
|
||||
void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
|
||||
{
|
||||
wxList list;
|
||||
list.Append( (wxObject*)new wxPoint(x1, y1) );
|
||||
list.Append( (wxObject*)new wxPoint(x2, y2) );
|
||||
list.Append( (wxObject*)new wxPoint(x3, y3) );
|
||||
DrawSpline(&list);
|
||||
wxNode *node = list.First();
|
||||
while (node)
|
||||
{
|
||||
wxPoint *p = (wxPoint*)node->Data();
|
||||
delete p;
|
||||
node = node->Next();
|
||||
}
|
||||
}
|
||||
|
||||
void wxDC::DrawSpline( int n, wxPoint points[] )
|
||||
{
|
||||
wxList list;
|
||||
for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
|
||||
DrawSpline( &list );
|
||||
}
|
||||
|
||||
void wxDC::SetClippingRegion( long x, long y, long width, long height )
|
||||
void wxDC::DoSetClippingRegion( long x, long y, long width, long height )
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipX1 = x;
|
||||
@@ -173,28 +68,17 @@ void wxDC::DestroyClippingRegion()
|
||||
m_clipping = FALSE;
|
||||
}
|
||||
|
||||
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
|
||||
{
|
||||
if (m_clipping)
|
||||
{
|
||||
if (x) *x = m_clipX1;
|
||||
if (y) *y = m_clipY1;
|
||||
if (width) *width = (m_clipX2 - m_clipX1);
|
||||
if (height) *height = (m_clipY2 - m_clipY1);
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *y = *width = *height = 0;
|
||||
}
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// get DC capabilities
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxDC::GetSize( int* width, int* height ) const
|
||||
void wxDC::DoGetSize( int* width, int* height ) const
|
||||
{
|
||||
if (width) *width = m_maxX-m_minX;
|
||||
if (height) *height = m_maxY-m_minY;
|
||||
}
|
||||
|
||||
void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
void wxDC::DoGetSizeMM( int* width, int* height ) const
|
||||
{
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
@@ -204,25 +88,42 @@ void wxDC::GetSizeMM( int* width, int* height ) const
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxDC::GetPPI(void) const
|
||||
wxSize wxDC::GetPPI() const
|
||||
{
|
||||
// TODO (should probably be pure virtual)
|
||||
return wxSize(0, 0);
|
||||
}
|
||||
|
||||
void wxDC::SetTextForeground( const wxColour &col )
|
||||
{
|
||||
m_textForegroundColour = col;
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// set various DC parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
void wxDC::SetTextBackground( const wxColour &col )
|
||||
void wxDC::ComputeScaleAndOrigin()
|
||||
{
|
||||
m_textBackgroundColour = col;
|
||||
// CMB: copy scale to see if it changes
|
||||
double origScaleX = m_scaleX;
|
||||
double origScaleY = m_scaleY;
|
||||
|
||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
||||
|
||||
// CMB: if scale has changed call SetPen to recalulate the line width
|
||||
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
||||
{
|
||||
// this is a bit artificial, but we need to force wxDC to think
|
||||
// the pen has changed
|
||||
// It gives an Assert, Robert Roebling
|
||||
/*
|
||||
wxPen pen = m_pen;
|
||||
m_pen = wxNullPen;
|
||||
SetPen( pen );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void wxDC::SetMapMode( int mode )
|
||||
{
|
||||
switch (mode)
|
||||
switch (mode)
|
||||
{
|
||||
case wxMM_TWIPS:
|
||||
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();
|
||||
}
|
||||
|
||||
void wxDC::GetUserScale( double *x, double *y )
|
||||
{
|
||||
if (x) *x = m_userScaleX;
|
||||
if (y) *y = m_userScaleY;
|
||||
}
|
||||
|
||||
void wxDC::SetLogicalScale( double x, double y )
|
||||
{
|
||||
// allow negative ?
|
||||
@@ -272,12 +167,6 @@ void wxDC::SetLogicalScale( double x, double y )
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
void wxDC::GetLogicalScale( double *x, double *y )
|
||||
{
|
||||
if (x) *x = m_logicalScaleX;
|
||||
if (y) *y = m_logicalScaleY;
|
||||
}
|
||||
|
||||
void wxDC::SetLogicalOrigin( long x, long y )
|
||||
{
|
||||
m_logicalOriginX = x * m_signX; // is this still correct ?
|
||||
@@ -285,26 +174,14 @@ void wxDC::SetLogicalOrigin( long x, long y )
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
void wxDC::GetLogicalOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_logicalOriginX;
|
||||
if (y) *y = m_logicalOriginY;
|
||||
}
|
||||
|
||||
void wxDC::SetDeviceOrigin( long x, long y )
|
||||
{
|
||||
// only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
|
||||
m_deviceOriginX = x;
|
||||
m_deviceOriginX = x;
|
||||
m_deviceOriginY = y;
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
void wxDC::GetDeviceOrigin( long *x, long *y )
|
||||
{
|
||||
if (x) *x = m_deviceOriginX;
|
||||
if (y) *y = m_deviceOriginY;
|
||||
}
|
||||
|
||||
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||
{
|
||||
// only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
|
||||
@@ -313,74 +190,47 @@ void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
|
||||
ComputeScaleAndOrigin();
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalX(long x) const
|
||||
// ---------------------------------------------------------------------------
|
||||
// coordinates transformations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
long wxDCBase::DeviceToLogicalX(long x) const
|
||||
{
|
||||
return XDEV2LOG(x);
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalY(long y) const
|
||||
long wxDCBase::DeviceToLogicalY(long y) const
|
||||
{
|
||||
return YDEV2LOG(y);
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalXRel(long x) const
|
||||
long wxDCBase::DeviceToLogicalXRel(long x) const
|
||||
{
|
||||
return XDEV2LOGREL(x);
|
||||
}
|
||||
|
||||
long wxDC::DeviceToLogicalYRel(long y) const
|
||||
long wxDCBase::DeviceToLogicalYRel(long y) const
|
||||
{
|
||||
return YDEV2LOGREL(y);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceX(long x) const
|
||||
long wxDCBase::LogicalToDeviceX(long x) const
|
||||
{
|
||||
return XLOG2DEV(x);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceY(long y) const
|
||||
long wxDCBase::LogicalToDeviceY(long y) const
|
||||
{
|
||||
return YLOG2DEV(y);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceXRel(long x) const
|
||||
long wxDCBase::LogicalToDeviceXRel(long x) const
|
||||
{
|
||||
return XLOG2DEVREL(x);
|
||||
}
|
||||
|
||||
long wxDC::LogicalToDeviceYRel(long y) const
|
||||
long wxDCBase::LogicalToDeviceYRel(long y) const
|
||||
{
|
||||
return YLOG2DEVREL(y);
|
||||
}
|
||||
|
||||
void wxDC::CalcBoundingBox( long x, long y )
|
||||
{
|
||||
if (x < m_minX) m_minX = x;
|
||||
if (y < m_minY) m_minY = y;
|
||||
if (x > m_maxX) m_maxX = x;
|
||||
if (y > m_maxY) m_maxY = y;
|
||||
}
|
||||
|
||||
void wxDC::ComputeScaleAndOrigin()
|
||||
{
|
||||
// CMB: copy scale to see if it changes
|
||||
double origScaleX = m_scaleX;
|
||||
double origScaleY = m_scaleY;
|
||||
|
||||
m_scaleX = m_logicalScaleX * m_userScaleX;
|
||||
m_scaleY = m_logicalScaleY * m_userScaleY;
|
||||
|
||||
// CMB: if scale has changed call SetPen to recalulate the line width
|
||||
if (m_scaleX != origScaleX || m_scaleY != origScaleY)
|
||||
{
|
||||
// this is a bit artificial, but we need to force wxDC to think
|
||||
// the pen has changed
|
||||
// It gives an Assert, Robert Roebling
|
||||
/*
|
||||
wxPen pen = m_pen;
|
||||
m_pen = wxNullPen;
|
||||
SetPen( pen );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -365,7 +365,7 @@ void wxCheckListBox::OnChar(wxKeyEvent& event)
|
||||
if ( event.KeyCode() == WXK_SPACE )
|
||||
GetItem(GetSelection())->Toggle();
|
||||
else
|
||||
wxListBox::OnChar(event);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 01/02/97
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -43,7 +43,7 @@
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxControl, wxWindow)
|
||||
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
|
||||
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
@@ -119,136 +119,54 @@ void wxFindMaxSize(WXHWND wnd, RECT *rect)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
// Not currently used
|
||||
void wxConvertDialogToPixels(wxWindow *control, int *x, int *y)
|
||||
#ifdef __WIN95__
|
||||
bool wxControl::MSWOnNotify(int idCtrl,
|
||||
WXLPARAM lParam,
|
||||
WXLPARAM* result)
|
||||
{
|
||||
if (control->m_windowParent && control->m_windowParent->is_dialog)
|
||||
{
|
||||
DWORD word = GetDialogBaseUnits();
|
||||
int xs = LOWORD(word);
|
||||
int ys = HIWORD(word);
|
||||
*x = (int)(*x * xs/4);
|
||||
*y = (int)(*y * ys/8);
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = *x;
|
||||
*y = *y;
|
||||
}
|
||||
}
|
||||
*/
|
||||
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;
|
||||
|
||||
void wxControl::MSWOnMouseMove(int x, int y, WXUINT flags)
|
||||
{
|
||||
/*
|
||||
// Trouble with this is that it sets the cursor for controls too :-(
|
||||
if (m_windowCursor.Ok() && !wxIsBusy())
|
||||
::SetCursor(m_windowCursor.GetHCURSOR());
|
||||
*/
|
||||
case NM_DBLCLK:
|
||||
eventType = wxEVT_COMMAND_LEFT_DCLICK;
|
||||
break;
|
||||
|
||||
if (!m_mouseInWindow)
|
||||
{
|
||||
// Generate an ENTER event
|
||||
m_mouseInWindow = TRUE;
|
||||
MSWOnMouseEnter(x, y, flags);
|
||||
}
|
||||
case NM_RCLICK:
|
||||
eventType = wxEVT_COMMAND_RIGHT_CLICK;
|
||||
break;
|
||||
|
||||
wxMouseEvent event(wxEVT_MOTION);
|
||||
case NM_RDBLCLK:
|
||||
eventType = wxEVT_COMMAND_RIGHT_DCLICK;
|
||||
break;
|
||||
|
||||
event.m_x = x; event.m_y = y;
|
||||
event.m_shiftDown = ((flags & MK_SHIFT) != 0);
|
||||
event.m_controlDown = ((flags & MK_CONTROL) != 0);
|
||||
event.m_leftDown = ((flags & MK_LBUTTON) != 0);
|
||||
event.m_middleDown = ((flags & MK_MBUTTON) != 0);
|
||||
event.m_rightDown = ((flags & MK_RBUTTON) != 0);
|
||||
event.SetTimestamp(wxApp::sm_lastMessageTime);
|
||||
event.SetEventObject( this );
|
||||
case NM_SETFOCUS:
|
||||
eventType = wxEVT_COMMAND_SET_FOCUS;
|
||||
break;
|
||||
|
||||
// Window gets a click down message followed by a mouse move
|
||||
// message even if position isn't changed! We want to discard
|
||||
// the trailing move event if x and y are the same.
|
||||
if ((m_lastMouseEvent == wxEVT_RIGHT_DOWN || m_lastMouseEvent == wxEVT_LEFT_DOWN ||
|
||||
m_lastMouseEvent == wxEVT_MIDDLE_DOWN) &&
|
||||
(m_lastMouseX == event.GetX() && m_lastMouseY == event.GetY()))
|
||||
{
|
||||
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
|
||||
m_lastMouseEvent = wxEVT_MOTION;
|
||||
return;
|
||||
}
|
||||
case NM_KILLFOCUS:
|
||||
eventType = wxEVT_COMMAND_KILL_FOCUS;
|
||||
break;
|
||||
|
||||
m_lastMouseEvent = wxEVT_MOTION;
|
||||
m_lastMouseX = event.GetX(); m_lastMouseY = event.GetY();
|
||||
case NM_RETURN:
|
||||
eventType = wxEVT_COMMAND_ENTER;
|
||||
break;
|
||||
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
Default();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
default:
|
||||
return wxWindow::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventType(eventType);
|
||||
event.SetEventObject(this);
|
||||
event.SetEventObject(this);
|
||||
|
||||
if ( !GetEventHandler()->ProcessEvent(event) )
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#else // !Win95
|
||||
return FALSE;
|
||||
#endif
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
#endif // Win95
|
||||
|
||||
void wxControl::ProcessCommand (wxCommandEvent & event)
|
||||
{
|
||||
|
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
|
||||
// for modal dialogs
|
||||
wxList wxModalDialogs;
|
||||
wxList wxModelessWindows; // Frames and modeless dialogs
|
||||
wxWindowList wxModalDialogs;
|
||||
wxWindowList wxModelessWindows; // Frames and modeless dialogs
|
||||
extern wxList WXDLLEXPORT wxPendingDelete;
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
@@ -58,12 +58,7 @@ extern wxList WXDLLEXPORT wxPendingDelete;
|
||||
END_EVENT_TABLE()
|
||||
#endif
|
||||
|
||||
bool wxDialog::MSWOnClose(void)
|
||||
{
|
||||
return Close();
|
||||
}
|
||||
|
||||
wxDialog::wxDialog(void)
|
||||
wxDialog::wxDialog()
|
||||
{
|
||||
m_isShown = FALSE;
|
||||
m_modalShowing = FALSE;
|
||||
@@ -235,7 +230,7 @@ void wxDialog::OnPaint(wxPaintEvent& event)
|
||||
// wxWindow::OnPaint(event);
|
||||
}
|
||||
|
||||
void wxDialog::Fit(void)
|
||||
void wxDialog::Fit()
|
||||
{
|
||||
wxWindow::Fit();
|
||||
}
|
||||
@@ -245,7 +240,7 @@ void wxDialog::Iconize(bool WXUNUSED(iconize))
|
||||
// Windows dialog boxes can't be iconized
|
||||
}
|
||||
|
||||
bool wxDialog::IsIconized(void) const
|
||||
bool wxDialog::IsIconized() const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -282,7 +277,7 @@ void wxDialog::GetPosition(int *x, int *y) const
|
||||
*y = rect.top;
|
||||
}
|
||||
|
||||
bool wxDialog::IsShown(void) const
|
||||
bool wxDialog::IsShown() const
|
||||
{
|
||||
return m_isShown;
|
||||
}
|
||||
@@ -299,13 +294,13 @@ bool wxDialog::Show(bool show)
|
||||
#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
|
||||
if (!modal) {
|
||||
if (show) {
|
||||
if (!wxModelessWindows.Member(this))
|
||||
wxModelessWindows.Append(this);
|
||||
if (!wxModelessWindows.Find(this))
|
||||
wxModelessWindows.Append(this);
|
||||
} else
|
||||
wxModelessWindows.DeleteObject(this);
|
||||
}
|
||||
if (show) {
|
||||
if (!wxTopLevelWindows.Member(this))
|
||||
if (!wxTopLevelWindows.Find(this))
|
||||
wxTopLevelWindows.Append(this);
|
||||
} else
|
||||
wxTopLevelWindows.DeleteObject(this);
|
||||
@@ -355,13 +350,13 @@ bool wxDialog::Show(bool show)
|
||||
EnableWindow((HWND) GetHWND(), TRUE);
|
||||
BringWindowToTop((HWND) GetHWND());
|
||||
|
||||
if (!wxModalDialogs.Member(this))
|
||||
if ( !wxModalDialogs.Find(this) )
|
||||
wxModalDialogs.Append(this);
|
||||
|
||||
MSG msg;
|
||||
// Must test whether this dialog still exists: we may not process
|
||||
// a message before the deletion.
|
||||
while (wxModalDialogs.Member(this) && m_modalShowing && GetMessage(&msg, NULL, 0, 0))
|
||||
while (wxModalDialogs.Find(this) && m_modalShowing && GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if ( m_acceleratorTable.Ok() &&
|
||||
::TranslateAccelerator((HWND)GetHWND(),
|
||||
@@ -394,7 +389,7 @@ bool wxDialog::Show(bool show)
|
||||
node=disabledWindows.First();
|
||||
while(node) {
|
||||
wxWindow* win = (wxWindow*) node->Data();
|
||||
if (wxModalDialogs.Member(win) || wxModelessWindows.Member(win))
|
||||
if (wxModalDialogs.Find(win) || wxModelessWindows.Find(win))
|
||||
{
|
||||
HWND hWnd = (HWND) win->GetHWND();
|
||||
if (::IsWindow(hWnd))
|
||||
@@ -480,7 +475,7 @@ void wxDialog::SetTitle(const wxString& title)
|
||||
SetWindowText((HWND) GetHWND(), (const char *)title);
|
||||
}
|
||||
|
||||
wxString wxDialog::GetTitle(void) const
|
||||
wxString wxDialog::GetTitle() const
|
||||
{
|
||||
GetWindowText((HWND) GetHWND(), wxBuffer, 1000);
|
||||
return wxString(wxBuffer);
|
||||
@@ -516,7 +511,7 @@ void wxDialog::Centre(int direction)
|
||||
}
|
||||
|
||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
||||
int wxDialog::ShowModal(void)
|
||||
int wxDialog::ShowModal()
|
||||
{
|
||||
m_windowStyle |= wxDIALOG_MODAL;
|
||||
Show(TRUE);
|
||||
@@ -605,7 +600,7 @@ void wxDialog::OnCloseWindow(wxCloseEvent& event)
|
||||
}
|
||||
|
||||
// Destroy the window (delayed, if a managed window)
|
||||
bool wxDialog::Destroy(void)
|
||||
bool wxDialog::Destroy()
|
||||
{
|
||||
if (!wxPendingDelete.Member(this))
|
||||
wxPendingDelete.Append(this);
|
||||
@@ -616,7 +611,8 @@ void wxDialog::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||
{
|
||||
// if we're using constraints - do use them
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if ( GetAutoLayout() ) {
|
||||
if ( GetAutoLayout() )
|
||||
{
|
||||
Layout();
|
||||
}
|
||||
#endif
|
||||
|
@@ -45,7 +45,7 @@
|
||||
#include <wx/msw/statbr95.h>
|
||||
#endif
|
||||
|
||||
extern wxList wxModelessWindows;
|
||||
extern wxWindowList wxModelessWindows;
|
||||
extern wxList WXDLLEXPORT wxPendingDelete;
|
||||
extern char wxFrameClassName[];
|
||||
extern wxMenu *wxCurrentPopupMenu;
|
||||
@@ -552,7 +552,7 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
*
|
||||
*/
|
||||
|
||||
void wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
|
||||
bool wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title,
|
||||
int x, int y, int width, int height, long style)
|
||||
|
||||
{
|
||||
@@ -611,12 +611,16 @@ void wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *
|
||||
extendedStyle |= WS_EX_TOPMOST;
|
||||
|
||||
m_iconized = FALSE;
|
||||
wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
|
||||
msflags, NULL, extendedStyle);
|
||||
if ( !wxWindow::MSWCreate(id, parent, wclass, wx_win, title, x, y, width, height,
|
||||
msflags, NULL, extendedStyle) )
|
||||
return FALSE;
|
||||
|
||||
// Seems to be necessary if we use WS_POPUP
|
||||
// style instead of WS_OVERLAPPED
|
||||
if (width > -1 && height > -1)
|
||||
::PostMessage((HWND) GetHWND(), WM_SIZE, SIZE_RESTORED, MAKELPARAM(width, height));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFrame::MSWOnPaint()
|
||||
@@ -673,60 +677,58 @@ WXHICON wxFrame::MSWOnQueryDragIcon()
|
||||
return m_defaultIcon;
|
||||
}
|
||||
|
||||
void wxFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
bool wxFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
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;
|
||||
bool processed = FALSE;
|
||||
|
||||
// restore all child frames too
|
||||
IconizeChildFrames(FALSE);
|
||||
switch ( id )
|
||||
{
|
||||
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:
|
||||
m_iconized = FALSE;
|
||||
break;
|
||||
// fall through
|
||||
|
||||
case SIZEICONIC:
|
||||
// iconize all child frames too
|
||||
IconizeChildFrames(TRUE);
|
||||
case SIZEFULLSCREEN:
|
||||
m_iconized = FALSE;
|
||||
break;
|
||||
|
||||
m_iconized = TRUE;
|
||||
break;
|
||||
}
|
||||
case SIZEICONIC:
|
||||
// iconize all child frames too
|
||||
IconizeChildFrames(TRUE);
|
||||
|
||||
if (!m_iconized)
|
||||
{
|
||||
// forward WM_SIZE to status bar control
|
||||
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 );
|
||||
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
|
||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||
}
|
||||
#endif // wxUSE_NATIVE_STATUSBAR
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
Default();
|
||||
}
|
||||
}
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
processed = GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
bool wxFrame::MSWOnClose()
|
||||
{
|
||||
return Close();
|
||||
return processed;
|
||||
}
|
||||
|
||||
bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
@@ -758,22 +760,6 @@ bool wxFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
return wxWindow::MSWOnCommand(id, cmd, control);
|
||||
}
|
||||
|
||||
void wxFrame::MSWOnMenuHighlight(WXWORD nItem, WXWORD nFlags, WXHMENU hSysMenu)
|
||||
{
|
||||
if (nFlags == 0xFFFF && hSysMenu == 0)
|
||||
{
|
||||
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, -1);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
|
||||
{
|
||||
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
|
||||
{
|
||||
return FALSE;
|
||||
@@ -788,44 +774,45 @@ bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Default resizing behaviour - if only ONE subwindow,
|
||||
// resize to client rectangle size
|
||||
// Default resizing behaviour - if only ONE subwindow, resize to client
|
||||
// rectangle size
|
||||
void wxFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
// if we're using constraints - do use them
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if ( GetAutoLayout() ) {
|
||||
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 we're using constraints - do use them
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if ( GetAutoLayout() )
|
||||
{
|
||||
if ( child )
|
||||
return; // it's our second subwindow - nothing to do
|
||||
child = win;
|
||||
Layout();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( child ) {
|
||||
// we have exactly one child - set it's size to fill the whole frame
|
||||
int clientW, clientH;
|
||||
GetClientSize(&clientW, &clientH);
|
||||
// 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 )
|
||||
return; // it's our second subwindow - nothing to do
|
||||
child = win;
|
||||
}
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
if ( child ) {
|
||||
// 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
|
||||
@@ -1031,14 +1018,79 @@ void wxFrame::PositionToolBar()
|
||||
}
|
||||
}
|
||||
|
||||
// propagate our state change to all child frames
|
||||
// propagate our state change to all child frames: this allows us to emulate X
|
||||
// Windows behaviour where child frames float independently of the parent one
|
||||
// on the desktop, but are iconized/restored with it
|
||||
void wxFrame::IconizeChildFrames(bool bIconize)
|
||||
{
|
||||
for ( wxNode *node = GetChildren().First(); node; node = node->Next() ) {
|
||||
wxWindow *win = (wxWindow *)node->Data();
|
||||
if ( win->IsKindOf(CLASSINFO(wxFrame)) ) {
|
||||
((wxFrame *)win)->Iconize(bIconize);
|
||||
for ( wxWindowList::Node *node = GetChildren().GetFirst();
|
||||
node;
|
||||
node = node->GetNext() )
|
||||
{
|
||||
wxWindow *win = node->GetData();
|
||||
|
||||
if ( win->IsKindOf(CLASSINFO(wxFrame)) )
|
||||
{
|
||||
((wxFrame *)win)->Iconize(bIconize);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// our private (non virtual) message handlers
|
||||
// ===========================================================================
|
||||
|
||||
bool wxFrame::HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu)
|
||||
{
|
||||
int item;
|
||||
if ( nFlags == 0xFFFF && hMenu == 0 )
|
||||
{
|
||||
// FIXME: what does this do? does it ever happen?
|
||||
item = -1;
|
||||
}
|
||||
else if ((nFlags != MF_SEPARATOR) && (nItem != 0) && (nItem != 65535))
|
||||
{
|
||||
item = nItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, item);
|
||||
event.SetEventObject( this );
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// the window proc for wxFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
long rc = 0;
|
||||
bool processed = FALSE;
|
||||
|
||||
switch ( message )
|
||||
{
|
||||
case WM_MENUSELECT:
|
||||
{
|
||||
WORD item = (WORD)wParam;
|
||||
#ifdef __WIN32__
|
||||
WORD flags = HIWORD(wParam);
|
||||
HMENU sysmenu = (HMENU)lParam;
|
||||
#else
|
||||
WORD flags = LOWORD(lParam);
|
||||
HMENU sysmenu = (HMENU)HIWORD(lParam);
|
||||
#endif
|
||||
processed = HandleMenuSelect(item, flags, (WXHMENU)sysmenu);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !processed )
|
||||
rc = wxWindow::MSWWindowProc(message, wParam, lParam);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@@ -83,9 +83,6 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
|
||||
// list box control implementation
|
||||
// ============================================================================
|
||||
|
||||
// this macro is dangerous but still better than tons of (HWND)GetHWND()
|
||||
#define hwnd (HWND)GetHWND()
|
||||
|
||||
bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
{
|
||||
/*
|
||||
@@ -213,7 +210,7 @@ bool wxListBox::Create(wxWindow *parent,
|
||||
#if wxUSE_CTL3D
|
||||
if (want3D)
|
||||
{
|
||||
Ctl3dSubclassCtl(hwnd);
|
||||
Ctl3dSubclassCtl(GetHwnd());
|
||||
m_useCtl3D = TRUE;
|
||||
}
|
||||
#endif
|
||||
@@ -227,7 +224,7 @@ bool wxListBox::Create(wxWindow *parent,
|
||||
}
|
||||
|
||||
if ( (m_windowStyle & wxLB_MULTIPLE) == 0 )
|
||||
SendMessage(hwnd, LB_SETCURSEL, 0, 0);
|
||||
SendMessage(GetHwnd(), LB_SETCURSEL, 0, 0);
|
||||
|
||||
SetFont(parent->GetFont());
|
||||
|
||||
@@ -259,7 +256,7 @@ void wxListBox::SetFirstItem(int N)
|
||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||
"invalid index in wxListBox::SetFirstItem" );
|
||||
|
||||
SendMessage(hwnd,LB_SETTOPINDEX,(WPARAM)N,(LPARAM)0) ;
|
||||
SendMessage(GetHwnd(),LB_SETTOPINDEX,(WPARAM)N,(LPARAM)0) ;
|
||||
}
|
||||
|
||||
void wxListBox::SetFirstItem(const wxString& s)
|
||||
@@ -275,7 +272,7 @@ void wxListBox::Delete(int N)
|
||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||
"invalid index in wxListBox::Delete" );
|
||||
|
||||
SendMessage(hwnd, LB_DELETESTRING, N, 0);
|
||||
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||
m_noItems--;
|
||||
|
||||
SetHorizontalExtent("");
|
||||
@@ -283,7 +280,7 @@ void wxListBox::Delete(int N)
|
||||
|
||||
void wxListBox::Append(const wxString& item)
|
||||
{
|
||||
int index = ListBox_AddString(hwnd, item);
|
||||
int index = ListBox_AddString(GetHwnd(), item);
|
||||
m_noItems ++;
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
@@ -291,7 +288,7 @@ void wxListBox::Append(const wxString& item)
|
||||
wxOwnerDrawn *pNewItem = CreateItem(index); // dummy argument
|
||||
pNewItem->SetName(item);
|
||||
m_aItems.Add(pNewItem);
|
||||
ListBox_SetItemData(hwnd, index, pNewItem);
|
||||
ListBox_SetItemData(GetHwnd(), index, pNewItem);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -300,7 +297,7 @@ void wxListBox::Append(const wxString& item)
|
||||
|
||||
void wxListBox::Append(const wxString& item, char *Client_data)
|
||||
{
|
||||
int index = ListBox_AddString(hwnd, item);
|
||||
int index = ListBox_AddString(GetHwnd(), item);
|
||||
m_noItems ++;
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
@@ -312,21 +309,21 @@ void wxListBox::Append(const wxString& item, char *Client_data)
|
||||
else
|
||||
#endif
|
||||
|
||||
ListBox_SetItemData(hwnd, index, Client_data);
|
||||
ListBox_SetItemData(GetHwnd(), index, Client_data);
|
||||
|
||||
SetHorizontalExtent(item);
|
||||
}
|
||||
|
||||
void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
||||
{
|
||||
ShowWindow(hwnd, SW_HIDE);
|
||||
ListBox_ResetContent(hwnd);
|
||||
ShowWindow(GetHwnd(), SW_HIDE);
|
||||
ListBox_ResetContent(GetHwnd());
|
||||
int i;
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
ListBox_AddString(hwnd, choices[i]);
|
||||
ListBox_AddString(GetHwnd(), choices[i]);
|
||||
if ( clientData )
|
||||
ListBox_SetItemData(hwnd, i, clientData[i]);
|
||||
ListBox_SetItemData(GetHwnd(), i, clientData[i]);
|
||||
}
|
||||
m_noItems = n;
|
||||
|
||||
@@ -344,7 +341,7 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
||||
wxOwnerDrawn *pNewItem = CreateItem(ui);
|
||||
pNewItem->SetName(choices[ui]);
|
||||
m_aItems.Add(pNewItem);
|
||||
ListBox_SetItemData(hwnd, ui, pNewItem);
|
||||
ListBox_SetItemData(GetHwnd(), ui, pNewItem);
|
||||
|
||||
wxASSERT_MSG(clientData[ui] == NULL,
|
||||
"Can't use client data with owner-drawn listboxes");
|
||||
@@ -353,12 +350,12 @@ void wxListBox::Set(int n, const wxString *choices, char** clientData)
|
||||
#endif
|
||||
|
||||
SetHorizontalExtent("");
|
||||
ShowWindow(hwnd, SW_SHOW);
|
||||
ShowWindow(GetHwnd(), SW_SHOW);
|
||||
}
|
||||
|
||||
int wxListBox::FindString(const wxString& s) const
|
||||
{
|
||||
int pos = ListBox_FindStringExact(hwnd, (WPARAM)-1, s);
|
||||
int pos = ListBox_FindStringExact(GetHwnd(), (WPARAM)-1, s);
|
||||
if (pos == LB_ERR)
|
||||
return -1;
|
||||
else
|
||||
@@ -367,7 +364,7 @@ int wxListBox::FindString(const wxString& s) const
|
||||
|
||||
void wxListBox::Clear()
|
||||
{
|
||||
ListBox_ResetContent(hwnd);
|
||||
ListBox_ResetContent(GetHwnd());
|
||||
|
||||
#if wxUSE_OWNER_DRAWN
|
||||
size_t uiCount = m_aItems.Count();
|
||||
@@ -379,7 +376,7 @@ void wxListBox::Clear()
|
||||
#endif // wxUSE_OWNER_DRAWN
|
||||
|
||||
m_noItems = 0;
|
||||
ListBox_GetHorizontalExtent(hwnd);
|
||||
ListBox_GetHorizontalExtent(GetHwnd());
|
||||
}
|
||||
|
||||
void wxListBox::SetSelection(int N, bool select)
|
||||
@@ -388,13 +385,13 @@ void wxListBox::SetSelection(int N, bool select)
|
||||
"invalid index in wxListBox::SetSelection" );
|
||||
|
||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
||||
SendMessage(hwnd, LB_SETSEL, select, N);
|
||||
SendMessage(GetHwnd(), LB_SETSEL, select, N);
|
||||
else
|
||||
{
|
||||
int N1 = N;
|
||||
if (!select)
|
||||
N1 = -1;
|
||||
SendMessage(hwnd, LB_SETCURSEL, N1, 0);
|
||||
SendMessage(GetHwnd(), LB_SETCURSEL, N1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +400,7 @@ bool wxListBox::Selected(int N) const
|
||||
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
|
||||
"invalid index in wxListBox::Selected" );
|
||||
|
||||
return SendMessage(hwnd, LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
|
||||
return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
void wxListBox::Deselect(int N)
|
||||
@@ -412,7 +409,7 @@ void wxListBox::Deselect(int N)
|
||||
"invalid index in wxListBox::Deselect" );
|
||||
|
||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
||||
SendMessage(hwnd, LB_SETSEL, FALSE, N);
|
||||
SendMessage(GetHwnd(), LB_SETSEL, FALSE, N);
|
||||
}
|
||||
|
||||
char *wxListBox::GetClientData(int N) const
|
||||
@@ -420,7 +417,7 @@ char *wxListBox::GetClientData(int N) const
|
||||
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
|
||||
"invalid index in wxListBox::GetClientData" );
|
||||
|
||||
return (char *)SendMessage(hwnd, LB_GETITEMDATA, N, 0);
|
||||
return (char *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0);
|
||||
}
|
||||
|
||||
void wxListBox::SetClientData(int N, char *Client_data)
|
||||
@@ -428,7 +425,7 @@ void wxListBox::SetClientData(int N, char *Client_data)
|
||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||
"invalid index in wxListBox::SetClientData" );
|
||||
|
||||
if ( ListBox_SetItemData(hwnd, N, Client_data) == LB_ERR )
|
||||
if ( ListBox_SetItemData(GetHwnd(), N, Client_data) == LB_ERR )
|
||||
wxLogDebug("LB_SETITEMDATA failed");
|
||||
}
|
||||
|
||||
@@ -439,10 +436,10 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
||||
|
||||
if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED))
|
||||
{
|
||||
int no_sel = ListBox_GetSelCount(hwnd);
|
||||
int no_sel = ListBox_GetSelCount(GetHwnd());
|
||||
if (no_sel != 0) {
|
||||
int *selections = new int[no_sel];
|
||||
if ( ListBox_GetSelItems(hwnd, no_sel, selections) == LB_ERR ) {
|
||||
if ( ListBox_GetSelItems(GetHwnd(), no_sel, selections) == LB_ERR ) {
|
||||
wxFAIL_MSG("This listbox can't have single-selection style!");
|
||||
}
|
||||
|
||||
@@ -457,7 +454,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
|
||||
}
|
||||
else // single-selection listbox
|
||||
{
|
||||
aSelections.Add(ListBox_GetCurSel(hwnd));
|
||||
aSelections.Add(ListBox_GetCurSel(GetHwnd()));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -472,7 +469,7 @@ int wxListBox::GetSelection() const
|
||||
"GetSelection() can't be used with multiple-selection "
|
||||
"listboxes, use GetSelections() instead." );
|
||||
|
||||
return ListBox_GetCurSel(hwnd);
|
||||
return ListBox_GetCurSel(GetHwnd());
|
||||
}
|
||||
|
||||
// Find string for position
|
||||
@@ -481,11 +478,11 @@ wxString wxListBox::GetString(int N) const
|
||||
wxCHECK_MSG( N >= 0 && N < m_noItems, "",
|
||||
"invalid index in wxListBox::GetClientData" );
|
||||
|
||||
int len = ListBox_GetTextLen(hwnd, N);
|
||||
int len = ListBox_GetTextLen(GetHwnd(), N);
|
||||
|
||||
// +1 for terminating NUL
|
||||
wxString result;
|
||||
ListBox_GetText(hwnd, N, result.GetWriteBuf(len + 1));
|
||||
ListBox_GetText(GetHwnd(), N, result.GetWriteBuf(len + 1));
|
||||
result.UngetWriteBuf();
|
||||
|
||||
return result;
|
||||
@@ -540,7 +537,7 @@ void wxListBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
if (control_width <= 0)
|
||||
control_width = (float)DEFAULT_ITEM_WIDTH;
|
||||
|
||||
MoveWindow(hwnd,
|
||||
MoveWindow(GetHwnd(),
|
||||
(int)control_x, (int)control_y,
|
||||
(int)control_width, (int)control_height,
|
||||
TRUE);
|
||||
@@ -560,8 +557,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
||||
|
||||
if (s != "")
|
||||
{
|
||||
int existingExtent = (int)SendMessage(hwnd, LB_GETHORIZONTALEXTENT, 0, 0L);
|
||||
HDC dc = GetWindowDC(hwnd);
|
||||
int existingExtent = (int)SendMessage(GetHwnd(), LB_GETHORIZONTALEXTENT, 0, 0L);
|
||||
HDC dc = GetWindowDC(GetHwnd());
|
||||
HFONT oldFont = 0;
|
||||
if (GetFont().Ok() && GetFont().GetResourceHandle())
|
||||
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
||||
@@ -574,15 +571,15 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
||||
if (oldFont)
|
||||
::SelectObject(dc, oldFont);
|
||||
|
||||
ReleaseDC(hwnd, dc);
|
||||
ReleaseDC(GetHwnd(), dc);
|
||||
if (extentX > existingExtent)
|
||||
SendMessage(hwnd, LB_SETHORIZONTALEXTENT, LOWORD(extentX), 0L);
|
||||
SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(extentX), 0L);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int largestExtent = 0;
|
||||
HDC dc = GetWindowDC(hwnd);
|
||||
HDC dc = GetWindowDC(GetHwnd());
|
||||
HFONT oldFont = 0;
|
||||
if (GetFont().Ok() && GetFont().GetResourceHandle())
|
||||
oldFont = (HFONT) ::SelectObject(dc, (HFONT) GetFont().GetResourceHandle());
|
||||
@@ -591,7 +588,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
||||
int i;
|
||||
for (i = 0; i < m_noItems; i++)
|
||||
{
|
||||
int len = (int)SendMessage(hwnd, LB_GETTEXT, i, (LONG)wxBuffer);
|
||||
int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer);
|
||||
wxBuffer[len] = 0;
|
||||
SIZE extentXY;
|
||||
::GetTextExtentPoint(dc, (LPSTR)wxBuffer, len, &extentXY);
|
||||
@@ -602,8 +599,8 @@ void wxListBox::SetHorizontalExtent(const wxString& s)
|
||||
if (oldFont)
|
||||
::SelectObject(dc, oldFont);
|
||||
|
||||
ReleaseDC(hwnd, dc);
|
||||
SendMessage(hwnd, LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
|
||||
ReleaseDC(GetHwnd(), dc);
|
||||
SendMessage(GetHwnd(), LB_SETHORIZONTALEXTENT, LOWORD(largestExtent), 0L);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -615,7 +612,7 @@ wxListBox::InsertItems(int nItems, const wxString items[], int pos)
|
||||
|
||||
int i;
|
||||
for (i = 0; i < nItems; i++)
|
||||
ListBox_InsertString(hwnd, i + pos, items[i]);
|
||||
ListBox_InsertString(GetHwnd(), i + pos, items[i]);
|
||||
m_noItems += nItems;
|
||||
|
||||
SetHorizontalExtent("");
|
||||
@@ -632,13 +629,13 @@ void wxListBox::SetString(int N, const wxString& s)
|
||||
|
||||
char *oldData = (char *)wxListBox::GetClientData(N);
|
||||
|
||||
SendMessage(hwnd, LB_DELETESTRING, N, 0);
|
||||
SendMessage(GetHwnd(), LB_DELETESTRING, N, 0);
|
||||
|
||||
int newN = N;
|
||||
if (N == (m_noItems - 1))
|
||||
newN = -1;
|
||||
|
||||
SendMessage(hwnd, LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
|
||||
SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const char *)s);
|
||||
if (oldData)
|
||||
wxListBox::SetClientData(N, oldData);
|
||||
|
||||
@@ -769,7 +766,7 @@ bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
|
||||
|
||||
DRAWITEMSTRUCT *pStruct = (DRAWITEMSTRUCT *)item;
|
||||
|
||||
long data = ListBox_GetItemData(hwnd, pStruct->itemID);
|
||||
long data = ListBox_GetItemData(GetHwnd(), pStruct->itemID);
|
||||
|
||||
wxCHECK( data && (data != LB_ERR), FALSE );
|
||||
|
||||
|
@@ -1157,7 +1157,7 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
else return FALSE;
|
||||
}
|
||||
|
||||
bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
{
|
||||
wxListEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
@@ -1275,7 +1275,7 @@ bool wxListCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
}
|
||||
|
||||
default :
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject( this );
|
||||
|
474
src/msw/mdi.cpp
474
src/msw/mdi.cpp
@@ -9,73 +9,102 @@
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ===========================================================================
|
||||
// declarations
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// headers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "mdi.h"
|
||||
#pragma implementation "mdi.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/setup.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/menu.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/settings.h"
|
||||
#include "wx/setup.h"
|
||||
#include "wx/frame.h"
|
||||
#include "wx/menu.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/utils.h"
|
||||
#include "wx/dialog.h"
|
||||
#include "wx/statusbr.h"
|
||||
#include "wx/settings.h"
|
||||
#endif
|
||||
|
||||
#include "wx/mdi.h"
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
#include <wx/msw/statbr95.h>
|
||||
#include <wx/msw/statbr95.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
extern wxList wxModelessWindows;
|
||||
// ---------------------------------------------------------------------------
|
||||
// global variables
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
extern wxWindowList wxModelessWindows; // from dialog.cpp
|
||||
extern wxMenu *wxCurrentPopupMenu;
|
||||
|
||||
#define IDM_WINDOWTILE 4001
|
||||
#define IDM_WINDOWCASCADE 4002
|
||||
#define IDM_WINDOWICONS 4003
|
||||
#define IDM_WINDOWNEXT 4004
|
||||
// This range gives a maximum of 500
|
||||
// MDI children. Should be enough :-)
|
||||
#define wxFIRST_MDI_CHILD 4100
|
||||
#define wxLAST_MDI_CHILD 4600
|
||||
|
||||
// Status border dimensions
|
||||
#define wxTHICK_LINE_BORDER 3
|
||||
#define wxTHICK_LINE_WIDTH 1
|
||||
|
||||
extern char wxMDIFrameClassName[];
|
||||
extern char wxMDIChildFrameClassName[];
|
||||
extern wxWindow *wxWndHook;
|
||||
extern wxWindow *wxWndHook; // from window.cpp
|
||||
|
||||
extern wxList *wxWinHandleList;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// constants
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static const int IDM_WINDOWTILE = 4001;
|
||||
static const int IDM_WINDOWCASCADE = 4002;
|
||||
static const int IDM_WINDOWICONS = 4003;
|
||||
static const int IDM_WINDOWNEXT = 4004;
|
||||
|
||||
// This range gives a maximum of 500 MDI children. Should be enough :-)
|
||||
static const int wxFIRST_MDI_CHILD = 4100;
|
||||
static const int wxLAST_MDI_CHILD = 4600;
|
||||
|
||||
// Status border dimensions
|
||||
static const int wxTHICK_LINE_BORDER = 3;
|
||||
static const int wxTHICK_LINE_WIDTH = 1;
|
||||
|
||||
// ===========================================================================
|
||||
// implementation
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxWin macros
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
|
||||
#endif // USE_SHARED_LIBRARY
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
|
||||
EVT_SIZE(wxMDIParentFrame::OnSize)
|
||||
EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
|
||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||
EVT_SIZE(wxMDIParentFrame::OnSize)
|
||||
EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
|
||||
EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
|
||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||
EVT_SCROLL(wxMDIClientWindow::OnScroll)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#endif
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMDIParentFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
wxMDIParentFrame::wxMDIParentFrame()
|
||||
{
|
||||
@@ -86,12 +115,12 @@ wxMDIParentFrame::wxMDIParentFrame()
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_defaultIcon = (WXHICON) (wxSTD_MDIPARENTFRAME_ICON ? wxSTD_MDIPARENTFRAME_ICON : wxDEFAULT_MDIPARENTFRAME_ICON);
|
||||
|
||||
@@ -163,30 +192,6 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
||||
delete m_clientWindow;
|
||||
}
|
||||
|
||||
// Get size *available for subwindows* i.e. excluding menu bar.
|
||||
void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
|
||||
{
|
||||
RECT rect;
|
||||
::GetClientRect((HWND) GetHWND(), &rect);
|
||||
|
||||
int cwidth = rect.right;
|
||||
int cheight = rect.bottom;
|
||||
|
||||
if ( GetStatusBar() )
|
||||
{
|
||||
int sw, sh;
|
||||
GetStatusBar()->GetSize(&sw, &sh);
|
||||
cheight -= sh;
|
||||
}
|
||||
|
||||
wxPoint pt(GetClientAreaOrigin());
|
||||
cheight -= pt.y;
|
||||
cwidth -= pt.x;
|
||||
|
||||
*x = cwidth;
|
||||
*y = cheight;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
{
|
||||
if (!menu_bar)
|
||||
@@ -246,9 +251,13 @@ void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
#if wxUSE_CONSTRAINTS
|
||||
if (GetAutoLayout())
|
||||
Layout();
|
||||
#endif
|
||||
if ( GetAutoLayout() )
|
||||
{
|
||||
Layout();
|
||||
return;
|
||||
}
|
||||
#endif // wxUSE_CONSTRAINTS
|
||||
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width, height;
|
||||
@@ -256,15 +265,6 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
||||
|
||||
if ( GetClientWindow() )
|
||||
GetClientWindow()->SetSize(x, y, width, height);
|
||||
|
||||
/* Already done in MSWOnSize
|
||||
// forward WM_SIZE to status bar control
|
||||
#if wxUSE_NATIVE_STATUSBAR
|
||||
if (m_frameStatusBar && m_frameStatusBar->IsKindOf(CLASSINFO(wxStatusBar95)))
|
||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||
#endif
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||
@@ -275,19 +275,19 @@ void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||
// Returns the active MDI child window
|
||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||
{
|
||||
// HWND hWnd = (HWND)LOWORD(SendMessage((HWND) GetClientWindow()->GetHWND(), WM_MDIGETACTIVE, 0, 0L));
|
||||
HWND hWnd = (HWND)SendMessage((HWND) GetClientWindow()->GetHWND(), WM_MDIGETACTIVE, 0, 0L);
|
||||
if (hWnd == 0)
|
||||
return NULL;
|
||||
else
|
||||
return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd);
|
||||
HWND hWnd = (HWND)::SendMessage(GetWinHwnd(GetClientWindow()),
|
||||
WM_MDIGETACTIVE, 0, 0L);
|
||||
if ( hWnd == 0 )
|
||||
return NULL;
|
||||
else
|
||||
return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd);
|
||||
}
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
// Create the client window class (don't Create the window, just return a new
|
||||
// class)
|
||||
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
|
||||
{
|
||||
return new wxMDIClientWindow ;
|
||||
return new wxMDIClientWindow;
|
||||
}
|
||||
|
||||
// Responds to colour changes, and passes event on to children.
|
||||
@@ -314,100 +314,110 @@ void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||
// MDI operations
|
||||
void wxMDIParentFrame::Cascade()
|
||||
{
|
||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDICASCADE, 0, 0);
|
||||
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::Tile()
|
||||
{
|
||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDITILE, MDITILE_HORIZONTAL, 0);
|
||||
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, MDITILE_HORIZONTAL, 0);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ArrangeIcons()
|
||||
{
|
||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDIICONARRANGE, 0, 0);
|
||||
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDIICONARRANGE, 0, 0);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivateNext()
|
||||
{
|
||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDINEXT, 0, 0);
|
||||
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 0);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::ActivatePrevious()
|
||||
{
|
||||
::SendMessage( (HWND) GetClientWindow()->GetHWND(), WM_MDINEXT, 0, 1);
|
||||
::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
// Returns a style for the client window - usually 0
|
||||
// or, for example, wxHSCROLL | wxVSCROLL
|
||||
long wxMDIParentFrame::GetClientStyle() const
|
||||
// the MDI parent frame window proc
|
||||
long wxMDIParentFrame::MSWWindowProc(WXUINT message,
|
||||
WXWPARAM wParam,
|
||||
WXLPARAM lParam)
|
||||
{
|
||||
return wxHSCROLL | wxVSCROLL ;
|
||||
}
|
||||
*/
|
||||
long rc = 0;
|
||||
bool processed = FALSE;
|
||||
|
||||
bool wxMDIParentFrame::MSWOnDestroy()
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
switch ( message )
|
||||
{
|
||||
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))
|
||||
{
|
||||
m_clientWindow = OnCreateClient();
|
||||
// Uses own style for client style
|
||||
m_clientWindow->CreateClient(this, GetWindowStyleFlag());
|
||||
}
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case SIZEFULLSCREEN:
|
||||
case SIZENORMAL:
|
||||
m_iconized = FALSE;
|
||||
break;
|
||||
case SIZEICONIC:
|
||||
m_iconized = TRUE;
|
||||
break;
|
||||
}
|
||||
processed = 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 );
|
||||
case WM_ERASEBKGND:
|
||||
processed = TRUE;
|
||||
|
||||
((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
|
||||
if ( m_parentFrameActive )
|
||||
{
|
||||
processed = HandleMenuSelect(item, flags, (WXHMENU)menu);
|
||||
}
|
||||
else if (m_currentChild)
|
||||
{
|
||||
processed = m_currentChild->
|
||||
HandleMenuSelect(item, flags, (WXHMENU)menu);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
if ( !processed )
|
||||
rc = wxFrame::MSWWindowProc(message, wParam, lParam);
|
||||
|
||||
wxSizeEvent event(wxSize(x, y), m_windowId);
|
||||
event.SetEventObject( this );
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
Default();
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::MSWOnActivate(int state, bool minimized, WXHWND activate)
|
||||
{
|
||||
wxWindow::MSWOnActivate(state, minimized, activate);
|
||||
bool processed = FALSE;
|
||||
|
||||
if ( wxWindow::MSWOnActivate(state, minimized, activate) )
|
||||
{
|
||||
// already processed
|
||||
processed = TRUE;
|
||||
}
|
||||
|
||||
// If this window is an MDI parent, we must also send an OnActivate message
|
||||
// to the current child.
|
||||
if ((m_currentChild != NULL) && ((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)))
|
||||
if ( (m_currentChild != NULL) &&
|
||||
((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)) )
|
||||
{
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
|
||||
event.SetEventObject( m_currentChild );
|
||||
m_currentChild->GetEventHandler()->ProcessEvent(event);
|
||||
if ( m_currentChild->GetEventHandler()->ProcessEvent(event) )
|
||||
processed = TRUE;
|
||||
}
|
||||
return 0;
|
||||
|
||||
return processed;
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
@@ -495,29 +505,6 @@ bool wxMDIParentFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
return wxWindow::MSWOnCommand(id, cmd, control);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::MSWOnMenuHighlight(WXWORD nItem, WXWORD nFlags, WXHMENU hSysMenu)
|
||||
{
|
||||
if (m_parentFrameActive)
|
||||
{
|
||||
if (nFlags == 0xFFFF && hSysMenu == (WXHMENU) NULL)
|
||||
{
|
||||
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, -1);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
else if (nFlags != MF_SEPARATOR)
|
||||
{
|
||||
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, nItem);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
else if (m_currentChild)
|
||||
{
|
||||
m_currentChild->MSWOnMenuHighlight(nItem, nFlags, hSysMenu);
|
||||
}
|
||||
}
|
||||
|
||||
long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
WXHWND clientWnd;
|
||||
@@ -526,45 +513,45 @@ long wxMDIParentFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARA
|
||||
else
|
||||
clientWnd = 0;
|
||||
|
||||
return DefFrameProc((HWND) GetHWND(), (HWND) clientWnd, message, wParam, lParam);
|
||||
return DefFrameProc(GetHwnd(), (HWND)clientWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::MSWProcessMessage(WXMSG* msg)
|
||||
{
|
||||
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWProcessMessage(msg))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
return m_currentChild && m_currentChild->GetHWND() &&
|
||||
m_currentChild->MSWProcessMessage(msg);
|
||||
}
|
||||
|
||||
bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg)
|
||||
{
|
||||
MSG *pMsg = (MSG *)msg;
|
||||
MSG *pMsg = (MSG *)msg;
|
||||
|
||||
if ((m_currentChild != (wxWindow *)NULL) && (m_currentChild->GetHWND() != (WXHWND) NULL) && m_currentChild->MSWTranslateMessage(msg))
|
||||
return TRUE;
|
||||
if ( m_currentChild && m_currentChild->GetHWND() &&
|
||||
m_currentChild->MSWTranslateMessage(msg) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (m_acceleratorTable.Ok() &&
|
||||
::TranslateAccelerator((HWND) GetHWND(), (HACCEL) m_acceleratorTable.GetHACCEL(), pMsg))
|
||||
return TRUE;
|
||||
if ( m_acceleratorTable.Ok() &&
|
||||
::TranslateAccelerator(GetHwnd(),
|
||||
GetTableHaccel(&m_acceleratorTable),
|
||||
pMsg) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN)
|
||||
{
|
||||
if (::TranslateMDISysAccel((HWND) GetClientWindow()->GetHWND(), pMsg))
|
||||
return TRUE;
|
||||
}
|
||||
if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN )
|
||||
{
|
||||
if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bool wxMDIParentFrame::MSWOnEraseBkgnd(WXHDC WXUNUSED(pDC))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern wxWindow *wxWndHook;
|
||||
extern wxList *wxWinHandleList;
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxMDIChildFrame
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
wxMDIChildFrame::wxMDIChildFrame()
|
||||
{
|
||||
@@ -572,12 +559,12 @@ wxMDIChildFrame::wxMDIChildFrame()
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
wxWindowID id,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
m_defaultIcon = (WXHICON) (wxSTD_MDICHILDFRAME_ICON ? wxSTD_MDICHILDFRAME_ICON : wxDEFAULT_MDICHILDFRAME_ICON);
|
||||
|
||||
@@ -797,46 +784,49 @@ void wxMDIChildFrame::Activate()
|
||||
}
|
||||
|
||||
static HWND invalidHandle = 0;
|
||||
void wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
bool wxMDIChildFrame::MSWOnSize(int x, int y, WXUINT id)
|
||||
{
|
||||
if (!GetHWND()) return;
|
||||
|
||||
if (invalidHandle == (HWND) GetHWND())
|
||||
{
|
||||
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)))
|
||||
HWND hwnd = GetHwnd();
|
||||
|
||||
if ( !hwnd || hwnd == invalidHandle )
|
||||
{
|
||||
wxSizeEvent event(wxSize(x, y), m_frameStatusBar->GetId());
|
||||
event.SetEventObject( m_frameStatusBar );
|
||||
|
||||
((wxStatusBar95 *)m_frameStatusBar)->OnSize(event);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
wxWindow::MSWOnSize(x, y, id);
|
||||
}
|
||||
|
||||
PositionStatusBar();
|
||||
PositionToolBar();
|
||||
|
||||
return wxWindow::MSWOnSize(x, y, id);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool wxMDIChildFrame::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control)
|
||||
@@ -895,7 +885,7 @@ bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHWND WXUNUSED(two))
|
||||
bool wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHWND WXUNUSED(two))
|
||||
{
|
||||
wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent();
|
||||
HMENU parent_menu = (HMENU) parent->GetWinMenu();
|
||||
@@ -922,7 +912,7 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
|
||||
}
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_windowId);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -931,7 +921,8 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
|
||||
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, m_windowId);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
if ( GetEventHandler()->ProcessEvent(event) )
|
||||
return TRUE;
|
||||
|
||||
// m_active = FALSE;
|
||||
if (parent_menu)
|
||||
@@ -953,8 +944,7 @@ long wxMDIChildFrame::MSWOnMDIActivate(long activate, WXHWND WXUNUSED(one), WXHW
|
||||
bool flag = (activate != 0);
|
||||
wxActivateEvent event(wxEVT_ACTIVATE, flag, m_windowId);
|
||||
event.SetEventObject( this );
|
||||
GetEventHandler()->ProcessEvent(event);
|
||||
return 0;
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::MSWDestroyWindow()
|
||||
@@ -1021,7 +1011,7 @@ bool wxMDIChildFrame::ResetWindowStyle(void *vrect)
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
|
||||
bool wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
|
||||
{
|
||||
WINDOWPOS *lpPos = (WINDOWPOS *)pos;
|
||||
#if defined(__WIN95__)
|
||||
@@ -1045,7 +1035,8 @@ void wxMDIChildFrame::MSWOnWindowPosChanging(void *pos)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Default();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Client window
|
||||
@@ -1123,10 +1114,3 @@ void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
|
||||
|
||||
Default();
|
||||
}
|
||||
|
||||
// Should hand the message to the default proc
|
||||
long wxMDIClientWindow::MSWOnMDIActivate(long bActivate, WXHWND, WXHWND)
|
||||
{
|
||||
return Default();
|
||||
}
|
||||
|
||||
|
@@ -464,7 +464,7 @@ void wxNotebook::Command(wxCommandEvent& event)
|
||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
||||
}
|
||||
|
||||
bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
|
||||
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
|
||||
{
|
||||
wxNotebookEvent event(wxEVT_NULL, m_windowId);
|
||||
|
||||
@@ -479,13 +479,13 @@ bool wxNotebook::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM* result)
|
||||
break;
|
||||
|
||||
default:
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
event.SetSelection(TabCtrl_GetCurSel(m_hwnd));
|
||||
event.SetOldSelection(m_nSelection);
|
||||
event.SetEventObject(this);
|
||||
event.SetInt(LOWORD(wParam)); // ctrl id
|
||||
event.SetInt(idCtrl);
|
||||
|
||||
bool processed = GetEventHandler()->ProcessEvent(event);
|
||||
*result = !event.IsAllowed();
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -28,9 +28,6 @@
|
||||
#include "wx/scrolbar.h"
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
// extern wxList wxScrollBarList;
|
||||
extern void wxFindMaxSize(HWND hwnd, RECT *rect);
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
|
||||
|
||||
@@ -53,16 +50,16 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
|
||||
return FALSE;
|
||||
parent->AddChild(this);
|
||||
SetName(name);
|
||||
SetValidator(validator);
|
||||
SetValidator(validator);
|
||||
|
||||
SetBackgroundColour(parent->GetBackgroundColour()) ;
|
||||
SetForegroundColour(parent->GetForegroundColour()) ;
|
||||
m_windowStyle = style;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
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 minPos, maxPos;
|
||||
::GetScrollRange((HWND) control, SB_CTL, &minPos, &maxPos);
|
||||
|
||||
#if defined(__WIN95__)
|
||||
// A page size greater than one has the effect of reducing the
|
||||
// effective range, therefore the range has already been
|
||||
// boosted artificially - so reduce it again.
|
||||
if ( m_pageSize > 1 )
|
||||
maxPos -= (m_pageSize - 1);
|
||||
#endif
|
||||
// A page size greater than one has the effect of reducing the effective
|
||||
// range, therefore the range has already been boosted artificially - so
|
||||
// reduce it again.
|
||||
if ( m_pageSize > 1 )
|
||||
maxPos -= (m_pageSize - 1);
|
||||
#endif // __WIN95__
|
||||
|
||||
wxEventType scrollEvent = wxEVT_NULL;
|
||||
|
||||
int nScrollInc;
|
||||
switch ( wParam )
|
||||
{
|
||||
case SB_TOP:
|
||||
nScrollInc = maxPos - position;
|
||||
scrollEvent = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
case SB_TOP:
|
||||
nScrollInc = maxPos - position;
|
||||
scrollEvent = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM:
|
||||
nScrollInc = - position;
|
||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
nScrollInc = - position;
|
||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
|
||||
case SB_LINEUP:
|
||||
nScrollInc = -1;
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
nScrollInc = -1;
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
nScrollInc = 1;
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
nScrollInc = 1;
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
nScrollInc = -GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
nScrollInc = -GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
nScrollInc = GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
nScrollInc = GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
nScrollInc = pos - position;
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
nScrollInc = pos - position;
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
|
||||
default:
|
||||
nScrollInc = 0;
|
||||
default:
|
||||
nScrollInc = 0;
|
||||
}
|
||||
|
||||
if (nScrollInc != 0)
|
||||
if ( nScrollInc == 0 )
|
||||
{
|
||||
int new_pos = position + nScrollInc;
|
||||
|
||||
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);
|
||||
// no event to process, so don't process it
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void wxScrollBar::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
{
|
||||
MSWOnVScroll(wParam, pos, control);
|
||||
int new_pos = position + nScrollInc;
|
||||
|
||||
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)
|
||||
@@ -233,7 +231,7 @@ void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageS
|
||||
// (see comment for SetPageLength)
|
||||
if ( m_pageSize > 1 )
|
||||
{
|
||||
range1 += (m_pageSize - 1);
|
||||
range1 += (m_pageSize - 1);
|
||||
}
|
||||
|
||||
SCROLLINFO info;
|
||||
@@ -291,7 +289,7 @@ void wxScrollBar::SetObjectLength(int objectLength)
|
||||
// (see comment for SetPageLength)
|
||||
if ( m_pageSize > 1 )
|
||||
{
|
||||
range += (m_pageSize - 1);
|
||||
range += (m_pageSize - 1);
|
||||
}
|
||||
|
||||
SCROLLINFO info;
|
||||
@@ -324,7 +322,7 @@ void wxScrollBar::GetValues(int *viewStart, int *viewLength, int *objectLength,
|
||||
#endif
|
||||
|
||||
WXHBRUSH wxScrollBar::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -75,9 +75,9 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
||||
m_tickFreq = 0;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
@@ -113,23 +113,23 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
||||
msStyle = TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
||||
|
||||
if ( m_windowStyle & wxSL_AUTOTICKS )
|
||||
msStyle |= TBS_AUTOTICKS ;
|
||||
msStyle |= TBS_AUTOTICKS ;
|
||||
|
||||
if ( m_windowStyle & wxSL_LEFT )
|
||||
msStyle |= TBS_LEFT;
|
||||
msStyle |= TBS_LEFT;
|
||||
else if ( m_windowStyle & wxSL_RIGHT )
|
||||
msStyle |= TBS_RIGHT;
|
||||
msStyle |= TBS_RIGHT;
|
||||
else if ( m_windowStyle & wxSL_TOP )
|
||||
msStyle |= TBS_TOP;
|
||||
msStyle |= TBS_TOP;
|
||||
else if ( m_windowStyle & wxSL_BOTTOM )
|
||||
msStyle |= TBS_BOTTOM;
|
||||
msStyle |= TBS_BOTTOM;
|
||||
else if ( m_windowStyle & wxSL_BOTH )
|
||||
msStyle |= TBS_BOTH;
|
||||
msStyle |= TBS_BOTH;
|
||||
else if ( ! (m_windowStyle & wxSL_AUTOTICKS) )
|
||||
msStyle |= TBS_NOTICKS;
|
||||
msStyle |= TBS_NOTICKS;
|
||||
|
||||
if ( m_windowStyle & wxSL_SELRANGE )
|
||||
msStyle |= TBS_ENABLESELRANGE ;
|
||||
msStyle |= TBS_ENABLESELRANGE ;
|
||||
|
||||
HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxBuffer,
|
||||
msStyle,
|
||||
@@ -167,14 +167,14 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
||||
{
|
||||
if (GetFont().GetResourceHandle())
|
||||
{
|
||||
if ( m_staticMin )
|
||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
if ( m_staticMax )
|
||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||
if ( m_staticMin )
|
||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
if ( m_staticMax )
|
||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
if (m_staticValue)
|
||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||
if (m_staticValue)
|
||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
bool wxSlider95::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
|
||||
WXWORD pos, WXHWND control)
|
||||
{
|
||||
int position = 0; // Dummy - not used in this mode
|
||||
|
||||
@@ -194,74 +195,74 @@ void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
wxEventType scrollEvent = wxEVT_NULL;
|
||||
switch ( wParam )
|
||||
{
|
||||
case SB_TOP:
|
||||
nScrollInc = m_rangeMax - position;
|
||||
scrollEvent = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
case SB_TOP:
|
||||
nScrollInc = m_rangeMax - position;
|
||||
scrollEvent = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM:
|
||||
nScrollInc = - position;
|
||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
nScrollInc = - position;
|
||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
|
||||
case SB_LINEUP:
|
||||
nScrollInc = - GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
nScrollInc = - GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
nScrollInc = GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
nScrollInc = GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
nScrollInc = -GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
nScrollInc = -GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
nScrollInc = GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
nScrollInc = GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
#ifdef __WIN32__
|
||||
nScrollInc = (signed short)pos - position;
|
||||
#else
|
||||
nScrollInc = pos - position;
|
||||
#endif
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
nScrollInc = (signed short)pos - position;
|
||||
#else // Win16
|
||||
nScrollInc = pos - position;
|
||||
#endif // Win32/16
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
|
||||
default:
|
||||
nScrollInc = 0;
|
||||
return;
|
||||
default:
|
||||
nScrollInc = 0;
|
||||
}
|
||||
|
||||
if ( nScrollInc == 0 )
|
||||
{
|
||||
|
||||
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
|
||||
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 );
|
||||
|
||||
}
|
||||
// no event...
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void wxSlider95::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
{
|
||||
MSWOnVScroll(wParam, pos, control);
|
||||
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
|
||||
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 );
|
||||
}
|
||||
|
||||
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_LABELS )
|
||||
{
|
||||
if ( m_windowStyle & wxSL_LABELS )
|
||||
{
|
||||
int min_len = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
int new_width = (int)(wxMax(min_len, max_len));
|
||||
int valueHeight = (int)cyf;
|
||||
int valueHeight = (int)cyf;
|
||||
#ifdef __WIN32__
|
||||
// For some reason, under Win95, the text edit control has
|
||||
// a lot of space before the first character
|
||||
new_width += 3*cx;
|
||||
#endif
|
||||
// The height needs to be a bit bigger under Win95 if using native
|
||||
// 3D effects.
|
||||
valueHeight = (int) (valueHeight * 1.5) ;
|
||||
// 3D effects.
|
||||
valueHeight = (int) (valueHeight * 1.5) ;
|
||||
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||
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_height = h1;
|
||||
if (slider_height < 0 )
|
||||
slider_height = 20;
|
||||
if (slider_height < 0 )
|
||||
slider_height = 20;
|
||||
|
||||
// Slider must have a minimum/default length/height
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
GetSize(&w1, &h1);
|
||||
}
|
||||
if ( w1 < 0 )
|
||||
w1 = 200;
|
||||
if ( h1 < 0 )
|
||||
h1 = 20;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
GetSize(&w1, &h1);
|
||||
}
|
||||
if ( w1 < 0 )
|
||||
w1 = 200;
|
||||
if ( h1 < 0 )
|
||||
h1 = 20;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_windowStyle & wxSL_LABELS )
|
||||
{
|
||||
if ( m_windowStyle & wxSL_LABELS )
|
||||
{
|
||||
int min_len;
|
||||
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||
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)
|
||||
{
|
||||
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...
|
||||
#ifdef __WIN32__
|
||||
// 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;
|
||||
|
||||
// The height needs to be a bit bigger under Win95 if using native
|
||||
// 3D effects.
|
||||
valueHeight = (int) (valueHeight * 1.5) ;
|
||||
// 3D effects.
|
||||
valueHeight = (int) (valueHeight * 1.5) ;
|
||||
|
||||
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||
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_width = w1;
|
||||
if (slider_width < 0 )
|
||||
slider_width = 20;
|
||||
if (slider_width < 0 )
|
||||
slider_width = 20;
|
||||
|
||||
// Slider must have a minimum/default length
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
GetSize(&w1, &h1);
|
||||
}
|
||||
if ( w1 < 0 )
|
||||
w1 = 20;
|
||||
if ( h1 < 0 )
|
||||
h1 = 200;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
// If we're prepared to use the existing size, then...
|
||||
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||
{
|
||||
GetSize(&w1, &h1);
|
||||
}
|
||||
if ( w1 < 0 )
|
||||
w1 = 20;
|
||||
if ( h1 < 0 )
|
||||
h1 = 200;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,8 +511,8 @@ void wxSlider95::SetRange(int minValue, int maxValue)
|
||||
char buf[40];
|
||||
if ( m_staticMin )
|
||||
{
|
||||
sprintf(buf, "%d", m_rangeMin);
|
||||
SetWindowText((HWND) m_staticMin, buf);
|
||||
sprintf(buf, "%d", m_rangeMin);
|
||||
SetWindowText((HWND) m_staticMin, buf);
|
||||
}
|
||||
|
||||
if ( m_staticMax )
|
||||
@@ -522,10 +523,10 @@ void wxSlider95::SetRange(int minValue, int maxValue)
|
||||
}
|
||||
|
||||
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 )
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
// Otherwise, it's a static
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
@@ -611,7 +612,7 @@ void wxSlider95::SetTick(int tickPos)
|
||||
|
||||
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)
|
||||
@@ -622,7 +623,7 @@ void wxSlider95::Command (wxCommandEvent & event)
|
||||
|
||||
bool wxSlider95::Show(bool show)
|
||||
{
|
||||
wxWindow::Show(show);
|
||||
wxWindow::Show(show);
|
||||
|
||||
int cshow;
|
||||
if (show)
|
||||
@@ -631,11 +632,11 @@ bool wxSlider95::Show(bool show)
|
||||
cshow = SW_HIDE;
|
||||
|
||||
if(m_staticValue)
|
||||
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||
if(m_staticMin)
|
||||
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||
if(m_staticMax)
|
||||
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
@@ -69,9 +69,9 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
||||
m_tickFreq = 0;
|
||||
|
||||
if ( id == -1 )
|
||||
m_windowId = (int)NewControlId();
|
||||
m_windowId = (int)NewControlId();
|
||||
else
|
||||
m_windowId = id;
|
||||
m_windowId = id;
|
||||
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
@@ -138,14 +138,14 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
||||
// GetFont()->RealizeResource();
|
||||
if (GetFont().GetResourceHandle())
|
||||
{
|
||||
if ( m_staticMin )
|
||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
if ( m_staticMax )
|
||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||
if ( m_staticMin )
|
||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
if ( m_staticMax )
|
||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
if (m_staticValue)
|
||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||
if (m_staticValue)
|
||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||
(WPARAM)GetFont().GetResourceHandle(),0L);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,8 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxSliderMSW::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
bool wxSliderMSW::MSWOnScroll(int WXUNUSED(orientation), WXWORD wParam,
|
||||
WXWORD pos, WXHWND control)
|
||||
{
|
||||
int position = ::GetScrollPos((HWND)control, SB_CTL);
|
||||
|
||||
@@ -164,75 +165,75 @@ void wxSliderMSW::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
wxEventType scrollEvent = wxEVT_NULL;
|
||||
switch ( wParam )
|
||||
{
|
||||
case SB_TOP:
|
||||
nScrollInc = m_rangeMax - position;
|
||||
scrollEvent = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
case SB_TOP:
|
||||
nScrollInc = m_rangeMax - position;
|
||||
scrollEvent = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM:
|
||||
nScrollInc = - position;
|
||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
nScrollInc = - position;
|
||||
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
|
||||
case SB_LINEUP:
|
||||
nScrollInc = - GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
nScrollInc = - GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
nScrollInc = GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
nScrollInc = GetLineSize();
|
||||
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
nScrollInc = -GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
nScrollInc = -GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
nScrollInc = GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
nScrollInc = GetPageSize();
|
||||
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
#ifdef __WIN32__
|
||||
nScrollInc = (signed short)pos - position;
|
||||
nScrollInc = (signed short)pos - position;
|
||||
#else
|
||||
nScrollInc = pos - position;
|
||||
nScrollInc = pos - position;
|
||||
#endif
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
|
||||
default:
|
||||
nScrollInc = 0;
|
||||
return;
|
||||
default:
|
||||
nScrollInc = 0;
|
||||
}
|
||||
|
||||
if (nScrollInc != 0)
|
||||
if (nScrollInc == 0)
|
||||
{
|
||||
|
||||
int newPos = position + nScrollInc;
|
||||
|
||||
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 );
|
||||
}
|
||||
// no event...
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void wxSliderMSW::MSWOnHScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
{
|
||||
MSWOnVScroll(wParam, pos, control);
|
||||
int newPos = position + nScrollInc;
|
||||
|
||||
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()
|
||||
@@ -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_LABELS )
|
||||
{
|
||||
if ( m_windowStyle & wxSL_LABELS )
|
||||
{
|
||||
int min_len = 0;
|
||||
|
||||
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)
|
||||
{
|
||||
int new_width = (int)(wxMax(min_len, max_len));
|
||||
int valueHeight = (int)cyf;
|
||||
int valueHeight = (int)cyf;
|
||||
#ifdef __WIN32__
|
||||
// For some reason, under Win95, the text edit control has
|
||||
// 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
if ( w1 < 0 )
|
||||
w1 = 200;
|
||||
if ( h1 < 0 )
|
||||
h1 = 20;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
if ( w1 < 0 )
|
||||
w1 = 200;
|
||||
if ( h1 < 0 )
|
||||
h1 = 20;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_windowStyle & wxSL_LABELS )
|
||||
{
|
||||
if ( m_windowStyle & wxSL_LABELS )
|
||||
{
|
||||
int min_len;
|
||||
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||
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)
|
||||
{
|
||||
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...
|
||||
#ifdef __WIN32__
|
||||
// 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);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
if ( w1 < 0 )
|
||||
w1 = 20;
|
||||
if ( h1 < 0 )
|
||||
h1 = 200;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No labels
|
||||
if ( w1 < 0 )
|
||||
w1 = 20;
|
||||
if ( h1 < 0 )
|
||||
h1 = 200;
|
||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,8 +461,8 @@ void wxSliderMSW::SetRange(int minValue, int maxValue)
|
||||
char buf[40];
|
||||
if ( m_staticMin )
|
||||
{
|
||||
sprintf(buf, "%d", m_rangeMin);
|
||||
SetWindowText((HWND) m_staticMin, buf);
|
||||
sprintf(buf, "%d", m_rangeMin);
|
||||
SetWindowText((HWND) m_staticMin, buf);
|
||||
}
|
||||
|
||||
if ( m_staticMax )
|
||||
@@ -472,10 +473,10 @@ void wxSliderMSW::SetRange(int minValue, int maxValue)
|
||||
}
|
||||
|
||||
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 )
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
// Otherwise, it's a static
|
||||
if (GetParent()->GetTransparentBackground())
|
||||
@@ -553,7 +554,7 @@ void wxSliderMSW::SetTick(int tickPos)
|
||||
|
||||
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)
|
||||
@@ -564,7 +565,7 @@ void wxSliderMSW::Command (wxCommandEvent & event)
|
||||
|
||||
bool wxSliderMSW::Show(bool show)
|
||||
{
|
||||
wxWindow::Show(show);
|
||||
wxWindow::Show(show);
|
||||
|
||||
int cshow;
|
||||
if (show)
|
||||
@@ -573,11 +574,11 @@ bool wxSliderMSW::Show(bool show)
|
||||
cshow = SW_HIDE;
|
||||
|
||||
if(m_staticValue)
|
||||
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||
if(m_staticMin)
|
||||
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||
if(m_staticMax)
|
||||
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@@ -6,22 +6,22 @@
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart and Markus Holzem
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "spinbutt.h"
|
||||
#pragma implementation "spinbutt.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
// Can't resolve reference to CreateUpDownControl in
|
||||
@@ -33,17 +33,17 @@
|
||||
#include "wx/msw/private.h"
|
||||
|
||||
#if !defined(__GNUWIN32__) || defined(__TWIN32__)
|
||||
#include <commctrl.h>
|
||||
#include <commctrl.h>
|
||||
#endif
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinButton, wxControl)
|
||||
#endif
|
||||
|
||||
wxSpinButton::wxSpinButton(void)
|
||||
wxSpinButton::wxSpinButton()
|
||||
{
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
m_min = 0;
|
||||
m_max = 100;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if ( m_windowStyle & wxSP_HORIZONTAL )
|
||||
wstyle |= UDS_HORZ;
|
||||
wstyle |= UDS_HORZ;
|
||||
if ( m_windowStyle & wxSP_ARROW_KEYS )
|
||||
wstyle |= UDS_ARROWKEYS;
|
||||
wstyle |= UDS_ARROWKEYS;
|
||||
if ( m_windowStyle & wxSP_WRAP )
|
||||
wstyle |= UDS_WRAP;
|
||||
wstyle |= UDS_WRAP;
|
||||
|
||||
// Create the ListView control.
|
||||
HWND hWndListControl = CreateUpDownControl(wstyle,
|
||||
@@ -94,177 +94,106 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
|
||||
m_windowId,
|
||||
wxGetInstance(),
|
||||
0,
|
||||
m_min, m_max, m_min);
|
||||
m_min, m_max, m_min);
|
||||
|
||||
m_hWnd = (WXHWND) hWndListControl;
|
||||
if (parent) parent->AddChild(this);
|
||||
|
||||
// TODO: have this for all controls.
|
||||
if ( !m_hWnd )
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
SubclassWin((WXHWND) m_hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
wxSpinButton::~wxSpinButton(void)
|
||||
wxSpinButton::~wxSpinButton()
|
||||
{
|
||||
}
|
||||
|
||||
// Attributes
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int wxSpinButton::GetValue(void) const
|
||||
int wxSpinButton::GetValue() const
|
||||
{
|
||||
return (int) ::SendMessage((HWND) GetHWND(), UDM_GETPOS, 0, 0);
|
||||
return (int) ::SendMessage((HWND) GetHWND(), UDM_GETPOS, 0, 0);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
m_min = minVal;
|
||||
m_max = maxVal;
|
||||
::SendMessage((HWND) GetHWND(), UDM_SETRANGE, 0,
|
||||
m_min = minVal;
|
||||
m_max = maxVal;
|
||||
::SendMessage((HWND) GetHWND(), UDM_SETRANGE, 0,
|
||||
(LPARAM) MAKELONG((short)maxVal, (short)minVal));
|
||||
}
|
||||
|
||||
void wxSpinButton::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
bool wxSpinButton::MSWOnScroll(int orientation, WXWORD wParam,
|
||||
WXWORD pos, WXHWND control)
|
||||
{
|
||||
if (control)
|
||||
{
|
||||
if ( !control )
|
||||
return FALSE;
|
||||
|
||||
wxSpinEvent event(wxEVT_NULL, m_windowId);
|
||||
event.SetPosition(pos);
|
||||
event.SetOrientation(wxVERTICAL);
|
||||
event.SetEventObject( this );
|
||||
event.SetOrientation(orientation);
|
||||
event.SetEventObject(this);
|
||||
|
||||
switch ( wParam )
|
||||
{
|
||||
case SB_TOP:
|
||||
event.m_eventType = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
switch ( wParam )
|
||||
{
|
||||
case SB_TOP:
|
||||
event.m_eventType = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM:
|
||||
event.m_eventType = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
case SB_BOTTOM:
|
||||
event.m_eventType = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
|
||||
case SB_LINEUP:
|
||||
event.m_eventType = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
case SB_LINEUP:
|
||||
event.m_eventType = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
event.m_eventType = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
case SB_LINEDOWN:
|
||||
event.m_eventType = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
event.m_eventType = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
case SB_PAGEUP:
|
||||
event.m_eventType = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
event.m_eventType = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
case SB_PAGEDOWN:
|
||||
event.m_eventType = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
event.m_eventType = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
event.m_eventType = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
Default();
|
||||
}
|
||||
}
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxSpinButton::MSWOnHScroll( WXWORD wParam, WXWORD pos, WXHWND control)
|
||||
{
|
||||
if (control)
|
||||
{
|
||||
wxSpinEvent event(wxEVT_NULL, m_windowId);
|
||||
event.SetPosition(pos);
|
||||
event.SetOrientation(wxHORIZONTAL);
|
||||
event.SetEventObject( this );
|
||||
|
||||
switch ( wParam )
|
||||
{
|
||||
case SB_TOP:
|
||||
event.m_eventType = wxEVT_SCROLL_TOP;
|
||||
break;
|
||||
|
||||
case SB_BOTTOM:
|
||||
event.m_eventType = wxEVT_SCROLL_BOTTOM;
|
||||
break;
|
||||
|
||||
case SB_LINEUP:
|
||||
event.m_eventType = wxEVT_SCROLL_LINEUP;
|
||||
break;
|
||||
|
||||
case SB_LINEDOWN:
|
||||
event.m_eventType = wxEVT_SCROLL_LINEDOWN;
|
||||
break;
|
||||
|
||||
case SB_PAGEUP:
|
||||
event.m_eventType = wxEVT_SCROLL_PAGEUP;
|
||||
break;
|
||||
|
||||
case SB_PAGEDOWN:
|
||||
event.m_eventType = wxEVT_SCROLL_PAGEDOWN;
|
||||
break;
|
||||
|
||||
case SB_THUMBTRACK:
|
||||
case SB_THUMBPOSITION:
|
||||
event.m_eventType = wxEVT_SCROLL_THUMBTRACK;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (!GetEventHandler()->ProcessEvent(event))
|
||||
Default();
|
||||
}
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
bool wxSpinButton::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
{
|
||||
// No command messages
|
||||
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;
|
||||
// No command messages
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Spin event
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxSpinEvent, wxScrollEvent)
|
||||
|
||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id):
|
||||
wxScrollEvent(commandType, id)
|
||||
wxSpinEvent::wxSpinEvent(wxEventType commandType, int id)
|
||||
: wxScrollEvent(commandType, id)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // __WIN95__
|
||||
|
@@ -148,7 +148,7 @@ bool wxTabCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
bool wxTabCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
{
|
||||
wxTabEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
@@ -171,12 +171,12 @@ bool wxTabCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
}
|
||||
|
||||
default :
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject( this );
|
||||
event.SetEventType(eventType);
|
||||
event.SetInt( (int) LOWORD(wParam) ) ;
|
||||
event.SetInt(idCtrl) ;
|
||||
|
||||
return ProcessEvent(event);
|
||||
}
|
||||
|
@@ -346,7 +346,7 @@ bool wxToolBar95::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam),
|
||||
bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl),
|
||||
WXLPARAM lParam,
|
||||
WXLPARAM *result)
|
||||
{
|
||||
|
@@ -1234,7 +1234,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
|
||||
// For Rich Edit controls. Do we need it?
|
||||
#if 0
|
||||
#if wxUSE_RICHEDIT
|
||||
bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
bool wxTextCtrl::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
wxCommandEvent event(0, m_windowId);
|
||||
int eventType = 0;
|
||||
@@ -1243,7 +1243,7 @@ bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
// Insert case code here
|
||||
default :
|
||||
return wxControl::MSWNotify(wParam, lParam);
|
||||
return wxControl::MSWOnNotify(wParam, lParam);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -914,7 +914,7 @@ bool wxTreeCtrl::MSWCommand(WXUINT cmd, WXWORD id)
|
||||
}
|
||||
|
||||
// process WM_NOTIFY Windows message
|
||||
bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
|
||||
{
|
||||
wxTreeEvent event(wxEVT_NULL, m_windowId);
|
||||
wxEventType eventType = wxEVT_NULL;
|
||||
@@ -1050,7 +1050,7 @@ bool wxTreeCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam, WXLPARAM *result)
|
||||
}
|
||||
|
||||
default:
|
||||
return wxControl::MSWNotify(wParam, lParam, result);
|
||||
return wxControl::MSWOnNotify(idCtrl, lParam, result);
|
||||
}
|
||||
|
||||
event.SetEventObject(this);
|
||||
|
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