From: Vadim Zeitlin Date: Thu, 16 Dec 1999 21:29:54 +0000 (+0000) Subject: Win16 compilation fixes X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8f177c8e7309c8cf3ece1563870d135cc8f0e6a1 Win16 compilation fixes git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/tmake/filelist.txt b/distrib/msw/tmake/filelist.txt index 8ea791003b..8c8892dff9 100644 --- a/distrib/msw/tmake/filelist.txt +++ b/distrib/msw/tmake/filelist.txt @@ -101,7 +101,7 @@ config.cpp C B ctrlcmn.cpp C ctrlsub.cpp C date.cpp C B -datetime.cpp C B +datetime.cpp C 32,B datstrm.cpp C db.cpp C dbtable.cpp C @@ -146,7 +146,7 @@ layout.cpp C lboxcmn.cpp C list.cpp C B log.cpp C B -longlong.cpp C B +longlong.cpp C 32,B memory.cpp C menucmn.cpp C mimetype.cpp C 32,B diff --git a/include/wx/defs.h b/include/wx/defs.h index 2452b337cc..174363f982 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -328,7 +328,7 @@ typedef int wxWindowID; // wxCALLBACK should be used for the functions which are called back by // Windows (such as compare function for wxListCtrl) -#if defined(__WXMSW__) +#if defined(__WIN32__) #if defined(__MINGW32__) || defined(__GNUWIN32__) #define wxCALLBACK __attribute__((stdcall)) #else @@ -336,7 +336,7 @@ typedef int wxWindowID; #define wxCALLBACK _stdcall #endif #else - // no stdcall under Unix + // no stdcall under Unix nor Win16 #define wxCALLBACK #endif // platform diff --git a/include/wx/image.h b/include/wx/image.h index 018d2932b5..8236f2bf44 100644 --- a/include/wx/image.h +++ b/include/wx/image.h @@ -45,12 +45,12 @@ public: #if wxUSE_STREAMS virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); - + virtual int GetImageCount( wxInputStream& stream ); bool CanRead( wxInputStream& stream ) { return DoCanRead(stream); } bool CanRead( const wxString& name ); -#endif +#endif // wxUSE_STREAMS void SetName(const wxString& name) { m_name = name; } void SetExtension(const wxString& ext) { m_extension = ext; } @@ -62,17 +62,176 @@ public: wxString GetMimeType() const { return m_mime; } protected: +#if wxUSE_STREAMS virtual bool DoCanRead( wxInputStream& stream ) = 0; +#endif // wxUSE_STREAMS wxString m_name; wxString m_extension; wxString m_mime; long m_type; +}; + +//----------------------------------------------------------------------------- +// wxPNGHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBPNG +class WXDLLEXPORT wxPNGHandler: public wxImageHandler +{ + DECLARE_DYNAMIC_CLASS(wxPNGHandler) + +public: + + inline wxPNGHandler() + { + m_name = "PNG file"; + m_extension = "png"; + m_type = wxBITMAP_TYPE_PNG; + m_mime = "image/png"; + }; + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); + virtual bool DoCanRead( wxInputStream& stream ); +#endif +}; +#endif + +//----------------------------------------------------------------------------- +// wxJPEGHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBJPEG +class WXDLLEXPORT wxJPEGHandler: public wxImageHandler +{ + DECLARE_DYNAMIC_CLASS(wxJPEGHandler) + +public: + + inline wxJPEGHandler() + { + m_name = "JPEG file"; + m_extension = "jpg"; + m_type = wxBITMAP_TYPE_JPEG; + m_mime = "image/jpeg"; + }; + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); + virtual bool DoCanRead( wxInputStream& stream ); +#endif +}; +#endif + +//----------------------------------------------------------------------------- +// wxTIFFHandler +//----------------------------------------------------------------------------- + +#if wxUSE_LIBTIFF +class WXDLLEXPORT wxTIFFHandler: public wxImageHandler +{ + DECLARE_DYNAMIC_CLASS(wxTIFFHandler) + +public: + + inline wxTIFFHandler() + { + m_name = "TIFF file"; + m_extension = "tif"; + m_type = wxBITMAP_TYPE_TIF; + m_mime = "image/tiff"; + }; + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); + virtual bool DoCanRead( wxInputStream& stream ); + virtual int GetImageCount( wxInputStream& stream ); +#endif +}; +#endif + +//----------------------------------------------------------------------------- +// wxBMPHandler +//----------------------------------------------------------------------------- + +class WXDLLEXPORT wxBMPHandler: public wxImageHandler +{ + DECLARE_DYNAMIC_CLASS(wxBMPHandler) + +public: + + inline wxBMPHandler() + { + m_name = "BMP file"; + m_extension = "bmp"; + m_type = wxBITMAP_TYPE_BMP; + m_mime = "image/bmp"; + }; +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); + virtual bool DoCanRead( wxInputStream& stream ); +#endif }; +//----------------------------------------------------------------------------- + +#if wxUSE_PNM +class WXDLLEXPORT wxPNMHandler : public wxImageHandler +{ + DECLARE_DYNAMIC_CLASS(wxPNMHandler) + +public: + + inline wxPNMHandler() + { + m_name = "PNM file"; + m_extension = "pnm"; + m_type = wxBITMAP_TYPE_PNM; + m_mime = "image/pnm"; + }; + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); + virtual bool DoCanRead( wxInputStream& stream ); +#endif +}; +#endif + +//----------------------------------------------------------------------------- +// wxPCXHandler +//----------------------------------------------------------------------------- + +#if wxUSE_PCX +class WXDLLEXPORT wxPCXHandler : public wxImageHandler +{ + DECLARE_DYNAMIC_CLASS(wxPCXHandler) + +public: + + inline wxPCXHandler() + { + m_name = "PCX file"; + m_extension = "pcx"; + m_type = wxBITMAP_TYPE_PCX; + m_mime = "image/pcx"; + }; + +#if wxUSE_STREAMS + virtual bool LoadFile( wxImage *image, wxInputStream& stream, bool verbose=TRUE, int index=0 ); + virtual bool SaveFile( wxImage *image, wxOutputStream& stream, bool verbose=TRUE ); + virtual bool DoCanRead( wxInputStream& stream ); +#endif // wxUSE_STREAMS +}; +#endif // wxUSE_PCX + //----------------------------------------------------------------------------- // wxImage //----------------------------------------------------------------------------- diff --git a/include/wx/listctrl.h b/include/wx/listctrl.h index 8807a74488..2108abc01c 100644 --- a/include/wx/listctrl.h +++ b/include/wx/listctrl.h @@ -284,9 +284,7 @@ public: inline long GetMask() { return m_item.m_mask; } inline const wxListItem &GetItem() const { return m_item; } -#ifndef __WXMSW__ void CopyObject(wxObject& object_dest) const; -#endif private: DECLARE_DYNAMIC_CLASS(wxListEvent) diff --git a/include/wx/msw/app.h b/include/wx/msw/app.h index 770123e24d..90a612d06c 100644 --- a/include/wx/msw/app.h +++ b/include/wx/msw/app.h @@ -104,8 +104,8 @@ protected: }; #if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL)) -int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance, char *lpszCmdLine, - int nCmdShow, bool enterLoop = TRUE); +int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance, + char *lpszCmdLine, int nCmdShow, bool enterLoop = TRUE); #else int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance); #endif diff --git a/include/wx/msw/colour.h b/include/wx/msw/colour.h index 2cf5908c8b..7546b611c3 100644 --- a/include/wx/msw/colour.h +++ b/include/wx/msw/colour.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_COLOUR_H_ @@ -75,8 +75,11 @@ public: WXCOLORREF GetPixel() const { return m_pixel; }; +public: + WXCOLORREF m_pixel; + private: - bool m_isInit; + bool m_isInit; unsigned char m_red; unsigned char m_blue; unsigned char m_green; @@ -84,12 +87,9 @@ private: // helper func void InitFromName(const wxString& colourName); -public: - WXCOLORREF m_pixel ; - private: DECLARE_DYNAMIC_CLASS(wxColour) }; #endif - // _WX_COLOUR_H_ + // _WX_COLOUR_H_ diff --git a/include/wx/msw/tbarmsw.h b/include/wx/msw/tbarmsw.h index d03dbe7ff3..278353b88c 100644 --- a/include/wx/msw/tbarmsw.h +++ b/include/wx/msw/tbarmsw.h @@ -16,7 +16,7 @@ #pragma interface "tbarmsw.h" #endif -#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR +#if wxUSE_TOOLBAR #include "wx/tbarbase.h" @@ -144,7 +144,7 @@ private: DECLARE_DYNAMIC_CLASS(wxToolBar) }; -#endif // wxUSE_TOOL/BUTTONBAR +#endif // wxUSE_TOOLBAR #endif // _WX_TBARMSW_H_ diff --git a/src/common/cmndata.cpp b/src/common/cmndata.cpp index 04cd0ccdb2..5353fe91cc 100644 --- a/src/common/cmndata.cpp +++ b/src/common/cmndata.cpp @@ -314,7 +314,7 @@ void wxPrintData::ConvertToNative() if ( hDevMode ) { - DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode); + LPDEVMODE devMode = (LPDEVMODE) GlobalLock(hDevMode); //// Orientation @@ -436,7 +436,7 @@ void wxPrintData::ConvertFromNative() if ( hDevMode ) { - DEVMODE *devMode = (DEVMODE*) GlobalLock(hDevMode); + LPDEVMODE devMode = (LPDEVMODE)GlobalLock(hDevMode); #ifndef __WXWINE__ //// Orientation diff --git a/src/common/image.cpp b/src/common/image.cpp index f2407e0978..59c7baec99 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -747,7 +747,7 @@ wxBitmap wxImage::ConvertToBitmap() const // create a DIB header int headersize = sizeof(BITMAPINFOHEADER); - LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize ); + BITMAPINFO *lpDIBh = (BITMAPINFO *) malloc( headersize ); wxCHECK_MSG( lpDIBh, bitmap, wxT("could not allocate memory for DIB header") ); // Fill in the DIB header lpDIBh->bmiHeader.biSize = headersize; @@ -939,7 +939,7 @@ wxImage::wxImage( const wxBitmap &bitmap ) // create a DIB header int headersize = sizeof(BITMAPINFOHEADER); - LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize ); + BITMAPINFO *lpDIBh = (BITMAPINFO *) malloc( headersize ); if( !lpDIBh ) { wxFAIL_MSG( wxT("could not allocate data for DIB header") ); @@ -1260,11 +1260,11 @@ wxImage::wxImage( const wxBitmap &bitmap ) } SetMaskColour( r, g, b ); SetMask( TRUE ); - } + } else { SetMask( FALSE ); - } + } // free allocated resources ::ReleaseDC(NULL, hdc); free(lpDIBh); diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 4d9ee47b80..f473853134 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -22,7 +22,7 @@ #pragma hdrstop #endif -#if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID) +#if !defined(wxUSE_NEW_GRID) || !(wxUSE_NEW_GRID) #include "gridg.cpp" #else @@ -66,7 +66,7 @@ bool wxGridTableBase::InsertRows( size_t pos, size_t numRows ) wxLogWarning( wxT("Called grid table class function InsertRows(pos=%d, N=%d)\n" "but your derived table class does not override this function"), pos, numRows ); - + return FALSE; } @@ -75,7 +75,7 @@ bool wxGridTableBase::AppendRows( size_t numRows ) wxLogWarning( wxT("Called grid table class function AppendRows(N=%d)\n" "but your derived table class does not override this function"), numRows ); - + return FALSE; } @@ -84,7 +84,7 @@ bool wxGridTableBase::DeleteRows( size_t pos, size_t numRows ) wxLogWarning( wxT("Called grid table class function DeleteRows(pos=%d, N=%d)\n" "but your derived table class does not override this function"), pos, numRows ); - + return FALSE; } @@ -93,7 +93,7 @@ bool wxGridTableBase::InsertCols( size_t pos, size_t numCols ) wxLogWarning( wxT("Called grid table class function InsertCols(pos=%d, N=%d)\n" "but your derived table class does not override this function"), pos, numCols ); - + return FALSE; } @@ -102,7 +102,7 @@ bool wxGridTableBase::AppendCols( size_t numCols ) wxLogWarning( wxT("Called grid table class function AppendCols(N=%d)\n" "but your derived table class does not override this function"), numCols ); - + return FALSE; } @@ -111,7 +111,7 @@ bool wxGridTableBase::DeleteCols( size_t pos, size_t numCols ) wxLogWarning( wxT("Called grid table class function DeleteCols(pos=%d, N=%d)\n" "but your derived table class does not override this function"), pos, numCols ); - + return FALSE; } @@ -199,7 +199,7 @@ wxGridStringTable::wxGridStringTable( int numRows, int numCols ) : wxGridTableBase() { int row, col; - + m_data.Alloc( numRows ); wxArrayString sa; @@ -208,7 +208,7 @@ wxGridStringTable::wxGridStringTable( int numRows, int numCols ) { sa.Add( wxEmptyString ); } - + for ( row = 0; row < numRows; row++ ) { m_data.Add( sa ); @@ -258,7 +258,7 @@ void wxGridStringTable::Clear() { int row, col; int numRows, numCols; - + numRows = m_data.GetCount(); if ( numRows > 0 ) { @@ -281,12 +281,12 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows ) size_t curNumRows = m_data.GetCount(); size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); - + if ( pos >= curNumRows ) { return AppendRows( numRows ); } - + wxArrayString sa; sa.Alloc( curNumCols ); for ( col = 0; col < curNumCols; col++ ) @@ -305,7 +305,7 @@ bool wxGridStringTable::InsertRows( size_t pos, size_t numRows ) wxGRIDTABLE_NOTIFY_ROWS_INSERTED, pos, numRows ); - + GetView()->ProcessTableMessage( msg ); } @@ -318,7 +318,7 @@ bool wxGridStringTable::AppendRows( size_t numRows ) size_t curNumRows = m_data.GetCount(); size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); - + wxArrayString sa; if ( curNumCols > 0 ) { @@ -328,7 +328,7 @@ bool wxGridStringTable::AppendRows( size_t numRows ) sa.Add( wxEmptyString ); } } - + for ( row = 0; row < numRows; row++ ) { m_data.Add( sa ); @@ -339,11 +339,11 @@ bool wxGridStringTable::AppendRows( size_t numRows ) wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, numRows ); - + GetView()->ProcessTableMessage( msg ); } - return TRUE; + return TRUE; } bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) @@ -351,7 +351,7 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) size_t n; size_t curNumRows = m_data.GetCount(); - + if ( pos >= curNumRows ) { wxLogError( wxT("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)...\n" @@ -364,7 +364,7 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) { numRows = curNumRows - pos; } - + if ( numRows >= curNumRows ) { m_data.Empty(); // don't release memory just yet @@ -383,11 +383,11 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) wxGRIDTABLE_NOTIFY_ROWS_DELETED, pos, numRows ); - + GetView()->ProcessTableMessage( msg ); } - return TRUE; + return TRUE; } bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) @@ -396,7 +396,7 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) size_t curNumRows = m_data.GetCount(); size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); - + if ( pos >= curNumCols ) { return AppendCols( numCols ); @@ -416,7 +416,7 @@ bool wxGridStringTable::InsertCols( size_t pos, size_t numCols ) wxGRIDTABLE_NOTIFY_COLS_INSERTED, pos, numCols ); - + GetView()->ProcessTableMessage( msg ); } @@ -436,7 +436,7 @@ bool wxGridStringTable::AppendCols( size_t numCols ) "Call AppendRows() first") ); return FALSE; } - + for ( row = 0; row < curNumRows; row++ ) { for ( n = 0; n < numCols; n++ ) @@ -450,7 +450,7 @@ bool wxGridStringTable::AppendCols( size_t numCols ) wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_COLS_APPENDED, numCols ); - + GetView()->ProcessTableMessage( msg ); } @@ -463,18 +463,18 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) size_t curNumRows = m_data.GetCount(); size_t curNumCols = ( curNumRows > 0 ? m_data[0].GetCount() : 0 ); - + if ( pos >= curNumCols ) { - wxLogError( wxT("Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" - "Pos value is invalid for present table with %d cols"), - pos, numCols, curNumCols ); - return FALSE; + wxLogError( wxT("Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" + "Pos value is invalid for present table with %d cols"), + pos, numCols, curNumCols ); + return FALSE; } if ( numCols > curNumCols - pos ) { - numCols = curNumCols - pos; + numCols = curNumCols - pos; } for ( row = 0; row < curNumRows; row++ ) @@ -498,11 +498,11 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) wxGRIDTABLE_NOTIFY_COLS_DELETED, pos, numCols ); - + GetView()->ProcessTableMessage( msg ); } - return TRUE; + return TRUE; } wxString wxGridStringTable::GetRowLabelValue( int row ) @@ -569,7 +569,7 @@ void wxGridStringTable::SetColLabelValue( int col, const wxString& value ) ////////////////////////////////////////////////////////////////////// IMPLEMENT_DYNAMIC_CLASS( wxGridTextCtrl, wxTextCtrl ) - + BEGIN_EVENT_TABLE( wxGridTextCtrl, wxTextCtrl ) EVT_KEY_DOWN( wxGridTextCtrl::OnKeyDown ) END_EVENT_TABLE() @@ -637,7 +637,7 @@ void wxGridTextCtrl::OnKeyDown( wxKeyEvent& ev ) ev.Skip(); } break; - + default: ev.Skip(); } @@ -654,7 +654,7 @@ void wxGridTextCtrl::SetStartValue( const wxString& s ) IMPLEMENT_DYNAMIC_CLASS( wxGrid, wxPanel ) - + BEGIN_EVENT_TABLE( wxGrid, wxPanel ) EVT_PAINT( wxGrid::OnPaint ) EVT_SIZE( wxGrid::OnSize ) @@ -665,7 +665,7 @@ BEGIN_EVENT_TABLE( wxGrid, wxPanel ) EVT_COMMAND_SCROLL( wxGRID_HORIZSCROLL, wxGrid::OnGridScroll) EVT_COMMAND_SCROLL( wxGRID_VERTSCROLL, wxGrid::OnGridScroll) END_EVENT_TABLE() - + wxGrid::~wxGrid() { @@ -701,14 +701,14 @@ void wxGrid::Init() // m_topEditCtrlEnabled = FALSE; m_topEditCtrl = new wxGridTextCtrl( this, - FALSE, - wxGRID_TOPCTRL, - "", - wxPoint(10, 10), - wxSize(WXGRID_DEFAULT_TOPEDIT_WIDTH, + FALSE, + wxGRID_TOPCTRL, + "", + wxPoint(10, 10), + wxSize(WXGRID_DEFAULT_TOPEDIT_WIDTH, WXGRID_DEFAULT_TOPEDIT_HEIGHT), - wxTE_MULTILINE ); - m_topEditCtrl->Show( FALSE ); + wxTE_MULTILINE ); + m_topEditCtrl->Show( FALSE ); if ( m_numRows <= 0 ) m_numRows = WXGRID_DEFAULT_NUMBER_ROWS; @@ -728,7 +728,7 @@ void wxGrid::Init() // m_labelFont = this->GetFont(); m_labelFont.SetWeight( m_labelFont.GetWeight() + 2 ); - + m_rowLabelHorizAlign = wxLEFT; m_rowLabelVertAlign = wxCENTRE; @@ -747,7 +747,7 @@ void wxGrid::Init() m_rowBottoms.Add( 0 ); // set by CalcDimensions() } m_sumRowHeights = m_defaultRowHeight * m_numRows; - + m_colWidths.Alloc( m_numCols ); m_colRights.Alloc( m_numRows ); m_sumColWidths = 0; @@ -757,14 +757,14 @@ void wxGrid::Init() m_colRights.Add( 0 ); // set by CalcDimensions() } m_sumColWidths = m_defaultColWidth * m_numCols; - + // TODO: improve this ? // m_defaultCellFont = this->GetFont(); - + m_gridLineColour = wxColour( 0, 0, 255 ); m_gridLinesEnabled = TRUE; - + m_scrollBarWidth = WXGRID_DEFAULT_SCROLLBAR_WIDTH; m_horizScrollBar = new wxScrollBar( this, @@ -772,7 +772,7 @@ void wxGrid::Init() wxPoint(0, 0), wxSize(10, 10), wxHORIZONTAL); - + m_vertScrollBar = new wxScrollBar( this, wxGRID_VERTSCROLL, wxPoint(0, 0), @@ -781,12 +781,12 @@ void wxGrid::Init() m_scrollPosX = 0; m_scrollPosY = 0; m_wholeColsVisible = 0; - m_wholeRowsVisible = 0; + m_wholeRowsVisible = 0; m_firstPaint = TRUE; m_inOnKeyDown = FALSE; m_batchCount = 0; - + m_cursorMode = WXGRID_CURSOR_DEFAULT; m_dragLastPos = -1; m_dragRowOrCol = -1; @@ -800,7 +800,7 @@ void wxGrid::Init() m_selectedTopLeft = wxGridNoCellCoords; m_selectedBottomRight = wxGridNoCellCoords; - + m_editable = TRUE; // default for whole grid // TODO: extend this to other types of controls @@ -815,11 +815,11 @@ void wxGrid::Init() , wxTE_MULTILINE | wxTE_NO_VSCROLL #endif ); - - m_cellEditCtrl->Show( FALSE ); + + m_cellEditCtrl->Show( FALSE ); m_cellEditCtrlEnabled = TRUE; - m_editCtrlType = wxGRID_TEXTCTRL; - + m_editCtrlType = wxGRID_TEXTCTRL; + // This is here in case OnSize does not get called when the grid is // displayed // @@ -835,7 +835,7 @@ void wxGrid::CalcDimensions() { int ctrlW, ctrlH; m_topEditCtrl->GetSize( &ctrlW, &ctrlH ); - + m_top = ctrlH + 20; } else @@ -893,7 +893,7 @@ void wxGrid::CalcDimensions() } } - + // calculate the coords of row bottom edges and col right edges // int bottom = m_top + m_colLabelHeight; @@ -908,9 +908,9 @@ void wxGrid::CalcDimensions() { right += m_colWidths[i]; m_colRights[i] = right; - } + } + - // check how many rows and cols are visible // m_wholeRowsVisible = 0; @@ -934,11 +934,11 @@ void wxGrid::CalcDimensions() // A partial col doesn't count, we still have to scroll to // see the rest of it if ( m_colRights[i] + vertScrollBarWidth > cw ) break; - + m_wholeColsVisible++ ; } } - + if ( m_vertScrollBar ) { if ( !vertScrollBarWidth ) @@ -953,14 +953,14 @@ void wxGrid::CalcDimensions() wxMax(m_wholeRowsVisible, 1), (m_wholeRowsVisible == 0 ? 1 : m_numRows), wxMax(m_wholeRowsVisible, 1) ); - + m_vertScrollBar->SetSize( cw - m_scrollBarWidth, m_top, m_scrollBarWidth, ch - m_top - horizScrollBarHeight); } } - + if ( m_horizScrollBar ) { if ( !horizScrollBarHeight ) @@ -1018,7 +1018,7 @@ bool wxGrid::IsOnScreen() bool wxGrid::Redimension( wxGridTableMessage& msg ) { int i; - + switch ( msg.GetId() ) { case wxGRIDTABLE_NOTIFY_ROWS_INSERTED: @@ -1134,7 +1134,7 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) m_numRows = 0; m_rowHeights.Clear(); m_rowBottoms.Clear(); -#endif +#endif m_currentCellCoords = wxGridNoCellCoords; } else if ( m_currentCellCoords.GetCol() >= m_numCols ) @@ -1154,57 +1154,57 @@ bool wxGrid::Redimension( wxGridTableMessage& msg ) // ----- event handlers // -// Generate a grid event based on a mouse event and +// Generate a grid event based on a mouse event and // return the result of ProcessEvent() // bool wxGrid::SendEvent( const wxEventType type, - int row, int col, - wxMouseEvent& mouseEv ) + int row, int col, + wxMouseEvent& mouseEv ) { if ( type == EVT_GRID_ROW_SIZE || - type == EVT_GRID_COL_SIZE ) + type == EVT_GRID_COL_SIZE ) { - int rowOrCol = (row == -1 ? col : row); + int rowOrCol = (row == -1 ? col : row); - wxGridSizeEvent gridEvt( GetId(), - type, - this, - rowOrCol, - mouseEv.GetX(), mouseEv.GetY(), - mouseEv.ControlDown(), - mouseEv.ShiftDown(), - mouseEv.AltDown(), - mouseEv.MetaDown() ); + wxGridSizeEvent gridEvt( GetId(), + type, + this, + rowOrCol, + mouseEv.GetX(), mouseEv.GetY(), + mouseEv.ControlDown(), + mouseEv.ShiftDown(), + mouseEv.AltDown(), + mouseEv.MetaDown() ); - return GetEventHandler()->ProcessEvent(gridEvt); + return GetEventHandler()->ProcessEvent(gridEvt); } else if ( type == EVT_GRID_RANGE_SELECT ) { - wxGridRangeSelectEvent gridEvt( GetId(), - type, - this, - m_selectedTopLeft, - m_selectedBottomRight, - mouseEv.ControlDown(), - mouseEv.ShiftDown(), - mouseEv.AltDown(), - mouseEv.MetaDown() ); + wxGridRangeSelectEvent gridEvt( GetId(), + type, + this, + m_selectedTopLeft, + m_selectedBottomRight, + mouseEv.ControlDown(), + mouseEv.ShiftDown(), + mouseEv.AltDown(), + mouseEv.MetaDown() ); - return GetEventHandler()->ProcessEvent(gridEvt); + return GetEventHandler()->ProcessEvent(gridEvt); } else { - wxGridEvent gridEvt( GetId(), - type, - this, - row, col, - mouseEv.GetX(), mouseEv.GetY(), - mouseEv.ControlDown(), - mouseEv.ShiftDown(), - mouseEv.AltDown(), - mouseEv.MetaDown() ); + wxGridEvent gridEvt( GetId(), + type, + this, + row, col, + mouseEv.GetX(), mouseEv.GetY(), + mouseEv.ControlDown(), + mouseEv.ShiftDown(), + mouseEv.AltDown(), + mouseEv.MetaDown() ); - return GetEventHandler()->ProcessEvent(gridEvt); + return GetEventHandler()->ProcessEvent(gridEvt); } } @@ -1213,28 +1213,28 @@ bool wxGrid::SendEvent( const wxEventType type, // of ProcessEvent(). // bool wxGrid::SendEvent( const wxEventType type, - int row, int col ) + int row, int col ) { if ( type == EVT_GRID_ROW_SIZE || - type == EVT_GRID_COL_SIZE ) + type == EVT_GRID_COL_SIZE ) { - int rowOrCol = (row == -1 ? col : row); + int rowOrCol = (row == -1 ? col : row); - wxGridSizeEvent gridEvt( GetId(), - type, - this, - rowOrCol ); + wxGridSizeEvent gridEvt( GetId(), + type, + this, + rowOrCol ); - return GetEventHandler()->ProcessEvent(gridEvt); + return GetEventHandler()->ProcessEvent(gridEvt); } else { - wxGridEvent gridEvt( GetId(), - type, - this, - row, col ); + wxGridEvent gridEvt( GetId(), + type, + this, + row, col ); - return GetEventHandler()->ProcessEvent(gridEvt); + return GetEventHandler()->ProcessEvent(gridEvt); } } @@ -1258,9 +1258,9 @@ void wxGrid::OnPaint( wxPaintEvent& WXUNUSED(ev) ) int cw, ch; GetClientSize( &cw, &ch ); dc.SetClippingRegion( 0, 0, cw - vs, ch - hs ); - + HideCurrentCellHighlight( dc ); - + DrawLabelAreas( dc ); DrawColLabels( dc ); DrawRowLabels( dc ); @@ -1274,7 +1274,7 @@ void wxGrid::OnPaint( wxPaintEvent& WXUNUSED(ev) ) { if ( m_currentCellCoords == wxGridNoCellCoords ) m_currentCellCoords.Set(0, 0); - + SetEditControlValue(); ShowCellEditControl(); m_firstPaint = FALSE; @@ -1298,7 +1298,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) int x = ev.GetX(); int y = ev.GetY(); int row, col; - + // ------------------------------------------------------------ // // Mouse dragging @@ -1306,7 +1306,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) if ( ev.Dragging() ) { m_isDragging = TRUE; - + if ( ev.LeftIsDown() ) { switch( m_cursorMode ) @@ -1319,10 +1319,10 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) { if ( !IsSelection() ) { - SelectBlock( cellCoords, cellCoords ); - } - else - { + SelectBlock( cellCoords, cellCoords ); + } + else + { // check for the mouse being outside the cell area // (we still want to let the user grow the selected block) // @@ -1333,7 +1333,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) else cellCoords.SetCol( m_scrollPosX ); } - + if ( cellCoords.GetRow() == -1 ) { if ( y >= m_bottom ) @@ -1341,10 +1341,10 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) else cellCoords.SetRow( m_scrollPosY ); } - + if ( !IsInSelection( cellCoords ) ) - SelectBlock( m_currentCellCoords, cellCoords ); - } + SelectBlock( m_currentCellCoords, cellCoords ); + } } } break; @@ -1360,11 +1360,11 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) } dc.DrawLine( m_left, ev.GetY(), m_right, ev.GetY()); - + m_dragLastPos = ev.GetY(); } break; - + case WXGRID_CURSOR_RESIZE_COL: { wxClientDC dc(this); @@ -1376,7 +1376,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) } dc.DrawLine( ev.GetX(), m_top, ev.GetX(), m_bottom ); - + m_dragLastPos = ev.GetX(); } break; @@ -1406,7 +1406,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) } m_isDragging = FALSE; - + // ------------------------------------------------------------ // // Left mouse button down @@ -1416,7 +1416,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) row = -1; col = -1; wxGridCellCoords cellCoords; - + switch( XYToArea( x, y ) ) { case WXGRID_ROWLABEL: @@ -1481,9 +1481,9 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) break; default: -#if 0 +#if 0 wxLogMessage( "outside grid area" ); -#endif +#endif break; } } @@ -1496,7 +1496,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) row = -1; col = -1; wxGridCellCoords cellCoords; - + switch( XYToArea( x, y ) ) { case WXGRID_ROWLABEL: @@ -1531,7 +1531,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) { // leave both row and col as -1 // - SendEvent( EVT_GRID_LABEL_LEFT_DCLICK, row, col, ev ); + SendEvent( EVT_GRID_LABEL_LEFT_DCLICK, row, col, ev ); } break; @@ -1546,9 +1546,9 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) break; default: -#if 0 +#if 0 wxLogMessage( "outside grid area" ); -#endif +#endif break; } } @@ -1558,85 +1558,85 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) // else if ( ev.LeftUp() ) { - switch ( m_cursorMode ) - { - case WXGRID_CURSOR_RESIZE_ROW: - { - if ( m_dragLastPos >= 0 ) - { - // erase the last line and resize the row - // - wxClientDC dc( this ); - dc.SetLogicalFunction( wxINVERT ); - dc.DrawLine( m_left, m_dragLastPos, - m_right, m_dragLastPos ); - HideCellEditControl(); - int top = m_top + m_colLabelHeight; - if ( m_dragRowOrCol > 0 ) - top = m_rowBottoms[m_dragRowOrCol-1]; + switch ( m_cursorMode ) + { + case WXGRID_CURSOR_RESIZE_ROW: + { + if ( m_dragLastPos >= 0 ) + { + // erase the last line and resize the row + // + wxClientDC dc( this ); + dc.SetLogicalFunction( wxINVERT ); + dc.DrawLine( m_left, m_dragLastPos, + m_right, m_dragLastPos ); + HideCellEditControl(); + int top = m_top + m_colLabelHeight; + if ( m_dragRowOrCol > 0 ) + top = m_rowBottoms[m_dragRowOrCol-1]; m_sumRowHeights -= m_rowHeights[ m_dragRowOrCol ]; - m_rowHeights[m_dragRowOrCol] = wxMax( ev.GetY() - top, - WXGRID_MIN_ROW_HEIGHT ); + m_rowHeights[m_dragRowOrCol] = wxMax( ev.GetY() - top, + WXGRID_MIN_ROW_HEIGHT ); m_sumRowHeights += m_rowHeights[ m_dragRowOrCol ]; - CalcDimensions(); - ShowCellEditControl(); - Refresh(); - - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, ev ); - } - } - break; - - case WXGRID_CURSOR_RESIZE_COL: - { - if ( m_dragLastPos >= 0 ) - { - // erase the last line and resize the col - // - wxClientDC dc( this ); - dc.SetLogicalFunction( wxINVERT ); - dc.DrawLine( m_left, m_dragLastPos, - m_right, m_dragLastPos ); - HideCellEditControl(); - int left = m_left + m_rowLabelWidth; - if ( m_dragRowOrCol > 0 ) - left = m_colRights[m_dragRowOrCol-1]; + CalcDimensions(); + ShowCellEditControl(); + Refresh(); + + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_ROW_SIZE, m_dragRowOrCol, -1, ev ); + } + } + break; + + case WXGRID_CURSOR_RESIZE_COL: + { + if ( m_dragLastPos >= 0 ) + { + // erase the last line and resize the col + // + wxClientDC dc( this ); + dc.SetLogicalFunction( wxINVERT ); + dc.DrawLine( m_left, m_dragLastPos, + m_right, m_dragLastPos ); + HideCellEditControl(); + int left = m_left + m_rowLabelWidth; + if ( m_dragRowOrCol > 0 ) + left = m_colRights[m_dragRowOrCol-1]; m_sumColWidths -= m_colWidths[m_dragRowOrCol]; - m_colWidths[m_dragRowOrCol] = wxMax( ev.GetX() - left, - WXGRID_MIN_COL_WIDTH ); + m_colWidths[m_dragRowOrCol] = wxMax( ev.GetX() - left, + WXGRID_MIN_COL_WIDTH ); m_sumColWidths += m_colWidths[m_dragRowOrCol]; - CalcDimensions(); - ShowCellEditControl(); - Refresh(); - - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, ev ); - } - } - break; - - case WXGRID_CURSOR_SELECT_CELL: - { - if ( IsSelection() ) - { - // Note: we are ending the event *after* doing - // default processing in this case - // - SendEvent( EVT_GRID_RANGE_SELECT, -1, -1, ev ); - } - } - break; - } - - m_dragLastPos = -1; + CalcDimensions(); + ShowCellEditControl(); + Refresh(); + + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_COL_SIZE, -1, m_dragRowOrCol, ev ); + } + } + break; + + case WXGRID_CURSOR_SELECT_CELL: + { + if ( IsSelection() ) + { + // Note: we are ending the event *after* doing + // default processing in this case + // + SendEvent( EVT_GRID_RANGE_SELECT, -1, -1, ev ); + } + } + break; + } + + m_dragLastPos = -1; } // ------------------------------------------------------------ // @@ -1644,18 +1644,18 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) // else if ( ev.RightDown() ) { - row = -1; - col = -1; - wxGridCellCoords cellCoords; - - switch( XYToArea( x, y ) ) - { - - case WXGRID_ROWLABEL: - { - row = YToRow(y); - if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) ) - { + row = -1; + col = -1; + wxGridCellCoords cellCoords; + + switch( XYToArea( x, y ) ) + { + + case WXGRID_ROWLABEL: + { + row = YToRow(y); + if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) ) + { // TODO: default processing ? } } @@ -1664,7 +1664,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) case WXGRID_COLLABEL: { col = XToCol(x); - if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) ) + if ( !SendEvent( EVT_GRID_LABEL_RIGHT_CLICK, row, col, ev ) ) { // TODO: default processing ? } @@ -1696,9 +1696,9 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) break; default: -#if 0 +#if 0 wxLogMessage( "outside grid area" ); -#endif +#endif break; } } @@ -1708,24 +1708,24 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) // else if ( ev.RightDClick() ) { - row = -1; - col = -1; - wxGridCellCoords cellCoords; - - switch( XYToArea( x, y ) ) - { - - case WXGRID_ROWLABEL: - { - row = YToRow(y); - SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev ); + row = -1; + col = -1; + wxGridCellCoords cellCoords; + + switch( XYToArea( x, y ) ) + { + + case WXGRID_ROWLABEL: + { + row = YToRow(y); + SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev ); } break; case WXGRID_COLLABEL: { col = XToCol(x); - SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev ); + SendEvent( EVT_GRID_LABEL_RIGHT_DCLICK, row, col, ev ); } break; @@ -1748,9 +1748,9 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) break; default: -#if 0 +#if 0 wxLogMessage( "outside grid area" ); -#endif +#endif break; } } @@ -1815,7 +1815,7 @@ void wxGrid::OnMouse( wxMouseEvent& ev ) } } break; - } + } } } @@ -1830,13 +1830,13 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev ) } m_inOnKeyDown = TRUE; - + // propagate the event up and see if it gets processed // wxWindow *parent = GetParent(); wxKeyEvent keyEvt( ev ); keyEvt.SetEventObject( parent ); - + if ( !parent->GetEventHandler()->ProcessEvent( keyEvt ) ) { // try local handlers @@ -1853,7 +1853,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev ) MoveCursorUp(); } break; - + case WXK_DOWN: if ( ev.ControlDown() ) { @@ -1902,7 +1902,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev ) ev.Skip(); } break; - + case WXK_END: if ( ev.ControlDown() ) { @@ -1914,7 +1914,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev ) ev.Skip(); } break; - + case WXK_PRIOR: MovePageUp(); break; @@ -1922,7 +1922,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev ) case WXK_NEXT: MovePageDown(); break; - + default: // now try the cell edit control // @@ -1960,7 +1960,7 @@ void wxGrid::OnText( wxCommandEvent& ev ) ((wxTextCtrl *)m_topEditCtrl)-> SetValue(((wxTextCtrl *)ctrl)->GetValue()); break; - + case wxGRID_COMBOBOX: ((wxComboBox *)m_topEditCtrl)-> SetValue(((wxComboBox *)ctrl)->GetValue()); @@ -1977,7 +1977,7 @@ void wxGrid::OnText( wxCommandEvent& ev ) ((wxTextCtrl *)m_cellEditCtrl)-> SetValue(((wxTextCtrl *)ctrl)->GetValue()); break; - + case wxGRID_COMBOBOX: ((wxComboBox *)m_cellEditCtrl)-> SetValue(((wxComboBox *)ctrl)->GetValue()); @@ -1986,7 +1986,7 @@ void wxGrid::OnText( wxCommandEvent& ev ) } else { - // in the case when in-place editing is turned off we just want to + // in the case when in-place editing is turned off we just want to // echo the text changes in the cell but not yet update the grid table // switch ( m_editCtrlType ) @@ -1994,7 +1994,7 @@ void wxGrid::OnText( wxCommandEvent& ev ) case wxGRID_TEXTCTRL: DrawCellValue( m_currentCellCoords, ((wxTextCtrl *)ctrl)->GetValue() ); break; - + case wxGRID_COMBOBOX: DrawCellValue( m_currentCellCoords, ((wxComboBox *)ctrl)->GetValue() ); break; @@ -2013,7 +2013,7 @@ void wxGrid::OnGridScroll( wxScrollEvent& ev ) wxWindow *parent = GetParent(); wxScrollEvent scrollEvt( ev ); if (parent->GetEventHandler()->ProcessEvent( scrollEvt )) return; - + HideCellEditControl(); if ( ev.GetEventObject() == m_horizScrollBar ) @@ -2072,8 +2072,8 @@ void wxGrid::SelectCell( const wxGridCellCoords& coords ) void wxGrid::ShowCellEditControl() { wxRect rect; - - if ( IsCellEditControlEnabled() ) + + if ( IsCellEditControlEnabled() ) { if ( !IsVisible( m_currentCellCoords ) ) { @@ -2082,7 +2082,7 @@ void wxGrid::ShowCellEditControl() else { rect = CellToRect( m_currentCellCoords ); - + m_cellEditCtrl->SetSize( rect ); m_cellEditCtrl->Show( TRUE ); @@ -2101,7 +2101,7 @@ void wxGrid::ShowCellEditControl() // TODO: anything ??? // break; - + case wxGRID_COMBOBOX: // TODO: anything ??? // @@ -2149,7 +2149,7 @@ void wxGrid::SetEditControlValue( const wxString& value ) // TODO: implement this // break; - + case wxGRID_COMBOBOX: // TODO: implement this // @@ -2174,7 +2174,7 @@ void wxGrid::SetEditControlValue( const wxString& value ) // TODO: implement this // break; - + case wxGRID_COMBOBOX: // TODO: implement this // @@ -2188,7 +2188,7 @@ void wxGrid::SaveEditControlValue() { if ( m_table ) { - wxWindow *ctrl = (wxWindow *)NULL; + wxWindow *ctrl = (wxWindow *)NULL; if ( IsCellEditControlEnabled() ) { @@ -2202,9 +2202,9 @@ void wxGrid::SaveEditControlValue() { return; } - + bool valueChanged = FALSE; - + switch ( m_editCtrlType ) { case wxGRID_TEXTCTRL: @@ -2223,13 +2223,13 @@ void wxGrid::SaveEditControlValue() // TODO: implement this // break; - + case wxGRID_COMBOBOX: // TODO: implement this // break; } - + if ( valueChanged ) { SendEvent( EVT_GRID_CELL_CHANGE, @@ -2280,7 +2280,7 @@ void wxGrid::XYToCell( int x, int y, wxGridCellCoords& coords ) int wxGrid::YToRow( int y ) { int i; - + if ( y > m_top + m_colLabelHeight ) { for ( i = m_scrollPosY; i < m_numRows; i++ ) @@ -2299,7 +2299,7 @@ int wxGrid::YToRow( int y ) int wxGrid::XToCol( int x ) { int i; - + if ( x > m_left + m_rowLabelWidth ) { for ( i = m_scrollPosX; i < m_numCols; i++ ) @@ -2321,7 +2321,7 @@ int wxGrid::XToCol( int x ) int wxGrid::YToEdgeOfRow( int y ) { int i, d; - + if ( y > m_top + m_colLabelHeight ) { for ( i = m_scrollPosY; i < m_numRows; i++ ) @@ -2337,7 +2337,7 @@ int wxGrid::YToEdgeOfRow( int y ) } return -1; - + } @@ -2347,7 +2347,7 @@ int wxGrid::YToEdgeOfRow( int y ) int wxGrid::XToEdgeOfCol( int x ) { int i, d; - + if ( x > m_left + m_rowLabelWidth ) { for ( i = m_scrollPosX; i < m_numCols; i++ ) @@ -2363,7 +2363,7 @@ int wxGrid::XToEdgeOfCol( int x ) } return -1; - + } @@ -2380,7 +2380,7 @@ wxRect wxGrid::CellToRect( int row, int col ) } return rect; -} +} bool wxGrid::MoveCursorUp() @@ -2412,7 +2412,7 @@ bool wxGrid::MoveCursorDown() if ( !IsVisible( m_currentCellCoords ) ) MakeCellVisible( m_currentCellCoords ); - + return TRUE; } @@ -2429,7 +2429,7 @@ bool wxGrid::MoveCursorLeft() if ( !IsVisible( m_currentCellCoords ) ) MakeCellVisible( m_currentCellCoords ); - + return TRUE; } @@ -2446,7 +2446,7 @@ bool wxGrid::MoveCursorRight() if ( !IsVisible( m_currentCellCoords ) ) MakeCellVisible( m_currentCellCoords ); - + return TRUE; } @@ -2470,7 +2470,7 @@ bool wxGrid::MovePageUp() SelectCell( row, m_currentCellCoords.GetCol() ); return TRUE; } - + return FALSE; } @@ -2491,13 +2491,13 @@ bool wxGrid::MovePageDown() { return FALSE; } - + // m_scrollPosY will have been updated // SelectCell( m_scrollPosY, m_currentCellCoords.GetCol() ); return TRUE; } - + return FALSE; } @@ -2509,7 +2509,7 @@ bool wxGrid::MoveCursorUpBlock() { int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - + if ( m_table->IsEmptyCell(row, col) ) { // starting in an empty cell: find the next block of @@ -2546,7 +2546,7 @@ bool wxGrid::MoveCursorUpBlock() } } } - + SelectCell( row, col ); if ( !IsVisible( m_currentCellCoords ) ) @@ -2566,7 +2566,7 @@ bool wxGrid::MoveCursorDownBlock() { int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - + if ( m_table->IsEmptyCell(row, col) ) { // starting in an empty cell: find the next block of @@ -2603,7 +2603,7 @@ bool wxGrid::MoveCursorDownBlock() } } } - + SelectCell( row, col ); if ( !IsVisible( m_currentCellCoords ) ) @@ -2623,7 +2623,7 @@ bool wxGrid::MoveCursorLeftBlock() { int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - + if ( m_table->IsEmptyCell(row, col) ) { // starting in an empty cell: find the next block of @@ -2660,7 +2660,7 @@ bool wxGrid::MoveCursorLeftBlock() } } } - + SelectCell( row, col ); if ( !IsVisible( m_currentCellCoords ) ) @@ -2680,7 +2680,7 @@ bool wxGrid::MoveCursorRightBlock() { int row = m_currentCellCoords.GetRow(); int col = m_currentCellCoords.GetCol(); - + if ( m_table->IsEmptyCell(row, col) ) { // starting in an empty cell: find the next block of @@ -2717,7 +2717,7 @@ bool wxGrid::MoveCursorRightBlock() } } } - + SelectCell( row, col ); if ( !IsVisible( m_currentCellCoords ) ) @@ -2742,10 +2742,10 @@ void wxGrid::DrawLabelAreas( wxDC& dc ) dc.SetPen(*wxTRANSPARENT_PEN); dc.SetBrush( wxBrush(GetLabelBackgroundColour(), wxSOLID) ); - + dc.DrawRectangle( m_left, m_top, cw - m_left, m_colLabelHeight ); - + dc.DrawRectangle( m_left, m_top, m_rowLabelWidth, ch - m_top ); } @@ -2766,7 +2766,7 @@ void wxGrid::DrawColLabels( wxDC& dc ) int labelLeft = m_left + m_rowLabelWidth; int i; - + for ( i = m_scrollPosX; i < m_numCols; i++ ) { if ( labelLeft > cw) break; @@ -2774,7 +2774,7 @@ void wxGrid::DrawColLabels( wxDC& dc ) rect.x = 1 + labelLeft; rect.width = m_colWidths[i]; DrawColLabel( dc, rect, i ); - + labelLeft += m_colWidths[i]; } } @@ -2789,7 +2789,7 @@ void wxGrid::DrawColLabelBorders( wxDC& dc ) GetClientSize( &cw, &ch ); dc.SetPen( *wxBLACK_PEN ); - + // horizontal lines // dc.DrawLine( m_left, m_top, cw, m_top ); @@ -2824,7 +2824,7 @@ void wxGrid::DrawColLabelBorders( wxDC& dc ) dc.DrawLine(colLeft + 1, m_top + 1, colLeft + 1, m_top + m_colLabelHeight); - + colLeft += m_colWidths[i]; } } @@ -2838,12 +2838,12 @@ void wxGrid::DrawColLabel( wxDC& dc, const wxRect& rect, int col ) rect2.y += 2; rect2.width -= 5; rect2.height -= 4; - + dc.SetBackgroundMode( wxTRANSPARENT ); dc.SetTextBackground( GetLabelBackgroundColour() ); dc.SetTextForeground( GetLabelTextColour() ); dc.SetFont( GetLabelFont() ); - + int hAlign, vAlign; GetColLabelAlignment( &hAlign, &vAlign ); DrawTextRectangle( dc, GetColLabelValue( col ), rect2, hAlign, vAlign ); @@ -2865,7 +2865,7 @@ void wxGrid::DrawRowLabels( wxDC& dc ) int labelTop = m_top + m_colLabelHeight; int i; - + for ( i = m_scrollPosY; i < m_numRows; i++ ) { if ( labelTop > ch ) break; @@ -2873,7 +2873,7 @@ void wxGrid::DrawRowLabels( wxDC& dc ) rect.y = 1 + labelTop; rect.height = m_rowHeights[i]; DrawRowLabel( dc, rect, i ); - + labelTop += m_rowHeights[i]; } } @@ -2888,7 +2888,7 @@ void wxGrid::DrawRowLabelBorders( wxDC& dc ) GetClientSize( &cw, &ch ); dc.SetPen( *wxBLACK_PEN ); - + // vertical lines // dc.DrawLine( m_left, m_top, m_left, ch ); @@ -2923,7 +2923,7 @@ void wxGrid::DrawRowLabelBorders( wxDC& dc ) dc.DrawLine( m_left + 1, rowTop + 1, m_left + 1, rowTop + m_rowHeights[i] ); - + rowTop += m_rowHeights[i]; } } @@ -2937,12 +2937,12 @@ void wxGrid::DrawRowLabel( wxDC& dc, const wxRect& rect, int row ) rect2.y += 2; rect2.width -= 5; rect2.height -= 4; - + dc.SetBackgroundMode( wxTRANSPARENT ); dc.SetTextBackground( GetLabelBackgroundColour() ); dc.SetTextForeground( GetLabelTextColour() ); dc.SetFont( GetLabelFont() ); - + int hAlign, vAlign; GetRowLabelAlignment( &hAlign, &vAlign ); DrawTextRectangle( dc, GetRowLabelValue( row ), rect2, hAlign, vAlign ); @@ -2967,7 +2967,7 @@ void wxGrid::DrawCellArea( wxDC& dc ) void wxGrid::DrawGridLines( wxDC& dc ) { if ( !m_gridLinesEnabled || !m_numRows || !m_numCols ) return; - + int i; int cw, ch; GetClientSize(&cw, &ch); @@ -3006,12 +3006,12 @@ void wxGrid::DrawGridLines( wxDC& dc ) void wxGrid::DrawCells( wxDC& dc ) { if ( !m_numRows || !m_numCols ) return; - + int row, col; - + int cw, ch; GetClientSize( &cw, &ch ); - + wxRect rect; if ( m_table ) @@ -3047,9 +3047,9 @@ void wxGrid::DrawCellBackground( wxDC& dc, const wxRect& rect, int row, int col rect2.y += 1; rect2.width -= 2; rect2.height -= 2; - + dc.SetBackgroundMode( wxSOLID ); - + if ( IsInSelection( row, col ) ) { // TODO: improve this @@ -3077,7 +3077,7 @@ void wxGrid::DrawCellValue( wxDC& dc, const wxRect& rect, int row, int col, rect2.y += 2; rect2.width -= 5; rect2.height -= 4; - + dc.SetBackgroundMode( wxTRANSPARENT ); if ( IsInSelection( row, col ) ) @@ -3093,10 +3093,10 @@ void wxGrid::DrawCellValue( wxDC& dc, const wxRect& rect, int row, int col, dc.SetTextForeground( GetCellTextColour(row, col) ); } dc.SetFont( GetCellFont(row, col) ); - + int hAlign, vAlign; GetCellAlignment( row, col, &hAlign, &vAlign ); - + if ( useValueArg ) { DrawTextRectangle( dc, value, rect2, hAlign, vAlign ); @@ -3108,7 +3108,7 @@ void wxGrid::DrawCellValue( wxDC& dc, const wxRect& rect, int row, int col, } -// this is used to echo text being entered into the top edit control when +// this is used to echo text being entered into the top edit control when // in-place editing is turned off // void wxGrid::DrawCellValue( const wxGridCellCoords& coords, const wxString& value ) @@ -3141,10 +3141,10 @@ void wxGrid::DrawCellHighlight( wxDC& dc, int row, int col ) int cw, ch; GetClientSize( &cw, &ch ); - + x = m_colRights[col] - m_colWidths[col]; if ( x >= cw ) return; - + y = m_rowBottoms[row] - m_rowHeights[row]; if ( y >= ch ) return; @@ -3169,10 +3169,10 @@ void wxGrid::DrawCell( int row, int col ) if ( !GetBatchCount() ) { if ( !IsVisible( wxGridCellCoords(row, col) ) ) return; - + int cw, ch; GetClientSize( &cw, &ch ); - + wxRect rect( CellToRect( row, col ) ); if ( m_table ) @@ -3220,7 +3220,7 @@ void wxGrid::DrawTextRectangle( wxDC& dc, long textWidth, textHeight; long lineWidth, lineHeight; wxArrayString lines; - + // see if we are already clipping // wxRect clipRect; @@ -3260,21 +3260,21 @@ void wxGrid::DrawTextRectangle( wxDC& dc, { GetTextBoxSize( dc, lines, &textWidth, &textHeight ); dc.GetTextExtent( lines[0], &lineWidth, &lineHeight ); - + float x, y; switch ( horizAlign ) { case wxRIGHT: - x = rect.x + (rect.width - textWidth - 1.0); + x = rect.x + (rect.width - textWidth - 1); break; case wxCENTRE: - x = rect.x + ((rect.width - textWidth)/2.0); + x = rect.x + ((rect.width - textWidth)/2); break; case wxLEFT: default: - x = rect.x + 1.0; + x = rect.x + 1; break; } @@ -3285,12 +3285,12 @@ void wxGrid::DrawTextRectangle( wxDC& dc, break; case wxCENTRE: - y = rect.y + ((rect.height - textHeight)/2.0); + y = rect.y + ((rect.height - textHeight)/2); break; case wxTOP: default: - y = rect.y + 1.0; + y = rect.y + 1; break; } @@ -3300,7 +3300,7 @@ void wxGrid::DrawTextRectangle( wxDC& dc, y += lineHeight; } } - + dc.DestroyClippingRegion(); if (alreadyClipping) dc.SetClippingRegion( clipRect ); } @@ -3388,7 +3388,7 @@ bool wxGrid::GetModelValues() bool wxGrid::SetModelValues() { int row, col; - + if ( m_table ) { for ( row = m_scrollPosY; row < m_numRows; row++ ) @@ -3401,7 +3401,7 @@ bool wxGrid::SetModelValues() return TRUE; } - + return FALSE; } @@ -3421,13 +3421,13 @@ bool wxGrid::CreateGrid( int numRows, int numCols ) { m_numRows = numRows; m_numCols = numCols; - + m_table = new wxGridStringTable( m_numRows, m_numCols ); m_table->SetView( this ); Init(); m_created = TRUE; } - + return m_created; } @@ -3457,7 +3457,7 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) wxLogError( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") ); return FALSE; } - + if ( m_table ) { bool ok = m_table->InsertRows( pos, numRows ); @@ -3467,7 +3467,7 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) // if ( ok ) { - if ( m_numCols == 0 ) + if ( m_numCols == 0 ) { m_table->AppendCols( WXGRID_DEFAULT_NUMBER_COLS ); // @@ -3475,15 +3475,15 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) // we should remember what the last non-zero number of cols was ? // } - + if ( m_currentCellCoords == wxGridNoCellCoords ) { // if we have just inserted cols into an empty grid the current // cell will be undefined... // - SelectCell( 0, 0 ); + SelectCell( 0, 0 ); } - + if ( !GetBatchCount() ) Refresh(); } @@ -3499,13 +3499,13 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) ) { // TODO: something with updateLabels flag - + if ( !m_created ) { wxLogError( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") ); return FALSE; } - + if ( m_table && m_table->AppendRows( numRows ) ) { if ( m_currentCellCoords == wxGridNoCellCoords ) @@ -3513,9 +3513,9 @@ bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) ) // if we have just inserted cols into an empty grid the current // cell will be undefined... // - SelectCell( 0, 0 ); + SelectCell( 0, 0 ); } - + // the table will have sent the results of the append row // operation to this view object as a grid table message // @@ -3537,7 +3537,7 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) wxLogError( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") ); return FALSE; } - + if ( m_table && m_table->DeleteRows( pos, numRows ) ) { // the table will have sent the results of the delete row @@ -3547,7 +3547,7 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) SetEditControlValue(); else HideCellEditControl(); - + if ( !GetBatchCount() ) Refresh(); return TRUE; } @@ -3560,7 +3560,7 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) { // TODO: something with updateLabels flag - + if ( !m_created ) { wxLogError( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") ); @@ -3571,7 +3571,7 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) { HideCellEditControl(); bool ok = m_table->InsertCols( pos, numCols ); - + // the table will have sent the results of the insert col // operation to this view object as a grid table message // @@ -3582,12 +3582,12 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) // if we have just inserted cols into an empty grid the current // cell will be undefined... // - SelectCell( 0, 0 ); + SelectCell( 0, 0 ); } if ( !GetBatchCount() ) Refresh(); } - + SetEditControlValue(); return ok; } @@ -3603,41 +3603,41 @@ bool wxGrid::AppendCols( int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") ); - return FALSE; + wxLogError( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") ); + return FALSE; } if ( m_table && m_table->AppendCols( numCols ) ) { - // the table will have sent the results of the append col - // operation to this view object as a grid table message - // + // the table will have sent the results of the append col + // operation to this view object as a grid table message + // if ( m_currentCellCoords == wxGridNoCellCoords ) { // if we have just inserted cols into an empty grid the current // cell will be undefined... // - SelectCell( 0, 0 ); + SelectCell( 0, 0 ); } - if ( !GetBatchCount() ) Refresh(); - return TRUE; + if ( !GetBatchCount() ) Refresh(); + return TRUE; } else { - return FALSE; + return FALSE; } } bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) { // TODO: something with updateLabels flag - + if ( !m_created ) { wxLogError( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") ); return FALSE; } - + if ( m_table && m_table->DeleteCols( pos, numCols ) ) { // the table will have sent the results of the delete col @@ -3647,7 +3647,7 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) SetEditControlValue(); else HideCellEditControl(); - + if ( !GetBatchCount() ) Refresh(); return TRUE; } @@ -3656,7 +3656,7 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) return FALSE; } } - + @@ -3673,7 +3673,7 @@ void wxGrid::EnableEditing( bool edit ) if ( !m_editable ) HideCellEditControl(); m_topEditCtrlEnabled = m_editable; m_cellEditCtrlEnabled = m_editable; - if ( !m_editable ) ShowCellEditControl(); + if ( !m_editable ) ShowCellEditControl(); } } @@ -3689,7 +3689,7 @@ void wxGrid::EnableTopEditControl( bool enable ) if ( m_currentCellCoords != wxGridNoCellCoords ) SetEditControlValue(); - + ShowCellEditControl(); if ( !GetBatchCount() ) Refresh(); } @@ -3701,11 +3701,11 @@ void wxGrid::EnableCellEditControl( bool enable ) enable != m_cellEditCtrlEnabled ) { wxClientDC dc( this ); - + HideCurrentCellHighlight( dc ); HideCellEditControl(); SaveEditControlValue(); - + m_cellEditCtrlEnabled = enable; SetEditControlValue(); @@ -3799,7 +3799,7 @@ void wxGrid::SetRowLabelAlignment( int horiz, int vert ) { m_rowLabelHorizAlign = horiz; } - + if ( vert == wxTOP || vert == wxCENTRE || vert == wxBOTTOM ) { m_rowLabelVertAlign = vert; @@ -3814,7 +3814,7 @@ void wxGrid::SetColLabelAlignment( int horiz, int vert ) { m_colLabelHorizAlign = horiz; } - + if ( vert == wxTOP || vert == wxCENTRE || vert == wxBOTTOM ) { m_colLabelVertAlign = vert; @@ -3844,7 +3844,7 @@ void wxGrid::SetColLabelValue( int col, const wxString& s ) void wxGrid::SetGridLineColour( const wxColour& colour ) { m_gridLineColour = colour; - + wxClientDC dc( this ); DrawGridLines( dc ); } @@ -3896,21 +3896,21 @@ wxColour wxGrid::GetCellBackgroundColour( int WXUNUSED(row), int WXUNUSED(col) ) { // TODO: replace this temp test code // - return wxColour( 255, 255, 255 ); + return wxColour( 255, 255, 255 ); } wxColour wxGrid::GetDefaultCellTextColour() { // TODO: replace this temp test code // - return wxColour( 0, 0, 0 ); + return wxColour( 0, 0, 0 ); } wxColour wxGrid::GetCellTextColour( int WXUNUSED(row), int WXUNUSED(col) ) { // TODO: replace this temp test code // - return wxColour( 0, 0, 0 ); + return wxColour( 0, 0, 0 ); } @@ -3918,7 +3918,7 @@ wxColour wxGrid::GetCellHighlightColour() { // TODO: replace this temp test code // - return wxColour( 0, 0, 0 ); + return wxColour( 0, 0, 0 ); } @@ -4105,7 +4105,7 @@ void wxGrid::SetCellValue( int row, int col, const wxString& s ) SetEditControlValue( s ); } } -} +} @@ -4160,7 +4160,7 @@ void wxGrid::MakeCellVisible( int row, int col ) { int lastX = m_scrollPosX; int lastY = m_scrollPosY; - + if ( row >= 0 && row < m_numRows && col >= 0 && col < m_numCols ) { @@ -4242,12 +4242,12 @@ void wxGrid::SelectRow( int row, bool addToSelected ) { if ( m_selectedTopLeft.GetRow() > row ) m_selectedTopLeft.SetRow( row ); - + m_selectedTopLeft.SetCol( 0 ); - + if ( m_selectedBottomRight.GetRow() < row ) m_selectedBottomRight.SetRow( row ); - + m_selectedBottomRight.SetCol( m_numCols - 1 ); } else @@ -4262,7 +4262,7 @@ void wxGrid::SelectRow( int row, bool addToSelected ) wxRect rect( SelectionToRect() ); if ( rect != wxGridNoCellRect ) Refresh( TRUE, &rect ); } - + wxGridRangeSelectEvent gridEvt( GetId(), EVT_GRID_RANGE_SELECT, this, @@ -4313,7 +4313,7 @@ void wxGrid::SelectCol( int col, bool addToSelected ) void wxGrid::SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol ) { int temp; - + if ( topRow > bottomRow ) { temp = topRow; @@ -4347,7 +4347,7 @@ void wxGrid::SelectBlock( int topRow, int leftCol, int bottomRow, int rightCol ) this, m_selectedTopLeft, m_selectedBottomRight ); - + GetEventHandler()->ProcessEvent(gridEvt); } } @@ -4374,7 +4374,7 @@ void wxGrid::ClearSelection() m_selectedTopLeft = wxGridNoCellCoords; m_selectedBottomRight = wxGridNoCellCoords; } -} +} wxRect wxGrid::SelectionToRect() @@ -4393,7 +4393,7 @@ wxRect wxGrid::SelectionToRect() { rect = wxRect( m_left, m_top, 0, 0 ); } - + cellRect = CellToRect( m_selectedBottomRight ); if ( cellRect != wxGridNoCellRect ) { @@ -4430,7 +4430,7 @@ wxGridEvent::wxGridEvent( int id, wxEventType type, wxObject* obj, m_shift = shift; m_alt = alt; m_meta = meta; - + SetEventObject(obj); } @@ -4449,7 +4449,7 @@ wxGridSizeEvent::wxGridSizeEvent( int id, wxEventType type, wxObject* obj, m_shift = shift; m_alt = alt; m_meta = meta; - + SetEventObject(obj); } @@ -4457,10 +4457,10 @@ wxGridSizeEvent::wxGridSizeEvent( int id, wxEventType type, wxObject* obj, IMPLEMENT_DYNAMIC_CLASS( wxGridRangeSelectEvent, wxEvent ) wxGridRangeSelectEvent::wxGridRangeSelectEvent(int id, wxEventType type, wxObject* obj, - const wxGridCellCoords& topLeft, - const wxGridCellCoords& bottomRight, - bool control, bool shift, bool alt, bool meta ) - : wxNotifyEvent( type, id ) + const wxGridCellCoords& topLeft, + const wxGridCellCoords& bottomRight, + bool control, bool shift, bool alt, bool meta ) + : wxNotifyEvent( type, id ) { m_topLeft = topLeft; m_bottomRight = bottomRight; diff --git a/src/generic/imaglist.cpp b/src/generic/imaglist.cpp index 87eb78dcd3..403cd4f13c 100644 --- a/src/generic/imaglist.cpp +++ b/src/generic/imaglist.cpp @@ -80,7 +80,7 @@ bool wxImageList::Replace( int index, const wxBitmap &bitmap ) //so construct it from a bitmap object until I can figure this nonsense out. (DW) newBitmap = new wxBitmap(bitmap) ; #else - newBitmap = new wxIcon( (const wxIcon&) bitmap ); + newBitmap = new wxBitmap( (const wxIcon&) bitmap ); #endif else newBitmap = new wxBitmap(bitmap) ; diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index c6ff8dc19b..8737d774f1 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -240,7 +240,8 @@ bool wxWizard::ShowPage(wxWizardPage *page, bool goingForward) // and update the buttons state m_btnPrev->Enable(m_page->GetPrev() != (wxWizardPage *)NULL); - if ( btnLabelWasNext != (m_page->GetNext() != (wxWizardPage *)NULL) ) + bool hasNext = m_page->GetNext() != (wxWizardPage *)NULL; + if ( btnLabelWasNext != hasNext ) { // need to update m_btnNext->SetLabel(btnLabelWasNext ? _("&Finish") : _("&Next >")); diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 008aa3ec21..8219aae622 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -172,9 +172,9 @@ bool wxBitmap::CopyFromCursor(const wxCursor& cursor) wxFAIL_MSG( _T("don't know how to convert cursor to bitmap") ); return FALSE; -#endif // Win16 - +#else return CopyFromIconOrCursor(cursor); +#endif // Win16 } bool wxBitmap::CopyFromIcon(const wxIcon& icon) diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index c7d8dd076f..1d0e976dc3 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -172,6 +172,9 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) } BOOL ok; + + // no MaskBlt() under Win16 +#ifdef __WIN32__ wxMask *mask = bitmap->GetMask(); if ( mask ) { @@ -196,6 +199,7 @@ bool wxBitmapButton::MSWOnDraw(WXDRAWITEMSTRUCT *item) ::DeleteObject(hbrBackground); } else +#endif // Win32 { ok = ::BitBlt(hDC, x1, y1, wBmp, hBmp, // dst memDC, 0, 0, // src diff --git a/src/msw/dir.cpp b/src/msw/dir.cpp index 06e86573f5..2ed4f0e02e 100644 --- a/src/msw/dir.cpp +++ b/src/msw/dir.cpp @@ -36,7 +36,147 @@ #include "wx/dir.h" #include "wx/filefn.h" // for wxPathExists() -#include +// ---------------------------------------------------------------------------- +// define the types and functions used for file searching +// ---------------------------------------------------------------------------- + +// under Win16 use compiler-specific functions +#ifdef __WIN16__ + #ifdef __VISUALC__ + #include + #include + + typedef struct _find_t FIND_STRUCT; + #elif defined(__BORLANDC__) + #include + + typedef struct ffblk FIND_STRUCT; + #else + #error "No directory searching functions for this compiler" + #endif + + typedef FIND_STRUCT *FIND_DATA; + typedef char FIND_ATTR; + + static inline FIND_DATA InitFindData() { return (FIND_DATA)NULL; } + static inline bool IsFindDataOk(FIND_DATA fd) { return fd != NULL; } + static inline void FreeFindData(FIND_DATA fd) { free(fd); } + + static inline FIND_DATA FindFirst(const wxString& spec, + FIND_STRUCT * WXUNUSED(finddata)) + { + // attribute to find all files + static const FIND_ATTR attr = 0x3F; + + FIND_DATA fd = (FIND_DATA)malloc(sizeof(FIND_STRUCT)); + + if ( + #ifdef __VISUALC__ + _dos_findfirst(spec, attr, fd) == 0 + #else // Borland + findfirst(spec, fd, attr) == 0 + #endif + ) + { + return fd; + } + else + { + free(fd); + + return NULL; + } + } + + static inline bool FindNext(FIND_DATA fd, FIND_STRUCT * WXUNUSED(finddata)) + { + #ifdef __VISUALC__ + return _dos_findnext(fd) == 0; + #else // Borland + return findnext(fd) == 0; + #endif + } + + static const wxChar *GetNameFromFindData(FIND_STRUCT *finddata) + { + #ifdef __VISUALC__ + return finddata->name; + #else // Borland + return finddata->ff_name; + #endif + } + + static const FIND_ATTR GetAttrFromFindData(FIND_STRUCT *finddata) + { + #ifdef __VISUALC__ + return finddata->attrib; + #else // Borland + return finddata->ff_attrib; + #endif + } + + static inline bool IsDir(FIND_ATTR attr) + { + return (attr & _A_SUBDIR) != 0; + } + + static inline bool IsHidden(FIND_ATTR attr) + { + return (attr & (_A_SYSTEM | _A_HIDDEN)) != 0; + } +#else // Win32 + #include + + typedef WIN32_FIND_DATA FIND_STRUCT; + typedef HANDLE FIND_DATA; + typedef DWORD FIND_ATTR; + + static inline FIND_DATA InitFindData() { return INVALID_HANDLE_VALUE; } + + static inline bool IsFindDataOk(FIND_DATA fd) + { + return fd != INVALID_HANDLE_VALUE; + } + + static inline void FreeFindData(FIND_DATA fd) + { + if ( !::FindClose(fd) ) + { + wxLogLastError(_T("FindClose")); + } + } + + static inline FIND_DATA FindFirst(const wxString& spec, + FIND_STRUCT *finddata) + { + return ::FindFirstFile(filespec, &finddata); + } + + static inline bool FindNext(FIND_DATA fd, FIND_STRUCT *finddata) + { + return ::FindNextFile(fd, finddata) != 0; + } + + static const wxChar *GetNameFromFindData(FIND_STRUCT *finddata) + { + return finddata->cFileName; + } + + static const FIND_ATTR GetAttrFromFindData(FIND_STRUCT *finddata) + { + return finddata->dwFileAttributes; + } + + static inline bool IsDir(FIND_ATTR attr) + { + return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0; + } + + static inline bool IsHidden(FIND_ATTR attr) + { + return (attr & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != 0; + } +#endif // __WIN16__ // ---------------------------------------------------------------------------- // constants @@ -71,7 +211,7 @@ public: bool Read(wxString *filename); private: - HANDLE m_handle; + FIND_DATA m_finddata; wxString m_dirname; wxString m_filespec; @@ -90,7 +230,7 @@ private: wxDirData::wxDirData(const wxString& dirname) : m_dirname(dirname) { - m_handle = INVALID_HANDLE_VALUE; + m_finddata = InitFindData(); } wxDirData::~wxDirData() @@ -100,14 +240,11 @@ wxDirData::~wxDirData() void wxDirData::Close() { - if ( m_handle != INVALID_HANDLE_VALUE ) + if ( IsFindDataOk(m_finddata) ) { - if ( !::FindClose(m_handle) ) - { - wxLogLastError(_T("FindClose")); - } + FreeFindData(m_finddata); - m_handle = INVALID_HANDLE_VALUE; + m_finddata = InitFindData(); } } @@ -120,21 +257,28 @@ bool wxDirData::Read(wxString *filename) { bool first = FALSE; +#ifdef __WIN32__ WIN32_FIND_DATA finddata; - if ( m_handle == INVALID_HANDLE_VALUE ) + #define PTR_TO_FINDDATA (&finddata) +#else // Win16 + #define PTR_TO_FINDDATA (m_finddata) +#endif + + if ( !IsFindDataOk(m_finddata) ) { // open first wxString filespec; filespec << m_dirname << _T('\\') << (!m_filespec ? _T("*.*") : m_filespec.c_str()); - m_handle = ::FindFirstFile(filespec, &finddata); + m_finddata = FindFirst(filespec, PTR_TO_FINDDATA); first = TRUE; } - if ( m_handle == INVALID_HANDLE_VALUE ) + if ( !IsFindDataOk(m_finddata) ) { +#ifdef __WIN32__ DWORD err = ::GetLastError(); if ( err != ERROR_FILE_NOT_FOUND ) @@ -142,13 +286,14 @@ bool wxDirData::Read(wxString *filename) wxLogSysError(err, _("Can not enumerate files in directory '%s'"), m_dirname.c_str()); } +#endif // __WIN32__ //else: not an error, just no (such) files return FALSE; } const wxChar *name; - DWORD attr; + FIND_ATTR attr; for ( ;; ) { @@ -158,22 +303,24 @@ bool wxDirData::Read(wxString *filename) } else { - if ( !::FindNextFile(m_handle, &finddata) ) + if ( !FindNext(m_finddata, PTR_TO_FINDDATA) ) { +#ifdef __WIN32__ DWORD err = ::GetLastError(); if ( err != ERROR_NO_MORE_FILES ) { wxLogLastError(_T("FindNext")); } +#endif // __WIN32__ //else: not an error, just no more (such) files return FALSE; } } - name = finddata.cFileName; - attr = finddata.dwFileAttributes; + name = GetNameFromFindData(PTR_TO_FINDDATA); + attr = GetAttrFromFindData(PTR_TO_FINDDATA); // don't return "." and ".." unless asked for if ( name[0] == _T('.') && @@ -185,12 +332,12 @@ bool wxDirData::Read(wxString *filename) } // check the type now - if ( !(m_flags & wxDIR_FILES) && !(attr & FILE_ATTRIBUTE_DIRECTORY) ) + if ( !(m_flags & wxDIR_FILES) && !IsDir(attr) ) { // it's a file, but we don't want them continue; } - else if ( !(m_flags & wxDIR_DIRS) && (attr & FILE_ATTRIBUTE_DIRECTORY) ) + else if ( !(m_flags & wxDIR_DIRS) && IsDir(attr) ) { // it's a dir, and we don't want it continue; @@ -199,7 +346,7 @@ bool wxDirData::Read(wxString *filename) // finally, check whether it's a hidden file if ( !(m_flags & wxDIR_HIDDEN) ) { - if ( attr & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM) ) + if ( IsHidden(attr) ) { // it's a hidden file, skip it continue; diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index bd3fa99176..7ec54aecf3 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -21,29 +21,27 @@ #endif #ifndef WX_PRECOMP - #include - #include "wx/defs.h" #include "wx/utils.h" #include "wx/msgdlg.h" #include "wx/dialog.h" #include "wx/filedlg.h" #include "wx/intl.h" #include "wx/log.h" -#endif -#include + #include "wx/msw/private.h" +#endif #if !defined(__WIN32__) || defined(__SALFORDC__) || defined(__WXWINE__) #include #endif -#include "wx/msw/private.h" - #include #include #include - IMPLEMENT_CLASS(wxFileDialog, wxDialog) +#include "wx/tokenzr.h" + +IMPLEMENT_CLASS(wxFileDialog, wxDialog) wxString wxFileSelector(const wxChar *title, const wxChar *defaultDir, diff --git a/src/msw/fontenum.cpp b/src/msw/fontenum.cpp index 7021de27dc..5674825c1b 100644 --- a/src/msw/fontenum.cpp +++ b/src/msw/fontenum.cpp @@ -129,7 +129,12 @@ void wxFontEnumeratorHelper::DoEnumerate() (LPARAM)this, 0 /* reserved */) ; #else // Win16 ::EnumFonts(hDC, (LPTSTR)NULL, (FONTENUMPROC)wxFontEnumeratorProc, - (LPARAM) (void*) this) ; + #ifdef STRICT + (LPARAM) + #else + (LPSTR) + #endif + this); #endif // Win32/16 ::ReleaseDC(NULL, hDC); diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index 3bd33d6bef..e338b71c0a 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -62,7 +62,7 @@ extern wxWindowList wxModelessWindows; extern wxList WXDLLEXPORT wxPendingDelete; -extern wxChar wxFrameClassName[]; +extern wxChar *wxFrameClassName; extern wxMenu *wxCurrentPopupMenu; // ---------------------------------------------------------------------------- diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index 9e2947717d..d34a94c64c 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -39,6 +39,10 @@ #include "wx/msw/dib.h" #include "wx/msw/gdiimage.h" +#ifdef __WIN16__ + #include "wx/msw/curico.h" +#endif // __WIN16__ + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index b521e1c583..8f09f1fcb3 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -61,13 +61,48 @@ static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, L // macros // ---------------------------------------------------------------------------- - IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl) - IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) +IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) // ============================================================================ // implementation // ============================================================================ +// ---------------------------------------------------------------------------- +// wxListEvent +// ---------------------------------------------------------------------------- + +void wxListEvent::CopyObject(wxObject& object_dest) const +{ + wxListEvent *obj = (wxListEvent *)&object_dest; + + wxNotifyEvent::CopyObject(object_dest); + + obj->m_code = m_code; + obj->m_itemIndex = m_itemIndex; + obj->m_oldItemIndex = m_oldItemIndex; + obj->m_col = m_col; + obj->m_cancelled = m_cancelled; + obj->m_pointDrag = m_pointDrag; + obj->m_item.m_mask = m_item.m_mask; + obj->m_item.m_itemId = m_item.m_itemId; + obj->m_item.m_col = m_item.m_col; + obj->m_item.m_state = m_item.m_state; + obj->m_item.m_stateMask = m_item.m_stateMask; + obj->m_item.m_text = m_item.m_text; + obj->m_item.m_image = m_item.m_image; + obj->m_item.m_data = m_item.m_data; + obj->m_item.m_format = m_item.m_format; + obj->m_item.m_width = m_item.m_width; + + if ( m_item.HasAttributes() ) + { + obj->m_item.SetTextColour(m_item.GetTextColour()); + obj->m_item.SetBackgroundColour(m_item.GetBackgroundColour()); + obj->m_item.SetFont(m_item.GetFont()); + } +} + // ---------------------------------------------------------------------------- // wxListCtrl construction // ---------------------------------------------------------------------------- diff --git a/src/msw/main.cpp b/src/msw/main.cpp index cfa9a598c9..3f8833f408 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -64,26 +64,21 @@ HINSTANCE wxhInstance = 0; #if !defined(_WINDLL) #if defined(__TWIN32__) || defined(__WXWINE__) + #define HINSTANCE HANDLE -extern "C" -BOOL PASCAL WinMain(HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) - -#else - -#ifdef __WATCOMC__ -int PASCAL -#else -int APIENTRY -#endif - - WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) -#endif -// __TWIN32__ + extern "C" +#endif // WINE +int PASCAL WinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPSTR lpCmdLine, + int nCmdShow) { - return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, lpCmdLine, nCmdShow); + return wxEntry((WXHINSTANCE) hInstance, (WXHINSTANCE) hPrevInstance, + lpCmdLine, nCmdShow); } -#endif + +#endif // !defined(_WINDLL) ///////////////////////////////////////////////////////////////////////////////// // DllMain diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 03b81da874..99439c6fe4 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -63,8 +63,8 @@ extern wxWindowList wxModelessWindows; // from dialog.cpp extern wxMenu *wxCurrentPopupMenu; -extern wxChar wxMDIFrameClassName[]; -extern wxChar wxMDIChildFrameClassName[]; +extern wxChar *wxMDIFrameClassName; +extern wxChar *wxMDIChildFrameClassName; extern wxWindow *wxWndHook; // from window.cpp extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index e9ceb4890b..da32aead68 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -185,7 +185,9 @@ bool wxStaticBitmap::MSWOnDraw(WXDRAWITEMSTRUCT *item) { LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT) item; - wxBitmap* bitmap = m_image.bitmap; + wxCHECK_MSG( !m_isIcon, FALSE, _T("icons not supported in wxStaticBitmap") ); + + wxBitmap* bitmap = (wxBitmap *)m_image; if ( !bitmap->Ok() ) return FALSE; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 2e4ccc5eac..a19fa57c7f 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -119,7 +119,7 @@ extern MSG s_currentMsg; wxMenu *wxCurrentPopupMenu = NULL; extern wxList WXDLLEXPORT wxPendingDelete; -extern wxChar wxCanvasClassName[]; +extern wxChar *wxCanvasClassName; // --------------------------------------------------------------------------- // private functions