more changes to make wx compile without implicit wxString->char* conversion (for STL build)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2007-06-20 07:44:45 +00:00
parent d38f70b249
commit e0a050e347
55 changed files with 183 additions and 169 deletions

View File

@@ -50,7 +50,7 @@ class WXDLLIMPEXP_CORE wxFontMapper;
class WXDLLIMPEXP_BASE wxFontMapperBase
{
public:
// constructtor and such
// constructor and such
// ---------------------
// default ctor

View File

@@ -51,7 +51,10 @@ public:
// Calls that CLIENT can make
virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); }
// FIXME-UTF8: change Execute() to DoExecute() to avoid having to do this;
// don't use c_str() below after removing ANSI build
virtual bool Execute(const wxString& str)
{ return Execute(str.c_str(), -1, wxIPC_TEXT); }
virtual wxChar *Request(const wxString& item, int *size = NULL, wxIPCFormat format = wxIPC_TEXT);
virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool StartAdvise(const wxString& item);

View File

@@ -66,7 +66,7 @@ public:
private:
// helper function: reads the command corresponding to the specified verb
// from the registry (returns an empty string if not found)
wxString GetCommand(const wxChar *verb) const;
wxString GetCommand(const wxString& verb) const;
// get the registry path for the given verb
wxString GetVerbPath(const wxString& verb) const;

View File

@@ -692,7 +692,7 @@ public:
{
if ( IsRegistered() )
{
if ( !::UnregisterClass(m_clsname, wxhInstance) )
if ( !::UnregisterClass(m_clsname.wx_str(), wxhInstance) )
{
wxLogLastError(_T("UnregisterClass"));
}

View File

@@ -959,7 +959,7 @@ bool DoShowAssertDialog(const wxString& msg)
wxT("You can also choose [Cancel] to suppress ")
wxT("further warnings.");
switch ( ::MessageBox(NULL, msgDlg, _T("wxWidgets Debug Alert"),
switch ( ::MessageBox(NULL, msgDlg.wx_str(), _T("wxWidgets Debug Alert"),
MB_YESNOCANCEL | MB_ICONSTOP ) )
{
case IDYES:
@@ -1027,7 +1027,7 @@ void ShowAssertDialog(const wxString& szFile,
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
msg << wxT("\r\n");
OutputDebugString(msg );
OutputDebugString(msg.wx_str());
#else
// send to stderr
wxFprintf(stderr, wxT("%s\n"), msg.c_str());

View File

@@ -317,7 +317,7 @@ wxFileExists (const wxString& filename)
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
// we must use GetFileAttributes() instead of the ANSI C functions because
// it can cope with network (UNC) paths unlike them
DWORD ret = ::GetFileAttributes(filename);
DWORD ret = ::GetFileAttributes(filename.fn_str());
return (ret != (DWORD)-1) && !(ret & FILE_ATTRIBUTE_DIRECTORY);
#else // !__WIN32__
@@ -1125,7 +1125,7 @@ wxCopyFile (const wxString& file1, const wxString& file2, bool overwrite)
// instead of our code if available
//
// NB: 3rd parameter is bFailIfExists i.e. the inverse of overwrite
if ( !::CopyFile(file1, file2, !overwrite) )
if ( !::CopyFile(file1.fn_str(), file2.fn_str(), !overwrite) )
{
wxLogSysError(_("Failed to copy the file '%s' to '%s'"),
file1.c_str(), file2.c_str());
@@ -1272,7 +1272,7 @@ bool wxRemoveFile(const wxString& file)
|| (defined(__MWERKS__) && defined(__MSL__))
int res = wxRemove(file);
#elif defined(__WXMAC__)
int res = unlink(wxFNCONV(file));
int res = unlink(file.fn_str());
#elif defined(__WXPALMOS__)
int res = 1;
// TODO with VFSFileDelete()
@@ -1288,7 +1288,7 @@ bool wxMkdir(const wxString& dir, int perm)
#if defined(__WXPALMOS__)
return false;
#elif defined(__WXMAC__) && !defined(__UNIX__)
return (mkdir( wxFNCONV(dir) , 0 ) == 0);
return (mkdir(dir.fn_str() , 0 ) == 0);
#else // !Mac
const wxChar *dirname = dir.c_str();
@@ -1376,7 +1376,7 @@ bool wxDirExists(const wxString& pathName)
return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
// stat() can't cope with network paths
DWORD ret = ::GetFileAttributes(strPath);
DWORD ret = ::GetFileAttributes(strPath.fn_str());
return (ret != (DWORD)-1) && (ret & FILE_ATTRIBUTE_DIRECTORY);
#elif defined(__OS2__)
@@ -1662,7 +1662,7 @@ bool wxSetWorkingDirectory(const wxString& d)
wxUnusedVar(d);
return false;
#else
return (bool)(SetCurrentDirectory(d) != 0);
return (bool)(SetCurrentDirectory(d.fn_str()) != 0);
#endif
#else
// Must change drive, too.

View File

@@ -163,7 +163,7 @@ public:
{
m_hFile = ::CreateFile
(
filename, // name
filename.fn_str(), // name
mode == Read ? GENERIC_READ // access mask
: GENERIC_WRITE,
FILE_SHARE_READ | // sharing mode
@@ -650,7 +650,7 @@ static int wxOpenWithDeleteOnClose(const wxString& filename)
DWORD attributes = FILE_ATTRIBUTE_TEMPORARY |
FILE_FLAG_DELETE_ON_CLOSE;
HANDLE h = ::CreateFile(filename, access, 0, NULL,
HANDLE h = ::CreateFile(filename.fn_str(), access, 0, NULL,
disposition, attributes, NULL);
return wxOpenOSFHandle(h, wxO_BINARY);
@@ -745,7 +745,8 @@ static wxString wxCreateTempImpl(
}
#elif defined(__WINDOWS__) && !defined(__WXMICROWIN__)
if ( !::GetTempFileName(dir, name, 0, wxStringBuffer(path, MAX_PATH + 1)) )
if ( !::GetTempFileName(dir.fn_str(), name.fn_str(), 0,
wxStringBuffer(path, MAX_PATH + 1)) )
{
wxLogLastError(_T("GetTempFileName"));
@@ -1802,13 +1803,13 @@ wxString wxFileName::GetShortPath() const
wxString path(GetFullPath());
#if defined(__WXMSW__) && defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
DWORD sz = ::GetShortPathName(path, NULL, 0);
DWORD sz = ::GetShortPathName(path.fn_str(), NULL, 0);
if ( sz != 0 )
{
wxString pathOut;
if ( ::GetShortPathName
(
path,
path.fn_str(),
wxStringBuffer(pathOut, sz),
sz
) != 0 )
@@ -1866,12 +1867,12 @@ wxString wxFileName::GetLongPath() const
if ( s_pfnGetLongPathName )
{
DWORD dwSize = (*s_pfnGetLongPathName)(path, NULL, 0);
DWORD dwSize = (*s_pfnGetLongPathName)(path.fn_str(), NULL, 0);
if ( dwSize > 0 )
{
if ( (*s_pfnGetLongPathName)
(
path,
path.fn_str(),
wxStringBuffer(pathOut, dwSize),
dwSize
) != 0 )
@@ -1921,7 +1922,7 @@ wxString wxFileName::GetLongPath() const
continue;
}
hFind = ::FindFirstFile(tmpPath, &findFileData);
hFind = ::FindFirstFile(tmpPath.fn_str(), &findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
// Error: most likely reason is that path doesn't exist, so

View File

@@ -157,7 +157,7 @@ IMPLEMENT_LOG_FUNCTION(Status)
void wxSafeShowMessage(const wxString& title, const wxString& text)
{
#ifdef __WINDOWS__
::MessageBox(NULL, text, title, MB_OK | MB_ICONSTOP);
::MessageBox(NULL, text.wx_str(), title.wx_str(), MB_OK | MB_ICONSTOP);
#else
wxFprintf(stderr, _T("%s: %s\n"), title.c_str(), text.c_str());
fflush(stderr);

View File

@@ -128,7 +128,8 @@ void wxMessageOutputBest::Output(const wxString& str)
#ifdef __WINDOWS__
if ( !IsInConsole() )
{
::MessageBox(NULL, str, _T("wxWidgets"), MB_ICONINFORMATION | MB_OK);
::MessageBox(NULL, str.wx_str(), _T("wxWidgets"),
MB_ICONINFORMATION | MB_OK);
}
else
#endif // __WINDOWS__/!__WINDOWS__
@@ -167,7 +168,7 @@ void wxMessageOutputDebug::Output(const wxString& str)
#if defined(__WXMSW__) && !defined(__WXMICROWIN__)
out.Replace(wxT("\t"), wxT(" "));
out.Replace(wxT("\n"), wxT("\r\n"));
::OutputDebugString(out);
::OutputDebugString(out.wx_str());
#elif defined(__WXMAC__) && !defined(__DARWIN__)
if ( wxIsDebuggerRunning() )
{

View File

@@ -181,7 +181,7 @@ public:
if ( !s.empty() )
{
pDt->ParseFormat(s, m_format);
pDt->ParseFormat(s.c_str(), m_format);
if ( !pDt->IsValid() )
return false;
}

View File

@@ -76,7 +76,7 @@ wxString wxGridCellDateTimeRenderer::GetString(const wxGrid& grid, int row, int
if (!hasDatetime )
{
text = table->GetValue(row, col);
hasDatetime = (val.ParseFormat( text, m_iformat, m_dateDef ) != (wxChar *)NULL) ;
hasDatetime = (val.ParseFormat(text.c_str(), m_iformat, m_dateDef) != (wxChar *)NULL) ;
}
if ( hasDatetime )

View File

@@ -407,7 +407,7 @@ void wxLogGui::DoLog(wxLogLevel level, const wxString& szString, time_t t)
// don't prepend debug/trace here: it goes to the
// debug window anyhow
str += wxT("\r\n");
OutputDebugString(str);
OutputDebugString(str.wx_str());
#else
// send them to stderr
wxFprintf(stderr, wxT("[%s] %s\n"),

View File

@@ -1117,6 +1117,7 @@ void wxComboBox::Replace( long from, long to, const wxString& value )
if (value.IsNull()) return;
gint pos = (gint)to;
// FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
#if wxUSE_UNICODE_UTF8
const char *utf8 = value.utf8_str();
#else

View File

@@ -158,19 +158,18 @@ enum MnemonicsFlag
MNEMONICS_CONVERT_MARKUP
};
static wxString GTKProcessMnemonics(const wxChar* label, MnemonicsFlag flag)
static wxString GTKProcessMnemonics(const wxString& label, MnemonicsFlag flag)
{
const size_t len = wxStrlen(label);
wxString labelGTK;
labelGTK.reserve(len);
for ( size_t i = 0; i < len; i++ )
labelGTK.reserve(label.length());
for ( wxString::const_iterator i = label.begin(); i != label.end(); ++i )
{
wxChar ch = label[i];
wxChar ch = *i;
switch ( ch )
{
case wxT('&'):
if ( i == len - 1 )
if ( i + 1 == label.end() )
{
// "&" at the end of string is an error
wxLogDebug(wxT("Invalid label \"%s\"."), label);
@@ -180,6 +179,7 @@ static wxString GTKProcessMnemonics(const wxChar* label, MnemonicsFlag flag)
if ( flag == MNEMONICS_CONVERT_MARKUP )
{
bool isMnemonic = true;
size_t distanceFromEnd = label.end() - i;
// is this ampersand introducing a mnemonic or rather an entity?
for (size_t j=0; j < wxMARKUP_ENTITY_MAX; j++)
@@ -187,8 +187,8 @@ static wxString GTKProcessMnemonics(const wxChar* label, MnemonicsFlag flag)
const wxChar *entity = wxMarkupEntities[wxMARKUP_ELEMENT_NAME][j];
size_t entityLen = wxStrlen(entity);
if (len - i >= entityLen &&
wxStrncmp(entity, &label[i], entityLen) == 0)
if (distanceFromEnd >= entityLen &&
wxString(i, i + entityLen) == entity)
{
labelGTK << entity;
i += entityLen - 1; // the -1 is because main for()
@@ -203,7 +203,7 @@ static wxString GTKProcessMnemonics(const wxChar* label, MnemonicsFlag flag)
continue;
}
ch = label[++i]; // skip '&' itself
ch = *(++i); // skip '&' itself
switch ( ch )
{
case wxT('&'):

View File

@@ -1512,17 +1512,15 @@ void wxGnomePrintDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord
bool underlined = m_font.Ok() && m_font.GetUnderlined();
#if wxUSE_UNICODE
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
// FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
#if wxUSE_UNICODE_UTF8
const char *data = text.utf8_str();
#else
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text );
if ( !wdata )
return;
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
const wxCharBuffer data = text.utf8_str();
#endif
size_t datalen = strlen((const char*)data);
pango_layout_set_text( m_layout, (const char*) data, datalen);
size_t datalen = strlen(data);
pango_layout_set_text( m_layout, data, datalen);
if (underlined)
{
@@ -1850,26 +1848,13 @@ void wxGnomePrintDC::DoGetTextExtent(const wxString& string, wxCoord *width, wxC
pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
// Set layout's text
#if wxUSE_UNICODE
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
const char *dataUTF8 = (const char *)data;
#else
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( string );
if ( !wdata )
{
if (width) (*width) = 0;
if (height) (*height) = 0;
return;
}
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
const char *dataUTF8 = (const char *)data;
#endif
if ( !dataUTF8 )
{
// hardly ideal, but what else can we do if conversion failed?
return;
}
// FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
#if wxUSE_UNICODE_UTF8
const char *dataUTF8 = string.utf8_str();
#else
const wxCharBuffer dataUTF8 = string.utf8_str();
#endif
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );

View File

@@ -868,18 +868,22 @@ wxString wxMenuItem::GTKProcessMenuItemLabel(const wxString& str, wxString *hotK
wxString text;
// '\t' is the deliminator indicating a hot key
const wxChar *pc = str;
while ( (*pc != wxT('\0')) && (*pc != wxT('\t')) )
wxString::const_iterator pc = str.begin();
while ( pc != str.end() && *pc != wxT('\t') )
{
if ((*pc == wxT('&')) && (*(pc+1) == wxT('&')))
if (*pc == wxT('&'))
{
// "&" is doubled to indicate "&" instead of accelerator
++pc;
text << wxT('&');
}
else if (*pc == wxT('&'))
{
text << wxT('_');
wxString::const_iterator next = pc + 1;
if (next != str.end() && *next == wxT('&'))
{
// "&" is doubled to indicate "&" instead of accelerator
++pc;
text << wxT('&');
}
else
{
text << wxT('_');
}
}
else if ( *pc == wxT('_') ) // escape underscores
{
@@ -898,7 +902,7 @@ wxString wxMenuItem::GTKProcessMenuItemLabel(const wxString& str, wxString *hotK
if(*pc == wxT('\t'))
{
pc++;
*hotKey = pc;
hotKey->assign(pc, str.end());
}
}

View File

@@ -90,7 +90,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
{
m_refData = new wxAcceleratorRefData;
HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource);
HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.wx_str());
M_ACCELDATA->m_hAccel = hAccel;
M_ACCELDATA->m_ok = hAccel != 0;
}

View File

@@ -572,7 +572,8 @@ static void DrawButtonText(HDC hdc,
// first we need to compute its bounding rect
RECT rc;
::CopyRect(&rc, pRect);
::DrawText(hdc, text, text.length(), &rc, DT_CENTER | DT_CALCRECT);
::DrawText(hdc, text.wx_str(), text.length(), &rc,
DT_CENTER | DT_CALCRECT);
// now center this rect inside the entire button area
const LONG w = rc.right - rc.left;
@@ -582,12 +583,12 @@ static void DrawButtonText(HDC hdc,
rc.top = (pRect->bottom - pRect->top)/2 - h/2;
rc.bottom = rc.top+h;
::DrawText(hdc, text, text.length(), &rc, DT_CENTER);
::DrawText(hdc, text.wx_str(), text.length(), &rc, DT_CENTER);
}
else // single line label
{
// Note: we must have DT_SINGLELINE for DT_VCENTER to work.
::DrawText(hdc, text, text.length(), pRect,
::DrawText(hdc, text.wx_str(), text.length(), pRect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}

View File

@@ -494,7 +494,7 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
// around it
if ( isFocused )
{
if ( !::DrawText(hdc, label, label.length(), &rectLabel,
if ( !::DrawText(hdc, label.wx_str(), label.length(), &rectLabel,
fmt | DT_CALCRECT) )
{
wxLogLastError(_T("DrawText(DT_CALCRECT)"));
@@ -506,7 +506,7 @@ bool wxCheckBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT));
}
if ( !::DrawText(hdc, label, label.length(), &rectLabel, fmt) )
if ( !::DrawText(hdc, label.wx_str(), label.length(), &rectLabel, fmt) )
{
wxLogLastError(_T("DrawText()"));
}

View File

@@ -69,7 +69,7 @@ wxColourDialogHookProc(HWND hwnd,
CHOOSECOLOR *pCC = (CHOOSECOLOR *)lParam;
wxColourDialog *dialog = (wxColourDialog *)pCC->lCustData;
::SetWindowText(hwnd, dialog->GetTitle());
::SetWindowText(hwnd, dialog->GetTitle().wx_str());
wxPoint pos = dialog->GetPosition();
if ( pos != wxDefaultPosition )

View File

@@ -326,7 +326,7 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD id)
// this string is going to become the new combobox value soon but
// we need it to be done right now, otherwise the event handler
// could get a wrong value when it calls our GetValue()
::SetWindowText(GetHwnd(), value);
::SetWindowText(GetHwnd(), value.wx_str());
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
@@ -680,7 +680,7 @@ void wxComboBox::Replace(long from, long to, const wxString& value)
Remove(from, to);
// Now replace with 'value', by pasting.
wxSetClipboardData(wxDF_TEXT, (wxObject *)(const wxChar *)value, 0, 0);
wxSetClipboardData(wxDF_TEXT, (wxObject *)value.wx_str(), 0, 0);
// Paste into edit control
SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L);

View File

@@ -140,7 +140,7 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
(
exstyle, // extended style
classname, // the kind of control to create
label, // the window name
label.wx_str(), // the window name
style, // the window style
x, y, w, h, // the window position and size
GetHwndOf(GetParent()), // parent

View File

@@ -254,12 +254,12 @@ wxCursor::wxCursor(const wxString& filename,
switch ( kind )
{
case wxBITMAP_TYPE_CUR_RESOURCE:
hcursor = ::LoadCursor(wxGetInstance(), filename);
hcursor = ::LoadCursor(wxGetInstance(), filename.fn_str());
break;
#ifndef __WXWINCE__
case wxBITMAP_TYPE_CUR:
hcursor = ::LoadCursorFromFile(filename);
hcursor = ::LoadCursorFromFile(filename.fn_str());
break;
#endif

View File

@@ -1748,7 +1748,7 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
SIZE sizeRect;
const size_t len = string.length();
if ( !::GetTextExtentPoint32(GetHdc(), string, len, &sizeRect) )
if ( !::GetTextExtentPoint32(GetHdc(), string.wx_str(), len, &sizeRect) )
{
wxLogLastError(_T("GetTextExtentPoint32()"));
}

View File

@@ -116,7 +116,10 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name,
{
if ( !driver_name.empty() && !device_name.empty() && !file.empty() )
{
m_hDC = (WXHDC) CreateDC(driver_name, device_name, file, NULL);
m_hDC = (WXHDC) CreateDC(driver_name.wx_str(),
device_name.wx_str(),
file.fn_str(),
NULL);
}
else // we don't have all parameters, ask the user
{
@@ -178,14 +181,14 @@ bool wxPrinterDC::StartDoc(const wxString& message)
{
DOCINFO docinfo;
docinfo.cbSize = sizeof(DOCINFO);
docinfo.lpszDocName = (const wxChar*)message;
docinfo.lpszDocName = message.wx_str();
wxString filename(m_printData.GetFilename());
if (filename.empty())
docinfo.lpszOutput = NULL;
else
docinfo.lpszOutput = (const wxChar *) filename;
docinfo.lpszOutput = filename.wx_str();
docinfo.lpszDatatype = NULL;
docinfo.fwType = 0;
@@ -323,7 +326,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
DEVMODE *lpDevMode = hDevMode ? (DEVMODE *)::GlobalLock(hDevMode) : NULL;
HDC hDC = ::CreateDC(NULL, deviceName, NULL, lpDevMode);
HDC hDC = ::CreateDC(NULL, deviceName.wx_str(), NULL, lpDevMode);
if ( !hDC )
wxLogLastError(_T("CreateDC(printer)"));

View File

@@ -286,7 +286,7 @@ bool wxDIB::Load(const wxString& filename)
m_handle = (HBITMAP)::LoadImage
(
wxGetInstance(),
filename,
filename.fn_str(),
IMAGE_BITMAP,
0, 0, // don't specify the size
LR_CREATEDIBSECTION | LR_LOADFROMFILE

View File

@@ -62,7 +62,7 @@ static inline void FreeFindData(FIND_DATA fd)
static inline FIND_DATA FindFirst(const wxString& spec,
FIND_STRUCT *finddata)
{
return ::FindFirstFile(spec, finddata);
return ::FindFirstFile(spec.fn_str(), finddata);
}
static inline bool FindNext(FIND_DATA fd, FIND_STRUCT *finddata)

View File

@@ -768,11 +768,11 @@ bool wxDisplayImplMultimon::ChangeMode(const wxVideoMode& mode)
// do change the mode
switch ( pfnChangeDisplaySettingsEx
(
GetName(), // display name
pDevMode, // dev mode or NULL to reset
NULL, // reserved
GetName().wx_str(), // display name
pDevMode, // dev mode or NULL to reset
NULL, // reserved
flags,
NULL // pointer to video parameters (not used)
NULL // pointer to video parameters (not used)
) )
{
case DISP_CHANGE_SUCCESSFUL:

View File

@@ -141,7 +141,11 @@ HMODULE wxGetModuleHandle(const char *name, void *addr)
// Windows CE only has Unicode API, so even we have an ANSI string here, we
// still need to use GetModuleHandleW() there and so do it everywhere to
// avoid #ifdefs -- this code is not performance-critical anyhow...
return ::GetModuleHandle(wxString::FromAscii((char *)name));
#ifdef __WINCE__
return ::GetModuleHandleW(wxConvLibc.cMB2WC(name).data());
#else
return ::GetModuleHandleA((char *)name);
#endif
}
// ============================================================================
@@ -278,7 +282,7 @@ wxDllType wxDynamicLibrary::GetProgramHandle()
wxDllType
wxDynamicLibrary::RawLoad(const wxString& libname, int WXUNUSED(flags))
{
return ::LoadLibrary(libname);
return ::LoadLibrary(libname.wx_str());
}
/* static */

View File

@@ -57,7 +57,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxEnhMetaFileDC, wxDC)
// we must pass NULL if the string is empty to metafile functions
static inline const wxChar *GetMetaFileName(const wxString& fn)
{ return !fn ? (const wxChar *)NULL : (const wxChar*)fn.c_str(); }
{ return !fn ? (const wxChar *)NULL : (const wxChar*)fn.wx_str(); }
// ============================================================================
// implementation
@@ -75,7 +75,7 @@ void wxEnhMetaFile::Init()
}
else // have valid file name, load metafile from it
{
m_hMF = (WXHANDLE)::GetEnhMetaFile(m_filename);
m_hMF = (WXHANDLE)::GetEnhMetaFile(m_filename.fn_str());
if ( !m_hMF )
wxLogSysError(_("Failed to load metafile from file \"%s\"."),
m_filename.c_str());
@@ -219,7 +219,7 @@ wxEnhMetaFileDC::wxEnhMetaFileDC(const wxString& filename,
ScreenHDC hdcRef;
m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename),
pRect, description);
pRect, description.wx_str());
if ( !m_hDC )
{
wxLogLastError(_T("CreateEnhMetaFile"));

View File

@@ -310,7 +310,7 @@ wxFindReplaceDialogHookProc(HWND hwnd,
FINDREPLACE *pFR = (FINDREPLACE *)lParam;
wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData;
::SetWindowText(hwnd, dialog->GetTitle());
::SetWindowText(hwnd, dialog->GetTitle().wx_str());
// don't return FALSE from here or the dialog won't be shown
return TRUE;

View File

@@ -320,7 +320,7 @@ int wxFileDialog::ShowModal()
of.lStructSize = gs_ofStructSize;
of.hwndOwner = hWnd;
of.lpstrTitle = WXSTRINGCAST m_message;
of.lpstrTitle = m_message.wx_str();
of.lpstrFileTitle = titleBuffer;
of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT;
@@ -396,7 +396,7 @@ int wxFileDialog::ShowModal()
//=== Setting defaultFileName >>=========================================
wxStrncpy( fileNameBuffer, (const wxChar *)m_fileName, wxMAXPATH-1 );
wxStrncpy(fileNameBuffer, m_fileName, wxMAXPATH-1);
fileNameBuffer[ wxMAXPATH-1 ] = wxT('\0');
of.lpstrFile = fileNameBuffer; // holds returned filename
@@ -409,7 +409,7 @@ int wxFileDialog::ShowModal()
wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
if (HasFdFlag(wxFD_SAVE))
{
const wxChar* extension = filterBuffer;
const wxChar* extension = filterBuffer.wx_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension
@@ -511,7 +511,7 @@ int wxFileDialog::ShowModal()
(of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) )
{
// User has typed a filename without an extension:
const wxChar* extension = filterBuffer;
const wxChar* extension = filterBuffer.wx_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension

View File

@@ -323,7 +323,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap,
int WXUNUSED(desiredHeight))
{
// TODO: load colourmap.
bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name));
bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name.wx_str()));
if ( !bitmap->Ok() )
{
@@ -438,7 +438,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
desiredHeight == ::GetSystemMetrics(SM_CYICON) )
{
// get the specified large icon from file
if ( !::ExtractIconEx(nameReal, iconIndex, &hicon, NULL, 1) )
if ( !::ExtractIconEx(nameReal.wx_str(), iconIndex, &hicon, NULL, 1) )
{
// it is not an error, but it might still be useful to be informed
// about it optionally
@@ -451,7 +451,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
desiredHeight == ::GetSystemMetrics(SM_CYSMICON) )
{
// get the specified small icon from file
if ( !::ExtractIconEx(nameReal, iconIndex, NULL, &hicon, 1) )
if ( !::ExtractIconEx(nameReal.wx_str(), iconIndex, NULL, &hicon, 1) )
{
wxLogTrace(_T("iconload"),
_T("No small icons found in the file '%s'."),
@@ -464,7 +464,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
if ( !hicon )
{
// take any size icon from the file by index
hicon = ::ExtractIcon(wxGetInstance(), nameReal, iconIndex);
hicon = ::ExtractIcon(wxGetInstance(), nameReal.wx_str(), iconIndex);
}
#endif
@@ -518,13 +518,13 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon,
// some icon rescaling internally which results in very ugly 16x16 icons
if ( hasSize )
{
hicon = (HICON)::LoadImage(wxGetInstance(), name, IMAGE_ICON,
hicon = (HICON)::LoadImage(wxGetInstance(), name.wx_str(), IMAGE_ICON,
desiredWidth, desiredHeight,
LR_DEFAULTCOLOR);
}
else
{
hicon = ::LoadIcon(wxGetInstance(), name);
hicon = ::LoadIcon(wxGetInstance(), name.wx_str());
}
// next check if it's not a standard icon

View File

@@ -88,7 +88,8 @@ CallHtmlHelpFunction(wxWindow *win, const wxChar *str, UINT uint, DWORD dword)
{
HTMLHELP htmlHelp = GetHtmlHelpFunction();
return htmlHelp && htmlHelp(GetSuitableHWND(win), str, uint, dword);
return htmlHelp &&
htmlHelp(GetSuitableHWND(win), str, uint, dword);
}
IMPLEMENT_DYNAMIC_CLASS(wxCHMHelpController, wxHelpControllerBase)
@@ -116,7 +117,8 @@ bool wxCHMHelpController::DisplayContents()
wxString str = GetValidFilename(m_helpFile);
return CallHtmlHelpFunction(GetParentWindow(), str, HH_DISPLAY_TOPIC, 0L);
return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_DISPLAY_TOPIC, 0L);
}
// Use topic or HTML filename
@@ -131,7 +133,8 @@ bool wxCHMHelpController::DisplaySection(const wxString& section)
if ( section.Find(wxT(".htm")) != wxNOT_FOUND )
{
// interpret as a file name
return CallHtmlHelpFunction(GetParentWindow(), str, HH_DISPLAY_TOPIC,
return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_DISPLAY_TOPIC,
wxPtrToUInt(section.c_str()));
}
@@ -146,8 +149,8 @@ bool wxCHMHelpController::DisplaySection(int section)
wxString str = GetValidFilename(m_helpFile);
return CallHtmlHelpFunction(GetParentWindow(), str, HH_HELP_CONTEXT,
(DWORD)section);
return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_HELP_CONTEXT, (DWORD)section);
}
bool wxCHMHelpController::DisplayContextPopup(int contextId)
@@ -171,7 +174,8 @@ bool wxCHMHelpController::DisplayContextPopup(int contextId)
popup.pszFont = NULL;
popup.pszText = NULL;
return CallHtmlHelpFunction(GetParentWindow(), str, HH_DISPLAY_TEXT_POPUP,
return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_DISPLAY_TEXT_POPUP,
wxPtrToUInt(&popup));
}
@@ -195,7 +199,7 @@ bool wxCHMHelpController::ShowContextHelpPopup(const wxString& text,
popup.clrBackground = (COLORREF)-1;
popup.rcMargins.top = popup.rcMargins.left = popup.rcMargins.right = popup.rcMargins.bottom = -1;
popup.pszFont = NULL;
popup.pszText = (const wxChar*) text;
popup.pszText = text.wx_str();
return CallHtmlHelpFunction(window, NULL, HH_DISPLAY_TEXT_POPUP,
wxPtrToUInt(&popup));
@@ -224,7 +228,8 @@ bool wxCHMHelpController::KeywordSearch(const wxString& k,
link.pszWindow = NULL ;
link.fIndexOnFail = TRUE ;
return CallHtmlHelpFunction(GetParentWindow(), str, HH_KEYWORD_LOOKUP,
return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_KEYWORD_LOOKUP,
wxPtrToUInt(&link));
}

View File

@@ -63,7 +63,7 @@ bool wxWinHelpController::DisplayContents(void)
wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_FINDER, 0L) != 0);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_FINDER, 0L) != 0);
}
bool wxWinHelpController::DisplaySection(int section)
@@ -73,7 +73,7 @@ bool wxWinHelpController::DisplaySection(int section)
wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_CONTEXT, (DWORD)section) != 0);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_CONTEXT, (DWORD)section) != 0);
}
bool wxWinHelpController::DisplayContextPopup(int contextId)
@@ -82,7 +82,7 @@ bool wxWinHelpController::DisplayContextPopup(int contextId)
wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
}
bool wxWinHelpController::DisplayBlock(long block)
@@ -98,7 +98,7 @@ bool wxWinHelpController::KeywordSearch(const wxString& k,
wxString str = GetValidFilename(m_helpFile);
return (WinHelp(GetSuitableHWND(this), (const wxChar*) str, HELP_PARTIALKEY, (DWORD)(const wxChar*) k) != 0);
return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_PARTIALKEY, (DWORD)k.wx_str()) != 0);
}
// Can't close the help window explicitly in WinHelp

View File

@@ -279,7 +279,7 @@ void wxListBox::Delete(unsigned int n)
int wxListBox::DoAppend(const wxString& item)
{
int index = ListBox_AddString(GetHwnd(), item);
int index = ListBox_AddString(GetHwnd(), item.wx_str());
m_noItems++;
#if wxUSE_OWNER_DRAWN
@@ -312,7 +312,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
unsigned int i;
for (i = 0; i < m_noItems; i++)
{
ListBox_AddString(GetHwnd(), choices[i]);
ListBox_AddString(GetHwnd(), choices[i].wx_str());
if ( clientData )
{
SetClientData(i, clientData[i]);
@@ -349,7 +349,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
if (bCase)
return wxItemContainerImmutable::FindString( s, bCase );
int pos = ListBox_FindStringExact(GetHwnd(), -1, s);
int pos = ListBox_FindStringExact(GetHwnd(), -1, s.wx_str());
if (pos == LB_ERR)
return wxNOT_FOUND;
else
@@ -520,7 +520,7 @@ wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
unsigned int nItems = items.GetCount();
for ( unsigned int i = 0; i < nItems; i++ )
{
int idx = ListBox_InsertString(GetHwnd(), i + pos, items[i]);
int idx = ListBox_InsertString(GetHwnd(), i + pos, items[i].wx_str());
#if wxUSE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW )
@@ -574,7 +574,7 @@ void wxListBox::SetString(unsigned int n, const wxString& s)
if ( n == (m_noItems - 1) )
newN = -1;
ListBox_InsertString(GetHwnd(), newN, s);
ListBox_InsertString(GetHwnd(), newN, s.wx_str());
// restore the client data
if ( oldData )

View File

@@ -1424,7 +1424,7 @@ long wxListCtrl::FindItem(long start, const wxString& str, bool partial)
findInfo.flags = LVFI_STRING;
if ( partial )
findInfo.flags |= LVFI_PARTIAL;
findInfo.psz = str;
findInfo.psz = str.wx_str();
// ListView_FindItem() excludes the first item from search and to look
// through all the items you need to start from -1 which is unnatural and

View File

@@ -199,7 +199,7 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
msflags &= ~WS_HSCROLL;
if ( !wxWindow::MSWCreate(wxMDIFrameClassName,
title,
title.wx_str(),
pos, size,
msflags,
exflags) )
@@ -711,7 +711,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE
? wxMDIChildFrameClassName
: wxMDIChildFrameClassNameNoRedraw;
mcs.szTitle = title;
mcs.szTitle = title.wx_str();
mcs.hOwner = wxGetInstance();
if (x != wxDefaultCoord)
mcs.x = x;
@@ -1430,14 +1430,14 @@ 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, _("&Window").wx_str());
break;
}
}
if ( !success )
{
::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window"));
::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window").wx_str());
}
}

View File

@@ -731,7 +731,7 @@ void wxMenu::SetTitle(const wxString& label)
if ( !label.empty() )
{
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
(unsigned)idMenuTitle, m_title) ||
(unsigned)idMenuTitle, m_title.wx_str()) ||
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{
wxLogLastError(wxT("InsertMenu"));
@@ -767,7 +767,7 @@ void wxMenu::SetTitle(const wxString& label)
#else
if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING,
(unsigned)idMenuTitle, m_title) )
(unsigned)idMenuTitle, m_title.wx_str()) )
{
wxLogLastError(wxT("ModifyMenu"));
}
@@ -979,7 +979,7 @@ WXHMENU wxMenuBar::Create()
{
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
(UINT)(*it)->GetHMenu(),
m_titles[i]) )
m_titles[i].wx_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}
@@ -1085,7 +1085,7 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
#else
if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld,
id, label) == (int)0xFFFFFFFF )
id, label.wx_str()) == (int)0xFFFFFFFF )
{
wxLogLastError(wxT("ModifyMenu"));
}
@@ -1130,7 +1130,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
if ( !::InsertMenu(GetHmenu(), (UINT)mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT)GetHmenuOf(menu), title) )
(UINT)GetHmenuOf(menu), title.wx_str()) )
{
wxLogLastError(wxT("InsertMenu"));
}
@@ -1197,7 +1197,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
#else
if ( !::InsertMenu(GetHmenu(), mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT)GetHmenuOf(menu), title) )
(UINT)GetHmenuOf(menu), title.wx_str()) )
{
wxLogLastError(wxT("InsertMenu"));
}
@@ -1256,7 +1256,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
}
#else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT)submenu, title) )
(UINT)submenu, title.wx_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}

View File

@@ -200,7 +200,7 @@ bool wxFileTypeImpl::EnsureExtKeyExists()
// get the command to use
// ----------------------------------------------------------------------------
wxString wxFileTypeImpl::GetCommand(const wxChar *verb) const
wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
{
// suppress possible error messages
wxLogNull nolog;

View File

@@ -109,7 +109,7 @@ int wxMessageDialog::ShowModal()
#endif // wxUSE_UNICODE
// do show the dialog
int msAns = MessageBox(hWnd, message, m_caption, msStyle);
int msAns = MessageBox(hWnd, message.wx_str(), m_caption.wx_str(), msStyle);
int ans;
switch (msAns)
{

View File

@@ -139,7 +139,7 @@ private:
void wxDataFormat::SetId(const wxString& format)
{
m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format);
m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.wx_str());
if ( !m_format )
{
wxLogError(_("Couldn't register clipboard format '%s'."), format);
@@ -1082,7 +1082,7 @@ size_t wxFileDataObject::GetDataSize() const
size_t len;
#if wxUSE_UNICODE_MSLU
if ( sizeOfChar == sizeof(char) )
len = strlen(wxConvFileName->cWC2MB(m_filenames[i]));
len = strlen(m_filenames[i].mb_str(*wxConvFileName));
else
#endif // wxUSE_UNICODE_MSLU
len = m_filenames[i].length();
@@ -1131,7 +1131,7 @@ bool wxFileDataObject::GetDataHere(void *WXUNUSED_IN_WINCE(pData)) const
#if wxUSE_UNICODE_MSLU
if ( sizeOfChar == sizeof(char) )
{
wxCharBuffer buf(wxConvFileName->cWC2MB(m_filenames[i]));
wxCharBuffer buf(m_filenames[i].mb_str(*wxConvFileName));
len = strlen(buf);
memcpy(pbuf, buf, len*sizeOfChar);
}

View File

@@ -170,7 +170,7 @@ bool wxRadioBox::Create(wxWindow *parent,
long newId = NewControlId();
HWND hwndBtn = ::CreateWindow(_T("BUTTON"),
choices[i],
choices[i].wx_str(),
styleBtn,
0, 0, 0, 0, // will be set in SetSize()
GetHwndOf(parent),

View File

@@ -573,7 +573,7 @@ void wxSlider::SetValue(int value)
if ( m_labels )
{
::SetWindowText((*m_labels)[SliderLabel_Value], Format(value));
::SetWindowText((*m_labels)[SliderLabel_Value], Format(value).wx_str());
}
}
@@ -587,8 +587,10 @@ void wxSlider::SetRange(int minValue, int maxValue)
if ( m_labels )
{
::SetWindowText((*m_labels)[SliderLabel_Min], Format(ValueInvertOrNot(m_rangeMin)));
::SetWindowText((*m_labels)[SliderLabel_Max], Format(ValueInvertOrNot(m_rangeMax)));
::SetWindowText((*m_labels)[SliderLabel_Min],
Format(ValueInvertOrNot(m_rangeMin)).wx_str());
::SetWindowText((*m_labels)[SliderLabel_Max],
Format(ValueInvertOrNot(m_rangeMax)).wx_str());
}
}

View File

@@ -52,7 +52,7 @@ public:
bool Create(const wxString& name)
{
m_hMutex = ::CreateMutex(NULL, FALSE, name);
m_hMutex = ::CreateMutex(NULL, FALSE, name.wx_str());
if ( !m_hMutex )
{
wxLogLastError(_T("CreateMutex"));

View File

@@ -462,7 +462,8 @@ void wxSpinCtrl::SetValue(int val)
// text control is currently empty, the spin button seems to be happy
// to leave it like this, while we really want to always show the
// current value in the control, so do it manually
::SetWindowText(GetBuddyHwnd(), wxString::Format(_T("%d"), val));
::SetWindowText(GetBuddyHwnd(),
wxString::Format(_T("%d"), val).wx_str());
}
m_oldValue = GetValue();

View File

@@ -500,13 +500,13 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc)
if ( !rtl )
{
RECT rc2 = { x, 0, x + width, y };
::DrawText(hdc, label, label.length(), &rc2,
::DrawText(hdc, label.wx_str(), label.length(), &rc2,
DT_SINGLELINE | DT_VCENTER);
}
else // RTL
{
RECT rc2 = { x, 0, x - width, y };
::DrawText(hdc, label, label.length(), &rc2,
::DrawText(hdc, label.wx_str(), label.length(), &rc2,
DT_SINGLELINE | DT_VCENTER | DT_RTLREADING);
}
}

View File

@@ -218,7 +218,7 @@ void wxStatusBar95::SetStatusText(const wxString& strText, int nField)
// Pass both field number and style. MSDN library doesn't mention
// that nField and style have to be 'ORed'
if ( !StatusBar_SetText(GetHwnd(), nField | style, strText) )
if ( !StatusBar_SetText(GetHwnd(), nField | style, strText.wx_str()) )
{
wxLogLastError(wxT("StatusBar_SetText"));
}
@@ -404,7 +404,7 @@ void wxStatusBar95::SetStatusStyles(int n, const int styles[])
// the fields' styles. MSDN library doesn't mention
// that nField and style have to be 'ORed'
wxString text = GetStatusText(i);
if (!StatusBar_SetText(GetHwnd(), style | i, text))
if (!StatusBar_SetText(GetHwnd(), style | i, text.wx_str()))
{
wxLogLastError(wxT("StatusBar_SetText"));
}

View File

@@ -446,7 +446,7 @@ bool wxTextCtrl::MSWCreateText(const wxString& value,
valueWin = value;
}
if ( !MSWCreateControl(windowClass, msStyle, pos, size, valueWin) )
if ( !MSWCreateControl(windowClass.wx_str(), msStyle, pos, size, valueWin) )
return false;
#if wxUSE_RICHEDIT

View File

@@ -339,7 +339,7 @@ void wxToolTip::Add(WXHWND hWnd)
while (token.length())
{
SIZE sz;
if ( !::GetTextExtentPoint32(hdc, token, token.length(), &sz) )
if ( !::GetTextExtentPoint32(hdc, token.wx_str(), token.length(), &sz) )
{
wxLogLastError(wxT("GetTextExtentPoint32"));
}

View File

@@ -479,7 +479,7 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
if ( !title.empty() )
{
::SetWindowText(GetHwnd(), title);
::SetWindowText(GetHwnd(), title.wx_str());
}
SubclassWin(m_hWnd);
@@ -507,7 +507,7 @@ bool wxTopLevelWindowMSW::CreateFrame(const wxString& title,
exflags |= WS_EX_LAYOUTRTL;
#endif
return MSWCreate(wxCanvasClassName, title, pos, sz, flags, exflags);
return MSWCreate(wxCanvasClassName, title.wx_str(), pos, sz, flags, exflags);
}
bool wxTopLevelWindowMSW::Create(wxWindow *parent,

View File

@@ -934,7 +934,7 @@ void wxTreeCtrl::SetItemText(const wxTreeItemId& item, const wxString& text)
{
if ( item == m_idEdited )
{
::SetWindowText(hwndEdit, text);
::SetWindowText(hwndEdit, text.wx_str());
}
}
}

View File

@@ -514,7 +514,7 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
ULARGE_INTEGER bytesFree, bytesTotal;
// may pass the path as is, GetDiskFreeSpaceEx() is smart enough
if ( !pGetDiskFreeSpaceEx(path,
if ( !pGetDiskFreeSpaceEx(path.fn_str(),
&bytesFree,
&bytesTotal,
NULL) )
@@ -564,7 +564,7 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
// FIXME: this is wrong, we should extract the root drive from path
// instead, but this is the job for wxFileName...
if ( !::GetDiskFreeSpace(path,
if ( !::GetDiskFreeSpace(path.fn_str(),
&lSectorsPerCluster,
&lBytesPerSector,
&lNumberOfFreeClusters,
@@ -608,7 +608,7 @@ bool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var),
return false;
#else // Win32
// first get the size of the buffer
DWORD dwRet = ::GetEnvironmentVariable(var, NULL, 0);
DWORD dwRet = ::GetEnvironmentVariable(var.wx_str(), NULL, 0);
if ( !dwRet )
{
// this means that there is no such variable
@@ -617,7 +617,8 @@ bool wxGetEnv(const wxString& WXUNUSED_IN_WINCE(var),
if ( value )
{
(void)::GetEnvironmentVariable(var, wxStringBuffer(*value, dwRet),
(void)::GetEnvironmentVariable(var.wx_str(),
wxStringBuffer(*value, dwRet),
dwRet);
}

View File

@@ -107,7 +107,9 @@ bool wxCheckForInterrupt(wxWindow *wnd)
#ifndef __WXMICROWIN__
wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType)
{
HRSRC hResource = ::FindResource(wxGetInstance(), resourceName, resourceType);
HRSRC hResource = ::FindResource(wxGetInstance(),
resourceName.wx_str(),
resourceType.wx_str());
if ( hResource == 0 )
return NULL;

View File

@@ -1979,7 +1979,7 @@ void wxWindowMSW::GetTextExtent(const wxString& string,
SIZE sizeRect;
TEXTMETRIC tm;
::GetTextExtentPoint32(hdc, string, string.length(), &sizeRect);
::GetTextExtentPoint32(hdc, string.wx_str(), string.length(), &sizeRect);
GetTextMetrics(hdc, &tm);
if ( x )
@@ -3369,8 +3369,8 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass,
m_hWnd = (WXHWND)::CreateWindowEx
(
extendedStyle,
className,
title ? title : (const wxChar*)m_windowName.c_str(),
className.wx_str(),
title ? title : m_windowName.wx_str(),
style,
x, y, w, h,
(HWND)MSWGetParent(),