Fixed VC++ compile error in mstream; formatted window.cpp.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-10-14 19:06:51 +00:00
parent 75ed1d15d0
commit 2d0a075d90
2 changed files with 2426 additions and 2426 deletions

View File

@@ -30,7 +30,7 @@
wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len) wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
: wxInputStream() : wxInputStream()
{ {
m_i_streambuf->SetBufferIO((char *)data, data+len); m_i_streambuf->SetBufferIO((char*) data, (char*) (data+len));
m_i_streambuf->Fixed(TRUE); m_i_streambuf->Fixed(TRUE);
} }

View File

@@ -97,11 +97,11 @@ wxWindow *wxFindWinFromHandle(WXHWND hWnd);
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler) BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
EVT_CHAR(wxWindow::OnChar) EVT_CHAR(wxWindow::OnChar)
EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground) EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged) EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindow::OnInitDialog) EVT_INIT_DIALOG(wxWindow::OnInitDialog)
EVT_IDLE(wxWindow::OnIdle) EVT_IDLE(wxWindow::OnIdle)
END_EVENT_TABLE() END_EVENT_TABLE()
#endif #endif
@@ -225,8 +225,8 @@ wxWindow::wxWindow(void)
m_minSizeY = -1; m_minSizeY = -1;
m_maxSizeX = -1; m_maxSizeX = -1;
m_maxSizeY = -1; m_maxSizeY = -1;
// m_paintHDC = 0; // m_paintHDC = 0;
// m_tempHDC = 0; // m_tempHDC = 0;
m_isBeingDeleted = FALSE; m_isBeingDeleted = FALSE;
m_oldWndProc = 0; m_oldWndProc = 0;
#ifndef __WIN32__ #ifndef __WIN32__
@@ -242,16 +242,16 @@ wxWindow::wxWindow(void)
// m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ; // m_backgroundColour = settings.GetSystemColour(wxSYS_COLOUR_WINDOW) ; ;
m_foregroundColour = *wxBLACK; m_foregroundColour = *wxBLACK;
/* /*
wxColour(GetRValue(GetSysColor(COLOR_WINDOW)), wxColour(GetRValue(GetSysColor(COLOR_WINDOW)),
GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
*/ */
// wxWnd // wxWnd
m_lastMsg = 0; m_lastMsg = 0;
m_lastWParam = 0; m_lastWParam = 0;
m_lastLParam = 0; m_lastLParam = 0;
// m_acceleratorTable = 0; // m_acceleratorTable = 0;
m_hMenu = 0; m_hMenu = 0;
m_xThumbSize = 0; m_xThumbSize = 0;
@@ -278,7 +278,7 @@ wxWindow::~wxWindow(void)
// it to nearer the end. Unsure of side-effects // it to nearer the end. Unsure of side-effects
// e.g. when deleting associated global data. // e.g. when deleting associated global data.
// Restore old Window proc, if required // Restore old Window proc, if required
// UnsubclassWin(); // UnsubclassWin();
// Have to delete constraints/sizer FIRST otherwise // Have to delete constraints/sizer FIRST otherwise
// sizers may try to look at deleted windows as they // sizers may try to look at deleted windows as they
@@ -614,7 +614,7 @@ void wxWindow::ScreenToClient(int *x, int *y) const
pt.y = *y; pt.y = *y;
::ScreenToClient(hWnd, &pt); ::ScreenToClient(hWnd, &pt);
/* /*
// We may be faking the client origin. // We may be faking the client origin.
// So a window that's really at (0, 30) may appear // So a window that's really at (0, 30) may appear
// (to wxWin apps) to be at (0, 0). // (to wxWin apps) to be at (0, 0).
@@ -624,7 +624,7 @@ void wxWindow::ScreenToClient(int *x, int *y) const
pt.x -= pt1.x; pt.x -= pt1.x;
pt.y -= pt1.y; pt.y -= pt1.y;
} }
*/ */
*x = pt.x; *x = pt.x;
*y = pt.y; *y = pt.y;
@@ -637,7 +637,7 @@ void wxWindow::ClientToScreen(int *x, int *y) const
pt.x = *x; pt.x = *x;
pt.y = *y; pt.y = *y;
/* /*
// We may be faking the client origin. // We may be faking the client origin.
// So a window that's really at (0, 30) may appear // So a window that's really at (0, 30) may appear
// (to wxWin apps) to be at (0, 0). // (to wxWin apps) to be at (0, 0).
@@ -647,7 +647,7 @@ void wxWindow::ClientToScreen(int *x, int *y) const
pt.x += pt1.x; pt.x += pt1.x;
pt.y += pt1.y; pt.y += pt1.y;
} }
*/ */
::ClientToScreen(hWnd, &pt); ::ClientToScreen(hWnd, &pt);
@@ -674,8 +674,8 @@ void wxWindow::SetCursor(const wxCursor& cursor)
} }
// This will cause big reentrancy problems if wxFlushEvents is implemented. // This will cause big reentrancy problems if wxFlushEvents is implemented.
// wxFlushEvents(); // wxFlushEvents();
// return old_cursor; // return old_cursor;
} }
@@ -783,7 +783,7 @@ bool wxWindow::Show(bool show)
{ {
BringWindowToTop(hWnd); BringWindowToTop(hWnd);
// Next line causes a crash on NT, apparently. // Next line causes a crash on NT, apparently.
// UpdateWindow(hWnd); // Should this be here or will it cause inefficiency? // UpdateWindow(hWnd); // Should this be here or will it cause inefficiency?
} }
return TRUE; return TRUE;
} }
@@ -850,8 +850,8 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
if (descent) *descent = tm.tmDescent; if (descent) *descent = tm.tmDescent;
if (externalLeading) *externalLeading = tm.tmExternalLeading; if (externalLeading) *externalLeading = tm.tmExternalLeading;
// if (fontToUse) // if (fontToUse)
// fontToUse->ReleaseResource(); // fontToUse->ReleaseResource();
} }
void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect) void wxWindow::Refresh(bool eraseBack, const wxRectangle *rect)
@@ -918,7 +918,7 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA
// Stop right here if we don't have a valid handle // Stop right here if we don't have a valid handle
// in our wxWnd object. // in our wxWnd object.
if (wnd && !wnd->m_hWnd) { if (wnd && !wnd->m_hWnd) {
// wxDebugMsg("Warning: could not find a valid handle, wx_win.cc/wxWndProc.\n"); // wxDebugMsg("Warning: could not find a valid handle, wx_win.cc/wxWndProc.\n");
wnd->m_hWnd = (WXHWND) hWnd; wnd->m_hWnd = (WXHWND) hWnd;
long res = wnd->MSWDefWindowProc(message, wParam, lParam ); long res = wnd->MSWDefWindowProc(message, wParam, lParam );
wnd->m_hWnd = 0; wnd->m_hWnd = 0;
@@ -950,10 +950,10 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
m_lastWParam == wParam && m_lastWParam == wParam &&
m_lastLParam == lParam ); m_lastLParam == lParam );
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
wxLogTrace(wxTraceMessages, "Processing %s(%lx, %lx)", wxLogTrace(wxTraceMessages, "Processing %s(%lx, %lx)",
wxGetMessageName(message), wParam, lParam); wxGetMessageName(message), wParam, lParam);
#endif // WXDEBUG #endif // WXDEBUG
HWND hWnd = (HWND)m_hWnd; HWND hWnd = (HWND)m_hWnd;
@@ -977,7 +977,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_SETFOCUS: case WM_SETFOCUS:
{ {
HWND hwnd = (HWND)wParam; HWND hwnd = (HWND)wParam;
// return OnSetFocus(hwnd); // return OnSetFocus(hwnd);
if (MSWOnSetFocus((WXHWND) hwnd)) if (MSWOnSetFocus((WXHWND) hwnd))
return 0; return 0;
@@ -987,7 +987,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_KILLFOCUS: case WM_KILLFOCUS:
{ {
HWND hwnd = (HWND)lParam; HWND hwnd = (HWND)lParam;
// return OnKillFocus(hwnd); // return OnKillFocus(hwnd);
if (MSWOnKillFocus((WXHWND) hwnd)) if (MSWOnKillFocus((WXHWND) hwnd))
return 0; return 0;
else else
@@ -1415,7 +1415,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_QUERYENDSESSION: case WM_QUERYENDSESSION:
{ {
// Same as WM_CLOSE, but inverted results. Thx Microsoft :-) // Same as WM_CLOSE, but inverted results. Thx Microsoft :-)
// return MSWOnClose(); // return MSWOnClose();
return MSWOnQueryEndSession(lParam); return MSWOnQueryEndSession(lParam);
break; break;
@@ -1462,7 +1462,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
// Dialog window proc // Dialog window proc
LONG APIENTRY _EXPORT LONG APIENTRY _EXPORT
wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) wxDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
return 0; return 0;
} }
@@ -1630,14 +1630,14 @@ bool wxWindow::MSWOnDestroy(void)
wxDebugMsg("wxWindow::MSWOnDestroy %d\n", handle); wxDebugMsg("wxWindow::MSWOnDestroy %d\n", handle);
#endif #endif
// delete our drop target if we've got one // delete our drop target if we've got one
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
if ( m_pDropTarget != NULL ) { if ( m_pDropTarget != NULL ) {
m_pDropTarget->Revoke(m_hWnd); m_pDropTarget->Revoke(m_hWnd);
delete m_pDropTarget; delete m_pDropTarget;
m_pDropTarget = NULL; m_pDropTarget = NULL;
} }
#endif #endif
return TRUE; return TRUE;
} }
@@ -1657,7 +1657,7 @@ bool wxWindow::MSWOnNotify(WXWPARAM wParam, WXLPARAM lParam)
// This won't work now, though, because any number of controls // This won't work now, though, because any number of controls
// could respond to the same generic messages :-( // could respond to the same generic messages :-(
/* This doesn't work for toolbars, but try for other controls first. /* This doesn't work for toolbars, but try for other controls first.
*/ */
NMHDR *hdr = (NMHDR *)lParam; NMHDR *hdr = (NMHDR *)lParam;
HWND hWnd = (HWND)hdr->hwndFrom; HWND hWnd = (HWND)hdr->hwndFrom;
@@ -1939,10 +1939,10 @@ long wxWindow::Default()
if (m_lastMsg == 0) if (m_lastMsg == 0)
return 0; return 0;
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.", wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.",
wxGetMessageName(m_lastMsg)); wxGetMessageName(m_lastMsg));
#endif // WXDEBUG #endif // WXDEBUG
return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam); return this->MSWDefWindowProc(m_lastMsg, m_lastWParam, m_lastLParam);
} }
@@ -2247,7 +2247,7 @@ void wxWindow::MSWOnMButtonDown(int x, int y, WXUINT flags)
void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags) void wxWindow::MSWOnMButtonUp(int x, int y, WXUINT flags)
{ {
//wxDebugMsg("MButtonUp\n") ; //wxDebugMsg("MButtonUp\n") ;
wxMouseEvent event(wxEVT_MIDDLE_UP); wxMouseEvent event(wxEVT_MIDDLE_UP);
event.m_x = x; event.m_y = y; event.m_x = x; event.m_y = y;
@@ -2745,8 +2745,8 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
#if WXDEBUG > 1 #if WXDEBUG > 1
wxDebugMsg("wxGetCharSize: Selecting HFONT %X\n", fnt); wxDebugMsg("wxGetCharSize: Selecting HFONT %X\n", fnt);
#endif #endif
// the_font->UseResource(); // the_font->UseResource();
// the_font->RealizeResource(); // the_font->RealizeResource();
if ((fnt=(HFONT) the_font->GetResourceHandle())) if ((fnt=(HFONT) the_font->GetResourceHandle()))
was = (HFONT) SelectObject(dc,fnt) ; was = (HFONT) SelectObject(dc,fnt) ;
} }
@@ -2762,8 +2762,8 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y,wxFont *the_font)
*x = tm.tmAveCharWidth; *x = tm.tmAveCharWidth;
*y = tm.tmHeight + tm.tmExternalLeading; *y = tm.tmHeight + tm.tmExternalLeading;
// if (the_font) // if (the_font)
// the_font->ReleaseResource(); // the_font->ReleaseResource();
} }
// Returns 0 if was a normal ASCII value, not a special key. This indicates that // Returns 0 if was a normal ASCII value, not a special key. This indicates that
@@ -2982,7 +2982,7 @@ wxWindow *wxGetActiveWindow(void)
static HHOOK wxTheKeyboardHook = 0; static HHOOK wxTheKeyboardHook = 0;
static FARPROC wxTheKeyboardHookProc = 0; static FARPROC wxTheKeyboardHookProc = 0;
int APIENTRY _EXPORT int APIENTRY _EXPORT
wxKeyboardHook(int nCode, WORD wParam, DWORD lParam); wxKeyboardHook(int nCode, WORD wParam, DWORD lParam);
void wxSetKeyboardHook(bool doIt) void wxSetKeyboardHook(bool doIt)
{ {
@@ -2992,7 +2992,7 @@ void wxSetKeyboardHook(bool doIt)
wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(), wxTheKeyboardHook = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC) wxTheKeyboardHookProc, wxGetInstance(),
#ifdef __WIN32__ #ifdef __WIN32__
GetCurrentThreadId()); GetCurrentThreadId());
// (DWORD)GetCurrentProcess()); // This is another possibility. Which is right? // (DWORD)GetCurrentProcess()); // This is another possibility. Which is right?
#else #else
GetCurrentTask()); GetCurrentTask());
#endif #endif
@@ -3005,7 +3005,7 @@ void wxSetKeyboardHook(bool doIt)
} }
int APIENTRY _EXPORT int APIENTRY _EXPORT
wxKeyboardHook(int nCode, WORD wParam, DWORD lParam) wxKeyboardHook(int nCode, WORD wParam, DWORD lParam)
{ {
DWORD hiWord = HIWORD(lParam); DWORD hiWord = HIWORD(lParam);
if (nCode != HC_NOREMOVE && ((hiWord & KF_UP) == 0)) if (nCode != HC_NOREMOVE && ((hiWord & KF_UP) == 0))
@@ -3019,10 +3019,10 @@ int APIENTRY _EXPORT
event.m_eventObject = NULL; event.m_eventObject = NULL;
event.m_keyCode = id; event.m_keyCode = id;
/* begin Albert's fix for control and shift key 26.5 */ /* begin Albert's fix for control and shift key 26.5 */
event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE); event.m_shiftDown = (::GetKeyState(VK_SHIFT)&0x100?TRUE:FALSE);
event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE); event.m_controlDown = (::GetKeyState(VK_CONTROL)&0x100?TRUE:FALSE);
/* end Albert's fix for control and shift key 26.5 */ /* end Albert's fix for control and shift key 26.5 */
event.SetTimestamp(wxApp::sm_lastMessageTime); event.SetTimestamp(wxApp::sm_lastMessageTime);
wxWindow *win = wxGetActiveWindow(); wxWindow *win = wxGetActiveWindow();
@@ -3077,7 +3077,7 @@ void wxWindow::Centre(int direction)
/* TODO (maybe) /* TODO (maybe)
void wxWindow::OnPaint(void) void wxWindow::OnPaint(void)
{ {
PaintSelectionHandles(); PaintSelectionHandles();
} }
*/ */
@@ -3135,11 +3135,11 @@ void wxWindow::OnEraseBackground(wxEraseEvent& event)
HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue())); HBRUSH hBrush = ::CreateSolidBrush(PALETTERGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT); int mode = ::SetMapMode((HDC) event.GetDC()->GetHDC(), MM_TEXT);
// ::GetClipBox((HDC) event.GetDC()->GetHDC(), &rect); // ::GetClipBox((HDC) event.GetDC()->GetHDC(), &rect);
::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush); ::FillRect ((HDC) event.GetDC()->GetHDC(), &rect, hBrush);
::DeleteObject(hBrush); ::DeleteObject(hBrush);
::SetMapMode((HDC) event.GetDC()->GetHDC(), mode); ::SetMapMode((HDC) event.GetDC()->GetHDC(), mode);
/* /*
// Less efficient version (and doesn't account for scrolling) // Less efficient version (and doesn't account for scrolling)
int w, h; int w, h;
GetClientSize(& w, & h); GetClientSize(& w, & h);
@@ -3148,7 +3148,7 @@ void wxWindow::OnEraseBackground(wxEraseEvent& event)
event.GetDC()->SetPen(wxTRANSPARENT_PEN); event.GetDC()->SetPen(wxTRANSPARENT_PEN);
event.GetDC()->DrawRectangle(0, 0, w+1, h+1); event.GetDC()->DrawRectangle(0, 0, w+1, h+1);
*/ */
} }
#if WXWIN_COMPATIBILITY #if WXWIN_COMPATIBILITY
@@ -3369,13 +3369,13 @@ void wxWindow::SetScrollbar(int orient, int pos, int thumbVisible,
int range, bool refresh) int range, bool refresh)
{ {
/* /*
SetScrollPage(orient, thumbVisible, FALSE); SetScrollPage(orient, thumbVisible, FALSE);
int oldRange = range - thumbVisible ; int oldRange = range - thumbVisible ;
SetScrollRange(orient, oldRange, FALSE); SetScrollRange(orient, oldRange, FALSE);
SetScrollPos(orient, pos, refresh); SetScrollPos(orient, pos, refresh);
*/ */
#if defined(__WIN95__) #if defined(__WIN95__)
int oldRange = range - thumbVisible ; int oldRange = range - thumbVisible ;
@@ -3840,8 +3840,8 @@ void wxWindow::SetSizer(wxSizer *sizer)
} }
/* /*
* New version * New version
*/ */
bool wxWindow::Layout(void) bool wxWindow::Layout(void)
{ {
@@ -4172,8 +4172,8 @@ wxObject* wxWindow::GetChild(int number) const
void wxWindow::OnDefaultAction(wxControl *initiatingItem) void wxWindow::OnDefaultAction(wxControl *initiatingItem)
{ {
/* This is obsolete now; if we wish to intercept listbox double-clicks, /* This is obsolete now; if we wish to intercept listbox double-clicks,
* we explicitly intercept the wxEVT_COMMAND_LISTBOX_DOUBLECLICKED * we explicitly intercept the wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
* event. * event.
if (initiatingItem->IsKindOf(CLASSINFO(wxListBox))) if (initiatingItem->IsKindOf(CLASSINFO(wxListBox)))
{ {
@@ -4202,7 +4202,7 @@ void wxWindow::OnDefaultAction(wxControl *initiatingItem)
event.SetEventObject(but); event.SetEventObject(but);
but->Command(event); but->Command(event);
} }
*/ */
} }
void wxWindow::Clear(void) void wxWindow::Clear(void)
@@ -4285,15 +4285,15 @@ wxWindow *wxWindow::FindWindow(const wxString& name)
// according to the cursor keys pressed // according to the cursor keys pressed
void wxWindow::OnChar(wxKeyEvent& event) void wxWindow::OnChar(wxKeyEvent& event)
{ {
int x_page = 0; int x_page = 0;
int y_page = 0; int y_page = 0;
int start_x = 0; int start_x = 0;
int start_y = 0; int start_y = 0;
// Bugfix Begin // Bugfix Begin
int v_width = 0; int v_width = 0;
int v_height = 0; int v_height = 0;
int y_pages = 0; int y_pages = 0;
// Bugfix End // Bugfix End
GetScrollUnitsPerPage(&x_page, &y_page); GetScrollUnitsPerPage(&x_page, &y_page);
// Bugfix Begin // Bugfix Begin
@@ -4304,11 +4304,11 @@ void wxWindow::OnChar(wxKeyEvent& event)
if (vert_units) if (vert_units)
y_pages = (int)(v_height/vert_units) - y_page; y_pages = (int)(v_height/vert_units) - y_page;
#ifdef __WXMSW__ #ifdef __WXMSW__
int y = 0; int y = 0;
#else #else
int y = y_page-1; int y = y_page-1;
#endif #endif
// Bugfix End // Bugfix End
switch (event.keyCode) switch (event.keyCode)
{ {
@@ -4379,7 +4379,7 @@ void wxWindow::OnChar(wxKeyEvent& event)
} }
// end // end
} }
} }
*/ */
// Setup background and foreground colours correctly // Setup background and foreground colours correctly