From 837e57436a89516a5fa9f478f401e06bd872c17c Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Mon, 14 Jun 1999 14:39:11 +0000 Subject: [PATCH] A few weeks of Unicode fixes (my old win95 laptop compiles sloowly, especially when through the nullmodem cable). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/accel.cpp | 4 +- src/msw/app.cpp | 62 +++++++------- src/msw/bitmap.cpp | 16 ++-- src/msw/bmpbuttn.cpp | 4 +- src/msw/button.cpp | 6 +- src/msw/caret.cpp | 8 +- src/msw/checkbox.cpp | 8 +- src/msw/checklst.cpp | 8 +- src/msw/choice.cpp | 10 +-- src/msw/clipbrd.cpp | 16 ++-- src/msw/combobox.cpp | 10 +-- src/msw/curico.cpp | 4 +- src/msw/cursor.cpp | 32 +++---- src/msw/data.cpp | 78 ++++++++--------- src/msw/dc.cpp | 6 +- src/msw/dcclient.cpp | 2 +- src/msw/dcmemory.cpp | 4 +- src/msw/dcprint.cpp | 36 ++++---- src/msw/dde.cpp | 94 ++++++++++---------- src/msw/dialog.cpp | 10 +-- src/msw/dib.cpp | 6 +- src/msw/dibutils.cpp | 10 ++- src/msw/dirdlg.cpp | 3 +- src/msw/filedlg.cpp | 118 ++++++++++++------------- src/msw/font.cpp | 4 +- src/msw/fontdlg.cpp | 4 +- src/msw/frame.cpp | 14 +-- src/msw/gaugemsw.cpp | 10 +-- src/msw/helpwin.cpp | 32 +++---- src/msw/icon.cpp | 2 +- src/msw/listbox.cpp | 52 +++++------ src/msw/listctrl.cpp | 24 +++--- src/msw/mdi.cpp | 16 ++-- src/msw/menu.cpp | 70 +++++++-------- src/msw/menuitem.cpp | 10 +-- src/msw/metafile.cpp | 16 ++-- src/msw/minifram.cpp | 20 ++--- src/msw/msgdlg.cpp | 2 +- src/msw/nativdlg.cpp | 22 ++--- src/msw/notebook.cpp | 24 +++--- src/msw/ownerdrw.cpp | 8 +- src/msw/pnghand.cpp | 26 +++--- src/msw/printwin.cpp | 2 +- src/msw/radiobox.cpp | 16 ++-- src/msw/radiobut.cpp | 8 +- src/msw/regconf.cpp | 14 +-- src/msw/registry.cpp | 86 +++++++++---------- src/msw/scrolbar.cpp | 2 +- src/msw/slider95.cpp | 22 ++--- src/msw/slidrmsw.cpp | 22 ++--- src/msw/statbmp.cpp | 8 +- src/msw/statbox.cpp | 4 +- src/msw/statbr95.cpp | 14 +-- src/msw/stattext.cpp | 6 +- src/msw/tabctrl.cpp | 16 ++-- src/msw/taskbar.cpp | 10 +-- src/msw/tbar95.cpp | 16 ++-- src/msw/textctrl.cpp | 60 +++++++------ src/msw/thread.cpp | 18 ++-- src/msw/timer.cpp | 4 +- src/msw/tooltip.cpp | 6 +- src/msw/treectrl.cpp | 32 +++---- src/msw/utils.cpp | 200 +++++++++++++++++++++---------------------- src/msw/utilsexc.cpp | 12 +-- src/msw/wave.cpp | 10 ++- src/msw/window.cpp | 38 ++++---- src/msw/xpmhand.cpp | 4 +- 67 files changed, 778 insertions(+), 763 deletions(-) diff --git a/src/msw/accel.cpp b/src/msw/accel.cpp index f82e7b7d10..fbd23d9939 100644 --- a/src/msw/accel.cpp +++ b/src/msw/accel.cpp @@ -84,12 +84,12 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource) HACCEL hAccel = #if defined(__WIN32__) && !defined(__TWIN32__) #ifdef UNICODE - ::LoadAcceleratorsW(wxGetInstance(), (const char *)resource); + ::LoadAcceleratorsW(wxGetInstance(), (const wxChar *)resource); #else ::LoadAcceleratorsA(wxGetInstance(), (const char *)resource); #endif #else - ::LoadAccelerators(wxGetInstance(), (const char *)resource); + ::LoadAccelerators(wxGetInstance(), (const wxChar *)resource); #endif M_ACCELDATA->m_hAccel = hAccel; M_ACCELDATA->m_ok = (hAccel != 0); diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 0c339a6a79..944714414d 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -91,8 +91,8 @@ // global variables // --------------------------------------------------------------------------- -extern char *wxBuffer; -extern char *wxOsVersion; +extern wxChar *wxBuffer; +extern wxChar *wxOsVersion; extern wxList *wxWinHandleList; extern wxList WXDLLEXPORT wxPendingDelete; #if wxUSE_THREADS @@ -107,11 +107,11 @@ MSG s_currentMsg; wxApp *wxTheApp = NULL; // FIXME why not const? and not static? -char wxFrameClassName[] = "wxFrameClass"; -char wxMDIFrameClassName[] = "wxMDIFrameClass"; -char wxMDIChildFrameClassName[] = "wxMDIChildFrameClass"; -char wxPanelClassName[] = "wxPanelClass"; -char wxCanvasClassName[] = "wxCanvasClass"; +wxChar wxFrameClassName[] = _T("wxFrameClass"); +wxChar wxMDIFrameClassName[] = _T("wxMDIFrameClass"); +wxChar wxMDIChildFrameClassName[] = _T("wxMDIChildFrameClass"); +wxChar wxPanelClassName[] = _T("wxPanelClass"); +wxChar wxCanvasClassName[] = _T("wxCanvasClass"); HICON wxSTD_FRAME_ICON = (HICON) NULL; HICON wxSTD_MDICHILDFRAME_ICON = (HICON) NULL; @@ -162,12 +162,12 @@ bool wxApp::Initialize() // wxRedirectIOToConsole(); #endif - wxBuffer = new char[1500]; // FIXME + wxBuffer = new wxChar[1500]; // FIXME wxClassInfo::InitializeClasses(); #if wxUSE_RESOURCES - wxGetResource("wxWindows", "OsVersion", &wxOsVersion); + wxGetResource(_T("wxWindows"), _T("OsVersion"), &wxOsVersion); #endif // I'm annoyed ... I don't know where to put this and I don't want to @@ -193,7 +193,7 @@ bool wxApp::Initialize() InitCommonControls(); #if wxUSE_RICHEDIT - gs_hRichEdit = LoadLibrary("RICHED32.DLL"); + gs_hRichEdit = LoadLibrary(_T("RICHED32.DLL")); if (gs_hRichEdit == (HINSTANCE) NULL) { @@ -215,20 +215,20 @@ bool wxApp::Initialize() #if wxUSE_CTL3D if (!Ctl3dRegister(wxhInstance)) - wxLogError("Cannot register CTL3D"); + wxLogError(_T("Cannot register CTL3D")); Ctl3dAutoSubclass(wxhInstance); #endif g_globalCursor = new wxCursor; - wxSTD_FRAME_ICON = LoadIcon(wxhInstance, "wxSTD_FRAME"); - wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, "wxSTD_MDIPARENTFRAME"); - wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, "wxSTD_MDICHILDFRAME"); + wxSTD_FRAME_ICON = LoadIcon(wxhInstance, _T("wxSTD_FRAME")); + wxSTD_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, _T("wxSTD_MDIPARENTFRAME")); + wxSTD_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, _T("wxSTD_MDICHILDFRAME")); - wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, "wxDEFAULT_FRAME"); - wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, "wxDEFAULT_MDIPARENTFRAME"); - wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, "wxDEFAULT_MDICHILDFRAME"); + wxDEFAULT_FRAME_ICON = LoadIcon(wxhInstance, _T("wxDEFAULT_FRAME")); + wxDEFAULT_MDIPARENTFRAME_ICON = LoadIcon(wxhInstance, _T("wxDEFAULT_MDIPARENTFRAME")); + wxDEFAULT_MDICHILDFRAME_ICON = LoadIcon(wxhInstance, _T("wxDEFAULT_MDICHILDFRAME")); RegisterWindowClasses(); @@ -236,7 +236,7 @@ bool wxApp::Initialize() LOGBRUSH lb; lb.lbStyle = BS_PATTERN; - lb.lbHatch = (int)LoadBitmap( wxhInstance, "wxDISABLE_BUTTON_BITMAP" ); + lb.lbHatch = (int)LoadBitmap( wxhInstance, _T("wxDISABLE_BUTTON_BITMAP") ); if ( lb.lbHatch ) { wxDisableButtonBrush = ::CreateBrushIndirect( & lb ); @@ -356,13 +356,13 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine) int count = 0; // Get application name - char name[260]; // 260 is MAX_PATH value from windef.h + wxChar name[260]; // 260 is MAX_PATH value from windef.h ::GetModuleFileName(wxhInstance, name, WXSIZEOF(name)); args.Add(name); count++; - strcpy(name, wxFileNameFromPath(name)); + wxStrcpy(name, wxFileNameFromPath(name)); wxStripExtension(name); wxTheApp->SetAppName(name); @@ -373,16 +373,16 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine) while (i < len) { // Skip whitespace - while ((i < len) && isspace(cmdLine.GetChar(i))) + while ((i < len) && wxIsspace(cmdLine.GetChar(i))) i ++; if (i < len) { - if (cmdLine.GetChar(i) == '"') // We found the start of a string + if (cmdLine.GetChar(i) == _T('"')) // We found the start of a string { i ++; int first = i; - while ((i < len) && (cmdLine.GetChar(i) != '"')) + while ((i < len) && (cmdLine.GetChar(i) != _T('"'))) i ++; wxString arg(cmdLine.Mid(first, (i - first))); @@ -396,7 +396,7 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine) else // Unquoted argument { int first = i; - while ((i < len) && !isspace(cmdLine.GetChar(i))) + while ((i < len) && !wxIsspace(cmdLine.GetChar(i))) i ++; wxString arg(cmdLine.Mid(first, (i - first))); @@ -407,11 +407,11 @@ void wxApp::ConvertToStandardCommandArgs(char* lpCmdLine) } } - wxTheApp->argv = new char*[count + 1]; + wxTheApp->argv = new wxChar*[count + 1]; for (i = 0; i < count; i++) { wxString arg(args[i]); - wxTheApp->argv[i] = copystring((const char*)arg); + wxTheApp->argv[i] = copystring((const wxChar*)arg); } wxTheApp->argv[count] = NULL; // argv[] is a NULL-terminated list wxTheApp->argc = count; @@ -531,7 +531,7 @@ void wxApp::CleanUp() // wxDebugContext, too. if (wxDebugContext::CountObjectsLeft(TRUE) > 0) { - wxLogDebug("There were memory leaks."); + wxLogDebug(_T("There were memory leaks.")); wxDebugContext::Dump(); wxDebugContext::PrintStatistics(); } @@ -588,12 +588,12 @@ int wxEntry(WXHINSTANCE hInstance, // the IMPLEMENT_APP macro is used instead, which sets an initializer // function for delayed, dynamic app object construction. wxCHECK_MSG( wxApp::GetInitializerFunction(), 0, - "No initializer - use IMPLEMENT_APP macro." ); + _T("No initializer - use IMPLEMENT_APP macro.") ); wxTheApp = (*wxApp::GetInitializerFunction()) (); } - wxCHECK_MSG( wxTheApp, 0, "You have to define an instance of wxApp!" ); + wxCHECK_MSG( wxTheApp, 0, _T("You have to define an instance of wxApp!") ); // save the WinMain() parameters wxTheApp->ConvertToStandardCommandArgs(lpCmdLine); @@ -771,7 +771,7 @@ bool wxApp::DoMessage() { #if wxUSE_THREADS wxASSERT_MSG( wxThread::IsMain(), - "only the main thread can process Windows messages" ); + _T("only the main thread can process Windows messages") ); static bool s_hadGuiLock = TRUE; static wxMsgArray s_aSavedMessages; @@ -1071,7 +1071,7 @@ wxWindow* wxApp::GetTopWindow() const int wxApp::GetComCtl32Version() const { // have we loaded COMCTL32 yet? - HMODULE theModule = ::GetModuleHandle("COMCTL32"); + HMODULE theModule = ::GetModuleHandle(_T("COMCTL32")); int version = 0; // if so, then we can check for the version diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 581eadde0a..e6194fcef9 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -61,8 +61,8 @@ wxBitmapRefData::~wxBitmapRefData(void) { if (m_selectedInto) { - char buf[200]; - sprintf(buf, "Bitmap was deleted without selecting out of wxMemoryDC %X.", (unsigned int) m_selectedInto); + wxChar buf[200]; + wxSprintf(buf, _T("Bitmap was deleted without selecting out of wxMemoryDC %X."), (unsigned int) m_selectedInto); wxFatalError(buf); } if (m_hBitmap) @@ -98,8 +98,8 @@ bool wxBitmap::FreeResource(bool WXUNUSED(force)) if (M_BITMAPDATA->m_selectedInto) { - char buf[200]; - sprintf(buf, "Bitmap %X was deleted without selecting out of wxMemoryDC %X.", (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); + wxChar buf[200]; + wxSprintf(buf, _T("Bitmap %X was deleted without selecting out of wxMemoryDC %X."), (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); wxFatalError(buf); } if (M_BITMAPDATA->m_hBitmap) @@ -208,7 +208,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -225,7 +225,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -238,7 +238,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -635,7 +635,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long } // it's probably not found - wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str()); + wxLogError(_T("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); return FALSE; } diff --git a/src/msw/bmpbuttn.cpp b/src/msw/bmpbuttn.cpp index 9404785a6f..4cad610d43 100644 --- a/src/msw/bmpbuttn.cpp +++ b/src/msw/bmpbuttn.cpp @@ -75,8 +75,8 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit m_hWnd = (WXHWND)CreateWindowEx ( 0, - "BUTTON", - "", + _T("BUTTON"), + _T(""), WS_VISIBLE | WS_TABSTOP | WS_CHILD | BS_OWNERDRAW , 0, 0, 0, 0, GetWinHwnd(parent), diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 80e8318503..aff5ee1b47 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -75,7 +75,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, m_hWnd = (WXHWND)CreateWindowEx ( MakeExtendedStyle(m_windowStyle), - "BUTTON", + _T("BUTTON"), label, WS_VISIBLE | WS_TABSTOP | WS_CHILD, 0, 0, 0, 0, @@ -115,7 +115,7 @@ void wxButton::DoSetSize(int x, int y, int width, int height, int sizeFlags) int current_width; int cyf; - char buf[300]; + wxChar buf[300]; GetWindowText((HWND) GetHWND(), buf, 300); GetTextExtent(buf, ¤t_width, &cyf,NULL,NULL, & this->GetFont()); @@ -164,7 +164,7 @@ wxString wxButton::GetLabel(void) const void wxButton::SetLabel(const wxString& label) { - SetWindowText((HWND) GetHWND(), (const char *) label); + SetWindowText((HWND) GetHWND(), (const wxChar *) label); } WXHBRUSH wxButton::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, diff --git a/src/msw/caret.cpp b/src/msw/caret.cpp index 17ef55cb21..dec7d89ea5 100644 --- a/src/msw/caret.cpp +++ b/src/msw/caret.cpp @@ -76,8 +76,8 @@ void wxCaretBase::SetBlinkTime(int milliseconds) bool wxCaret::MSWCreateCaret() { - wxASSERT_MSG( GetWindow(), "caret without window cannot be created" ); - wxASSERT_MSG( IsOk(), "caret of zero size cannot be created" ); + wxASSERT_MSG( GetWindow(), _T("caret without window cannot be created") ); + wxASSERT_MSG( IsOk(), _T("caret of zero size cannot be created") ); if ( !m_hasCaret ) { @@ -138,8 +138,8 @@ void wxCaret::OnKillFocus() void wxCaret::DoShow() { - wxASSERT_MSG( GetWindow(), "caret without window cannot be shown" ); - wxASSERT_MSG( IsOk(), "caret of zero size cannot be shown" ); + wxASSERT_MSG( GetWindow(), _T("caret without window cannot be shown") ); + wxASSERT_MSG( IsOk(), _T("caret of zero size cannot be shown") ); if ( !m_hasCaret ) { diff --git a/src/msw/checkbox.cpp b/src/msw/checkbox.cpp index 436706ad41..89f0c52cca 100644 --- a/src/msw/checkbox.cpp +++ b/src/msw/checkbox.cpp @@ -58,8 +58,8 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, m_windowStyle = style; wxString Label = label; - if (Label == "") - Label = " "; // Apparently needed or checkbox won't show + if (Label == _T("")) + Label = _T(" "); // Apparently needed or checkbox won't show if ( id == -1 ) m_windowId = NewControlId(); @@ -89,7 +89,7 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, msStyle |= WS_BORDER; */ - m_hWnd = (WXHWND)CreateWindowEx(exStyle, "BUTTON", Label, + m_hWnd = (WXHWND)CreateWindowEx(exStyle, _T("BUTTON"), Label, msStyle, 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, @@ -245,7 +245,7 @@ bool wxBitmapCheckBox::Create(wxWindow *parent, wxWindowID id, const wxBitmap *l checkHeight = -1 ; long msStyle = CHECK_FLAGS; - HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, "toggle", + HWND wx_button = CreateWindowEx(MakeExtendedStyle(m_windowStyle), CHECK_CLASS, _T("toggle"), msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index 613edc426a..f9de4075a8 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -221,7 +221,7 @@ void wxCheckListBoxItem::Check(bool check) // update it int index = m_pParent->GetItemIndex(this); - wxASSERT_MSG( index != wxNOT_FOUND, "what does this item do here?" ); + wxASSERT_MSG( index != wxNOT_FOUND, _T("what does this item do here?") ); m_nIndex = (size_t)index; } @@ -234,7 +234,7 @@ void wxCheckListBoxItem::Check(bool check) if ( ::SendMessage(hwndListbox, LB_GETITEMRECT, m_nIndex, (LPARAM)&rcUpdate) == LB_ERR ) { - wxLogDebug("LB_GETITEMRECT failed"); + wxLogDebug(_T("LB_GETITEMRECT failed")); } #else // Win16 // FIXME this doesn't work if the listbox is scrolled! @@ -285,7 +285,7 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, void wxCheckListBox::Delete(int N) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::Delete" ); + _T("invalid index in wxListBox::Delete") ); wxListBox::Delete(N); @@ -298,7 +298,7 @@ void wxCheckListBox::Delete(int N) void wxCheckListBox::InsertItems(int nItems, const wxString items[], int pos) { wxCHECK_RET( pos >= 0 && pos <= m_noItems, - "invalid index in wxCheckListBox::InsertItems" ); + _T("invalid index in wxCheckListBox::InsertItems") ); wxListBox::InsertItems(nItems, items, pos); diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index cf0aec140e..3f349227d3 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -87,12 +87,12 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, if ( want3D || wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; - m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "COMBOBOX", NULL, + m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("COMBOBOX"), NULL, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create combobox" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create combobox") ); /* #if wxUSE_CTL3D @@ -123,7 +123,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, void wxChoice::Append(const wxString& item) { - SendMessage((HWND) GetHWND(), CB_ADDSTRING, 0, (LONG)(const char *)item); + SendMessage((HWND) GetHWND(), CB_ADDSTRING, 0, (LONG)(const wxChar *)item); m_noStrings ++; } @@ -166,7 +166,7 @@ int wxChoice::FindString(const wxString& s) const } return -1; #else - int pos = (int)SendMessage((HWND) GetHWND(), CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)(LPSTR)(const char *)s); + int pos = (int)SendMessage((HWND) GetHWND(), CB_FINDSTRINGEXACT, (WPARAM)-1, (LPARAM)(LPSTR)(const wxChar *)s); if (pos == LB_ERR) return -1; else @@ -327,7 +327,7 @@ wxString wxChoice::GetStringSelection (void) const if (sel > -1) return wxString(this->GetString (sel)); else - return wxString(""); + return wxString(_T("")); } bool wxChoice::SetStringSelection (const wxString& s) diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 36aa9b6b05..5f8cc9d74d 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -81,7 +81,7 @@ static bool gs_wxClipboardIsOpen = FALSE; bool wxOpenClipboard() { - wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, "clipboard already opened." ); + wxCHECK_MSG( !gs_wxClipboardIsOpen, TRUE, _T("clipboard already opened.") ); wxWindow *win = wxTheApp->GetTopWindow(); if ( win ) @@ -95,7 +95,7 @@ bool wxOpenClipboard() } else { - wxLogDebug("Can not open clipboard without a main window,"); + wxLogDebug(_T("Can not open clipboard without a main window.")); return FALSE; } @@ -103,7 +103,7 @@ bool wxOpenClipboard() bool wxCloseClipboard() { - wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, "clipboard is not opened" ); + wxCHECK_MSG( gs_wxClipboardIsOpen, FALSE, _T("clipboard is not opened") ); gs_wxClipboardIsOpen = FALSE; @@ -420,13 +420,13 @@ wxDataFormat wxEnumClipboardFormats(wxDataFormat dataFormat) return ::EnumClipboardFormats(dataFormat); } -int wxRegisterClipboardFormat(char *formatName) +int wxRegisterClipboardFormat(wxChar *formatName) { return ::RegisterClipboardFormat(formatName); } bool wxGetClipboardFormatName(wxDataFormat dataFormat, - char *formatName, + wxChar *formatName, int maxCount) { return ::GetClipboardFormatName((int)dataFormat, formatName, maxCount) > 0; @@ -470,10 +470,10 @@ bool wxClipboard::SetData( wxDataObject *data ) bool wxClipboard::AddData( wxDataObject *data ) { - wxCHECK_MSG( data, FALSE, "data is invalid" ); + wxCHECK_MSG( data, FALSE, _T("data is invalid") ); #if wxUSE_DRAG_AND_DROP - wxCHECK_MSG( wxIsClipboardOpened(), FALSE, "clipboard not open" ); + wxCHECK_MSG( wxIsClipboardOpened(), FALSE, _T("clipboard not open") ); wxDataFormat format = data->GetFormat(); @@ -527,7 +527,7 @@ bool wxClipboard::IsSupported( wxDataFormat format ) bool wxClipboard::GetData( wxDataObject *data ) { - wxCHECK_MSG( wxIsClipboardOpened(), FALSE, "clipboard not open" ); + wxCHECK_MSG( wxIsClipboardOpened(), FALSE, _T("clipboard not open") ); #if wxUSE_DRAG_AND_DROP wxDataFormat format = data->GetFormat(); diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 7f2f67ad41..f7eff22ed6 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -108,12 +108,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, if ( want3D || wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; - m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "COMBOBOX", NULL, + m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("COMBOBOX"), NULL, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create combobox" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create combobox") ); /* #if wxUSE_CTL3D @@ -164,7 +164,7 @@ void wxComboBox::SetValue(const wxString& value) } if (singletons > 0) { - char *tmp = new char[len + singletons + 1]; + wxChar *tmp = new wxChar[len + singletons + 1]; int j = 0; for (i = 0; i < len; i ++) { @@ -181,7 +181,7 @@ void wxComboBox::SetValue(const wxString& value) delete[] tmp; } else - SetWindowText((HWND) GetHWND(), (const char *)value); + SetWindowText((HWND) GetHWND(), (const wxChar *)value); } // Clipboard operations @@ -278,7 +278,7 @@ void wxComboBox::Replace(long from, long to, const wxString& value) SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0); // Now replace with 'value', by pasting. - wxSetClipboardData(wxDF_TEXT, (wxObject *)(const char *)value, 0, 0); + wxSetClipboardData(wxDF_TEXT, (wxObject *)(const wxChar *)value, 0, 0); // Paste into edit control SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L); diff --git a/src/msw/curico.cpp b/src/msw/curico.cpp index 9258b5ad20..dbf2c1cd68 100644 --- a/src/msw/curico.cpp +++ b/src/msw/curico.cpp @@ -216,7 +216,7 @@ HICON MakeIcon( HANDLE hDIB, HINSTANCE hInst) lpDIB->bmiHeader.biBitCount))); // Get a hDC so we can create a bitmap compatible with it - hDC = CreateDC( "DISPLAY", NULL, NULL, NULL); + hDC = CreateDC( _T("DISPLAY"), NULL, NULL, NULL); // 5) Create a device dependent bitmap with the XOR bits. hbmXor = CreateDIBitmap( hDC, (LPBITMAPINFOHEADER)&(lpDIB->bmiHeader), @@ -577,7 +577,7 @@ HCURSOR MakeCursor( HANDLE hDIB, LPPOINT lpptHotSpot, HINSTANCE hInst) lpDIB->bmiHeader.biBitCount))); // Get a hDC so we can create a bitmap compatible with it - hDC = CreateDC( "DISPLAY", NULL, NULL, NULL); + hDC = CreateDC( _T("DISPLAY"), NULL, NULL, NULL); // 5) Create a device dependent bitmap with the XOR bits. hbmXor = CreateBitmap( (int )lpDIB->bmiHeader.biWidth, diff --git a/src/msw/cursor.cpp b/src/msw/cursor.cpp index d3e67418a9..3ad8200c69 100644 --- a/src/msw/cursor.cpp +++ b/src/msw/cursor.cpp @@ -89,14 +89,14 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho else if (flags & wxBITMAP_TYPE_CUR) { #if wxUSE_RESOURCE_LOADING_IN_MSW - M_CURSORDATA->m_hCursor = (WXHCURSOR) ReadCursorFile((char *)(const char *)cursor_file, wxGetInstance(), &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); + M_CURSORDATA->m_hCursor = (WXHCURSOR) ReadCursorFile(WXSTRINGCAST cursor_file, wxGetInstance(), &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); M_CURSORDATA->m_destroyCursor = TRUE; #endif } else if (flags & wxBITMAP_TYPE_ICO) { #if wxUSE_RESOURCE_LOADING_IN_MSW - M_CURSORDATA->m_hCursor = (WXHCURSOR) IconToCursor((char *)(const char *)cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); + M_CURSORDATA->m_hCursor = (WXHCURSOR) IconToCursor(WXSTRINGCAST cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); M_CURSORDATA->m_destroyCursor = TRUE; #endif } @@ -105,7 +105,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho #if wxUSE_RESOURCE_LOADING_IN_MSW HBITMAP hBitmap = 0; HPALETTE hPalette = 0; - bool success = ReadDIB((char *)(const char *)cursor_file, &hBitmap, &hPalette) != 0; + bool success = ReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0; if (!success) return; if (hPalette) @@ -157,27 +157,27 @@ wxCursor::wxCursor(int cursor_type) } case wxCURSOR_HAND: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_HAND"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_HAND")); break; } case wxCURSOR_BULLSEYE: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BULLSEYE"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_BULLSEYE")); break; } case wxCURSOR_PENCIL: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PENCIL"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PENCIL")); break; } case wxCURSOR_MAGNIFIER: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_MAGNIFIER"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_MAGNIFIER")); break; } case wxCURSOR_NO_ENTRY: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_NO_ENTRY"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_NO_ENTRY")); break; } case wxCURSOR_LEFT_BUTTON: @@ -197,42 +197,42 @@ wxCursor::wxCursor(int cursor_type) } case wxCURSOR_SIZING: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_SIZING"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_SIZING")); break; } case wxCURSOR_WATCH: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_WATCH"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_WATCH")); break; } case wxCURSOR_SPRAYCAN: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_ROLLER"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_ROLLER")); break; } case wxCURSOR_PAINT_BRUSH: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PBRUSH"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PBRUSH")); break; } case wxCURSOR_POINT_LEFT: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PLEFT"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PLEFT")); break; } case wxCURSOR_POINT_RIGHT: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PRIGHT"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PRIGHT")); break; } case wxCURSOR_QUESTION_ARROW: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_QARROW"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_QARROW")); break; } case wxCURSOR_BLANK: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BLANK"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_BLANK")); break; } default: diff --git a/src/msw/data.cpp b/src/msw/data.cpp index dc3a9aa018..da26953b96 100644 --- a/src/msw/data.cpp +++ b/src/msw/data.cpp @@ -29,7 +29,7 @@ #define _MAXPATHLEN 500 // Useful buffer, initialized in wxCommonInit -char *wxBuffer = NULL; +wxChar *wxBuffer = NULL; // Windows List wxWindowList wxTopLevelWindows; @@ -118,48 +118,48 @@ wxFont wxNullFont; wxColour wxNullColour; // Default window names -const char *wxButtonNameStr = "button"; -const char *wxCanvasNameStr = "canvas"; -const char *wxCheckBoxNameStr = "check"; -const char *wxChoiceNameStr = "choice"; -const char *wxComboBoxNameStr = "comboBox"; -const char *wxDialogNameStr = "dialog"; -const char *wxFrameNameStr = "frame"; -const char *wxGaugeNameStr = "gauge"; -const char *wxStaticBoxNameStr = "groupBox"; -const char *wxListBoxNameStr = "listBox"; -const char *wxStaticTextNameStr = "message"; -const char *wxStaticBitmapNameStr = "message"; -const char *wxMultiTextNameStr = "multitext"; -const char *wxPanelNameStr = "panel"; -const char *wxRadioBoxNameStr = "radioBox"; -const char *wxRadioButtonNameStr = "radioButton"; -const char *wxBitmapRadioButtonNameStr = "radioButton"; -const char *wxScrollBarNameStr = "scrollBar"; -const char *wxSliderNameStr = "slider"; -const char *wxStaticNameStr = "static"; -const char *wxTextCtrlWindowNameStr = "textWindow"; -const char *wxTextCtrlNameStr = "text"; -const char *wxVirtListBoxNameStr = "virtListBox"; -const char *wxButtonBarNameStr = "buttonbar"; -const char *wxEnhDialogNameStr = "Shell"; -const char *wxToolBarNameStr = "toolbar"; -const char *wxStatusLineNameStr = "status_line"; -const char *wxEmptyString = ""; -const char *wxGetTextFromUserPromptStr = "Input Text"; -const char *wxMessageBoxCaptionStr = "Message"; -const char *wxFileSelectorPromptStr = "Select a file"; -const char *wxFileSelectorDefaultWildcardStr = "*.*"; -const char *wxInternalErrorStr = "wxWindows Internal Error"; -const char *wxFatalErrorStr = "wxWindows Fatal Error"; -const char *wxTreeCtrlNameStr = "treeCtrl"; +const wxChar *wxButtonNameStr = _T("button"); +const wxChar *wxCanvasNameStr = _T("canvas"); +const wxChar *wxCheckBoxNameStr = _T("check"); +const wxChar *wxChoiceNameStr = _T("choice"); +const wxChar *wxComboBoxNameStr = _T("comboBox"); +const wxChar *wxDialogNameStr = _T("dialog"); +const wxChar *wxFrameNameStr = _T("frame"); +const wxChar *wxGaugeNameStr = _T("gauge"); +const wxChar *wxStaticBoxNameStr = _T("groupBox"); +const wxChar *wxListBoxNameStr = _T("listBox"); +const wxChar *wxStaticTextNameStr = _T("message"); +const wxChar *wxStaticBitmapNameStr = _T("message"); +const wxChar *wxMultiTextNameStr = _T("multitext"); +const wxChar *wxPanelNameStr = _T("panel"); +const wxChar *wxRadioBoxNameStr = _T("radioBox"); +const wxChar *wxRadioButtonNameStr = _T("radioButton"); +const wxChar *wxBitmapRadioButtonNameStr = _T("radioButton"); +const wxChar *wxScrollBarNameStr = _T("scrollBar"); +const wxChar *wxSliderNameStr = _T("slider"); +const wxChar *wxStaticNameStr = _T("static"); +const wxChar *wxTextCtrlWindowNameStr = _T("textWindow"); +const wxChar *wxTextCtrlNameStr = _T("text"); +const wxChar *wxVirtListBoxNameStr = _T("virtListBox"); +const wxChar *wxButtonBarNameStr = _T("buttonbar"); +const wxChar *wxEnhDialogNameStr = _T("Shell"); +const wxChar *wxToolBarNameStr = _T("toolbar"); +const wxChar *wxStatusLineNameStr = _T("status_line"); +const wxChar *wxEmptyString = _T(""); +const wxChar *wxGetTextFromUserPromptStr = _T("Input Text"); +const wxChar *wxMessageBoxCaptionStr = _T("Message"); +const wxChar *wxFileSelectorPromptStr = _T("Select a file"); +const wxChar *wxFileSelectorDefaultWildcardStr = _T("*.*"); +const wxChar *wxInternalErrorStr = _T("wxWindows Internal Error"); +const wxChar *wxFatalErrorStr = _T("wxWindows Fatal Error"); +const wxChar *wxTreeCtrlNameStr = _T("treeCtrl"); // See wx/utils.h -const char *wxFloatToStringStr = "%.2f"; -const char *wxDoubleToStringStr = "%.2f"; +const wxChar *wxFloatToStringStr = _T("%.2f"); +const wxChar *wxDoubleToStringStr = _T("%.2f"); #ifdef __WXMSW__ -const char *wxUserResourceStr = "TEXT"; +const wxChar *wxUserResourceStr = _T("TEXT"); #endif #if wxUSE_SHARED_LIBRARY diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index a7b088cb0e..f53d6d84f7 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -680,7 +680,7 @@ void wxDC::DoDrawText(const wxString& text, long x, long y) else SetBkMode(GetHdc(), OPAQUE); - (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), (char *) (const char *)text, strlen((const char *)text)); + (void)TextOut(GetHdc(), XLOG2DEV(x), YLOG2DEV(y), WXSTRINGCAST text, wxStrlen(WXSTRINGCAST text)); if (m_textBackgroundColour.Ok()) (void)SetBkColor(GetHdc(), old_background); @@ -755,7 +755,7 @@ void wxDC::SetFont(const wxFont& the_font) HFONT f = (HFONT) ::SelectObject(GetHdc(), (HFONT) m_font.GetResourceHandle()); if (f == (HFONT) NULL) { - wxLogDebug("::SelectObject failed in wxDC::SetFont."); + wxLogDebug(_T("::SelectObject failed in wxDC::SetFont.")); } if (!m_oldFont) m_oldFont = (WXHFONT) f; @@ -962,7 +962,7 @@ void wxDC::GetTextExtent(const wxString& string, long *x, long *y, SIZE sizeRect; TEXTMETRIC tm; - GetTextExtentPoint(GetHdc(), (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect); + GetTextExtentPoint(GetHdc(), WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); GetTextMetrics(GetHdc(), &tm); if (x) *x = XDEV2LOGREL(sizeRect.cx); diff --git a/src/msw/dcclient.cpp b/src/msw/dcclient.cpp index 75fe09b4c1..3f6a4be196 100644 --- a/src/msw/dcclient.cpp +++ b/src/msw/dcclient.cpp @@ -175,7 +175,7 @@ wxPaintDC::wxPaintDC() wxPaintDC::wxPaintDC(wxWindow *canvas) { - wxCHECK_RET( canvas, "NULL canvas in wxPaintDC ctor" ); + wxCHECK_RET( canvas, _T("NULL canvas in wxPaintDC ctor") ); #ifdef __WXDEBUG__ if ( !g_isPainting ) diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index 7e171ac46c..1a4b151391 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -82,7 +82,7 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap) // a device context if (bitmap.GetSelectedInto() && (bitmap.GetSelectedInto() != this)) { - wxFatalError("Error in wxMemoryDC::SelectObject\nBitmap is selected in another wxMemoryDC.\nDelete the first wxMemoryDC or use SelectObject(NULL)"); + wxFatalError(_T("Error in wxMemoryDC::SelectObject\nBitmap is selected in another wxMemoryDC.\nDelete the first wxMemoryDC or use SelectObject(NULL)")); return; } @@ -111,7 +111,7 @@ void wxMemoryDC::SelectObject(const wxBitmap& bitmap) if (bm == ERROR) { - wxFatalError("Error in wxMemoryDC::SelectObject\nBitmap may not be loaded, or may be selected in another wxMemoryDC.\nDelete the first wxMemoryDC to deselect bitmap."); + wxFatalError(_T("Error in wxMemoryDC::SelectObject\nBitmap may not be loaded, or may be selected in another wxMemoryDC.\nDelete the first wxMemoryDC to deselect bitmap.")); } else if (!m_oldBitmap) m_oldBitmap = (WXHBITMAP) bm; diff --git a/src/msw/dcprint.cpp b/src/msw/dcprint.cpp index 0f402ccffb..bd7399b58c 100644 --- a/src/msw/dcprint.cpp +++ b/src/msw/dcprint.cpp @@ -47,7 +47,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam { m_isInteractive = interactive; - if (!file.IsNull() && file != "") + if (!file.IsNull() && file != _T("")) m_printData.SetFilename(file); #if wxUSE_COMMON_DIALOGS @@ -82,11 +82,11 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam } else #endif - if ((!driver_name.IsNull() && driver_name != "") && - (!device_name.IsNull() && device_name != "") && - (!file.IsNull() && file != "")) + if ((!driver_name.IsNull() && driver_name != _T("")) && + (!device_name.IsNull() && device_name != _T("")) && + (!file.IsNull() && file != _T(""))) { - m_hDC = (WXHDC) CreateDC((char *) (const char *) driver_name, (char *) (const char *) device_name, (char *) (const char *) file, NULL); + m_hDC = (WXHDC) CreateDC(WXSTRINGCAST driver_name, WXSTRINGCAST device_name, WXSTRINGCAST file, NULL); m_ok = m_hDC ? TRUE: FALSE; } else @@ -148,14 +148,14 @@ bool wxPrinterDC::StartDoc(const wxString& message) { DOCINFO docinfo; docinfo.cbSize = sizeof(DOCINFO); - docinfo.lpszDocName = (const char *)message; + docinfo.lpszDocName = (const wxChar*)message; wxString filename(m_printData.GetFilename()); if (filename.IsEmpty()) docinfo.lpszOutput = NULL; else - docinfo.lpszOutput = (const char *) filename; + docinfo.lpszOutput = (const wxChar *) filename; #if defined(__WIN95__) docinfo.lpszDatatype = NULL; @@ -184,7 +184,7 @@ bool wxPrinterDC::StartDoc(const wxString& message) if (ret <= 0) { DWORD lastError = GetLastError(); - wxLogDebug("wxDC::StartDoc failed with error: %d\n", lastError); + wxLogDebug(_T("wxDC::StartDoc failed with error: %d\n"), lastError); } #endif @@ -262,7 +262,7 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName) GlobalFree(pd.hDevMode); pd.hDevMode=NULL; } - return ( deviceName != "" ); + return ( deviceName != _T("") ); } #if 0 @@ -348,16 +348,16 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst) wxPrintData printData = printDataConst; printData.ConvertToNative(); - char* driverName = (char*) NULL; + wxChar* driverName = (wxChar*) NULL; wxString devNameStr = printData.GetPrinterName(); - char* deviceName; - char* portName = (char*) NULL; // Obsolete in WIN32 + wxChar* deviceName; + wxChar* portName = (wxChar*) NULL; // Obsolete in WIN32 - if (devNameStr == "") - deviceName = (char*) NULL; + if (devNameStr == _T("")) + deviceName = (wxChar*) NULL; else - deviceName = (char*) (const char*) devNameStr; + deviceName = WXSTRINGCAST devNameStr; LPDEVMODE lpDevMode = (LPDEVMODE) NULL; @@ -366,15 +366,15 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst) if ( hDevMode ) lpDevMode = (DEVMODE*) GlobalLock(hDevMode); - if (devNameStr == "") + if (devNameStr == _T("")) { // Retrieve the default device name wxString portName; bool ret = wxGetDefaultDeviceName(devNameStr, portName); - wxASSERT_MSG( ret, "Could not get default device name." ); + wxASSERT_MSG( ret, _T("Could not get default device name.") ); - deviceName = (char*) (const char*) devNameStr; + deviceName = WXSTRINGCAST devNameStr; } #ifdef __WIN32__ diff --git a/src/msw/dde.cpp b/src/msw/dde.cpp index d8fe4dfa5a..2d28519ecc 100644 --- a/src/msw/dde.cpp +++ b/src/msw/dde.cpp @@ -214,7 +214,7 @@ wxDDEServer::wxDDEServer(void) bool wxDDEServer::Create(const wxString& server_name) { m_serviceName = server_name; - HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)server_name, CP_WINANSI); + HSZ serviceName = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST server_name, CP_WINANSI); if (DdeNameService(DDEIdInst, serviceName, (HSZ) NULL, DNS_REGISTER) == 0) { @@ -226,9 +226,9 @@ bool wxDDEServer::Create(const wxString& server_name) wxDDEServer::~wxDDEServer(void) { - if (m_serviceName != "") + if (m_serviceName != _T("")) { - HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)m_serviceName, CP_WINANSI); + HSZ serviceName = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST m_serviceName, CP_WINANSI); if (DdeNameService(DDEIdInst, serviceName, NULL, DNS_UNREGISTER) == 0) { DDEPrintError(); @@ -324,8 +324,8 @@ bool wxDDEClient::ValidHost(const wxString& /* host */) wxConnectionBase *wxDDEClient::MakeConnection(const wxString& /* host */, const wxString& server_name, const wxString& topic) { - HSZ serviceName = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)server_name, CP_WINANSI); - HSZ topic_atom = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)topic, CP_WINANSI); + HSZ serviceName = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST server_name, CP_WINANSI); + HSZ topic_atom = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST topic, CP_WINANSI); HCONV hConv = DdeConnect(DDEIdInst, serviceName, topic_atom, (PCONVCONTEXT)NULL); if (hConv == (HCONV) NULL) @@ -439,11 +439,11 @@ bool wxDDEConnection::Disconnect(void) return (DdeDisconnect((HCONV) m_hConv) != 0); } -bool wxDDEConnection::Execute(char *data, int size, wxIPCFormat format) +bool wxDDEConnection::Execute(wxChar *data, int size, wxIPCFormat format) { DWORD result; if (size < 0) - size = strlen(data); + size = wxStrlen(data); size ++; @@ -471,11 +471,11 @@ char *wxDDEConnection::Request(const wxString& item, int *size, wxIPCFormat form else return NULL; } -bool wxDDEConnection::Poke(const wxString& item, char *data, int size, wxIPCFormat format) +bool wxDDEConnection::Poke(const wxString& item, wxChar *data, int size, wxIPCFormat format) { DWORD result; if (size < 0) - size = strlen(data); + size = wxStrlen(data); size ++; @@ -503,10 +503,10 @@ bool wxDDEConnection::StopAdvise(const wxString& item) } // Calls that SERVER can make -bool wxDDEConnection::Advise(const wxString& item, char *data, int size, wxIPCFormat format) +bool wxDDEConnection::Advise(const wxString& item, wxChar *data, int size, wxIPCFormat format) { if (size < 0) - size = strlen(data); + size = wxStrlen(data); size ++; @@ -541,11 +541,11 @@ DWORD /* lData2 */) { case XTYP_CONNECT: { - char topic_buf[100]; - char server_buf[100]; - DdeQueryString(DDEIdInst, hsz1, (LPSTR)topic_buf, sizeof(topic_buf), + wxChar topic_buf[100]; + wxChar server_buf[100]; + DdeQueryString(DDEIdInst, hsz1, (LPTSTR)topic_buf, WXSIZEOF(topic_buf), CP_WINANSI); - DdeQueryString(DDEIdInst, hsz2, (LPSTR)server_buf, sizeof(topic_buf), + DdeQueryString(DDEIdInst, hsz2, (LPTSTR)server_buf, WXSIZEOF(topic_buf), CP_WINANSI); wxDDEServer *server = DDEFindServer(server_buf); if (server) @@ -612,8 +612,8 @@ DWORD /* lData2 */) if (connection) { - char item_name[200]; - DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name), + wxChar item_name[200]; + DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); int user_size = -1; @@ -636,8 +636,8 @@ DWORD /* lData2 */) if (connection) { - char item_name[200]; - DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name), + wxChar item_name[200]; + DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0); DdeFreeDataHandle(hData); @@ -653,8 +653,8 @@ DWORD /* lData2 */) if (connection) { - char item_name[200]; - DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name), + wxChar item_name[200]; + DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); return (DDERETURN)connection->OnStartAdvise(connection->m_topicName, wxString(item_name)); @@ -668,8 +668,8 @@ DWORD /* lData2 */) if (connection) { - char item_name[200]; - DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name), + wxChar item_name[200]; + DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); return (DDERETURN)connection->OnStopAdvise(connection->m_topicName, wxString(item_name)); } else return (DDERETURN)0; @@ -697,8 +697,8 @@ DWORD /* lData2 */) if (connection) { - char item_name[200]; - DdeQueryString(DDEIdInst, hsz2, (LPSTR)item_name, sizeof(item_name), + wxChar item_name[200]; + DdeQueryString(DDEIdInst, hsz2, (LPTSTR)item_name, WXSIZEOF(item_name), CP_WINANSI); DWORD len = DdeGetData(hData, (LPBYTE)(connection->m_bufPtr), connection->m_bufSize, 0); @@ -717,7 +717,7 @@ DWORD /* lData2 */) // Atom table stuff static HSZ DDEAddAtom(const wxString& string) { - HSZ atom = DdeCreateStringHandle(DDEIdInst, (char*) (const char *)string, CP_WINANSI); + HSZ atom = DdeCreateStringHandle(DDEIdInst, WXSTRINGCAST string, CP_WINANSI); wxAtomTable.Append(string, (wxObject *)atom); return atom; } @@ -736,68 +736,68 @@ static HSZ DDEGetAtom(const wxString& string) void DDEPrintError(void) { - char *err = NULL; + wxChar *err = NULL; switch (DdeGetLastError(DDEIdInst)) { case DMLERR_ADVACKTIMEOUT: - err = "A request for a synchronous advise transaction has timed out."; + err = _T("A request for a synchronous advise transaction has timed out."); break; case DMLERR_BUSY: - err = "The response to the transaction caused the DDE_FBUSY bit to be set."; + err = _T("The response to the transaction caused the DDE_FBUSY bit to be set."); break; case DMLERR_DATAACKTIMEOUT: - err = "A request for a synchronous data transaction has timed out."; + err = _T("A request for a synchronous data transaction has timed out."); break; case DMLERR_DLL_NOT_INITIALIZED: - err = "A DDEML function was called without first calling the DdeInitialize function,\n\ror an invalid instance identifier\n\rwas passed to a DDEML function."; + err = _T("A DDEML function was called without first calling the DdeInitialize function,\n\ror an invalid instance identifier\n\rwas passed to a DDEML function."); break; case DMLERR_DLL_USAGE: - err = "An application initialized as APPCLASS_MONITOR has\n\rattempted to perform a DDE transaction,\n\ror an application initialized as APPCMD_CLIENTONLY has \n\rattempted to perform server transactions."; + err = _T("An application initialized as APPCLASS_MONITOR has\n\rattempted to perform a DDE transaction,\n\ror an application initialized as APPCMD_CLIENTONLY has \n\rattempted to perform server transactions."); break; case DMLERR_EXECACKTIMEOUT: - err = "A request for a synchronous execute transaction has timed out."; + err = _T("A request for a synchronous execute transaction has timed out."); break; case DMLERR_INVALIDPARAMETER: - err = "A parameter failed to be validated by the DDEML."; + err = _T("A parameter failed to be validated by the DDEML."); break; case DMLERR_LOW_MEMORY: - err = "A DDEML application has created a prolonged race condition."; + err = _T("A DDEML application has created a prolonged race condition."); break; case DMLERR_MEMORY_ERROR: - err = "A memory allocation failed."; + err = _T("A memory allocation failed."); break; case DMLERR_NO_CONV_ESTABLISHED: - err = "A client's attempt to establish a conversation has failed."; + err = _T("A client's attempt to establish a conversation has failed."); break; case DMLERR_NOTPROCESSED: - err = "A transaction failed."; + err = _T("A transaction failed."); break; case DMLERR_POKEACKTIMEOUT: - err = "A request for a synchronous poke transaction has timed out."; + err = _T("A request for a synchronous poke transaction has timed out."); break; case DMLERR_POSTMSG_FAILED: - err = "An internal call to the PostMessage function has failed. "; + err = _T("An internal call to the PostMessage function has failed. "); break; case DMLERR_REENTRANCY: - err = "Reentrancy problem."; + err = _T("Reentrancy problem."); break; case DMLERR_SERVER_DIED: - err = "A server-side transaction was attempted on a conversation\n\rthat was terminated by the client, or the server\n\rterminated before completing a transaction."; + err = _T("A server-side transaction was attempted on a conversation\n\rthat was terminated by the client, or the server\n\rterminated before completing a transaction."); break; case DMLERR_SYS_ERROR: - err = "An internal error has occurred in the DDEML."; + err = _T("An internal error has occurred in the DDEML."); break; case DMLERR_UNADVACKTIMEOUT: - err = "A request to end an advise transaction has timed out."; + err = _T("A request to end an advise transaction has timed out."); break; case DMLERR_UNFOUND_QUEUE_ID: - err = "An invalid transaction identifier was passed to a DDEML function.\n\rOnce the application has returned from an XTYP_XACT_COMPLETE callback,\n\rthe transaction identifier for that callback is no longer valid."; + err = _T("An invalid transaction identifier was passed to a DDEML function.\n\rOnce the application has returned from an XTYP_XACT_COMPLETE callback,\n\rthe transaction identifier for that callback is no longer valid."); break; default: - err = "Unrecognised error type."; + err = _T("Unrecognised error type."); break; } - MessageBox((HWND) NULL, (LPCSTR)err, "DDE Error", MB_OK | MB_ICONINFORMATION); + MessageBox((HWND) NULL, (LPCTSTR)err, _T("DDE Error"), MB_OK | MB_ICONINFORMATION); } #endif diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index e73db1485f..7870d6aebe 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -122,13 +122,13 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id, // Allows creation of dialogs with & without captions under MSWindows, // resizeable or not (but a resizeable dialog always has caption - // otherwise it would look too strange) - const char *dlg; + const wxChar *dlg; if ( style & wxTHICK_FRAME ) - dlg = "wxResizeableDialog"; + dlg = _T("wxResizeableDialog"); else if ( style & wxCAPTION ) - dlg = "wxCaptionDialog"; + dlg = _T("wxCaptionDialog"); else - dlg = "wxNoCaptionDialog"; + dlg = _T("wxNoCaptionDialog"); MSWCreate(m_windowId, parent, NULL, this, NULL, x, y, width, height, 0, // style is not used if we have dlg template @@ -480,7 +480,7 @@ bool wxDialog::Show(bool show) void wxDialog::SetTitle(const wxString& title) { - SetWindowText((HWND) GetHWND(), (const char *)title); + SetWindowText((HWND) GetHWND(), title.c_str()); } wxString wxDialog::GetTitle() const diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 73c68707c8..7a6a51e01f 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -426,7 +426,7 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) BITMAPFILEHEADER bf; WORD nNumColors; BOOL result = FALSE; - char str[128]; + wxChar str[128]; WORD offBits; HDC hDC; BOOL bCoreHead = FALSE; @@ -436,8 +436,8 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) fh = OpenFile (lpFileName, &of, OF_READ); if (fh == -1) { - wsprintf(str,"Can't open file '%s'", lpFileName); - MessageBox(NULL, str, "Error", MB_ICONSTOP | MB_OK); + wsprintf(str,_T("Can't open file '%s'"), lpFileName); + MessageBox(NULL, str, _T("Error"), MB_ICONSTOP | MB_OK); return (0); } diff --git a/src/msw/dibutils.cpp b/src/msw/dibutils.cpp index 3acbd1fbea..c14fc71762 100644 --- a/src/msw/dibutils.cpp +++ b/src/msw/dibutils.cpp @@ -125,12 +125,12 @@ void ClearSystemPalette(void) * bits.... */ -int DibWriteFile(LPSTR szFile, LPBITMAPINFOHEADER lpbi) +int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi) { HFILE fh; OFSTRUCT of; - fh = OpenFile(szFile, &of, OF_WRITE | OF_CREATE); + fh = OpenFile(wxConvFile.cWX2MB(szFile), &of, OF_WRITE | OF_CREATE); if (!fh) { // printf("la regamos0"); @@ -166,7 +166,7 @@ int DibWriteFile(LPSTR szFile, LPBITMAPINFOHEADER lpbi) return 1; } -PDIB DibOpenFile(LPSTR szFile) +PDIB DibOpenFile(LPTSTR szFile) { HFILE fh; DWORD dwLen; @@ -181,7 +181,7 @@ PDIB DibOpenFile(LPSTR szFile) #define GetCurrentInstance() (HINSTANCE)SELECTOROF((LPVOID)&of) #endif - fh = OpenFile(szFile, &of, OF_READ); + fh = OpenFile(wxConvFile.cWX2MB(szFile), &of, OF_READ); if (fh == -1) { @@ -190,6 +190,8 @@ PDIB DibOpenFile(LPSTR szFile) // TODO: Unicode version #ifdef __WIN16__ h = FindResource(GetCurrentInstance(), szFile, RT_BITMAP); +#elif wxUSE_UNICODE + h = FindResourceW(GetCurrentInstance(), szFile, RT_BITMAP); #else h = FindResourceA(GetCurrentInstance(), szFile, RT_BITMAP); #endif diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index ecfac092c5..80b5e4dbb4 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -94,10 +94,11 @@ int wxDirDialog::ShowModal(void) */ // Fill in the BROWSEINFO structure. + wxWX2MBbuf message = m_message.mb_str(); bi.hwndOwner = hWnd; bi.pidlRoot = NULL; // pidlPrograms; bi.pszDisplayName = lpBuffer; - bi.lpszTitle = (LPCTSTR) (const char *) m_message; + bi.lpszTitle = (const char*)message; // BC++ 4.52 says LPSTR, not LPTSTR? bi.ulFlags = 0; bi.lpfn = NULL; bi.lParam = 0; diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 1aeb326354..f2b7231c4d 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -46,11 +46,11 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog) #endif -wxString wxFileSelector(const char *title, - const char *defaultDir, - const char *defaultFileName, - const char *defaultExtension, - const char *filter, +wxString wxFileSelector(const wxChar *title, + const wxChar *defaultDir, + const wxChar *defaultFileName, + const wxChar *defaultExtension, + const wxChar *filter, int flags, wxWindow *parent, int x, int y) @@ -69,7 +69,7 @@ wxString wxFileSelector(const char *title, wxString filter2; if ( defaultExtension && !filter ) - filter2 = wxString("*.") + defaultExtension; + filter2 = wxString(_T("*.")) + defaultExtension; else if ( filter ) filter2 = filter; @@ -84,14 +84,14 @@ wxString wxFileSelector(const char *title, wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y)); - if( Strlen(defaultExtension) != 0 ) + if( wxStrlen(defaultExtension) != 0 ) { int filterFind = 1, filterIndex = 0; for( unsigned int i = 0; i < filter2.Len(); i++ ) { - if( filter2.GetChar(i) == '|' ) + if( filter2.GetChar(i) == _T('|') ) { // save the start index of the new filter unsigned int is = i++; @@ -100,7 +100,7 @@ wxString wxFileSelector(const char *title, // find the end of the filter for( ; i < filter2.Len(); i++ ) { - if(filter2[i] == '|') + if(filter2[i] == _T('|')) break; } @@ -121,7 +121,7 @@ wxString wxFileSelector(const char *title, if ( fileDialog.ShowModal() == wxID_OK ) { - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); + wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath()); return wxBuffer; } else @@ -149,24 +149,24 @@ wxString wxFileSelector(const char *title, # endif -wxString wxFileSelectorEx(const char *title, - const char *defaultDir, - const char *defaultFileName, +wxString wxFileSelectorEx(const wxChar *title, + const wxChar *defaultDir, + const wxChar *defaultFileName, int* defaultFilterIndex, - const char *filter, + const wxChar *filter, int flags, wxWindow* parent, int x, int y) { - wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "", - defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y)); + wxFileDialog fileDialog(parent, title ? title : _T(""), defaultDir ? defaultDir : _T(""), + defaultFileName ? defaultFileName : _T(""), filter ? filter : _T(""), flags, wxPoint(x, y)); if ( fileDialog.ShowModal() == wxID_OK ) { *defaultFilterIndex = fileDialog.GetFilterIndex(); - strcpy(wxBuffer, (const char *)fileDialog.GetPath()); + wxStrcpy(wxBuffer, (const wxChar *)fileDialog.GetPath()); return wxBuffer; } else @@ -180,7 +180,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, m_message = message; m_dialogStyle = style; m_parent = parent; - m_path = ""; + m_path = _T(""); m_fileName = defaultFileName; m_dir = defaultDir; m_wildCard = wildCard; @@ -192,11 +192,11 @@ int wxFileDialog::ShowModal(void) HWND hWnd = 0; if (m_parent) hWnd = (HWND) m_parent->GetHWND(); - static char fileNameBuffer [ MAXPATH ]; // the file-name - char titleBuffer [ MAXFILE+1+MAXEXT ]; // the file-name, without path + static wxChar fileNameBuffer [ MAXPATH ]; // the file-name + wxChar titleBuffer [ MAXFILE+1+MAXEXT ]; // the file-name, without path - *fileNameBuffer = '\0'; - *titleBuffer = '\0'; + *fileNameBuffer = _T('\0'); + *titleBuffer = _T('\0'); long msw_flags = 0; if ( (m_dialogStyle & wxHIDE_READONLY) || (m_dialogStyle & wxSAVE) ) @@ -216,7 +216,7 @@ int wxFileDialog::ShowModal(void) of.lStructSize = sizeof(OPENFILENAME); of.hwndOwner = hWnd; - of.lpstrTitle = (char *)(const char *)m_message; + of.lpstrTitle = WXSTRINGCAST m_message; of.lpstrFileTitle = titleBuffer; @@ -227,10 +227,10 @@ int wxFileDialog::ShowModal(void) size_t i = 0; size_t len = m_dir.Length(); for (i = 0; i < len; i++) - if (m_dir[i] == '/') - m_dir[i] = '\\'; + if (m_dir[i] == _T('/')) + m_dir[i] = _T('\\'); - of.lpstrInitialDir = (const char *) m_dir; + of.lpstrInitialDir = m_dir.c_str(); of.Flags = msw_flags; @@ -249,13 +249,13 @@ int wxFileDialog::ShowModal(void) //======================================================================= wxString theFilter; - if ( Strlen(m_wildCard) == 0 ) - theFilter = wxString("*.*"); + if ( wxStrlen(m_wildCard) == 0 ) + theFilter = wxString(_T("*.*")); else theFilter = m_wildCard ; wxString filterBuffer; - if ( !strchr( theFilter, '|' ) ) { // only one filter ==> default text + if ( !wxStrchr( theFilter, _T('|') ) ) { // only one filter ==> default text filterBuffer.Printf(_("Files (%s)|%s"), theFilter.c_str(), theFilter.c_str()); } @@ -264,21 +264,21 @@ int wxFileDialog::ShowModal(void) } - filterBuffer += "|"; + filterBuffer += _T("|"); // Replace | with \0 for (i = 0; i < filterBuffer.Len(); i++ ) { - if ( filterBuffer.GetChar(i) == '|' ) { - filterBuffer[i] = '\0'; + if ( filterBuffer.GetChar(i) == _T('|') ) { + filterBuffer[i] = _T('\0'); } } - of.lpstrFilter = (LPSTR)(const char *)filterBuffer; + of.lpstrFilter = (LPTSTR)(const wxChar *)filterBuffer; of.nFilterIndex = m_filterIndex; //=== Setting defaultFileName >>========================================= - strncpy( fileNameBuffer, (const char *)m_fileName, MAXPATH-1 ); - fileNameBuffer[ MAXPATH-1 ] = '\0'; + wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, MAXPATH-1 ); + fileNameBuffer[ MAXPATH-1 ] = _T('\0'); of.lpstrFile = fileNameBuffer; // holds returned filename of.nMaxFile = MAXPATH; @@ -290,13 +290,13 @@ int wxFileDialog::ShowModal(void) if ( success ) { - const char* extension = NULL; + const wxChar* extension = NULL; //=== Adding the correct extension >>================================= m_filterIndex = (int)of.nFilterIndex; - if ( of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != '.' ) + if ( of.nFileExtension && fileNameBuffer[ of.nFileExtension-1] != _T('.') ) { // user has typed an filename // without an extension: @@ -304,22 +304,22 @@ int wxFileDialog::ShowModal(void) extension = filterBuffer; for( int i = 0; i < maxFilter; i++ ) { // get extension - extension = extension + strlen( extension ) +1; + extension = extension + wxStrlen( extension ) +1; } - extension = strrchr( extension, '.' ); + extension = wxStrrchr( extension, _T('.') ); if ( extension // != "blabla" - && !strrchr( extension, '*' ) // != "blabla.*" - && !strrchr( extension, '?' ) // != "blabla.?" + && !wxStrrchr( extension, _T('*') ) // != "blabla.*" + && !wxStrrchr( extension, _T('?') ) // != "blabla.?" && extension[1] // != "blabla." - && extension[1] != ' ' ) // != "blabla. " + && extension[1] != _T(' ') ) // != "blabla. " { // now concat extension to the fileName: m_fileName = wxString(fileNameBuffer) + extension; - int len = strlen( fileNameBuffer ); - strncpy( fileNameBuffer + len, extension, MAXPATH - len ); - fileNameBuffer[ MAXPATH -1 ] = '\0'; + int len = wxStrlen( fileNameBuffer ); + wxStrncpy( fileNameBuffer + len, extension, MAXPATH - len ); + fileNameBuffer[ MAXPATH -1 ] = _T('\0'); } } @@ -350,38 +350,40 @@ int wxFileDialog::ShowModal(void) // Generic file load/save dialog (for internal use only) static wxString wxDefaultFileSelector(bool load, - const char *what, - const char *extension, - const char *default_name, + const wxChar *what, + const wxChar *extension, + const wxChar *default_name, wxWindow *parent) { wxString prompt; - wxString str = load ? _("Load %s file") : _("Save %s file"); + wxString str; + if (load) str = _("Load %s file"); + else str = _("Save %s file"); prompt.Printf(str, what); - const char *ext = extension; - if (*ext == '.') + const wxChar *ext = extension; + if (*ext == _T('.')) ext++; wxString wild; - wild.Printf("*.%s", ext); + wild.Printf(_T("*.%s"), ext); return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent); } // Generic file load dialog -WXDLLEXPORT wxString wxLoadFileSelector(const char *what, - const char *extension, - const char *default_name, +WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what, + const wxChar *extension, + const wxChar *default_name, wxWindow *parent) { return wxDefaultFileSelector(TRUE, what, extension, default_name, parent); } // Generic file save dialog -WXDLLEXPORT wxString wxSaveFileSelector(const char *what, - const char *extension, - const char *default_name, +WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what, + const wxChar *extension, + const wxChar *default_name, wxWindow *parent) { return wxDefaultFileSelector(FALSE, what, extension, default_name, parent); diff --git a/src/msw/font.cpp b/src/msw/font.cpp index d6c84ee3b6..a953351bae 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -158,9 +158,9 @@ bool wxFont::RealizeResource(void) else if (M_FONTDATA->m_weight == wxBOLD) ff_weight = FW_BOLD; - const char* pzFace = (const char*) ff_face; + const wxChar* pzFace = (const wxChar*) ff_face; if (!M_FONTDATA->m_faceName.IsNull()) - pzFace = (const char*) M_FONTDATA->m_faceName ; + pzFace = (const wxChar*) M_FONTDATA->m_faceName ; /* Always calculate fonts using the screen DC (is this the best strategy?) * There may be confusion if a font is selected into a printer diff --git a/src/msw/fontdlg.cpp b/src/msw/fontdlg.cpp index 90886ed197..c68ffd6d2e 100644 --- a/src/msw/fontdlg.cpp +++ b/src/msw/fontdlg.cpp @@ -199,7 +199,7 @@ void wxFillLogFont(LOGFONT *logFont, wxFont *font) logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS; logFont->lfQuality = PROOF_QUALITY; logFont->lfPitchAndFamily = DEFAULT_PITCH | ff_family; - strcpy(logFont->lfFaceName, ff_face); + wxStrcpy(logFont->lfFaceName, ff_face); } wxFont wxCreateFontFromLogFont(LOGFONT *logFont) // , bool createNew) @@ -209,7 +209,7 @@ wxFont wxCreateFontFromLogFont(LOGFONT *logFont) // , bool createNew) int fontWeight = wxNORMAL; int fontPoints = 10; bool fontUnderline = FALSE; - char *fontFace = NULL; + wxChar *fontFace = NULL; // int lfFamily = logFont->lfPitchAndFamily & 0xF0; int lfFamily = logFont->lfPitchAndFamily; diff --git a/src/msw/frame.cpp b/src/msw/frame.cpp index c71be7552c..48d39d7495 100644 --- a/src/msw/frame.cpp +++ b/src/msw/frame.cpp @@ -43,7 +43,7 @@ extern wxWindowList wxModelessWindows; extern wxList WXDLLEXPORT wxPendingDelete; -extern char wxFrameClassName[]; +extern wxChar wxFrameClassName[]; extern wxMenu *wxCurrentPopupMenu; #if !USE_SHARED_LIBRARY @@ -384,7 +384,7 @@ wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id, { // VZ: calling CreateStatusBar twice is an error - why anyone would do it? wxCHECK_MSG( m_frameStatusBar == NULL, FALSE, - "recreating status bar in wxFrame" ); + _T("recreating status bar in wxFrame") ); m_frameStatusBar = OnCreateStatusBar(number, style, id, name); @@ -399,14 +399,14 @@ wxStatusBar* wxFrame::CreateStatusBar(int number, long style, wxWindowID id, void wxFrame::SetStatusText(const wxString& text, int number) { - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set text for" ); + wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set text for") ); m_frameStatusBar->SetStatusText(text, number); } void wxFrame::SetStatusWidths(int n, const int widths_field[]) { - wxCHECK_RET( m_frameStatusBar != NULL, "no statusbar to set widths for" ); + wxCHECK_RET( m_frameStatusBar != NULL, _T("no statusbar to set widths for") ); m_frameStatusBar->SetStatusWidths(n, widths_field); PositionStatusBar(); @@ -441,7 +441,7 @@ void wxFrame::SetMenuBar(wxMenuBar *menu_bar) return; } - wxCHECK_RET( !menu_bar->GetFrame(), "this menubar is already attached" ); + wxCHECK_RET( !menu_bar->GetFrame(), _T("this menubar is already attached") ); if (m_frameMenuBar) delete m_frameMenuBar; @@ -487,7 +487,7 @@ void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event) * */ -bool wxFrame::MSWCreate(int id, wxWindow *parent, const char *wclass, wxWindow *wx_win, const char *title, +bool wxFrame::MSWCreate(int id, wxWindow *parent, const wxChar *wclass, wxWindow *wx_win, const wxChar *title, int x, int y, int width, int height, long style) { @@ -732,7 +732,7 @@ void wxFrame::ClientToScreen(int *x, int *y) const wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name) { wxCHECK_MSG( m_frameToolBar == NULL, FALSE, - "recreating toolbar in wxFrame" ); + _T("recreating toolbar in wxFrame") ); wxToolBar* toolBar = OnCreateToolBar(style, id, name); if (toolBar) diff --git a/src/msw/gaugemsw.cpp b/src/msw/gaugemsw.cpp index 97fc9b7cfb..138ac9eaf7 100644 --- a/src/msw/gaugemsw.cpp +++ b/src/msw/gaugemsw.cpp @@ -107,7 +107,7 @@ bool wxGaugeMSW::Create(wxWindow *parent, wxWindowID id, msFlags |= ZYZGS_3D; HWND wx_button = - CreateWindowEx(MakeExtendedStyle(m_windowStyle), "zYzGauge", NULL, msFlags, + CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("zYzGauge"), NULL, msFlags, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); @@ -674,7 +674,7 @@ void FAR PASCAL Draw3DLine(HDC hdc, WORD x, WORD y, WORD nLen, /* static global variables */ -static char gszzYzGaugeClass[] = "zYzGauge"; +static wxChar gszzYzGaugeClass[] = _T("zYzGauge"); /* window word position definitions */ @@ -786,7 +786,7 @@ BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance) /* Get a DC to determine whether device is mono or not, and set * default foreground/background colors as appropriate. */ - if ((hdc = CreateIC("DISPLAY", NULL, NULL, 0L))) + if ((hdc = CreateIC(_T("DISPLAY"), NULL, NULL, 0L))) { /* check for mono-display */ if ((GetDeviceCaps(hdc, BITSPIXEL) == 1) && @@ -849,7 +849,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc) DWORD dwExtent; RECT rc1, rc2; HFONT hFont; - char ach[ 6 ]; + wxChar ach[ 6 ]; WORD dx, dy, wGomerX, wGomerY; /* Win32s has no GetTextExtent(); let's try GetTextExtentPoint() instead, * which needs a SIZE* parameter */ @@ -940,7 +940,7 @@ static void PASCAL gaugePaint(HWND hwnd, HDC hdc) hFont = (HFONT) SelectObject(hdc, pgauge->hFont); /* build up a string to blit out--ie the meaning of life: "42%" */ - wsprintf(ach, "%3d%%", (WORD)((DWORD)iPos * 100 / iRange)); + wsprintf(ach, _T("%3d%%"), (WORD)((DWORD)iPos * 100 / iRange)); /* Win32s has no GetTextExtent(); let's try GetTextExtentPoint() instead */ #if defined(__WIN32__) GetTextExtentPoint(hdc, ach, wGomerX = lstrlen(ach), &size); diff --git a/src/msw/helpwin.cpp b/src/msw/helpwin.cpp index eb74f4960c..f5d4860472 100644 --- a/src/msw/helpwin.cpp +++ b/src/msw/helpwin.cpp @@ -68,19 +68,19 @@ bool wxWinHelpController::LoadFile(const wxString& file) bool wxWinHelpController::DisplayContents(void) { - if (m_helpFile == "") return FALSE; + if (m_helpFile == _T("")) return FALSE; wxString str = m_helpFile; size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.')) - str += ".hlp"; + if (!(str[(size_t)(len-1)] == _T('p') && str[(size_t)(len-2)] == _T('l') && str[(size_t)(len-3)] == _T('h') && str[(size_t)(len-4)] == _T('.'))) + str += _T(".hlp"); if (wxTheApp->GetTopWindow()) { #if defined(__WIN95__) - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_FINDER, 0L); + WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_FINDER, 0L); #else - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_CONTENTS, 0L); + WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTENTS, 0L); #endif return TRUE; } @@ -90,16 +90,16 @@ bool wxWinHelpController::DisplayContents(void) bool wxWinHelpController::DisplaySection(int section) { // Use context number - if (m_helpFile == "") return FALSE; + if (m_helpFile == _T("")) return FALSE; wxString str = m_helpFile; size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.')) - str += ".hlp"; + if (!(str[(size_t)(len-1)] == _T('p') && str[(size_t)(len-2)] == _T('l') && str[(size_t)(len-3)] == _T('h') && str[(size_t)(len-4)] == _T('.'))) + str += _T(".hlp"); if (wxTheApp->GetTopWindow()) { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_CONTEXT, (DWORD)section); + WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)section); return TRUE; } return FALSE; @@ -108,16 +108,16 @@ bool wxWinHelpController::DisplaySection(int section) bool wxWinHelpController::DisplayBlock(long block) { // Use context number -- a very rough equivalent to block id! - if (m_helpFile == "") return FALSE; + if (m_helpFile == _T("")) return FALSE; wxString str = m_helpFile; size_t len = str.Length(); if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.')) - str += ".hlp"; + str += _T(".hlp"); if (wxTheApp->GetTopWindow()) { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_CONTEXT, (DWORD)block); + WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_CONTEXT, (DWORD)block); return TRUE; } return FALSE; @@ -125,16 +125,16 @@ bool wxWinHelpController::DisplayBlock(long block) bool wxWinHelpController::KeywordSearch(const wxString& k) { - if (m_helpFile == "") return FALSE; + if (m_helpFile == _T("")) return FALSE; wxString str = m_helpFile; size_t len = str.Length(); - if (!(str[(size_t)(len-1)] == 'p' && str[(size_t)(len-2)] == 'l' && str[(size_t)(len-3)] == 'h' && str[(size_t)(len-4)] == '.')) - str += ".hlp"; + if (!(str[(size_t)(len-1)] == _T('p') && str[(size_t)(len-2)] == _T('l') && str[(size_t)(len-3)] == _T('h') && str[(size_t)(len-4)] == _T('.'))) + str += _T(".hlp"); if (wxTheApp->GetTopWindow()) { - WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const char*) str, HELP_PARTIALKEY, (DWORD)(const char*) k); + WinHelp((HWND) wxTheApp->GetTopWindow()->GetHWND(), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k); return TRUE; } return FALSE; diff --git a/src/msw/icon.cpp b/src/msw/icon.cpp index 36ce690043..a788d29ed1 100644 --- a/src/msw/icon.cpp +++ b/src/msw/icon.cpp @@ -119,7 +119,7 @@ bool wxICOFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla { wxIcon *icon = (wxIcon *)bitmap; wxIconRefData *data = (wxIconRefData *)icon->GetRefData(); - data->m_hIcon = (WXHICON)ReadIconFile((char *)name.c_str(), wxGetInstance(), + data->m_hIcon = (WXHICON)ReadIconFile((wxChar *)name.c_str(), wxGetInstance(), &data->m_width, &data->m_height); data->m_ok = data->m_hIcon != 0; diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 869a9116b5..6ef3532c9f 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -130,7 +130,7 @@ bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) event.m_commandInt = aSelections[0] ; event.m_clientData = GetClientData(event.m_commandInt); wxString str(GetString(event.m_commandInt)); - if (str != "") + if (str != _T("")) { event.m_commandString = str; } @@ -229,13 +229,13 @@ bool wxListBox::Create(wxWindow *parent, wstyle |= WS_BORDER; } - m_hWnd = (WXHWND)::CreateWindowEx(exStyle, "LISTBOX", NULL, + m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("LISTBOX"), NULL, wstyle | WS_CHILD, 0, 0, 0, 0, (HWND)parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create listbox" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create listbox") ); #if wxUSE_CTL3D if (want3D) @@ -284,7 +284,7 @@ void wxListBox::SetupColours() void wxListBox::SetFirstItem(int N) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::SetFirstItem" ); + _T("invalid index in wxListBox::SetFirstItem") ); SendMessage(GetHwnd(),LB_SETTOPINDEX,(WPARAM)N,(LPARAM)0) ; } @@ -300,7 +300,7 @@ void wxListBox::SetFirstItem(const wxString& s) void wxListBox::Delete(int N) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::Delete" ); + _T("invalid index in wxListBox::Delete") ); SendMessage(GetHwnd(), LB_DELETESTRING, N, 0); m_noItems--; @@ -334,7 +334,7 @@ void wxListBox::Append(const wxString& item, void *Client_data) if ( m_windowStyle & wxLB_OWNERDRAW ) { // client data must be pointer to wxOwnerDrawn, otherwise we would crash // in OnMeasure/OnDraw. - wxFAIL_MSG("Can't use client data with owner-drawn listboxes"); + wxFAIL_MSG(_T("Can't use client data with owner-drawn listboxes")); } else #endif @@ -374,7 +374,7 @@ void wxListBox::Set(int n, const wxString *choices, void** clientData) ListBox_SetItemData(GetHwnd(), ui, pNewItem); wxASSERT_MSG(clientData[ui] == NULL, - "Can't use client data with owner-drawn listboxes"); + _T("Can't use client data with owner-drawn listboxes")); } } #endif @@ -412,7 +412,7 @@ void wxListBox::Clear() void wxListBox::SetSelection(int N, bool select) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::SetSelection" ); + _T("invalid index in wxListBox::SetSelection") ); if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED)) SendMessage(GetHwnd(), LB_SETSEL, select, N); @@ -428,7 +428,7 @@ void wxListBox::SetSelection(int N, bool select) bool wxListBox::Selected(int N) const { wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE, - "invalid index in wxListBox::Selected" ); + _T("invalid index in wxListBox::Selected") ); return SendMessage(GetHwnd(), LB_GETSEL, N, 0) == 0 ? FALSE : TRUE; } @@ -436,7 +436,7 @@ bool wxListBox::Selected(int N) const void wxListBox::Deselect(int N) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::Deselect" ); + _T("invalid index in wxListBox::Deselect") ); if ((m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED)) SendMessage(GetHwnd(), LB_SETSEL, FALSE, N); @@ -445,18 +445,18 @@ void wxListBox::Deselect(int N) void *wxListBox::GetClientData(int N) const { wxCHECK_MSG( N >= 0 && N < m_noItems, NULL, - "invalid index in wxListBox::GetClientData" ); + _T("invalid index in wxListBox::GetClientData") ); - return (char *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0); + return (void *)SendMessage(GetHwnd(), LB_GETITEMDATA, N, 0); } void wxListBox::SetClientData(int N, void *Client_data) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::SetClientData" ); + _T("invalid index in wxListBox::SetClientData") ); if ( ListBox_SetItemData(GetHwnd(), N, Client_data) == LB_ERR ) - wxLogDebug("LB_SETITEMDATA failed"); + wxLogDebug(_T("LB_SETITEMDATA failed")); } // Return number of selections and an array of selected integers @@ -470,7 +470,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const if (no_sel != 0) { int *selections = new int[no_sel]; if ( ListBox_GetSelItems(GetHwnd(), no_sel, selections) == LB_ERR ) { - wxFAIL_MSG("This listbox can't have single-selection style!"); + wxFAIL_MSG(_T("This listbox can't have single-selection style!")); } aSelections.Alloc(no_sel); @@ -496,8 +496,8 @@ int wxListBox::GetSelection() const wxCHECK_MSG( !(m_windowStyle & wxLB_MULTIPLE) && !(m_windowStyle & wxLB_EXTENDED), -1, - "GetSelection() can't be used with multiple-selection " - "listboxes, use GetSelections() instead." ); + _T("GetSelection() can't be used with multiple-selection " + "listboxes, use GetSelections() instead.") ); return ListBox_GetCurSel(GetHwnd()); } @@ -506,7 +506,7 @@ int wxListBox::GetSelection() const wxString wxListBox::GetString(int N) const { wxCHECK_MSG( N >= 0 && N < m_noItems, "", - "invalid index in wxListBox::GetClientData" ); + _T("invalid index in wxListBox::GetClientData") ); int len = ListBox_GetTextLen(GetHwnd(), N); @@ -585,7 +585,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s) return; TEXTMETRIC lpTextMetric; - if (s != "") + if (s != _T("")) { int existingExtent = (int)SendMessage(GetHwnd(), LB_GETHORIZONTALEXTENT, 0, 0L); HDC dc = GetWindowDC(GetHwnd()); @@ -595,7 +595,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s) GetTextMetrics(dc, &lpTextMetric); SIZE extentXY; - ::GetTextExtentPoint(dc, (LPSTR) (const char *)s, s.Length(), &extentXY); + ::GetTextExtentPoint(dc, (LPTSTR) (const wxChar *)s, s.Length(), &extentXY); int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth); if (oldFont) @@ -621,7 +621,7 @@ void wxListBox::SetHorizontalExtent(const wxString& s) int len = (int)SendMessage(GetHwnd(), LB_GETTEXT, i, (LONG)wxBuffer); wxBuffer[len] = 0; SIZE extentXY; - ::GetTextExtentPoint(dc, (LPSTR)wxBuffer, len, &extentXY); + ::GetTextExtentPoint(dc, (LPTSTR)wxBuffer, len, &extentXY); int extentX = (int)(extentXY.cx + lpTextMetric.tmAveCharWidth); if (extentX > largestExtent) largestExtent = extentX; @@ -638,20 +638,20 @@ void wxListBox::InsertItems(int nItems, const wxString items[], int pos) { wxCHECK_RET( pos >= 0 && pos <= m_noItems, - "invalid index in wxListBox::InsertItems" ); + _T("invalid index in wxListBox::InsertItems") ); int i; for (i = 0; i < nItems; i++) ListBox_InsertString(GetHwnd(), i + pos, items[i]); m_noItems += nItems; - SetHorizontalExtent(""); + SetHorizontalExtent(_T("")); } void wxListBox::SetString(int N, const wxString& s) { wxCHECK_RET( N >= 0 && N < m_noItems, - "invalid index in wxListBox::SetString" ); + _T("invalid index in wxListBox::SetString") ); int sel = -1; if (!(m_windowStyle & wxLB_MULTIPLE) && !(m_windowStyle & wxLB_EXTENDED)) @@ -665,7 +665,7 @@ void wxListBox::SetString(int N, const wxString& s) if (N == (m_noItems - 1)) newN = -1; - SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const char *)s); + SendMessage(GetHwnd(), LB_INSERTSTRING, newN, (LPARAM) (const wxChar *)s); if (oldData) wxListBox::SetClientData(N, oldData); @@ -779,7 +779,7 @@ bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) MEASUREITEMSTRUCT *pStruct = (MEASUREITEMSTRUCT *)item; wxDC dc; - dc.SetHDC((WXHDC)CreateIC("DISPLAY", NULL, NULL, 0)); + dc.SetHDC((WXHDC)CreateIC(_T("DISPLAY"), NULL, NULL, 0)); dc.SetFont(wxSystemSettings::GetSystemFont(wxSYS_ANSI_VAR_FONT)); pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE; diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 242f9dfab9..a8a91ee309 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -115,7 +115,7 @@ bool wxListCtrl::Create(wxWindow *parent, // Create the ListView control. m_hWnd = (WXHWND)CreateWindowEx(exStyle, WC_LISTVIEW, - "", + _T(""), wstyle, x, y, width, height, (HWND) parent->GetHWND(), @@ -124,7 +124,7 @@ bool wxListCtrl::Create(wxWindow *parent, NULL); if ( !m_hWnd ) { - wxLogError("Can't create list control window."); + wxLogError(_T("Can't create list control window.")); return FALSE; } @@ -229,7 +229,7 @@ void wxListCtrl::RecreateWindow() WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; HWND hWndListControl = CreateWindowEx(exStyle, WC_LISTVIEW, - "", + _T(""), style, x, y, width, height, (HWND) GetParent()->GetHWND(), @@ -381,7 +381,7 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const if ( item.m_mask & wxLIST_MASK_TEXT ) { lvCol.mask |= LVCF_TEXT; - lvCol.pszText = new char[513]; + lvCol.pszText = new wxChar[513]; lvCol.cchTextMax = 512; } @@ -503,7 +503,7 @@ bool wxListCtrl::GetItem(wxListItem& info) const if ( info.m_mask & wxLIST_MASK_TEXT ) { lvItem.mask |= LVIF_TEXT; - lvItem.pszText = new char[513]; + lvItem.pszText = new wxChar[513]; lvItem.cchTextMax = 512; } else @@ -1094,7 +1094,7 @@ long wxListCtrl::InsertColumn(long col, wxListItem& item) } else { - wxLogDebug("Failed to insert the column '%s' into listview!", + wxLogDebug(_T("Failed to insert the column '%s' into listview!"), lvCol.pszText); } @@ -1297,7 +1297,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( !event.m_item.m_text.IsNull() ) { info->item.pszText = AddPool(event.m_item.m_text); - info->item.cchTextMax = strlen(info->item.pszText) + 1; + info->item.cchTextMax = wxStrlen(info->item.pszText) + 1; } } // wxConvertToMSWListItem(this, event.m_item, info->item); @@ -1308,7 +1308,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) return TRUE; } -char *wxListCtrl::AddPool(const wxString& str) +wxChar *wxListCtrl::AddPool(const wxString& str) { // Remove the first element if 3 strings exist if ( m_stringPool.Number() == 3 ) @@ -1317,8 +1317,8 @@ char *wxListCtrl::AddPool(const wxString& str) delete[] (char *)node->Data(); delete node; } - wxNode *node = m_stringPool.Add((char *) (const char *)str); - return (char *)node->Data(); + wxNode *node = m_stringPool.Add(WXSTRINGCAST str); + return (wxChar *)node->Data(); } // List item structure @@ -1356,7 +1356,7 @@ static void wxConvertFromMSWListItem(const wxListCtrl *ctrl, wxListItem& info, L if ( needText ) { - lvItem.pszText = new char[513]; + lvItem.pszText = new wxChar[513]; lvItem.cchTextMax = 512; } // lvItem.mask |= TVIF_HANDLE | TVIF_STATE | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_CHILDREN | TVIF_PARAM ; @@ -1467,7 +1467,7 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, wxListItem& info, LV_ } else { - lvItem.pszText = (char *) (const char *)info.m_text ; + lvItem.pszText = WXSTRINGCAST info.m_text ; if ( lvItem.pszText ) lvItem.cchTextMax = info.m_text.Length(); else diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 1468591234..d305041600 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -57,8 +57,8 @@ extern wxWindowList wxModelessWindows; // from dialog.cpp extern wxMenu *wxCurrentPopupMenu; -extern char wxMDIFrameClassName[]; -extern char wxMDIChildFrameClassName[]; +extern wxChar wxMDIFrameClassName[]; +extern wxChar wxMDIChildFrameClassName[]; extern wxWindow *wxWndHook; // from window.cpp extern wxList *wxWinHandleList; @@ -174,7 +174,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent, int width = size.x; int height = size.y; - m_windowMenu = (WXHMENU) ::LoadMenu(wxGetInstance(), "wxWindowMenu"); + m_windowMenu = (WXHMENU) ::LoadMenu(wxGetInstance(), _T("wxWindowMenu")); DWORD msflags = WS_OVERLAPPED; if (style & wxMINIMIZE_BOX) @@ -1084,7 +1084,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) m_hWnd = (WXHWND)::CreateWindowEx ( exStyle, - "MDICLIENT", + _T("MDICLIENT"), NULL, msStyle, 0, 0, 0, 0, @@ -1137,7 +1137,7 @@ static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) // update menu bar of the parent window wxWindow *parent = win->GetParent(); - wxCHECK_RET( parent, "MDI client without parent frame? weird..." ); + wxCHECK_RET( parent, _T("MDI client without parent frame? weird...") ); ::DrawMenuBar(GetWinHwnd(parent)); } @@ -1150,11 +1150,11 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) bool success = FALSE; for ( int i = 0; i < N; i++ ) { - char buf[256]; + wxChar buf[256]; int chars = GetMenuString(hmenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION); if ( chars == 0 ) { - wxLogLastError("GetMenuString"); + wxLogLastError(_T("GetMenuString")); continue; } @@ -1163,7 +1163,7 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) { success = TRUE; ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, - (UINT)subMenu, "&Window"); + (UINT)subMenu, _T("&Window")); break; } } diff --git a/src/msw/menu.cpp b/src/msw/menu.cpp index 94bb4a0116..b89b794879 100644 --- a/src/msw/menu.cpp +++ b/src/msw/menu.cpp @@ -144,12 +144,12 @@ void wxMenu::Break() // function appends a new item or submenu to the menu void wxMenu::Append(wxMenuItem *pItem) { - wxCHECK_RET( pItem != NULL, "can't append NULL item to the menu" ); + wxCHECK_RET( pItem != NULL, _T("can't append NULL item to the menu") ); #if wxUSE_ACCEL // check for accelerators: they are given after '\t' wxString label = pItem->GetName(); - int posTab = label.Find('\t'); + int posTab = label.Find(_T('\t')); if ( posTab != wxNOT_FOUND ) { // parse the accelerator string int keyCode = 0; @@ -189,7 +189,7 @@ void wxMenu::Append(wxMenuItem *pItem) (current.Len() == 2 || (current.Len() == 3 && isdigit(current[2U]))) ) { int n; - sscanf(current.c_str() + 1, "%d", &n); + wxSscanf(current.c_str() + 1, _T("%d"), &n); keyCode = VK_F1 + n - 1; } @@ -241,13 +241,13 @@ void wxMenu::Append(wxMenuItem *pItem) id = pItem->GetId(); } - LPCSTR pData; + LPCTSTR pData; #if wxUSE_OWNER_DRAWN if ( pItem->IsOwnerDrawn() ) { // want to get {Measure|Draw}Item messages? // item draws itself, pass pointer to it in data parameter flags |= MF_OWNERDRAW; - pData = (LPCSTR)pItem; + pData = (LPCTSTR)pItem; } else #endif @@ -274,7 +274,7 @@ void wxMenu::Append(wxMenuItem *pItem) if ( !SetMenuItemInfo(GetHMENU(), (unsigned)id, FALSE, &mii) ) { - wxLogLastError("SetMenuItemInfo"); + wxLogLastError(_T("SetMenuItemInfo")); } } #endif // __WIN32__ @@ -321,7 +321,7 @@ void wxMenu::Delete(int id) break; } - wxCHECK_RET( node, "wxMenu::Delete(): item doesn't exist" ); + wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") ); HMENU menu = GetHMENU(); @@ -374,7 +374,7 @@ size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const void wxMenu::Enable(int id, bool Flag) { wxMenuItem *item = FindItemForId(id); - wxCHECK_RET( item != NULL, "can't enable non-existing menu item" ); + wxCHECK_RET( item != NULL, _T("can't enable non-existing menu item") ); item->Enable(Flag); } @@ -382,7 +382,7 @@ void wxMenu::Enable(int id, bool Flag) bool wxMenu::IsEnabled(int id) const { wxMenuItem *item = FindItemForId(id); - wxCHECK_MSG( item != NULL, FALSE, "invalid item id" ); + wxCHECK_MSG( item != NULL, FALSE, _T("invalid item id") ); return item->IsEnabled(); } @@ -390,7 +390,7 @@ bool wxMenu::IsEnabled(int id) const void wxMenu::Check(int id, bool Flag) { wxMenuItem *item = FindItemForId(id); - wxCHECK_RET( item != NULL, "can't get status of non-existing menu item" ); + wxCHECK_RET( item != NULL, _T("can't get status of non-existing menu item") ); item->Check(Flag); } @@ -398,7 +398,7 @@ void wxMenu::Check(int id, bool Flag) bool wxMenu::IsChecked(int id) const { wxMenuItem *item = FindItemForId(id); - wxCHECK_MSG( item != NULL, FALSE, "invalid item id" ); + wxCHECK_MSG( item != NULL, FALSE, _T("invalid item id") ); return item->IsChecked(); } @@ -406,7 +406,7 @@ bool wxMenu::IsChecked(int id) const void wxMenu::SetLabel(int id, const wxString& label) { wxMenuItem *item = FindItemForId(id) ; - wxCHECK_RET( item, "wxMenu::SetLabel: no such item" ); + wxCHECK_RET( item, _T("wxMenu::SetLabel: no such item") ); item->SetName(label); } @@ -418,7 +418,7 @@ wxString wxMenu::GetLabel(int id) const if (pItem) label = pItem->GetName() ; else - wxFAIL_MSG("wxMenu::GetLabel: item doesn't exist"); + wxFAIL_MSG(_T("wxMenu::GetLabel: item doesn't exist")); return label; } @@ -429,7 +429,7 @@ void wxMenu::SetHelpString(int itemId, const wxString& helpString) if (item) item->SetHelp(helpString); else - wxFAIL_MSG("wxMenu::SetHelpString: item doesn't exist"); + wxFAIL_MSG(_T("wxMenu::SetHelpString: item doesn't exist")); } wxString wxMenu::GetHelpString (int itemId) const @@ -439,7 +439,7 @@ wxString wxMenu::GetHelpString (int itemId) const if (item) help = item->GetHelp(); else - wxFAIL_MSG("wxMenu::GetHelpString: item doesn't exist"); + wxFAIL_MSG(_T("wxMenu::GetHelpString: item doesn't exist")); return help; } @@ -463,7 +463,7 @@ void wxMenu::SetTitle(const wxString& label) (unsigned)idMenuTitle, m_title) || !InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) ) { - wxLogLastError("InsertMenu"); + wxLogLastError(_T("InsertMenu")); } } } @@ -647,7 +647,7 @@ void wxMenu::Attach(wxMenuBar *menubar) { // menu can be in at most one menubar because otherwise they would both // delete the menu pointer - wxASSERT_MSG( !m_menuBar, "menu belongs to 2 menubars, expect a crash" ); + wxASSERT_MSG( !m_menuBar, _T("menu belongs to 2 menubars, expect a crash") ); m_menuBar = menubar; m_savehMenu = m_hMenu; @@ -656,7 +656,7 @@ void wxMenu::Attach(wxMenuBar *menubar) void wxMenu::Detach() { - wxASSERT_MSG( m_menuBar, "can't detach menu if it's not attached" ); + wxASSERT_MSG( m_menuBar, _T("can't detach menu if it's not attached") ); m_hMenu = m_savehMenu; m_savehMenu = 0; @@ -719,14 +719,14 @@ wxMenuBar::~wxMenuBar() void wxMenuBar::Refresh() { - wxCHECK_RET( m_menuBarFrame, "can't refresh a menubar withotu a frame" ); + wxCHECK_RET( m_menuBarFrame, _T("can't refresh a menubar withotu a frame") ); DrawMenuBar((HWND)m_menuBarFrame->GetHWND()) ; } WXHMENU wxMenuBar::Create() { - wxCHECK_MSG( !m_hMenu, TRUE, "menubar already created" ); + wxCHECK_MSG( !m_hMenu, TRUE, _T("menubar already created") ); m_hMenu = (WXHMENU)::CreateMenu(); @@ -761,7 +761,7 @@ void wxMenuBar::Enable(int id, bool enable) wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_RET( item, "attempt to enable an item which doesn't exist" ); + wxCHECK_RET( item, _T("attempt to enable an item which doesn't exist") ); item->Enable(enable); } @@ -780,8 +780,8 @@ void wxMenuBar::Check(int id, bool check) wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_RET( item, "attempt to check an item which doesn't exist" ); - wxCHECK_RET( item->IsCheckable(), "attempt to check an uncheckable item" ); + wxCHECK_RET( item, _T("attempt to check an item which doesn't exist") ); + wxCHECK_RET( item->IsCheckable(), _T("attempt to check an uncheckable item") ); item->Check(check); } @@ -791,7 +791,7 @@ bool wxMenuBar::IsChecked(int id) const wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_MSG( item, FALSE, "wxMenuBar::IsChecked(): no such item" ); + wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsChecked(): no such item") ); int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND); @@ -803,7 +803,7 @@ bool wxMenuBar::IsEnabled(int id) const wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_MSG( item, FALSE, "wxMenuBar::IsEnabled(): no such item" ); + wxCHECK_MSG( item, FALSE, _T("wxMenuBar::IsEnabled(): no such item") ); int flag = ::GetMenuState(GetHMenuOf(itemMenu), id, MF_BYCOMMAND) ; @@ -815,7 +815,7 @@ void wxMenuBar::SetLabel(int id, const wxString& label) wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_RET( item, "wxMenuBar::SetLabel(): no such item" ); + wxCHECK_RET( item, _T("wxMenuBar::SetLabel(): no such item") ); item->SetName(label); } @@ -825,7 +825,7 @@ wxString wxMenuBar::GetLabel(int id) const wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_MSG( item, "", "wxMenuBar::GetLabel(): no such item" ); + wxCHECK_MSG( item, _T(""), _T("wxMenuBar::GetLabel(): no such item") ); return item->GetName(); } @@ -835,7 +835,7 @@ void wxMenuBar::SetHelpString (int id, const wxString& helpString) wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_RET( item, "wxMenuBar::SetHelpString(): no such item" ); + wxCHECK_RET( item, _T("wxMenuBar::SetHelpString(): no such item") ); item->SetHelp(helpString); } @@ -845,7 +845,7 @@ wxString wxMenuBar::GetHelpString (int id) const wxMenu *itemMenu = NULL; wxMenuItem *item = FindItemForId(id, &itemMenu) ; - wxCHECK_MSG( item, "", "wxMenuBar::GetHelpString(): no such item" ); + wxCHECK_MSG( item, _T(""), _T("wxMenuBar::GetHelpString(): no such item") ); return item->GetHelp(); } @@ -863,7 +863,7 @@ void wxMenuBar::SetLabelTop(int pos, const wxString& label) UINT flagsOld = ::GetMenuState((HMENU)m_hMenu, pos, MF_BYPOSITION); if ( flagsOld == 0xFFFFFFFF ) { - wxLogLastError("GetMenuState"); + wxLogLastError(_T("GetMenuState")); return; } @@ -910,7 +910,7 @@ bool wxMenuBar::OnDelete(wxMenu *a_menu, int pos) if ( ::RemoveMenu((HMENU)m_hMenu, (UINT)pos, MF_BYPOSITION) ) { // VZ: I'm not sure about what's going on here, so I leave an assert - wxASSERT_MSG( m_menus[pos] == a_menu, "what is this parameter for??" ); + wxASSERT_MSG( m_menus[pos] == a_menu, _T("what is this parameter for??") ); a_menu->Detach(); @@ -927,7 +927,7 @@ bool wxMenuBar::OnDelete(wxMenu *a_menu, int pos) return FALSE; } -bool wxMenuBar::OnAppend(wxMenu *a_menu, const char *title) +bool wxMenuBar::OnAppend(wxMenu *a_menu, const wxChar *title) { WXHMENU submenu = a_menu->GetHMenu(); if ( !submenu ) @@ -941,7 +941,7 @@ bool wxMenuBar::OnAppend(wxMenu *a_menu, const char *title) if ( !::AppendMenu(GetHMENU(), MF_POPUP | MF_STRING, (UINT)submenu, title) ) { - wxLogLastError("AppendMenu"); + wxLogLastError(_T("AppendMenu")); } Refresh(); @@ -968,7 +968,7 @@ void wxMenuBar::Append (wxMenu * menu, const wxString& title) new_menus[i] = m_menus[i]; m_menus[i] = NULL; new_titles[i] = m_titles[i]; - m_titles[i] = ""; + m_titles[i] = _T(""); } if (m_menus) { @@ -1102,7 +1102,7 @@ WXHMENU wxMenu::GetHMenu() const else if ( m_savehMenu != 0 ) return m_savehMenu; - wxFAIL_MSG("wxMenu without HMENU"); + wxFAIL_MSG(_T("wxMenu without HMENU")); return 0; } diff --git a/src/msw/menuitem.cpp b/src/msw/menuitem.cpp index fa63e469a8..76fa0af2d9 100644 --- a/src/msw/menuitem.cpp +++ b/src/msw/menuitem.cpp @@ -87,7 +87,7 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu, int id, #endif //owner drawn m_strHelp(strHelp) { - wxASSERT_MSG( pParentMenu != NULL, "a menu item should have a parent" ); + wxASSERT_MSG( pParentMenu != NULL, _T("a menu item should have a parent") ); #if wxUSE_OWNER_DRAWN // set default menu colors @@ -151,7 +151,7 @@ void wxMenuItem::Enable(bool bDoEnable) void wxMenuItem::Check(bool bDoCheck) { - wxCHECK_RET( IsCheckable(), "only checkable items may be checked" ); + wxCHECK_RET( IsCheckable(), _T("only checkable items may be checked") ); if ( m_bChecked != bDoCheck ) { long rc = CheckMenuItem(GetHMenuOf(m_pParentMenu), @@ -192,12 +192,12 @@ void wxMenuItem::SetName(const wxString& strName) flagsOld |= MF_POPUP; } - LPCSTR data; + LPCTSTR data; #if wxUSE_OWNER_DRAWN if ( IsOwnerDrawn() ) { flagsOld |= MF_OWNERDRAW; - data = (LPCSTR)this; + data = (LPCTSTR)this; } else #endif //owner drawn @@ -210,7 +210,7 @@ void wxMenuItem::SetName(const wxString& strName) MF_BYCOMMAND | flagsOld, id, data) == 0xFFFFFFFF ) { - wxLogLastError("ModifyMenu"); + wxLogLastError(_T("ModifyMenu")); } } } diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 635537b662..0d4a30f506 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -72,7 +72,7 @@ wxMetafile::wxMetafile(const wxString& file) M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC; M_METAFILEDATA->m_metafile = 0; - if (!file.IsNull() && (file.Cmp("") == 0)) + if (!file.IsNull() && (file.Cmp(_T("")) == 0)) M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file); } @@ -146,7 +146,7 @@ wxMetafileDC::wxMetafileDC(const wxString& file) if (!file.IsNull() && wxFileExists(file)) wxRemoveFile(file); - if (!file.IsNull() && (file != "")) + if (!file.IsNull() && (file != _T(""))) m_hDC = (WXHDC) CreateMetaFile(file); else m_hDC = (WXHDC) CreateMetaFile(NULL); @@ -167,7 +167,7 @@ wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, i m_minY = 10000; m_maxX = -10000; m_maxY = -10000; - if (file != "" && wxFileExists(file)) wxRemoveFile(file); + if (file != _T("") && wxFileExists(file)) wxRemoveFile(file); m_hDC = (WXHDC) CreateMetaFile(file); m_ok = TRUE; @@ -197,7 +197,7 @@ void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y, SIZE sizeRect; TEXTMETRIC tm; - GetTextExtentPoint(dc, (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect); + GetTextExtentPoint(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); GetTextMetrics(dc, &tm); ReleaseDC(NULL, dc); @@ -340,12 +340,12 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i p < (WORD *)&pMFHead ->checksum; ++p) pMFHead ->checksum ^= *p; - FILE *fd = fopen((char *)(const char *)filename, "rb"); + FILE *fd = fopen(filename.mb_str(wxConvFile), "rb"); if (!fd) return FALSE; - char tempFileBuf[256]; - wxGetTempFileName("mf", tempFileBuf); - FILE *fHandle = fopen(tempFileBuf, "wb"); + wxChar tempFileBuf[256]; + wxGetTempFileName(_T("mf"), tempFileBuf); + FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb"); if (!fHandle) return FALSE; fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle); diff --git a/src/msw/minifram.cpp b/src/msw/minifram.cpp index 67c1df931a..016e7e775a 100644 --- a/src/msw/minifram.cpp +++ b/src/msw/minifram.cpp @@ -166,13 +166,13 @@ wxMiniFrame::~wxMiniFrame(void) #define HASCAPTION( hwnd ) (TestWinStyle( hwnd, IBS_VERTCAPTION ) ||\ TestWinStyle( hwnd, IBS_HORZCAPTION )) -#define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,"ibSize",(HANDLE)i) -#define GETCAPTIONSIZE(h) (UINT)GetProp(h,"ibSize") -#define FREECAPTIONSIZE(h) RemoveProp(h,"ibSize") +#define SETCAPTIONSIZE(h,i) (UINT)SetProp(h,_T("ibSize"),(HANDLE)i) +#define GETCAPTIONSIZE(h) (UINT)GetProp(h,_T("ibSize")) +#define FREECAPTIONSIZE(h) RemoveProp(h,_T("ibSize")) -#define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,"ibFlag",(HANDLE)i) -#define GETMENUWASUPFLAG(h) (UINT)GetProp(h,"ibFlag") -#define FREEMENUWASUPFLAG(h) RemoveProp(h,"ibFlag") +#define SETMENUWASUPFLAG(h,i) (UINT)SetProp(h,_T("ibFlag"),(HANDLE)i) +#define GETMENUWASUPFLAG(h) (UINT)GetProp(h,_T("ibFlag")) +#define FREEMENUWASUPFLAG(h) RemoveProp(h,_T("ibFlag")) ///////////////////////////////////////////////////////////////////// // Little known fact: @@ -390,7 +390,7 @@ LRESULT WINAPI ibDefWindowProc( HWND hWnd, UINT uiMsg, WPARAM wParam, LPARAM lPa { // VZ: I don't know what should be here, but the vars must // be inited! - wxFAIL_MSG("don't know how to initialize cx, cy"); + wxFAIL_MSG(_T("don't know how to initialize cx, cy")); cx = cy = 0; } @@ -870,14 +870,14 @@ BOOL PASCAL DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc, if (fWin31) { HFONT hFont ; - LPSTR lpsz ; + LPTSTR lpsz ; LOGFONT lf ; TEXTMETRIC tm ; int cx ; int cy ; SIZE Size ; - lpsz = (char*)GlobalAllocPtr( GHND, ui + 2 ); + lpsz = (wxChar*)GlobalAllocPtr( GHND, (ui + 2) * sizeof(wxChar) ); if (lpsz) { UINT nBkMode ; @@ -901,7 +901,7 @@ BOOL PASCAL DrawCaption( HDC hDC, HWND hWnd, LPRECT lprc, { // Can only rotate true type fonts (well, ok, we could // try and use "modern"). - strcpy( lf.lfFaceName, "Arial" ) ; + wxStrcpy( lf.lfFaceName, _T("Arial") ) ; lf.lfPitchAndFamily = FF_SWISS | 0x04; lf.lfEscapement = 900 ; diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index 5abe1042a5..f90d620808 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -83,7 +83,7 @@ int wxMessageDialog::ShowModal(void) else msStyle |= MB_TASKMODAL; - int msAns = MessageBox(hWnd, (LPCSTR)(const char *)m_message, (LPCSTR)(const char *)m_caption, msStyle); + int msAns = MessageBox(hWnd, (LPCTSTR)(const wxChar *)m_message, (LPCTSTR)(const wxChar *)m_caption, msStyle); int ans = wxOK; switch (msAns) { diff --git a/src/msw/nativdlg.cpp b/src/msw/nativdlg.cpp index d85100a5ed..8db2ed7b57 100644 --- a/src/msw/nativdlg.cpp +++ b/src/msw/nativdlg.cpp @@ -171,7 +171,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) wxWindow* win = NULL; - if (str == "BUTTON") + if (str == _T("BUTTON")) { int style1 = (style & 0xFF); if ((style1 == BS_3STATE) || (style1 == BS_AUTO3STATE) || (style1 == BS_AUTOCHECKBOX) || @@ -188,7 +188,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) { // TODO: how to find the bitmap? win = new wxBitmapButton; - wxLogError("Have not yet implemented bitmap button as BS_BITMAP button."); + wxLogError(_T("Have not yet implemented bitmap button as BS_BITMAP button.")); } #endif else if (style1 == BS_OWNERDRAW) @@ -215,7 +215,7 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) id); } } - else if (str == "COMBOBOX") + else if (str == _T("COMBOBOX")) { win = new wxComboBox; } @@ -225,30 +225,30 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) // for correct functioning. // Could have wxWindow::AdoptAttributesFromHWND(WXHWND) // to be overridden by each control class. - else if (str == "EDIT") + else if (str == _T("EDIT")) { win = new wxTextCtrl; } - else if (str == "LISTBOX") + else if (str == _T("LISTBOX")) { win = new wxListBox; } - else if (str == "SCROLLBAR") + else if (str == _T("SCROLLBAR")) { win = new wxScrollBar; } #if defined(__WIN95__) && !defined(__TWIN32__) - else if (str == "MSCTLS_UPDOWN32") + else if (str == _T("MSCTLS_UPDOWN32")) { win = new wxSpinButton; } #endif - else if (str == "MSCTLS_TRACKBAR32") + else if (str == _T("MSCTLS_TRACKBAR32")) { // Need to ascertain if it's horiz or vert win = new wxSlider; } - else if (str == "STATIC") + else if (str == _T("STATIC")) { int style1 = (style & 0xFF); @@ -260,13 +260,13 @@ wxWindow* wxWindow::CreateWindowFromHWND(wxWindow* parent, WXHWND hWnd) win = new wxStaticBitmap; // Help! this doesn't correspond with the wxWin implementation. - wxLogError("Please make SS_BITMAP statics into owner-draw buttons."); + wxLogError(_T("Please make SS_BITMAP statics into owner-draw buttons.")); } #endif } else { - wxString msg("Don't know how to convert from Windows class "); + wxString msg(_T("Don't know how to convert from Windows class ")); msg += str; wxLogError(msg); } diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index f16fa88b61..d6c5fc5234 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -185,7 +185,7 @@ int wxNotebook::GetRowCount() const int wxNotebook::SetSelection(int nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("notebook page out of range") ); ChangePage(m_nSelection, nPage); @@ -204,20 +204,20 @@ void wxNotebook::AdvanceSelection(bool bForward) bool wxNotebook::SetPageText(int nPage, const wxString& strText) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") ); TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; - tcItem.pszText = (char *)strText.c_str(); + tcItem.pszText = (wxChar *)strText.c_str(); return TabCtrl_SetItem(m_hwnd, nPage, &tcItem) != 0; } wxString wxNotebook::GetPageText(int nPage) const { - wxCHECK_MSG( IS_VALID_PAGE(nPage), "", "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), _T(""), _T("notebook page out of range") ); - char buf[256]; + wxChar buf[256]; TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; tcItem.pszText = buf; @@ -232,7 +232,7 @@ wxString wxNotebook::GetPageText(int nPage) const int wxNotebook::GetPageImage(int nPage) const { - wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), -1, _T("notebook page out of range") ); TC_ITEM tcItem; tcItem.mask = TCIF_IMAGE; @@ -242,7 +242,7 @@ int wxNotebook::GetPageImage(int nPage) const bool wxNotebook::SetPageImage(int nPage, int nImage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") ); TC_ITEM tcItem; tcItem.mask = TCIF_IMAGE; @@ -272,7 +272,7 @@ void wxNotebook::SetTabSize(const wxSize& sz) // remove one page from the notebook bool wxNotebook::DeletePage(int nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") ); TabCtrl_DeleteItem(m_hwnd, nPage); @@ -285,7 +285,7 @@ bool wxNotebook::DeletePage(int nPage) // remove one page from the notebook, without deleting bool wxNotebook::RemovePage(int nPage) { - wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, "notebook page out of range" ); + wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("notebook page out of range") ); TabCtrl_DeleteItem(m_hwnd, nPage); @@ -343,13 +343,13 @@ bool wxNotebook::InsertPage(int nPage, if (!strText.IsEmpty()) { tcItem.mask |= TCIF_TEXT; - tcItem.pszText = (char *)strText.c_str(); + tcItem.pszText = (wxChar *)strText.c_str(); } else - tcItem.pszText = (char *) NULL; + tcItem.pszText = (wxChar *) NULL; if ( TabCtrl_InsertItem(m_hwnd, nPage, &tcItem) == -1 ) { - wxLogError("Can't create the notebook page '%s'.", strText.c_str()); + wxLogError(_T("Can't create the notebook page '%s'."), strText.c_str()); return FALSE; } diff --git a/src/msw/ownerdrw.cpp b/src/msw/ownerdrw.cpp index be1ce8d47e..cefdc0e8e3 100644 --- a/src/msw/ownerdrw.cpp +++ b/src/msw/ownerdrw.cpp @@ -68,13 +68,13 @@ bool wxOwnerDrawn::OnMeasureItem(size_t *pwidth, size_t *pheight) dc.SetFont(GetFont()); // ## ugly... - char *szStripped = new char[m_strName.Len()]; - wxStripMenuCodes((char *)m_strName.c_str(), szStripped); + wxChar *szStripped = new wxChar[m_strName.Len()]; + wxStripMenuCodes((wxChar *)m_strName.c_str(), szStripped); wxString str = szStripped; delete [] szStripped; // # without this menu items look too tightly packed (at least under Windows) - str += 'W'; // 'W' is typically the widest letter + str += _T('W'); // 'W' is typically the widest letter dc.GetTextExtent(str, (long *)pwidth, (long *)pheight); m_nHeight = *pheight; // remember height for use in OnDrawItem @@ -150,7 +150,7 @@ bool wxOwnerDrawn::OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODSt HFONT hPrevFont = (HFONT) ::SelectObject(hdc, hfont); DrawState(hdc, NULL, NULL, - (LPARAM)(const char *)m_strName, m_strName.Length(), + (LPARAM)(const wxChar *)m_strName, m_strName.Length(), x, rc.y, rc.GetWidth(), rc.GetHeight(), DST_PREFIXTEXT | ( st & wxODDisabled ? DSS_DISABLED : 0) ); diff --git a/src/msw/pnghand.cpp b/src/msw/pnghand.cpp index ec8bbd781d..c855358dd7 100644 --- a/src/msw/pnghand.cpp +++ b/src/msw/pnghand.cpp @@ -93,7 +93,7 @@ wxPNGReader::wxPNGReader(void) imageOK = FALSE; } -wxPNGReader::wxPNGReader ( char* ImageFileName ) +wxPNGReader::wxPNGReader ( wxChar* ImageFileName ) { imageOK = FALSE; filetype = 0; @@ -383,12 +383,12 @@ wxMask *wxPNGReader::CreateMask(void) return mask; } -bool wxPNGReader::ReadFile(char * ImageFileName) +bool wxPNGReader::ReadFile(wxChar * ImageFileName) { int number_passes; if (ImageFileName) - strcpy(filename, ImageFileName); + wxStrcpy(filename, ImageFileName); FILE *fp; png_struct *png_ptr; @@ -396,7 +396,7 @@ bool wxPNGReader::ReadFile(char * ImageFileName) wxPNGReaderIter iter(this); /* open the file */ - fp = fopen(filename, "rb"); + fp = fopen(wxConvFile.cWX2MB(filename), "rb"); if (!fp) return FALSE; @@ -525,10 +525,10 @@ bool wxPNGReader::ReadFile(char * ImageFileName) /* write a png file */ -bool wxPNGReader::SaveFile(char * ImageFileName) +bool wxPNGReader::SaveFile(wxChar * ImageFileName) { if (ImageFileName) - strcpy(filename, ImageFileName); + wxStrcpy(filename, ImageFileName); wxPNGReaderIter iter(this); FILE *fp; @@ -536,7 +536,7 @@ bool wxPNGReader::SaveFile(char * ImageFileName) png_info *info_ptr; /* open the file */ - fp = fopen(filename, "wb"); + fp = fopen(wxConvFile.cWX2MB(filename), "wb"); if (!fp) return FALSE; @@ -693,14 +693,14 @@ static void DecToHex(int dec, char *buf) } -bool wxPNGReader::SaveXPM(char *filename, char *name) +bool wxPNGReader::SaveXPM(wxChar *filename, wxChar *name) { - char nameStr[256]; + wxChar nameStr[256]; if ( name ) - strcpy(nameStr, name); + wxStrcpy(nameStr, name); else { - strcpy(nameStr, filename); + wxStrcpy(nameStr, filename); wxStripExtension(nameStr); } @@ -713,7 +713,7 @@ bool wxPNGReader::SaveXPM(char *filename, char *name) if ( !GetPalette() ) return FALSE; - ofstream str(filename); + ofstream str(wxConvFile.cWX2MB(filename)); if ( str.bad() ) return FALSE; @@ -770,7 +770,7 @@ bool wxPNGFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla int desiredWidth, int desiredHeight) { wxPNGReader reader; - if (reader.ReadFile((char*) (const char*) name)) + if (reader.ReadFile(WXSTRINGCAST name)) { return reader.InstantiateBitmap(bitmap); } diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index 36beaf6021..4034697c85 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -211,7 +211,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt if (!win) { wxEndBusyCursor(); - wxLogDebug("Could not create an abort dialog."); + wxLogDebug(_T("Could not create an abort dialog.")); delete dc; } diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 4038a36348..ebd76b52bb 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -110,7 +110,7 @@ bool wxRadioBox::MSWCommand(WXUINT cmd, WXWORD id) } } - wxASSERT_MSG( selectedButton != -1, "click from alien button?" ); + wxASSERT_MSG( selectedButton != -1, _T("click from alien button?") ); if ( selectedButton != m_selectedButton ) { @@ -257,7 +257,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, } // Create a dummy radio control to end the group. - (void)CreateWindowEx(0, RADIO_CLASS, "", WS_GROUP | RADIO_FLAGS, + (void)CreateWindowEx(0, RADIO_CLASS, _T(""), WS_GROUP | RADIO_FLAGS, 0, 0, 0, 0, hwndParent, (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -289,14 +289,14 @@ wxRadioBox::~wxRadioBox() wxString wxRadioBox::GetLabel(int item) const { - wxCHECK_MSG( item >= 0 && item < m_noItems, "", "invalid radiobox index" ); + wxCHECK_MSG( item >= 0 && item < m_noItems, _T(""), _T("invalid radiobox index") ); return wxGetWindowText(m_radioButtons[item]); } void wxRadioBox::SetLabel(int item, const wxString& label) { - wxCHECK_RET( item >= 0 && item < m_noItems, "invalid radiobox index" ); + wxCHECK_RET( item >= 0 && item < m_noItems, _T("invalid radiobox index") ); m_radioWidth[item] = m_radioHeight[item] = -1; SetWindowText((HWND)m_radioButtons[item], label.c_str()); @@ -308,7 +308,7 @@ void wxRadioBox::SetLabel(int item, wxBitmap *bitmap) m_radioWidth[item] = bitmap->GetWidth() + FB_MARGIN; m_radioHeight[item] = bitmap->GetHeight() + FB_MARGIN; */ - wxFAIL_MSG("not implemented"); + wxFAIL_MSG(_T("not implemented")); } int wxRadioBox::FindString(const wxString& s) const @@ -324,7 +324,7 @@ int wxRadioBox::FindString(const wxString& s) const void wxRadioBox::SetSelection(int N) { - wxCHECK_RET( (N >= 0) && (N < m_noItems), "invalid radiobox index" ); + wxCHECK_RET( (N >= 0) && (N < m_noItems), _T("invalid radiobox index") ); // Following necessary for Win32s, because Win32s translate BM_SETCHECK if (m_selectedButton >= 0 && m_selectedButton < m_noItems) @@ -361,7 +361,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE)) yy = currentY; - char buf[400]; + wxChar buf[400]; int y_offset = yy; int x_offset = xx; @@ -725,7 +725,7 @@ LRESULT APIENTRY _EXPORT wxRadioBtnWndProc(HWND hwnd, { wxRadioBox *radiobox = (wxRadioBox *)::GetWindowLong(hwnd, GWL_USERDATA); - wxCHECK_MSG( radiobox, 0, "radio button without radio box?" ); + wxCHECK_MSG( radiobox, 0, _T("radio button without radio box?") ); int sel = radiobox->GetSelection(); diff --git a/src/msw/radiobut.cpp b/src/msw/radiobut.cpp index 0117ba49f1..8f7c9786be 100644 --- a/src/msw/radiobut.cpp +++ b/src/msw/radiobut.cpp @@ -90,11 +90,11 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, msStyle |= WS_BORDER; */ - m_hWnd = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, (const char *)label, + m_hWnd = (WXHWND) CreateWindowEx(exStyle, RADIO_CLASS, (const wxChar *)label, msStyle,0,0,0,0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create radiobutton" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create radiobutton") ); #if wxUSE_CTL3D if (want3D) @@ -112,7 +112,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, // SetValue(value); // start GRW fix - if (label != "") + if (label != _T("")) { int label_width, label_height; GetTextExtent(label, &label_width, &label_height, NULL, NULL, & this->GetFont()); @@ -142,7 +142,7 @@ bool wxRadioButton::Create(wxWindow *parent, wxWindowID id, void wxRadioButton::SetLabel(const wxString& label) { - SetWindowText((HWND) GetHWND(), (const char *)label); + SetWindowText((HWND) GetHWND(), (const wxChar *)label); } void wxRadioButton::SetValue(bool value) diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index cc1b230b54..99cc9465dc 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -98,7 +98,7 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName, if ( appName.IsEmpty() ) { - wxCHECK_RET( wxTheApp, "No application name in wxRegConfig ctor!" ); + wxCHECK_RET( wxTheApp, _T("No application name in wxRegConfig ctor!") ); strRoot << wxTheApp->GetAppName(); } else @@ -337,7 +337,7 @@ bool wxRegConfig::Read(const wxString& key, wxString *pStr) const if ( IsImmutable(path.Name()) ) { if ( TryGetValue(m_keyGlobal, path.Name(), *pStr) ) { if ( m_keyLocal.HasValue(path.Name()) ) { - wxLogWarning("User value for immutable key '%s' ignored.", + wxLogWarning(_T("User value for immutable key '%s' ignored."), path.Name().c_str()); } *pStr = wxConfigBase::ExpandEnvVars(*pStr); @@ -373,7 +373,7 @@ bool wxRegConfig::Read(const wxString& key, wxString *pStr, if ( IsImmutable(path.Name()) ) { if ( TryGetValue(m_keyGlobal, path.Name(), *pStr) ) { if ( m_keyLocal.HasValue(path.Name()) ) { - wxLogWarning("User value for immutable key '%s' ignored.", + wxLogWarning(_T("User value for immutable key '%s' ignored."), path.Name().c_str()); } @@ -416,7 +416,7 @@ bool wxRegConfig::Read(const wxString& key, long *plResult) const if ( IsImmutable(path.Name()) ) { if ( TryGetValue(m_keyGlobal, path.Name(), plResult) ) { if ( m_keyLocal.HasValue(path.Name()) ) { - wxLogWarning("User value for immutable key '%s' ignored.", + wxLogWarning(_T("User value for immutable key '%s' ignored."), path.Name().c_str()); } @@ -441,7 +441,7 @@ bool wxRegConfig::Write(const wxString& key, const wxString& szValue) wxConfigPathChanger path(this, key); if ( IsImmutable(path.Name()) ) { - wxLogError("Can't change immutable entry '%s'.", path.Name().c_str()); + wxLogError(_T("Can't change immutable entry '%s'."), path.Name().c_str()); return FALSE; } @@ -453,7 +453,7 @@ bool wxRegConfig::Write(const wxString& key, long lValue) wxConfigPathChanger path(this, key); if ( IsImmutable(path.Name()) ) { - wxLogError("Can't change immutable entry '%s'.", path.Name().c_str()); + wxLogError(_T("Can't change immutable entry '%s'."), path.Name().c_str()); return FALSE; } @@ -516,7 +516,7 @@ bool wxRegConfig::RenameGroup(const wxString& oldName, const wxString& newName) // TODO there is no way to rename a registry key - we must do a deep copy // ourselves - wxFAIL_MSG("Registry key renaming not implemented"); + wxFAIL_MSG(_T("Registry key renaming not implemented")); return FALSE; } diff --git a/src/msw/registry.cpp b/src/msw/registry.cpp index 099b376cfd..fbdb35b0e8 100644 --- a/src/msw/registry.cpp +++ b/src/msw/registry.cpp @@ -62,28 +62,28 @@ typedef unsigned char *RegString; static struct { HKEY hkey; - const char *szName; - const char *szShortName; + const wxChar *szName; + const wxChar *szShortName; } aStdKeys[] = { - { HKEY_CLASSES_ROOT, "HKEY_CLASSES_ROOT", "HKCR" }, + { HKEY_CLASSES_ROOT, _T("HKEY_CLASSES_ROOT"), _T("HKCR") }, #ifdef __WIN32__ - { HKEY_CURRENT_USER, "HKEY_CURRENT_USER", "HKCU" }, - { HKEY_LOCAL_MACHINE, "HKEY_LOCAL_MACHINE", "HKLM" }, - { HKEY_USERS, "HKEY_USERS", "HKU" }, // short name? - { HKEY_PERFORMANCE_DATA, "HKEY_PERFORMANCE_DATA", "HKPD" }, + { HKEY_CURRENT_USER, _T("HKEY_CURRENT_USER"), _T("HKCU") }, + { HKEY_LOCAL_MACHINE, _T("HKEY_LOCAL_MACHINE"), _T("HKLM") }, + { HKEY_USERS, _T("HKEY_USERS"), _T("HKU") }, // short name? + { HKEY_PERFORMANCE_DATA, _T("HKEY_PERFORMANCE_DATA"), _T("HKPD") }, #if WINVER >= 0x0400 - { HKEY_CURRENT_CONFIG, "HKEY_CURRENT_CONFIG", "HKCC" }, + { HKEY_CURRENT_CONFIG, _T("HKEY_CURRENT_CONFIG"), _T("HKCC") }, #ifndef __GNUWIN32__ - { HKEY_DYN_DATA, "HKEY_DYN_DATA", "HKDD" }, // short name? + { HKEY_DYN_DATA, _T("HKEY_DYN_DATA"), _T("HKDD") }, // short name? #endif //GNUWIN32 #endif //WINVER >= 4.0 #endif //WIN32 }; // the registry name separator (perhaps one day MS will change it to '/' ;-) -#define REG_SEPARATOR '\\' +#define REG_SEPARATOR _T('\\') // useful for Windows programmers: makes somewhat more clear all these zeroes // being passed to Windows APIs @@ -107,11 +107,11 @@ aStdKeys[] = static inline void RemoveTrailingSeparator(wxString& str); // returns TRUE if given registry key exists -static bool KeyExists(WXHKEY hRootKey, const char *szKey); +static bool KeyExists(WXHKEY hRootKey, const wxChar *szKey); // combines value and key name (uses static buffer!) -static const char *GetFullName(const wxRegKey *pKey, - const char *szValue = NULL); +static const wxChar *GetFullName(const wxRegKey *pKey, + const wxChar *szValue = NULL); // ============================================================================ // implementation of wxRegKey class @@ -125,18 +125,18 @@ const size_t wxRegKey::nStdKeys = WXSIZEOF(aStdKeys); // @@ should take a `StdKey key', but as it's often going to be used in loops // it would require casts in user code. -const char *wxRegKey::GetStdKeyName(size_t key) +const wxChar *wxRegKey::GetStdKeyName(size_t key) { // return empty string if key is invalid - wxCHECK_MSG( key < nStdKeys, "", "invalid key in wxRegKey::GetStdKeyName" ); + wxCHECK_MSG( key < nStdKeys, _T(""), _T("invalid key in wxRegKey::GetStdKeyName") ); return aStdKeys[key].szName; } -const char *wxRegKey::GetStdKeyShortName(size_t key) +const wxChar *wxRegKey::GetStdKeyShortName(size_t key) { // return empty string if key is invalid - wxCHECK( key < nStdKeys, "" ); + wxCHECK( key < nStdKeys, _T("") ); return aStdKeys[key].szShortName; } @@ -156,7 +156,7 @@ wxRegKey::StdKey wxRegKey::ExtractKeyName(wxString& strKey) } if ( ui == nStdKeys ) { - wxFAIL_MSG("invalid key prefix in wxRegKey::ExtractKeyName."); + wxFAIL_MSG(_T("invalid key prefix in wxRegKey::ExtractKeyName.")); hRootKey = HKEY_CLASSES_ROOT; } @@ -176,7 +176,7 @@ wxRegKey::StdKey wxRegKey::GetStdKeyFromHkey(WXHKEY hkey) return (StdKey)ui; } - wxFAIL_MSG("non root hkey passed to wxRegKey::GetStdKeyFromHkey."); + wxFAIL_MSG(_T("non root hkey passed to wxRegKey::GetStdKeyFromHkey.")); return HKCR; } @@ -472,7 +472,7 @@ bool wxRegKey::DeleteSelf() return TRUE; } -bool wxRegKey::DeleteKey(const char *szKey) +bool wxRegKey::DeleteKey(const wxChar *szKey) { if ( !Open() ) return FALSE; @@ -481,13 +481,13 @@ bool wxRegKey::DeleteKey(const char *szKey) return key.DeleteSelf(); } -bool wxRegKey::DeleteValue(const char *szValue) +bool wxRegKey::DeleteValue(const wxChar *szValue) { if ( !Open() ) return FALSE; #if defined(__WIN32__) && !defined(__TWIN32__) - m_dwLastError = RegDeleteValue((HKEY) m_hKey, (char*) (const char*) szValue); + m_dwLastError = RegDeleteValue((HKEY) m_hKey, WXSTRINGCAST szValue); if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("can't delete value '%s' from key '%s'"), szValue, GetName().c_str()); @@ -514,14 +514,14 @@ bool wxRegKey::DeleteValue(const char *szValue) // ---------------------------------------------------------------------------- // return TRUE if value exists -bool wxRegKey::HasValue(const char *szValue) const +bool wxRegKey::HasValue(const wxChar *szValue) const { // this function should be silent, so suppress possible messages from Open() wxLogNull nolog; #ifdef __WIN32__ if ( CONST_CAST Open() ) { - return RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED, + return RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, NULL, NULL, NULL) == ERROR_SUCCESS; } else @@ -545,7 +545,7 @@ bool wxRegKey::HasSubkeys() const } // returns TRUE if given subkey exists -bool wxRegKey::HasSubKey(const char *szKey) const +bool wxRegKey::HasSubKey(const wxChar *szKey) const { // this function should be silent, so suppress possible messages from Open() wxLogNull nolog; @@ -556,14 +556,14 @@ bool wxRegKey::HasSubKey(const char *szKey) const return FALSE; } -wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue) const +wxRegKey::ValueType wxRegKey::GetValueType(const wxChar *szValue) const { #ifdef __WIN32__ if ( ! CONST_CAST Open() ) return Type_None; DWORD dwType; - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED, + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, &dwType, NULL, NULL); if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("can't read value of key '%s'"), @@ -578,7 +578,7 @@ wxRegKey::ValueType wxRegKey::GetValueType(const char *szValue) const } #ifdef __WIN32__ -bool wxRegKey::SetValue(const char *szValue, long lValue) +bool wxRegKey::SetValue(const wxChar *szValue, long lValue) { #ifdef __TWIN32__ wxFAIL_MSG("RegSetValueEx not implemented by TWIN32"); @@ -597,12 +597,12 @@ bool wxRegKey::SetValue(const char *szValue, long lValue) #endif } -bool wxRegKey::QueryValue(const char *szValue, long *plValue) const +bool wxRegKey::QueryValue(const wxChar *szValue, long *plValue) const { if ( CONST_CAST Open() ) { DWORD dwType, dwSize = sizeof(DWORD); RegString pBuf = (RegString)plValue; - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED, + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, &dwType, pBuf, &dwSize); if ( m_dwLastError != ERROR_SUCCESS ) { wxLogSysError(m_dwLastError, _("can't read value of key '%s'"), @@ -612,7 +612,7 @@ bool wxRegKey::QueryValue(const char *szValue, long *plValue) const else { // check that we read the value of right type wxASSERT_MSG( dwType == REG_DWORD, - "Type mismatch in wxRegKey::QueryValue()." ); + _T("Type mismatch in wxRegKey::QueryValue().") ); return TRUE; } @@ -623,23 +623,23 @@ bool wxRegKey::QueryValue(const char *szValue, long *plValue) const #endif //Win32 -bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const +bool wxRegKey::QueryValue(const wxChar *szValue, wxString& strValue) const { if ( CONST_CAST Open() ) { #ifdef __WIN32__ // first get the type and size of the data DWORD dwType, dwSize; - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED, + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, &dwType, NULL, &dwSize); if ( m_dwLastError == ERROR_SUCCESS ) { RegString pBuf = (RegString)strValue.GetWriteBuf(dwSize); - m_dwLastError = RegQueryValueEx((HKEY) m_hKey, (char*) (const char*) szValue, RESERVED, + m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED, &dwType, pBuf, &dwSize); strValue.UngetWriteBuf(); if ( m_dwLastError == ERROR_SUCCESS ) { // check that it was the right type wxASSERT_MSG( dwType == REG_SZ, - "Type mismatch in wxRegKey::QueryValue()." ); + _T("Type mismatch in wxRegKey::QueryValue().") ); return TRUE; } @@ -660,7 +660,7 @@ bool wxRegKey::QueryValue(const char *szValue, wxString& strValue) const return FALSE; } -bool wxRegKey::SetValue(const char *szValue, const wxString& strValue) +bool wxRegKey::SetValue(const wxChar *szValue, const wxString& strValue) { if ( CONST_CAST Open() ) { #if defined( __WIN32__) && !defined(__TWIN32__) @@ -715,7 +715,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const return FALSE; #if defined( __WIN32__) && !defined(__TWIN32__) - char szValueName[1024]; // @@ use RegQueryInfoKey... + wxChar szValueName[1024]; // @@ use RegQueryInfoKey... DWORD dwValueLen = WXSIZEOF(szValueName); lIndex++; @@ -768,7 +768,7 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const if ( lIndex == -1 ) return FALSE; - char szKeyName[_MAX_PATH + 1]; + wxChar szKeyName[_MAX_PATH + 1]; m_dwLastError = RegEnumKey((HKEY) m_hKey, lIndex++, szKeyName, WXSIZEOF(szKeyName)); if ( m_dwLastError != ERROR_SUCCESS ) { @@ -789,7 +789,7 @@ bool wxRegKey::GetNextKey(wxString& strKeyName, long& lIndex) const } // returns TRUE if the value contains a number (else it's some string) -bool wxRegKey::IsNumericValue(const char *szValue) const +bool wxRegKey::IsNumericValue(const wxChar *szValue) const { ValueType type = GetValueType(szValue); switch ( type ) { @@ -806,7 +806,7 @@ bool wxRegKey::IsNumericValue(const char *szValue) const // ============================================================================ // implementation of global private functions // ============================================================================ -bool KeyExists(WXHKEY hRootKey, const char *szKey) +bool KeyExists(WXHKEY hRootKey, const wxChar *szKey) { HKEY hkeyDummy; if ( RegOpenKey( (HKEY) hRootKey, szKey, &hkeyDummy) == ERROR_SUCCESS ) { @@ -817,12 +817,12 @@ bool KeyExists(WXHKEY hRootKey, const char *szKey) return FALSE; } -const char *GetFullName(const wxRegKey *pKey, const char *szValue) +const wxChar *GetFullName(const wxRegKey *pKey, const wxChar *szValue) { static wxString s_str; s_str = pKey->GetName(); - if ( !IsEmpty(szValue) ) - s_str << "\\" << szValue; + if ( !wxIsEmpty(szValue) ) + s_str << _T("\\") << szValue; return s_str.c_str(); } diff --git a/src/msw/scrolbar.cpp b/src/msw/scrolbar.cpp index 2d9071894f..614a0cf640 100644 --- a/src/msw/scrolbar.cpp +++ b/src/msw/scrolbar.cpp @@ -84,7 +84,7 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, // Now create scrollbar DWORD _direction = (style & wxHORIZONTAL) ? SBS_HORZ: SBS_VERT; - HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), "SCROLLBAR", "scrollbar", + HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(style), _T("SCROLLBAR"), _T("scrollbar"), _direction | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index f9aa9ea5c1..7bfe7c1a79 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -93,14 +93,14 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, bool want3D; WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; - m_staticValue = (WXHWND) CreateWindowEx(exStyle, "STATIC", NULL, + m_staticValue = (WXHWND) CreateWindowEx(exStyle, _T("STATIC"), NULL, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); // Now create min static control - sprintf(wxBuffer, "%d", minValue); - m_staticMin = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer, + wxSprintf(wxBuffer, _T("%d"), minValue); + m_staticMin = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer, STATIC_FLAGS, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -149,15 +149,15 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, SubclassWin(GetHWND()); - SetWindowText((HWND) m_hWnd, ""); + SetWindowText((HWND) m_hWnd, _T("")); SetFont(parent->GetFont()); if ( m_windowStyle & wxSL_LABELS ) { // Finally, create max value static item - sprintf(wxBuffer, "%d", maxValue); - m_staticMax = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer, + wxSprintf(wxBuffer, _T("%d"), maxValue); + m_staticMax = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer, STATIC_FLAGS, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -285,7 +285,7 @@ void wxSlider95::SetValue(int value) ::SendMessage((HWND) GetHWND(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)value); if (m_staticValue) { - sprintf(wxBuffer, "%d", value); + wxSprintf(wxBuffer, _T("%d"), value); SetWindowText((HWND) m_staticValue, wxBuffer); } } @@ -360,7 +360,7 @@ void wxSlider95::DoSetSize(int x, int y, int width, int height, int sizeFlags) AdjustForParentClientOrigin(x1, y1, sizeFlags); - char buf[300]; + wxChar buf[300]; int x_offset = x; int y_offset = y; @@ -508,16 +508,16 @@ void wxSlider95::SetRange(int minValue, int maxValue) ::SendMessage((HWND) GetHWND(), TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue)); - char buf[40]; + wxChar buf[40]; if ( m_staticMin ) { - sprintf(buf, "%d", m_rangeMin); + wxSprintf(buf, _T("%d"), m_rangeMin); SetWindowText((HWND) m_staticMin, buf); } if ( m_staticMax ) { - sprintf(buf, "%d", m_rangeMax); + wxSprintf(buf, _T("%d"), m_rangeMax); SetWindowText((HWND) m_staticMax, buf); } } diff --git a/src/msw/slidrmsw.cpp b/src/msw/slidrmsw.cpp index 2ec3e8536e..fb14495286 100644 --- a/src/msw/slidrmsw.cpp +++ b/src/msw/slidrmsw.cpp @@ -85,14 +85,14 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id, bool want3D; WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ; - m_staticValue = (WXHWND) CreateWindowEx(exStyle, "STATIC", NULL, + m_staticValue = (WXHWND) CreateWindowEx(exStyle, _T("STATIC"), NULL, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); // Now create min static control - sprintf(wxBuffer, "%d", minValue); - m_staticMin = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer, + wxSprintf(wxBuffer, _T("%d"), minValue); + m_staticMin = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer, STATIC_FLAGS, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -106,7 +106,7 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id, else msStyle = SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ; - HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), "SCROLLBAR", wxBuffer, + HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("SCROLLBAR"), wxBuffer, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); @@ -125,8 +125,8 @@ bool wxSliderMSW::Create(wxWindow *parent, wxWindowID id, SubclassWin(GetHWND()); // Finally, create max value static item - sprintf(wxBuffer, "%d", maxValue); - m_staticMax = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer, + wxSprintf(wxBuffer, _T("%d"), maxValue); + m_staticMax = (WXHWND) CreateWindowEx(0, _T("STATIC"), wxBuffer, STATIC_FLAGS, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); @@ -256,7 +256,7 @@ void wxSliderMSW::SetValue(int value) ::SetScrollPos((HWND) GetHWND(), SB_CTL, value, TRUE); if (m_staticValue) { - sprintf(wxBuffer, "%d", value); + wxSprintf(wxBuffer, _T("%d"), value); SetWindowText((HWND) m_staticValue, wxBuffer); } } @@ -331,7 +331,7 @@ void wxSliderMSW::DoSetSize(int x, int y, int width, int height, int sizeFlags) AdjustForParentClientOrigin(x1, y1, sizeFlags); - char buf[300]; + wxChar buf[300]; int x_offset = x; int y_offset = y; @@ -458,16 +458,16 @@ void wxSliderMSW::SetRange(int minValue, int maxValue) m_rangeMax = maxValue; ::SetScrollRange((HWND) GetHWND(), SB_CTL, m_rangeMin, m_rangeMax, TRUE); - char buf[40]; + wxChar buf[40]; if ( m_staticMin ) { - sprintf(buf, "%d", m_rangeMin); + wxSprintf(buf, _T("%d"), m_rangeMin); SetWindowText((HWND) m_staticMin, buf); } if ( m_staticMax ) { - sprintf(buf, "%d", m_rangeMax); + wxSprintf(buf, _T("%d"), m_rangeMax); SetWindowText((HWND) m_staticMax, buf); } } diff --git a/src/msw/statbmp.cpp b/src/msw/statbmp.cpp index 8e693a39e9..727d02e67f 100644 --- a/src/msw/statbmp.cpp +++ b/src/msw/statbmp.cpp @@ -87,17 +87,17 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, #ifdef __WIN32__ // create a static control with either SS_BITMAP or SS_ICON style depending // on what we have here - const char *classname = "STATIC"; + const wxChar *classname = _T("STATIC"); int winstyle = m_isIcon ? SS_ICON : SS_BITMAP; #else // Win16 - const char *classname = "BUTTON"; + const wxChar *classname = _T("BUTTON"); int winstyle = BS_OWNERDRAW; #endif // Win32 m_hWnd = (WXHWND)::CreateWindow ( classname, - "", + _T(""), winstyle | WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, (HWND)parent->GetHWND(), @@ -106,7 +106,7 @@ bool wxStaticBitmap::Create(wxWindow *parent, wxWindowID id, NULL ); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create static bitmap" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create static bitmap") ); SetBitmap(bitmap); diff --git a/src/msw/statbox.cpp b/src/msw/statbox.cpp index 15d87f01bc..6ca6074e54 100644 --- a/src/msw/statbox.cpp +++ b/src/msw/statbox.cpp @@ -75,7 +75,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, WXDWORD exStyle = Determine3DEffects(0, &want3D) ; HWND wx_button = - CreateWindowEx(exStyle, "BUTTON", (const char *)label, msStyle, + CreateWindowEx(exStyle, _T("BUTTON"), (const wxChar *)label, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); #if wxUSE_CTL3D @@ -101,7 +101,7 @@ bool wxStaticBox::Create(wxWindow *parent, wxWindowID id, void wxStaticBox::SetLabel(const wxString& label) { - SetWindowText((HWND)m_hWnd, (const char *)label); + SetWindowText((HWND)m_hWnd, (const wxChar *)label); } void wxStaticBox::DoSetSize(int x, int y, int width, int height, int sizeFlags) diff --git a/src/msw/statbr95.cpp b/src/msw/statbr95.cpp index 4c0f0991fd..2263d1a3bb 100644 --- a/src/msw/statbr95.cpp +++ b/src/msw/statbr95.cpp @@ -57,9 +57,9 @@ // windowsx.h and commctrl.h don't define those, so we do it here #define StatusBar_SetParts(h, n, w) SendMessage(h, SB_SETPARTS, (WPARAM)n, (LPARAM)w) -#define StatusBar_SetText(h, n, t) SendMessage(h, SB_SETTEXT, (WPARAM)n, (LPARAM)(LPCSTR)t) +#define StatusBar_SetText(h, n, t) SendMessage(h, SB_SETTEXT, (WPARAM)n, (LPARAM)(LPCTSTR)t) #define StatusBar_GetTextLen(h, n) LOWORD(SendMessage(h, SB_GETTEXTLENGTH, (WPARAM)n, 0)) -#define StatusBar_GetText(h, n, s) LOWORD(SendMessage(h, SB_GETTEXT, (WPARAM)n, (LPARAM)(LPSTR)s)) +#define StatusBar_GetText(h, n, s) LOWORD(SendMessage(h, SB_GETTEXT, (WPARAM)n, (LPARAM)(LPTSTR)s)) #define hwnd ((HWND)m_hWnd) @@ -97,11 +97,11 @@ bool wxStatusBar95::Create(wxWindow *parent, wxWindowID id, long style) wstyle |= SBARS_SIZEGRIP; m_hWnd = (WXHWND)CreateStatusWindow(wstyle, - "", + _T(""), (HWND)parent->GetHWND(), m_windowId); if ( m_hWnd == 0 ) { - wxLogSysError("can't create status bar window"); + wxLogSysError(_T("can't create status bar window")); return FALSE; } @@ -191,7 +191,7 @@ void wxStatusBar95::SetFieldsWidth() } if ( !StatusBar_SetParts(hwnd, m_nFields, pWidths) ) { - wxLogDebug("StatusBar_SetParts failed."); + wxLogDebug(_T("StatusBar_SetParts failed.")); } delete [] pWidths; @@ -200,7 +200,7 @@ void wxStatusBar95::SetFieldsWidth() void wxStatusBar95::SetStatusText(const wxString& strText, int nField) { if ( !StatusBar_SetText(hwnd, nField, strText) ) { - wxLogDebug("StatusBar_SetText failed"); + wxLogDebug(_T("StatusBar_SetText failed")); } } @@ -208,7 +208,7 @@ wxString wxStatusBar95::GetStatusText(int nField) const { wxASSERT( (nField > -1) && (nField < m_nFields) ); - wxString str(""); + wxString str(_T("")); int len = StatusBar_GetTextLen(hwnd, nField); if (len > 0) { diff --git a/src/msw/stattext.cpp b/src/msw/stattext.cpp index d8308232ea..2d56002296 100644 --- a/src/msw/stattext.cpp +++ b/src/msw/stattext.cpp @@ -72,12 +72,12 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, if ( wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; - m_hWnd = (WXHWND)::CreateWindowEx(MakeExtendedStyle(m_windowStyle), "STATIC", (const char *)label, + m_hWnd = (WXHWND)::CreateWindowEx(MakeExtendedStyle(m_windowStyle), _T("STATIC"), (const wxChar *)label, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create static ctrl" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create static ctrl") ); #if wxUSE_CTL3D /* @@ -162,7 +162,7 @@ void wxStaticText::SetLabel(const wxString& label) int w, h; GetTextExtent(label, &w, &h, NULL, NULL, & GetFont()); MoveWindow((HWND) GetHWND(), point.x, point.y, (int)(w + 10), (int)h, TRUE); - SetWindowText((HWND) GetHWND(), (const char *)label); + SetWindowText((HWND) GetHWND(), (const wxChar *)label); } WXHBRUSH wxStaticText::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, diff --git a/src/msw/tabctrl.cpp b/src/msw/tabctrl.cpp index 20f1d669f1..4f525436fc 100644 --- a/src/msw/tabctrl.cpp +++ b/src/msw/tabctrl.cpp @@ -114,7 +114,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons // Create the toolbar control. HWND hWndTabCtrl = CreateWindowEx(0L, // No extended styles. WC_TABCONTROL, // Class name for the tab control - "", // No default text. + _T(""), // No default text. WS_CHILD | WS_BORDER | WS_VISIBLE | tabStyle, // Styles and defaults. x, y, width, height, // Standard size and position. (HWND) parent->GetHWND(), // Parent window @@ -241,8 +241,8 @@ int wxTabCtrl::GetRowCount() const // Get the item text wxString wxTabCtrl::GetItemText(int item) const { - char buf[256]; - wxString str(""); + wxChar buf[256]; + wxString str(_T("")); TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; tcItem.pszText = buf; @@ -300,14 +300,14 @@ int wxTabCtrl::HitTest(const wxPoint& pt, long& flags) // Insert an item bool wxTabCtrl::InsertItem(int item, const wxString& text, int imageId, void* data) { - char buf[256]; + wxChar buf[256]; TC_ITEM tcItem; tcItem.mask = TCIF_PARAM; tcItem.lParam = (long) data; - if (text != "") + if (text != _T("")) { tcItem.mask |= TCIF_TEXT; - strcpy(buf, (const char*) text); + wxStrcpy(buf, (const wxChar*) text); tcItem.pszText = buf; tcItem.cchTextMax = 256; } @@ -336,10 +336,10 @@ void wxTabCtrl::SetImageList(wxImageList* imageList) // Set the text for an item bool wxTabCtrl::SetItemText(int item, const wxString& text) { - char buf[256]; + wxChar buf[256]; TC_ITEM tcItem; tcItem.mask = TCIF_TEXT; - strcpy(buf, (const char*) text); + wxStrcpy(buf, (const wxChar*) text); tcItem.pszText = buf; tcItem.cchTextMax = 256; diff --git a/src/msw/taskbar.cpp b/src/msw/taskbar.cpp index b34e42e02e..fdf563dc37 100644 --- a/src/msw/taskbar.cpp +++ b/src/msw/taskbar.cpp @@ -48,7 +48,7 @@ LRESULT APIENTRY _EXPORT wxTaskBarIconWindowProc( HWND hWnd, unsigned msg, UINT wParam, LONG lParam ); -char *wxTaskBarWindowClass = "wxTaskBarWindowClass"; +wxChar *wxTaskBarWindowClass = _T("wxTaskBarWindowClass"); wxList wxTaskBarIcon::sm_taskBarIcons; bool wxTaskBarIcon::sm_registeredClass = FALSE; @@ -117,10 +117,10 @@ bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip) notifyData.hIcon = (HICON) icon.GetHICON(); } - if (((const char*) tooltip != NULL) && (tooltip != "")) + if (((const wxChar*) tooltip != NULL) && (tooltip != _T(""))) { notifyData.uFlags |= NIF_TIP ; - lstrcpyn(notifyData.szTip, (char*) (const char*) tooltip, sizeof(notifyData.szTip)); + lstrcpyn(notifyData.szTip, WXSTRINGCAST tooltip, sizeof(notifyData.szTip)); } notifyData.uID = 99; @@ -239,7 +239,7 @@ bool wxTaskBarIcon::RegisterWindowClass() return TRUE; // Also register the taskbar message here - sm_taskbarMsg = ::RegisterWindowMessage("wxTaskBarIconMessage"); + sm_taskbarMsg = ::RegisterWindowMessage(_T("wxTaskBarIconMessage")); WNDCLASS wc; bool rc; @@ -271,7 +271,7 @@ WXHWND wxTaskBarIcon::CreateTaskBarWindow() HINSTANCE hInstance = GetModuleHandle(NULL); HWND hWnd = CreateWindowEx (0, wxTaskBarWindowClass, - "wxTaskBarWindow", + _T("wxTaskBarWindow"), WS_OVERLAPPED, 0, 0, diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index fc78112d5c..aef9105c82 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -105,8 +105,8 @@ bool wxToolBar95::Create(wxWindow *parent, m_foregroundColour = *wxBLACK ; wxASSERT_MSG( (style & wxTB_VERTICAL) == 0, - "Sorry, wxToolBar95 under Windows 95 only " - "supports horizontal orientation." ); + _T("Sorry, wxToolBar95 under Windows 95 only " + "supports horizontal orientation.") ); m_maxWidth = -1; m_maxHeight = -1; @@ -161,7 +161,7 @@ bool wxToolBar95::Create(wxWindow *parent, ( exStyle, // Extended styles. TOOLBARCLASSNAME, // Class name for the toolbar. - "", // No default text. + _T(""), // No default text. msflags, // Styles x, y, width, height, // Standard toolbar size and position. (HWND) parent->GetHWND(), // Parent window of the toolbar. @@ -170,7 +170,7 @@ bool wxToolBar95::Create(wxWindow *parent, NULL // No class data. ); - wxCHECK_MSG( hWndToolbar, FALSE, "Toolbar creation failed" ); + wxCHECK_MSG( hWndToolbar, FALSE, _T("Toolbar creation failed") ); // Toolbar-specific initialisation ::SendMessage(hWndToolbar, TB_BUTTONSTRUCTSIZE, @@ -252,7 +252,7 @@ bool wxToolBar95::CreateTools() replaceBitmap.nIDNew = (UINT) (HBITMAP) m_hBitmap; replaceBitmap.nButtons = noButtons; if (::SendMessage((HWND) GetHWND(), TB_REPLACEBITMAP, (WPARAM) 0, (LPARAM) &replaceBitmap) == -1) - wxFAIL_MSG("Could not add bitmap to toolbar"); + wxFAIL_MSG(_T("Could not add bitmap to toolbar")); ::DeleteObject((HBITMAP) oldToolBarBitmap); @@ -271,7 +271,7 @@ bool wxToolBar95::CreateTools() addBitmap.hInst = 0; addBitmap.nID = (UINT)m_hBitmap; if (::SendMessage((HWND) GetHWND(), TB_ADDBITMAP, (WPARAM) noButtons, (LPARAM) &addBitmap) == -1) - wxFAIL_MSG("Could not add bitmap to toolbar"); + wxFAIL_MSG(_T("Could not add bitmap to toolbar")); } // Now add the buttons. @@ -316,7 +316,7 @@ bool wxToolBar95::CreateTools() long rc = ::SendMessage((HWND) GetHWND(), TB_ADDBUTTONS, (WPARAM)i, (LPARAM)& buttons); - wxCHECK_MSG( rc, FALSE, "failed to add buttons to the toolbar" ); + wxCHECK_MSG( rc, FALSE, _T("failed to add buttons to the toolbar") ); (void)::SendMessage((HWND) GetHWND(), TB_AUTOSIZE, (WPARAM)0, (LPARAM) 0); @@ -373,7 +373,7 @@ bool wxToolBar95::MSWOnNotify(int WXUNUSED(idCtrl), { if ( hdr->code == TTN_NEEDTEXTA ) { - ttText->lpszText = (char *)help.c_str(); + ttText->lpszText = (wxChar *)help.c_str(); } #if (_WIN32_IE >= 0x0300) else diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 6e3d88dc59..65b1f25222 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -135,7 +135,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, if (m_windowStyle & wxTE_MULTILINE) { wxASSERT_MSG( !(m_windowStyle & wxTE_PROCESS_ENTER), - "wxTE_PROCESS_ENTER style is ignored for multiline controls" ); + _T("wxTE_PROCESS_ENTER style is ignored for multiline controls") ); msStyle |= ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL ; // WS_BORDER m_windowStyle |= wxTE_PROCESS_ENTER; @@ -151,14 +151,14 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, if (m_windowStyle & wxTE_PASSWORD) // hidden input msStyle |= ES_PASSWORD; - const char *windowClass = "EDIT"; + const wxChar *windowClass = _T("EDIT"); #if wxUSE_RICHEDIT if ( m_windowStyle & wxTE_MULTILINE ) { msStyle |= ES_AUTOVSCROLL; m_isRich = TRUE; - windowClass = "RichEdit" ; + windowClass = _T("RichEdit") ; } else m_isRich = FALSE; @@ -172,7 +172,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, #if wxUSE_RICHEDIT if (m_windowStyle & wxSIMPLE_BORDER) { - windowClass = "EDIT"; + windowClass = _T("EDIT"); m_isRich = FALSE; } #endif @@ -187,7 +187,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, 0, 0, 0, 0, (HWND) ((wxWindow*)parent)->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create text ctrl" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create text ctrl") ); #if wxUSE_CTL3D if ( want3D ) @@ -240,7 +240,7 @@ void wxTextCtrl::AdoptAttributesFromHWND() // retrieve the style to see whether this is an edit or richedit ctrl #if wxUSE_RICHEDIT - char buf[256]; + wxChar buf[256]; #ifndef __WIN32__ GetClassName((HWND) hWnd, buf, 256); @@ -259,7 +259,7 @@ void wxTextCtrl::AdoptAttributesFromHWND() wxString str(buf); str.UpperCase(); - if (str == "EDIT") + if (str == _T("EDIT")) m_isRich = FALSE; else m_isRich = TRUE; @@ -299,7 +299,7 @@ void wxTextCtrl::SetValue(const wxString& value) } if (singletons > 0) { - char *tmp = new char[len + singletons + 1]; + wxChar *tmp = new wxChar[len + singletons + 1]; int j = 0; for (i = 0; i < len; i ++) { @@ -316,7 +316,7 @@ void wxTextCtrl::SetValue(const wxString& value) delete[] tmp; } else - SetWindowText(GetHwnd(), (const char *)value); + SetWindowText(GetHwnd(), (const wxChar *)value); AdjustSpaceLimit(); } @@ -486,7 +486,7 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value) SendMessage(hWnd, WM_CUT, (WPARAM)0, (LPARAM)0); // Now replace with 'value', by pasting. - wxSetClipboardData(wxDF_TEXT, (wxObject *) (const char *)value, 0, 0); + wxSetClipboardData(wxDF_TEXT, (wxObject *) (const wxChar *)value, 0, 0); // Paste into edit control SendMessage(hWnd, WM_PASTE, (WPARAM)0, (LPARAM)0L); @@ -543,7 +543,7 @@ bool wxTextCtrl::LoadFile(const wxString& file) Clear(); // ifstream input(WXSTRINGCAST file, ios::nocreate | ios::in); - ifstream input(WXSTRINGCAST file, ios::in); + ifstream input(MBSTRINGCAST file.mb_str(wxConvFile), ios::in); if (!input.bad()) { @@ -555,31 +555,37 @@ bool wxTextCtrl::LoadFile(const wxString& file) #ifdef __SALFORDC__ struct _stat stat_buf; - if (stat((char*) (const char*) file, &stat_buf) < 0) + if (stat(MBSTRINGCAST file.mb_str(wxConvFile), &stat_buf) < 0) return FALSE; #else struct stat stat_buf; - if (stat(file, &stat_buf) < 0) + if (stat(file.mb_str(wxConvFile), &stat_buf) < 0) return FALSE; #endif -// char *tmp_buffer = (char*)farmalloc(stat_buf.st_size+1); +// wxChar *tmp_buffer = (wxChar*)farmalloc(stat_buf.st_size+1); // This may need to be a bigger buffer than the file size suggests, // if it's a UNIX file. Give it an extra 1000 just in case. - char *tmp_buffer = (char*)farmalloc((size_t)(stat_buf.st_size+1+1000)); + wxChar *tmp_buffer = (wxChar*)farmalloc((size_t)(stat_buf.st_size+1+1000)); + char *read_buffer = new char[512]; long no_lines = 0; long pos = 0; while (!input.eof() && input.peek() != EOF) { - input.getline(wxBuffer, 500); - int len = strlen(wxBuffer); + input.getline(read_buffer, 500); + int len = strlen(read_buffer); wxBuffer[len] = 13; wxBuffer[len+1] = 10; wxBuffer[len+2] = 0; - strcpy(tmp_buffer+pos, wxBuffer); - pos += strlen(wxBuffer); +#if wxUSE_UNICODE + pos += wxConvCurrent->MB2WC(tmp_buffer+pos, read_buffer, (size_t)-1); +#else + strcpy(tmp_buffer+pos, read_buffer); + pos += strlen(read_buffer); +#endif no_lines++; } + delete[] read_buffer; SetWindowText(GetHwnd(), tmp_buffer); SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L); @@ -599,15 +605,15 @@ bool wxTextCtrl::SaveFile(const wxString& file) { wxString theFile(file); - if (theFile == "") + if (theFile == _T("")) theFile = m_fileName; - if (theFile == "") + if (theFile == _T("")) return FALSE; m_fileName = theFile; - ofstream output((char*) (const char*) theFile); + ofstream output(MBSTRINGCAST theFile.mb_str(wxConvFile)); if (output.bad()) return FALSE; @@ -664,7 +670,7 @@ void wxTextCtrl::AppendText(const wxString& text) void wxTextCtrl::Clear() { - SetWindowText(GetHwnd(), ""); + SetWindowText(GetHwnd(), _T("")); } bool wxTextCtrl::IsModified() const @@ -1002,7 +1008,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const wxString& s) wxTextCtrl& wxTextCtrl::operator<<(float f) { wxString str; - str.Printf("%.2f", f); + str.Printf(_T("%.2f"), f); AppendText(str); return *this; } @@ -1010,7 +1016,7 @@ wxTextCtrl& wxTextCtrl::operator<<(float f) wxTextCtrl& wxTextCtrl::operator<<(double d) { wxString str; - str.Printf("%.2f", d); + str.Printf(_T("%.2f"), d); AppendText(str); return *this; } @@ -1018,7 +1024,7 @@ wxTextCtrl& wxTextCtrl::operator<<(double d) wxTextCtrl& wxTextCtrl::operator<<(int i) { wxString str; - str.Printf("%d", i); + str.Printf(_T("%d"), i); AppendText(str); return *this; } @@ -1026,7 +1032,7 @@ wxTextCtrl& wxTextCtrl::operator<<(int i) wxTextCtrl& wxTextCtrl::operator<<(long i) { wxString str; - str.Printf("%ld", i); + str.Printf(_T("%ld"), i); AppendText(str); return *this; } diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 1b26944ae7..ba50980e8e 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -105,7 +105,7 @@ wxMutex::wxMutex() wxMutex::~wxMutex() { if (m_locked > 0) - wxLogDebug("Warning: freeing a locked mutex (%d locks).", m_locked); + wxLogDebug(_T("Warning: freeing a locked mutex (%d locks)."), m_locked); CloseHandle(p_internal->p_mutex); } @@ -129,7 +129,7 @@ wxMutexError wxMutex::Lock() case WAIT_TIMEOUT: default: - wxFAIL_MSG("impossible return value in wxMutex::Lock"); + wxFAIL_MSG(_T("impossible return value in wxMutex::Lock")); } m_locked++; @@ -375,7 +375,7 @@ bool wxThreadInternal::Create(wxThread *thread) win_priority = THREAD_PRIORITY_HIGHEST; else { - wxFAIL_MSG("invalid value of thread priority parameter"); + wxFAIL_MSG(_T("invalid value of thread priority parameter")); win_priority = THREAD_PRIORITY_NORMAL; } @@ -575,7 +575,7 @@ wxThread::ExitCode wxThread::Delete() break; default: - wxFAIL_MSG("unexpected result of MsgWaitForMultipleObject"); + wxFAIL_MSG(_T("unexpected result of MsgWaitForMultipleObject")); } } while ( result != WAIT_OBJECT_0 ); @@ -594,7 +594,7 @@ wxThread::ExitCode wxThread::Delete() } wxASSERT_MSG( (LPVOID)rc != (LPVOID)STILL_ACTIVE, - "thread must be already terminated." ); + _T("thread must be already terminated.") ); ::CloseHandle(hThread); } @@ -625,7 +625,7 @@ void wxThread::Exit(void *status) ::ExitThread((DWORD)status); - wxFAIL_MSG("Couldn't return from ExitThread()!"); + wxFAIL_MSG(_T("Couldn't return from ExitThread()!")); } void wxThread::SetPriority(unsigned int prio) @@ -770,7 +770,7 @@ void WXDLLEXPORT wxMutexGuiEnter() { // this would dead lock everything... wxASSERT_MSG( !wxThread::IsMain(), - "main thread doesn't want to block in wxMutexGuiEnter()!" ); + _T("main thread doesn't want to block in wxMutexGuiEnter()!") ); // the order in which we enter the critical sections here is crucial!! @@ -800,7 +800,7 @@ void WXDLLEXPORT wxMutexGuiLeave() { // decrement the number of waiters now wxASSERT_MSG( s_nWaitingForGui > 0, - "calling wxMutexGuiLeave() without entering it first?" ); + _T("calling wxMutexGuiLeave() without entering it first?") ); s_nWaitingForGui--; @@ -813,7 +813,7 @@ void WXDLLEXPORT wxMutexGuiLeave() void WXDLLEXPORT wxMutexGuiLeaveOrEnter() { wxASSERT_MSG( wxThread::IsMain(), - "only main thread may call wxMutexGuiLeaveOrEnter()!" ); + _T("only main thread may call wxMutexGuiLeaveOrEnter()!") ); wxCriticalSectionLocker enter(*s_critsectWaitingForGui); diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 334fe2c99b..6189c29160 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -90,7 +90,7 @@ bool wxTimer::Start(int milliseconds, bool mode) if (milliseconds < 0) milliseconds = lastMilli; - wxCHECK_MSG( milliseconds > 0, FALSE, "invalid value for timer timeour" ); + wxCHECK_MSG( milliseconds > 0, FALSE, _T("invalid value for timer timeour") ); lastMilli = milli = milliseconds; @@ -143,7 +143,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) { wxNode *node = wxTimerList.Find((long)idTimer); - wxCHECK_MSG( node, 0, "bogus timer id in wxTimerProc" ); + wxCHECK_MSG( node, 0, _T("bogus timer id in wxTimerProc") ); wxProcessTimer(*(wxTimer *)node->Data()); diff --git a/src/msw/tooltip.cpp b/src/msw/tooltip.cpp index f17e964b68..c119026190 100644 --- a/src/msw/tooltip.cpp +++ b/src/msw/tooltip.cpp @@ -111,7 +111,7 @@ static void SendTooltipMessageToAll(UINT msg, WPARAM wParam, LPARAM lParam) continue; } - wxASSERT_MSG( dialog || frame, "logic error" ); + wxASSERT_MSG( dialog || frame, _T("logic error") ); WXHWND hwndTT = frame ? frame->GetToolTipCtrl() : dialog->GetToolTipCtrl(); @@ -173,7 +173,7 @@ WXHWND wxToolTip::GetToolTipCtrl() } wxCHECK_MSG( frame || dialog, 0, - "can't create tooltip control outside a frame or a dialog" ); + _T("can't create tooltip control outside a frame or a dialog") ); HWND hwndTT = (HWND)(frame ? frame->GetToolTipCtrl() : dialog->GetToolTipCtrl()); @@ -271,7 +271,7 @@ void wxToolTip::SetTip(const wxString& tip) { // update it immediately wxToolInfo ti(m_window); - ti.lpszText = (char *)m_text.c_str(); + ti.lpszText = (wxChar *)m_text.c_str(); (void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti); } diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index e61d985c06..d519c144c0 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -160,7 +160,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, ( exStyle, WC_TREEVIEW, - "", + _T(""), wstyle, pos.x, pos.y, size.x, size.y, (HWND)parent->GetHWND(), @@ -169,7 +169,7 @@ bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, NULL ); - wxCHECK_MSG( m_hWnd, FALSE, "Failed to create tree ctrl" ); + wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create tree ctrl") ); if ( parent ) parent->AddChild(this); @@ -287,7 +287,7 @@ size_t wxTreeCtrl::GetChildrenCount(const wxTreeItemId& item, bool recursively) wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const { - char buf[512]; // the size is arbitrary... + wxChar buf[512]; // the size is arbitrary... wxTreeViewItem tvItem(item, TVIF_TEXT); tvItem.pszText = buf; @@ -295,7 +295,7 @@ wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const if ( !DoGetItem(&tvItem) ) { // don't return some garbage which was on stack, but an empty string - buf[0] = '\0'; + buf[0] = _T('\0'); } return wxString(buf); @@ -304,7 +304,7 @@ wxString wxTreeCtrl::GetItemText(const wxTreeItemId& item) const void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text) { wxTreeViewItem tvItem(item, TVIF_TEXT); - tvItem.pszText = (char *)text.c_str(); // conversion is ok + tvItem.pszText = (wxChar *)text.c_str(); // conversion is ok DoSetItem(&tvItem); } @@ -495,16 +495,16 @@ wxTreeItemId wxTreeCtrl::GetFirstVisibleItem() const wxTreeItemId wxTreeCtrl::GetNextVisible(const wxTreeItemId& item) const { - wxASSERT_MSG( IsVisible(item), "The item you call GetNextVisible() " - "for must be visible itself!"); + wxASSERT_MSG( IsVisible(item), _T("The item you call GetNextVisible() " + "for must be visible itself!")); return wxTreeItemId((WXHTREEITEM) TreeView_GetNextVisible(wxhWnd, (HTREEITEM) (WXHTREEITEM) item)); } wxTreeItemId wxTreeCtrl::GetPrevVisible(const wxTreeItemId& item) const { - wxASSERT_MSG( IsVisible(item), "The item you call GetPrevVisible() " - "for must be visible itself!"); + wxASSERT_MSG( IsVisible(item), _T("The item you call GetPrevVisible() " + "for must be visible itself!")); return wxTreeItemId((WXHTREEITEM) TreeView_GetPrevVisible(wxhWnd, (HTREEITEM) (WXHTREEITEM) item)); } @@ -533,7 +533,7 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, if ( !text.IsEmpty() ) { mask |= TVIF_TEXT; - tvIns.item.pszText = (char *)text.c_str(); // cast is ok + tvIns.item.pszText = (wxChar *)text.c_str(); // cast is ok } if ( image != -1 ) @@ -668,7 +668,7 @@ void wxTreeCtrl::DoExpand(const wxTreeItemId& item, int flag) flag == (TVE_COLLAPSE | TVE_COLLAPSERESET) || flag == TVE_EXPAND || flag == TVE_TOGGLE, - "Unknown flag in wxTreeCtrl::DoExpand" ); + _T("Unknown flag in wxTreeCtrl::DoExpand") ); // TreeView_Expand doesn't send TVN_ITEMEXPAND(ING) messages, so we must // emulate them @@ -691,7 +691,7 @@ void wxTreeCtrl::DoExpand(const wxTreeItemId& item, int flag) else { // I wonder if it really ever happens... - wxLogDebug("TreeView_Expand: change didn't took place."); + wxLogDebug(_T("TreeView_Expand: change didn't took place.")); } } @@ -770,7 +770,7 @@ wxTextCtrl* wxTreeCtrl::EditLabel(const wxTreeItemId& item, HWND hWnd = (HWND) TreeView_EditLabel(wxhWnd, (HTREEITEM) (WXHTREEITEM) item); - wxCHECK_MSG( hWnd, NULL, "Can't edit tree ctrl label" ); + wxCHECK_MSG( hWnd, NULL, _T("Can't edit tree ctrl label") ); DeleteTextCtrl(); @@ -856,7 +856,7 @@ static int CALLBACK TreeView_CompareCallback(wxTreeItemData *pItem1, int wxTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2) { - return strcmp(GetItemText(item1), GetItemText(item2)); + return wxStrcmp(GetItemText(item1), GetItemText(item2)); } void wxTreeCtrl::SortChildren(const wxTreeItemId& item) @@ -995,8 +995,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; default: - wxLogDebug("unexpected code %d in TVN_ITEMEXPAND " - "message", tv->action); + wxLogDebug(_T("unexpected code %d in TVN_ITEMEXPAND " + "message"), tv->action); } bool ing = (hdr->code == TVN_ITEMEXPANDING); diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index c9c1d5b68a..574c346ba7 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -109,10 +109,10 @@ /// END for console support // In the WIN.INI file -static const char WX_SECTION[] = "wxWindows"; -static const char eHOSTNAME[] = "HostName"; -static const char eUSERID[] = "UserId"; -static const char eUSERNAME[] = "UserName"; +static const wxChar WX_SECTION[] = _T("wxWindows"); +static const wxChar eHOSTNAME[] = _T("HostName"); +static const wxChar eUSERID[] = _T("UserId"); +static const wxChar eUSERNAME[] = _T("UserName"); // For the following functions we SHOULD fill in support // for Windows-NT (which I don't know) as I assume it begin @@ -120,26 +120,26 @@ static const char eUSERNAME[] = "UserName"; // functions beyond those provided by WinSock // Get full hostname (eg. DoDo.BSn-Germany.crg.de) -bool wxGetHostName(char *buf, int maxSize) +bool wxGetHostName(wxChar *buf, int maxSize) { #if defined(__WIN32__) && !defined(__TWIN32__) DWORD nSize = maxSize; return (::GetComputerName(buf, &nSize) != 0); #else - char *sysname; - const char *default_host = "noname"; + wxChar *sysname; + const wxChar *default_host = _T("noname"); - if ((sysname = getenv("SYSTEM_NAME")) == NULL) { + if ((sysname = wxGetenv(_T("SYSTEM_NAME"))) == NULL) { GetProfileString(WX_SECTION, eHOSTNAME, default_host, buf, maxSize - 1); } else - strncpy(buf, sysname, maxSize - 1); - buf[maxSize] = '\0'; + wxStrncpy(buf, sysname, maxSize - 1); + buf[maxSize] = _T('\0'); return *buf ? TRUE : FALSE; #endif } // Get user ID e.g. jacs -bool wxGetUserId(char *buf, int maxSize) +bool wxGetUserId(wxChar *buf, int maxSize) { #if defined(__WIN32__) && !defined(__win32s__) && !defined(__TWIN32__) @@ -192,7 +192,7 @@ bool wxGetUserId(char *buf, int maxSize) DWORD nSize = maxSize; if ( ::GetUserName(buf, &nSize) == 0 ) { - wxLogSysError("Can not get user name"); + wxLogSysError(_T("Can not get user name")); return FALSE; } @@ -201,23 +201,23 @@ bool wxGetUserId(char *buf, int maxSize) #endif // 0/1 #else // Win16 or Win32s - char *user; - const char *default_id = "anonymous"; + wxChar *user; + const wxChar *default_id = _T("anonymous"); // Can't assume we have NIS (PC-NFS) or some other ID daemon // So we ... - if ( (user = getenv("USER")) == NULL && - (user = getenv("LOGNAME")) == NULL ) { + if ( (user = wxGetenv(_T("USER"))) == NULL && + (user = wxGetenv(_T("LOGNAME"))) == NULL ) { // Use wxWindows configuration data (comming soon) GetProfileString(WX_SECTION, eUSERID, default_id, buf, maxSize - 1); } else - strncpy(buf, user, maxSize - 1); + wxStrncpy(buf, user, maxSize - 1); return *buf ? TRUE : FALSE; #endif } // Get user name e.g. Julian Smart -bool wxGetUserName(char *buf, int maxSize) +bool wxGetUserName(wxChar *buf, int maxSize) { #if wxUSE_PENWINDOWS && !defined(__WATCOMC__) && !defined(__GNUWIN32__) extern HANDLE g_hPenWin; // PenWindows Running? @@ -233,7 +233,7 @@ bool wxGetUserName(char *buf, int maxSize) { // Could use NIS, MS-Mail or other site specific programs // Use wxWindows configuration data - bool ok = GetProfileString(WX_SECTION, eUSERNAME, "", buf, maxSize - 1) != 0; + bool ok = GetProfileString(WX_SECTION, eUSERNAME, _T(""), buf, maxSize - 1) != 0; if ( !ok ) { ok = wxGetUserId(buf, maxSize); @@ -241,7 +241,7 @@ bool wxGetUserName(char *buf, int maxSize) if ( !ok ) { - strncpy(buf, "Unknown User", maxSize); + wxStrncpy(buf, _T("Unknown User"), maxSize); } } @@ -259,17 +259,17 @@ int wxKill(long pid, int sig) bool wxShell(const wxString& command) { - char *shell; - if ((shell = getenv("COMSPEC")) == NULL) - shell = "\\COMMAND.COM"; + wxChar *shell; + if ((shell = wxGetenv(_T("COMSPEC"))) == NULL) + shell = _T("\\COMMAND.COM"); - char tmp[255]; - if (command != "") - sprintf(tmp, "%s /c %s", shell, WXSTRINGCAST command); + wxChar tmp[255]; + if (command != _T("")) + wxSprintf(tmp, _T("%s /c %s"), shell, WXSTRINGCAST command); else - strcpy(tmp, shell); + wxStrcpy(tmp, shell); - return (wxExecute((char *)tmp, FALSE) != 0); + return (wxExecute((wxChar *)tmp, FALSE) != 0); } // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) @@ -348,10 +348,10 @@ void wxFlushEvents() } // Output a debug mess., in a system dependent fashion. -void wxDebugMsg(const char *fmt ...) +void wxDebugMsg(const wxChar *fmt ...) { va_list ap; - static char buffer[512]; + static wxChar buffer[512]; if (!wxTheApp->GetWantDebugOutput()) return ; @@ -359,7 +359,7 @@ void wxDebugMsg(const char *fmt ...) va_start(ap, fmt); wvsprintf(buffer,fmt,ap) ; - OutputDebugString((LPCSTR)buffer) ; + OutputDebugString((LPCTSTR)buffer) ; va_end(ap); } @@ -367,8 +367,8 @@ void wxDebugMsg(const char *fmt ...) // Non-fatal error: pop up message box and (possibly) continue void wxError(const wxString& msg, const wxString& title) { - sprintf(wxBuffer, "%s\nContinue?", WXSTRINGCAST msg); - if (MessageBox(NULL, (LPCSTR)wxBuffer, (LPCSTR)WXSTRINGCAST title, + wxSprintf(wxBuffer, _T("%s\nContinue?"), WXSTRINGCAST msg); + if (MessageBox(NULL, (LPCTSTR)wxBuffer, (LPCTSTR)WXSTRINGCAST title, MB_ICONSTOP | MB_YESNO) == IDNO) wxExit(); } @@ -376,8 +376,8 @@ void wxError(const wxString& msg, const wxString& title) // Fatal error: pop up message box and abort void wxFatalError(const wxString& msg, const wxString& title) { - sprintf(wxBuffer, "%s: %s", WXSTRINGCAST title, WXSTRINGCAST msg); - FatalAppExit(0, (LPCSTR)wxBuffer); + wxSprintf(wxBuffer, _T("%s: %s"), WXSTRINGCAST title, WXSTRINGCAST msg); + FatalAppExit(0, (LPCTSTR)wxBuffer); } // Emit a beeeeeep @@ -444,48 +444,48 @@ int wxGetOsVersion(int *majorVsn, int *minorVsn) #if wxUSE_RESOURCES bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file) { - if (file != "") - return (WritePrivateProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)value, (LPCSTR)WXSTRINGCAST file) != 0); + if (file != _T("")) + return (WritePrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)value, (LPCTSTR)WXSTRINGCAST file) != 0); else - return (WriteProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)WXSTRINGCAST value) != 0); + return (WriteProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)WXSTRINGCAST value) != 0); } bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) { - char buf[50]; - sprintf(buf, "%.4f", value); + wxChar buf[50]; + wxSprintf(buf, _T("%.4f"), value); return wxWriteResource(section, entry, buf, file); } bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file) { - char buf[50]; - sprintf(buf, "%ld", value); + wxChar buf[50]; + wxSprintf(buf, _T("%ld"), value); return wxWriteResource(section, entry, buf, file); } bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file) { - char buf[50]; - sprintf(buf, "%d", value); + wxChar buf[50]; + wxSprintf(buf, _T("%d"), value); return wxWriteResource(section, entry, buf, file); } -bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file) +bool wxGetResource(const wxString& section, const wxString& entry, wxChar **value, const wxString& file) { - static const char defunkt[] = "$$default"; - if (file != "") + static const wxChar defunkt[] = _T("$$default"); + if (file != _T("")) { - int n = GetPrivateProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)defunkt, - (LPSTR)wxBuffer, 1000, (LPCSTR)WXSTRINGCAST file); - if (n == 0 || strcmp(wxBuffer, defunkt) == 0) + int n = GetPrivateProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt, + (LPTSTR)wxBuffer, 1000, (LPCTSTR)WXSTRINGCAST file); + if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0) return FALSE; } else { - int n = GetProfileString((LPCSTR)WXSTRINGCAST section, (LPCSTR)WXSTRINGCAST entry, (LPCSTR)defunkt, - (LPSTR)wxBuffer, 1000); - if (n == 0 || strcmp(wxBuffer, defunkt) == 0) + int n = GetProfileString((LPCTSTR)WXSTRINGCAST section, (LPCTSTR)WXSTRINGCAST entry, (LPCTSTR)defunkt, + (LPTSTR)wxBuffer, 1000); + if (n == 0 || wxStrcmp(wxBuffer, defunkt) == 0) return FALSE; } if (*value) delete[] (*value); @@ -495,11 +495,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value, bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file) { - char *s = NULL; - bool succ = wxGetResource(section, entry, (char **)&s, file); + wxChar *s = NULL; + bool succ = wxGetResource(section, entry, (wxChar **)&s, file); if (succ) { - *value = (float)strtod(s, NULL); + *value = (float)wxStrtod(s, NULL); delete[] s; return TRUE; } @@ -508,11 +508,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value, bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file) { - char *s = NULL; - bool succ = wxGetResource(section, entry, (char **)&s, file); + wxChar *s = NULL; + bool succ = wxGetResource(section, entry, (wxChar **)&s, file); if (succ) { - *value = strtol(s, NULL, 10); + *value = wxStrtol(s, NULL, 10); delete[] s; return TRUE; } @@ -521,11 +521,11 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value, bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file) { - char *s = NULL; - bool succ = wxGetResource(section, entry, (char **)&s, file); + wxChar *s = NULL; + bool succ = wxGetResource(section, entry, (wxChar **)&s, file); if (succ) { - *value = (int)strtol(s, NULL, 10); + *value = (int)wxStrtol(s, NULL, 10); delete[] s; return TRUE; } @@ -556,7 +556,7 @@ void wxBeginBusyCursor(wxCursor *cursor) void wxEndBusyCursor() { wxCHECK_RET( gs_wxBusyCursorCount > 0, - "no matching wxBeginBusyCursor() for wxEndBusyCursor()" ); + _T("no matching wxBeginBusyCursor() for wxEndBusyCursor()") ); if ( --gs_wxBusyCursorCount == 0 ) { @@ -573,29 +573,29 @@ bool wxIsBusy() } // --------------------------------------------------------------------------- -const char* wxGetHomeDir(wxString *pstr) +const wxChar* wxGetHomeDir(wxString *pstr) { wxString& strDir = *pstr; #if defined(__UNIX__) && !defined(__TWIN32__) - const char *szHome = getenv("HOME"); + const wxChar *szHome = wxGetenv("HOME"); if ( szHome == NULL ) { // we're homeless... wxLogWarning(_("can't find user's HOME, using current directory.")); - strDir = "."; + strDir = _T("."); } else strDir = szHome; // add a trailing slash if needed - if ( strDir.Last() != '/' ) - strDir << '/'; + if ( strDir.Last() != _T('/') ) + strDir << _T('/'); #else // Windows #ifdef __WIN32__ - const char *szHome = getenv("HOMEDRIVE"); + const wxChar *szHome = wxGetenv(_T("HOMEDRIVE")); if ( szHome != NULL ) strDir << szHome; - szHome = getenv("HOMEPATH"); + szHome = wxGetenv(_T("HOMEPATH")); if ( szHome != NULL ) { strDir << szHome; @@ -605,7 +605,7 @@ const char* wxGetHomeDir(wxString *pstr) // create it in our program's dir. However, if the user took care // to set HOMEPATH to something other than "\\", we suppose that he // knows what he is doing and use the supplied value. - if ( strcmp(szHome, "\\") != 0 ) + if ( wxStrcmp(szHome, _T("\\")) != 0 ) return strDir.c_str(); } @@ -632,29 +632,29 @@ const char* wxGetHomeDir(wxString *pstr) } // Hack for MS-DOS -char *wxGetUserHome (const wxString& user) +wxChar *wxGetUserHome (const wxString& user) { - char *home; + wxChar *home; wxString user1(user); - if (user1 != "") { - char tmp[64]; + if (user1 != _T("")) { + wxChar tmp[64]; if (wxGetUserId(tmp, sizeof(tmp)/sizeof(char))) { // Guests belong in the temp dir - if (Stricmp(tmp, "annonymous") == 0) { - if ((home = getenv("TMP")) != NULL || - (home = getenv("TMPDIR")) != NULL || - (home = getenv("TEMP")) != NULL) - return *home ? home : (char*)"\\"; + if (wxStricmp(tmp, _T("annonymous")) == 0) { + if ((home = wxGetenv(_T("TMP"))) != NULL || + (home = wxGetenv(_T("TMPDIR"))) != NULL || + (home = wxGetenv(_T("TEMP"))) != NULL) + return *home ? home : (wxChar*)_T("\\"); } - if (Stricmp(tmp, WXSTRINGCAST user1) == 0) - user1 = ""; + if (wxStricmp(tmp, WXSTRINGCAST user1) == 0) + user1 = _T(""); } } - if (user1 == "") - if ((home = getenv("HOME")) != NULL) + if (user1 == _T("")) + if ((home = wxGetenv(_T("HOME"))) != NULL) { - strcpy(wxBuffer, home); + wxStrcpy(wxBuffer, home); Unix2DosFilename(wxBuffer); return wxBuffer; } @@ -675,7 +675,7 @@ bool wxCheckForInterrupt(wxWindow *wnd) return TRUE;//*** temporary? } else{ - wxFAIL_MSG("wnd==NULL !!!"); + wxFAIL_MSG(_T("wnd==NULL !!!")); return FALSE;//*** temporary? } @@ -685,9 +685,9 @@ bool wxCheckForInterrupt(wxWindow *wnd) // Returns NULL or newly-allocated memory, so use delete[] to clean up. #ifdef __WXMSW__ -char *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) +wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) { - char *s = NULL; + wxChar *s = NULL; #if !defined(__WIN32__) || defined(__TWIN32__) HRSRC hResource = ::FindResource(wxGetInstance(), WXSTRINGCAST resourceName, WXSTRINGCAST resourceType); #else @@ -703,7 +703,7 @@ char *wxLoadUserResource(const wxString& resourceName, const wxString& resourceT HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource); if (hData == 0) return NULL; - char *theText = (char *)LockResource(hData); + wxChar *theText = (wxChar *)LockResource(hData); if (!theText) return NULL; @@ -1053,18 +1053,18 @@ http://ftp.digital.com/pub/micro/NT/WinSite/programr/dbwin32.zip #include #endif -void OutputDebugStringW95(const char* lpOutputString, ...) +void OutputDebugStringW95(const wxChar* lpOutputString, ...) { HANDLE heventDBWIN; /* DBWIN32 synchronization object */ HANDLE heventData; /* data passing synch object */ HANDLE hSharedFile; /* memory mapped file shared data */ LPSTR lpszSharedMem; - char achBuffer[500]; + wxChar achBuffer[500]; /* create the output buffer */ va_list args; va_start(args, lpOutputString); - vsprintf(achBuffer, lpOutputString, args); + wxVsprintf(achBuffer, lpOutputString, args); va_end(args); /* @@ -1094,26 +1094,26 @@ void OutputDebugStringW95(const char* lpOutputString, ...) } /* make sure DBWIN is open and waiting */ - heventDBWIN = OpenEvent(EVENT_MODIFY_STATE, FALSE, "DBWIN_BUFFER_READY"); + heventDBWIN = OpenEvent(EVENT_MODIFY_STATE, FALSE, _T("DBWIN_BUFFER_READY")); if ( !heventDBWIN ) { - //MessageBox(NULL, "DBWIN_BUFFER_READY nonexistent", NULL, MB_OK); + //MessageBox(NULL, _T("DBWIN_BUFFER_READY nonexistent"), NULL, MB_OK); return; } /* get a handle to the data synch object */ - heventData = OpenEvent(EVENT_MODIFY_STATE, FALSE, "DBWIN_DATA_READY"); + heventData = OpenEvent(EVENT_MODIFY_STATE, FALSE, _T("DBWIN_DATA_READY")); if ( !heventData ) { - // MessageBox(NULL, "DBWIN_DATA_READY nonexistent", NULL, MB_OK); + // MessageBox(NULL, _T("DBWIN_DATA_READY nonexistent"), NULL, MB_OK); CloseHandle(heventDBWIN); return; } - hSharedFile = CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, 4096, "DBWIN_BUFFER"); + hSharedFile = CreateFileMapping((HANDLE)-1, NULL, PAGE_READWRITE, 0, 4096, _T("DBWIN_BUFFER")); if (!hSharedFile) { - //MessageBox(NULL, "DebugTrace: Unable to create file mapping object DBWIN_BUFFER", "Error", MB_OK); + //MessageBox(NULL, _T("DebugTrace: Unable to create file mapping object DBWIN_BUFFER"), _T("Error"), MB_OK); CloseHandle(heventDBWIN); CloseHandle(heventData); return; @@ -1122,7 +1122,7 @@ void OutputDebugStringW95(const char* lpOutputString, ...) lpszSharedMem = (LPSTR)MapViewOfFile(hSharedFile, FILE_MAP_WRITE, 0, 0, 512); if (!lpszSharedMem) { - //MessageBox(NULL, "DebugTrace: Unable to map shared memory", "Error", MB_OK); + //MessageBox(NULL, _T("DebugTrace: Unable to map shared memory"), _T("Error"), MB_OK); CloseHandle(heventDBWIN); CloseHandle(heventData); return; @@ -1138,7 +1138,7 @@ void OutputDebugStringW95(const char* lpOutputString, ...) *((LPDWORD)lpszSharedMem) = _getpid(); #endif - wsprintf(lpszSharedMem + sizeof(DWORD), "%s", achBuffer); + wsprintf((LPTSTR)(lpszSharedMem + sizeof(DWORD)), _T("%s"), achBuffer); /* signal data ready event */ SetEvent(heventData); diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 9f23fca1f4..0c566962da 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -106,7 +106,7 @@ static DWORD wxExecuteThread(wxExecuteData *data) } wxASSERT_MSG( data->dwExitCode != STILL_ACTIVE, - "process should have terminated" ); + _T("process should have terminated") ); // send a message indicating process termination to the window SendMessage(data->hWnd, wxWM_PROC_TERMINATED, 0, (LPARAM)data); @@ -147,11 +147,11 @@ LRESULT APIENTRY _EXPORT wxExecuteWindowCbk(HWND hWnd, UINT message, return 0; } -extern char wxPanelClassName[]; +extern wxChar wxPanelClassName[]; long wxExecute(const wxString& command, bool sync, wxProcess *handler) { - wxCHECK_MSG( !!command, 0, "empty command in wxExecute" ); + wxCHECK_MSG( !!command, 0, _T("empty command in wxExecute") ); #if defined(__WIN32__) && !defined(__TWIN32__) // the old code is disabled because we really need a process handle @@ -223,7 +223,7 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler) if ( ::CreateProcess( NULL, // application name (use only cmd line) - (char *)command.c_str(), // full command line + (wxChar *)command.c_str(), // full command line NULL, // security attributes: defaults for both NULL, // the process and its main thread FALSE, // don't inherit handles @@ -247,7 +247,7 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler) // termination HWND hwnd = ::CreateWindow(wxPanelClassName, NULL, 0, 0, 0, 0, 0, NULL, (HMENU)NULL, wxGetInstance(), 0); - wxASSERT_MSG( hwnd, "can't create a hidden window for wxExecute" ); + wxASSERT_MSG( hwnd, _T("can't create a hidden window for wxExecute") ); FARPROC ExecuteWindowInstance = MakeProcInstance((FARPROC)wxExecuteWindowCbk, wxGetInstance()); @@ -262,7 +262,7 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler) data->state = sync; if ( sync ) { - wxASSERT_MSG( !handler, "wxProcess param ignored for sync execution" ); + wxASSERT_MSG( !handler, _T("wxProcess param ignored for sync execution") ); data->handler = NULL; } diff --git a/src/msw/wave.cpp b/src/msw/wave.cpp index 805a64fa0e..df4b95ee74 100644 --- a/src/msw/wave.cpp +++ b/src/msw/wave.cpp @@ -73,9 +73,13 @@ bool wxWave::Create(const wxString& fileName, bool isResource) HRSRC hresInfo; #if defined(__WIN32__) && !defined(__TWIN32__) - hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, "WAVE"); +#ifdef _UNICODE + hresInfo = ::FindResourceW((HMODULE) wxhInstance, fileName, _T("WAVE")); #else - hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, "WAVE"); + hresInfo = ::FindResourceA((HMODULE) wxhInstance, fileName, _T("WAVE")); +#endif +#else + hresInfo = ::FindResource((HMODULE) wxhInstance, fileName, _T("WAVE")); #endif if (!hresInfo) return FALSE; @@ -129,7 +133,7 @@ bool wxWave::Play(bool async, bool looped) const return FALSE; #ifdef __WIN32__ - return ( ::PlaySound((LPCSTR)m_waveData, NULL, SND_MEMORY | + return ( ::PlaySound((LPCTSTR)m_waveData, NULL, SND_MEMORY | SND_NODEFAULT | (async ? SND_ASYNC : SND_SYNC) | (looped ? (SND_LOOP | SND_ASYNC) : 0)) != 0 ); #else return ( ::sndPlaySound((LPCSTR)m_waveData, SND_MEMORY | diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 48ccd27be1..766391e26e 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -117,7 +117,7 @@ extern MSG s_currentMsg; wxMenu *wxCurrentPopupMenu = NULL; extern wxList WXDLLEXPORT wxPendingDelete; -extern char wxCanvasClassName[]; +extern wxChar wxCanvasClassName[]; #ifdef __WXDEBUG__ // see comments in dcclient.cpp where g_isPainting is defined @@ -301,7 +301,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - wxCHECK_MSG( parent, FALSE, "can't create wxWindow without parent" ); + wxCHECK_MSG( parent, FALSE, _T("can't create wxWindow without parent") ); CreateBase(parent, id, pos, size, style, name); @@ -796,7 +796,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect) void wxWindow::SubclassWin(WXHWND hWnd) { - wxASSERT_MSG( !m_oldWndProc, "subclassing window twice?" ); + wxASSERT_MSG( !m_oldWndProc, _T("subclassing window twice?") ); wxAssociateWinWithHandle((HWND)hWnd, this); @@ -1295,7 +1295,7 @@ void wxWindow::GetTextExtent(const wxString& string, SIZE sizeRect; TEXTMETRIC tm; - GetTextExtentPoint(dc, (const char *)string, (int)string.Length(), &sizeRect); + GetTextExtentPoint(dc, (const wxChar *)string, (int)string.Length(), &sizeRect); GetTextMetrics(dc, &tm); if ( fontToUse && fnt && hfontOld ) @@ -1589,7 +1589,7 @@ LRESULT APIENTRY _EXPORT wxWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARA { // trace all messages - useful for the debugging #ifdef __WXDEBUG__ - wxLogTrace(wxTraceMessages, "Processing %s(wParam=%8lx, lParam=%8lx)", + wxLogTrace(wxTraceMessages, _T("Processing %s(wParam=%8lx, lParam=%8lx)"), wxGetMessageName(message), wParam, lParam); #endif // __WXDEBUG__ @@ -1966,7 +1966,7 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) if ( !processed ) { #ifdef __WXDEBUG__ - wxLogTrace(wxTraceMessages, "Forwarding %s to DefWindowProc.", + wxLogTrace(wxTraceMessages, _T("Forwarding %s to DefWindowProc."), wxGetMessageName(message)); #endif // __WXDEBUG__ rc.result = MSWDefWindowProc(message, wParam, lParam); @@ -2007,7 +2007,7 @@ void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win) // adding NULL hWnd is (first) surely a result of an error and // (secondly) breaks menu command processing wxCHECK_RET( hWnd != (HWND)NULL, - "attempt to add a NULL hWnd to window list ignored" ); + _T("attempt to add a NULL hWnd to window list ignored") ); if ( !wxWinHandleList->Find((long)hWnd) ) wxWinHandleList->Append((long)hWnd, win); @@ -2034,16 +2034,16 @@ void wxWindow::MSWDetachWindowMenu() int i; for (i = 0; i < N; i++) { - char buf[100]; + wxChar buf[100]; int chars = GetMenuString(hMenu, i, buf, 100, MF_BYPOSITION); if ( !chars ) { - wxLogLastError("GetMenuString"); + wxLogLastError(_T("GetMenuString")); continue; } - if ( strcmp(buf, "&Window") == 0 ) + if ( wxStrcmp(buf, _T("&Window")) == 0 ) { RemoveMenu(hMenu, i, MF_BYPOSITION); @@ -2055,15 +2055,15 @@ void wxWindow::MSWDetachWindowMenu() bool wxWindow::MSWCreate(int id, wxWindow *parent, - const char *wclass, + const wxChar *wclass, wxWindow *wx_win, - const char *title, + const wxChar *title, int x, int y, int width, int height, WXDWORD style, - const char *dialog_template, + const wxChar *dialog_template, WXDWORD extendedStyle) { int x1 = CW_USEDEFAULT; @@ -2119,14 +2119,14 @@ bool wxWindow::MSWCreate(int id, if ( !::SetWindowPos(GetHwnd(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE) ) { - wxLogLastError("SetWindowPos"); + wxLogLastError(_T("SetWindowPos")); } } // move the dialog to its initial position without forcing repainting if ( !::MoveWindow(GetHwnd(), x1, y1, width1, height1, FALSE) ) { - wxLogLastError("MoveWindow"); + wxLogLastError(_T("MoveWindow")); } } else @@ -2137,7 +2137,7 @@ bool wxWindow::MSWCreate(int id, m_hWnd = (WXHWND)CreateWindowEx(extendedStyle, wclass, - title ? title : "", + title ? title : _T(""), style, x1, y1, width1, height1, @@ -2211,7 +2211,7 @@ bool wxWindow::MSWOnNotify(int WXUNUSED(idCtrl), if ( hdr->code == TTN_NEEDTEXT && m_tooltip ) { TOOLTIPTEXT *ttt = (TOOLTIPTEXT *)lParam; - ttt->lpszText = (char *)m_tooltip->GetTip().c_str(); + ttt->lpszText = (wxChar *)m_tooltip->GetTip().c_str(); // processed return TRUE; @@ -2388,7 +2388,7 @@ bool wxWindow::HandleDropFiles(WXWPARAM wParam) int wIndex; for (wIndex=0; wIndex < (int)gwFilesDropped; wIndex++) { - DragQueryFile (hFilesInfo, wIndex, (LPSTR) wxBuffer, 1000); + DragQueryFile (hFilesInfo, wIndex, (LPTSTR) wxBuffer, 1000); files[wIndex] = wxBuffer; } DragFinish (hFilesInfo); @@ -3101,7 +3101,7 @@ bool wxWindow::HandleJoystickEvent(WXUINT msg, int x, int y, WXUINT flags) break; default: - wxFAIL_MSG("no such joystick event"); + wxFAIL_MSG(_T("no such joystick event")); return FALSE; } diff --git a/src/msw/xpmhand.cpp b/src/msw/xpmhand.cpp index da59e8b150..8841226237 100644 --- a/src/msw/xpmhand.cpp +++ b/src/msw/xpmhand.cpp @@ -60,7 +60,7 @@ bool wxXPMFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla if (dc) { xpmAttr.valuemask = XpmReturnPixels; - int errorStatus = XpmReadFileToImage(&dc, WXSTRINGCAST name, &ximage, (XImage **) NULL, &xpmAttr); + int errorStatus = XpmReadFileToImage(&dc, MBSTRINGCAST name.mb_str(wxConvFile), &ximage, (XImage **) NULL, &xpmAttr); DeleteDC(dc); if (errorStatus == XpmSuccess) { @@ -108,7 +108,7 @@ bool wxXPMFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type ximage.height = M_BITMAPHANDLERDATA->m_height; ximage.depth = M_BITMAPHANDLERDATA->m_depth; ximage.bitmap = (HBITMAP)M_BITMAPHANDLERDATA->m_hBitmap; - int errorStatus = XpmWriteFileFromImage(&dc, WXSTRINGCAST name, + int errorStatus = XpmWriteFileFromImage(&dc, MBSTRINGCAST name.mb_str(wxConvFile), &ximage, (XImage *) NULL, (XpmAttributes *) NULL); if (dc) -- 2.45.2