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 class WXDLLIMPEXP_BASE wxFontMapperBase
{ {
public: public:
// constructtor and such // constructor and such
// --------------------- // ---------------------
// default ctor // default ctor

View File

@@ -51,7 +51,10 @@ public:
// Calls that CLIENT can make // Calls that CLIENT can make
virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT); 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 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 Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT);
virtual bool StartAdvise(const wxString& item); virtual bool StartAdvise(const wxString& item);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -76,7 +76,7 @@ wxString wxGridCellDateTimeRenderer::GetString(const wxGrid& grid, int row, int
if (!hasDatetime ) if (!hasDatetime )
{ {
text = table->GetValue(row, col); 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 ) 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 // don't prepend debug/trace here: it goes to the
// debug window anyhow // debug window anyhow
str += wxT("\r\n"); str += wxT("\r\n");
OutputDebugString(str); OutputDebugString(str.wx_str());
#else #else
// send them to stderr // send them to stderr
wxFprintf(stderr, wxT("[%s] %s\n"), 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; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
// FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
#if wxUSE_UNICODE_UTF8 #if wxUSE_UNICODE_UTF8
const char *utf8 = value.utf8_str(); const char *utf8 = value.utf8_str();
#else #else

View File

@@ -158,19 +158,18 @@ enum MnemonicsFlag
MNEMONICS_CONVERT_MARKUP 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; wxString labelGTK;
labelGTK.reserve(len); labelGTK.reserve(label.length());
for ( size_t i = 0; i < len; i++ ) for ( wxString::const_iterator i = label.begin(); i != label.end(); ++i )
{ {
wxChar ch = label[i]; wxChar ch = *i;
switch ( ch ) switch ( ch )
{ {
case wxT('&'): case wxT('&'):
if ( i == len - 1 ) if ( i + 1 == label.end() )
{ {
// "&" at the end of string is an error // "&" at the end of string is an error
wxLogDebug(wxT("Invalid label \"%s\"."), label); wxLogDebug(wxT("Invalid label \"%s\"."), label);
@@ -180,6 +179,7 @@ static wxString GTKProcessMnemonics(const wxChar* label, MnemonicsFlag flag)
if ( flag == MNEMONICS_CONVERT_MARKUP ) if ( flag == MNEMONICS_CONVERT_MARKUP )
{ {
bool isMnemonic = true; bool isMnemonic = true;
size_t distanceFromEnd = label.end() - i;
// is this ampersand introducing a mnemonic or rather an entity? // is this ampersand introducing a mnemonic or rather an entity?
for (size_t j=0; j < wxMARKUP_ENTITY_MAX; j++) 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]; const wxChar *entity = wxMarkupEntities[wxMARKUP_ELEMENT_NAME][j];
size_t entityLen = wxStrlen(entity); size_t entityLen = wxStrlen(entity);
if (len - i >= entityLen && if (distanceFromEnd >= entityLen &&
wxStrncmp(entity, &label[i], entityLen) == 0) wxString(i, i + entityLen) == entity)
{ {
labelGTK << entity; labelGTK << entity;
i += entityLen - 1; // the -1 is because main for() i += entityLen - 1; // the -1 is because main for()
@@ -203,7 +203,7 @@ static wxString GTKProcessMnemonics(const wxChar* label, MnemonicsFlag flag)
continue; continue;
} }
ch = label[++i]; // skip '&' itself ch = *(++i); // skip '&' itself
switch ( ch ) switch ( ch )
{ {
case wxT('&'): 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(); bool underlined = m_font.Ok() && m_font.GetUnderlined();
#if wxUSE_UNICODE // FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
const wxCharBuffer data = wxConvUTF8.cWC2MB( text ); #if wxUSE_UNICODE_UTF8
const char *data = text.utf8_str();
#else #else
const wxWCharBuffer wdata = wxConvLocal.cMB2WC( text ); const wxCharBuffer data = text.utf8_str();
if ( !wdata )
return;
const wxCharBuffer data = wxConvUTF8.cWC2MB( wdata );
#endif #endif
size_t datalen = strlen((const char*)data); size_t datalen = strlen(data);
pango_layout_set_text( m_layout, (const char*) data, datalen); pango_layout_set_text( m_layout, data, datalen);
if (underlined) 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 ); pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
// Set layout's text // 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 ) // FIXME-UTF8: wouldn't be needed if utf8_str() always returned a buffer
{ #if wxUSE_UNICODE_UTF8
// hardly ideal, but what else can we do if conversion failed? const char *dataUTF8 = string.utf8_str();
return; #else
} const wxCharBuffer dataUTF8 = string.utf8_str();
#endif
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) ); 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; wxString text;
// '\t' is the deliminator indicating a hot key // '\t' is the deliminator indicating a hot key
const wxChar *pc = str; wxString::const_iterator pc = str.begin();
while ( (*pc != wxT('\0')) && (*pc != wxT('\t')) ) while ( pc != str.end() && *pc != wxT('\t') )
{ {
if ((*pc == wxT('&')) && (*(pc+1) == wxT('&'))) if (*pc == wxT('&'))
{ {
// "&" is doubled to indicate "&" instead of accelerator wxString::const_iterator next = pc + 1;
++pc; if (next != str.end() && *next == wxT('&'))
text << wxT('&'); {
} // "&" is doubled to indicate "&" instead of accelerator
else if (*pc == wxT('&')) ++pc;
{ text << wxT('&');
text << wxT('_'); }
else
{
text << wxT('_');
}
} }
else if ( *pc == wxT('_') ) // escape underscores else if ( *pc == wxT('_') ) // escape underscores
{ {
@@ -898,7 +902,7 @@ wxString wxMenuItem::GTKProcessMenuItemLabel(const wxString& str, wxString *hotK
if(*pc == wxT('\t')) if(*pc == wxT('\t'))
{ {
pc++; pc++;
*hotKey = pc; hotKey->assign(pc, str.end());
} }
} }

View File

@@ -90,7 +90,7 @@ wxAcceleratorTable::wxAcceleratorTable(const wxString& resource)
{ {
m_refData = new wxAcceleratorRefData; m_refData = new wxAcceleratorRefData;
HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource); HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.wx_str());
M_ACCELDATA->m_hAccel = hAccel; M_ACCELDATA->m_hAccel = hAccel;
M_ACCELDATA->m_ok = hAccel != 0; 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 // first we need to compute its bounding rect
RECT rc; RECT rc;
::CopyRect(&rc, pRect); ::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 // now center this rect inside the entire button area
const LONG w = rc.right - rc.left; 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.top = (pRect->bottom - pRect->top)/2 - h/2;
rc.bottom = rc.top+h; 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 else // single line label
{ {
// Note: we must have DT_SINGLELINE for DT_VCENTER to work. // 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); DT_SINGLELINE | DT_CENTER | DT_VCENTER);
} }

View File

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

View File

@@ -69,7 +69,7 @@ wxColourDialogHookProc(HWND hwnd,
CHOOSECOLOR *pCC = (CHOOSECOLOR *)lParam; CHOOSECOLOR *pCC = (CHOOSECOLOR *)lParam;
wxColourDialog *dialog = (wxColourDialog *)pCC->lCustData; wxColourDialog *dialog = (wxColourDialog *)pCC->lCustData;
::SetWindowText(hwnd, dialog->GetTitle()); ::SetWindowText(hwnd, dialog->GetTitle().wx_str());
wxPoint pos = dialog->GetPosition(); wxPoint pos = dialog->GetPosition();
if ( pos != wxDefaultPosition ) 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 // this string is going to become the new combobox value soon but
// we need it to be done right now, otherwise the event handler // we need it to be done right now, otherwise the event handler
// could get a wrong value when it calls our GetValue() // 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()); wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
@@ -680,7 +680,7 @@ void wxComboBox::Replace(long from, long to, const wxString& value)
Remove(from, to); Remove(from, to);
// Now replace with 'value', by pasting. // 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 // Paste into edit control
SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L); SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L);

View File

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

View File

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

View File

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

View File

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

View File

@@ -286,7 +286,7 @@ bool wxDIB::Load(const wxString& filename)
m_handle = (HBITMAP)::LoadImage m_handle = (HBITMAP)::LoadImage
( (
wxGetInstance(), wxGetInstance(),
filename, filename.fn_str(),
IMAGE_BITMAP, IMAGE_BITMAP,
0, 0, // don't specify the size 0, 0, // don't specify the size
LR_CREATEDIBSECTION | LR_LOADFROMFILE 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, static inline FIND_DATA FindFirst(const wxString& spec,
FIND_STRUCT *finddata) FIND_STRUCT *finddata)
{ {
return ::FindFirstFile(spec, finddata); return ::FindFirstFile(spec.fn_str(), finddata);
} }
static inline bool FindNext(FIND_DATA fd, FIND_STRUCT *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 // do change the mode
switch ( pfnChangeDisplaySettingsEx switch ( pfnChangeDisplaySettingsEx
( (
GetName(), // display name GetName().wx_str(), // display name
pDevMode, // dev mode or NULL to reset pDevMode, // dev mode or NULL to reset
NULL, // reserved NULL, // reserved
flags, flags,
NULL // pointer to video parameters (not used) NULL // pointer to video parameters (not used)
) ) ) )
{ {
case DISP_CHANGE_SUCCESSFUL: 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 // 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 // still need to use GetModuleHandleW() there and so do it everywhere to
// avoid #ifdefs -- this code is not performance-critical anyhow... // 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 wxDllType
wxDynamicLibrary::RawLoad(const wxString& libname, int WXUNUSED(flags)) wxDynamicLibrary::RawLoad(const wxString& libname, int WXUNUSED(flags))
{ {
return ::LoadLibrary(libname); return ::LoadLibrary(libname.wx_str());
} }
/* static */ /* static */

View File

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

View File

@@ -310,7 +310,7 @@ wxFindReplaceDialogHookProc(HWND hwnd,
FINDREPLACE *pFR = (FINDREPLACE *)lParam; FINDREPLACE *pFR = (FINDREPLACE *)lParam;
wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData; 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 // don't return FALSE from here or the dialog won't be shown
return TRUE; return TRUE;

View File

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

View File

@@ -323,7 +323,7 @@ bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap,
int WXUNUSED(desiredHeight)) int WXUNUSED(desiredHeight))
{ {
// TODO: load colourmap. // TODO: load colourmap.
bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name)); bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name.wx_str()));
if ( !bitmap->Ok() ) if ( !bitmap->Ok() )
{ {
@@ -438,7 +438,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
desiredHeight == ::GetSystemMetrics(SM_CYICON) ) desiredHeight == ::GetSystemMetrics(SM_CYICON) )
{ {
// get the specified large icon from file // 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 // it is not an error, but it might still be useful to be informed
// about it optionally // about it optionally
@@ -451,7 +451,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
desiredHeight == ::GetSystemMetrics(SM_CYSMICON) ) desiredHeight == ::GetSystemMetrics(SM_CYSMICON) )
{ {
// get the specified small icon from file // 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"), wxLogTrace(_T("iconload"),
_T("No small icons found in the file '%s'."), _T("No small icons found in the file '%s'."),
@@ -464,7 +464,7 @@ bool wxICOFileHandler::LoadIcon(wxIcon *icon,
if ( !hicon ) if ( !hicon )
{ {
// take any size icon from the file by index // take any size icon from the file by index
hicon = ::ExtractIcon(wxGetInstance(), nameReal, iconIndex); hicon = ::ExtractIcon(wxGetInstance(), nameReal.wx_str(), iconIndex);
} }
#endif #endif
@@ -518,13 +518,13 @@ bool wxICOResourceHandler::LoadIcon(wxIcon *icon,
// some icon rescaling internally which results in very ugly 16x16 icons // some icon rescaling internally which results in very ugly 16x16 icons
if ( hasSize ) if ( hasSize )
{ {
hicon = (HICON)::LoadImage(wxGetInstance(), name, IMAGE_ICON, hicon = (HICON)::LoadImage(wxGetInstance(), name.wx_str(), IMAGE_ICON,
desiredWidth, desiredHeight, desiredWidth, desiredHeight,
LR_DEFAULTCOLOR); LR_DEFAULTCOLOR);
} }
else else
{ {
hicon = ::LoadIcon(wxGetInstance(), name); hicon = ::LoadIcon(wxGetInstance(), name.wx_str());
} }
// next check if it's not a standard icon // 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(); HTMLHELP htmlHelp = GetHtmlHelpFunction();
return htmlHelp && htmlHelp(GetSuitableHWND(win), str, uint, dword); return htmlHelp &&
htmlHelp(GetSuitableHWND(win), str, uint, dword);
} }
IMPLEMENT_DYNAMIC_CLASS(wxCHMHelpController, wxHelpControllerBase) IMPLEMENT_DYNAMIC_CLASS(wxCHMHelpController, wxHelpControllerBase)
@@ -116,7 +117,8 @@ bool wxCHMHelpController::DisplayContents()
wxString str = GetValidFilename(m_helpFile); 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 // Use topic or HTML filename
@@ -131,7 +133,8 @@ bool wxCHMHelpController::DisplaySection(const wxString& section)
if ( section.Find(wxT(".htm")) != wxNOT_FOUND ) if ( section.Find(wxT(".htm")) != wxNOT_FOUND )
{ {
// interpret as a file name // 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())); wxPtrToUInt(section.c_str()));
} }
@@ -146,8 +149,8 @@ bool wxCHMHelpController::DisplaySection(int section)
wxString str = GetValidFilename(m_helpFile); wxString str = GetValidFilename(m_helpFile);
return CallHtmlHelpFunction(GetParentWindow(), str, HH_HELP_CONTEXT, return CallHtmlHelpFunction(GetParentWindow(),
(DWORD)section); str.wx_str(), HH_HELP_CONTEXT, (DWORD)section);
} }
bool wxCHMHelpController::DisplayContextPopup(int contextId) bool wxCHMHelpController::DisplayContextPopup(int contextId)
@@ -171,7 +174,8 @@ bool wxCHMHelpController::DisplayContextPopup(int contextId)
popup.pszFont = NULL; popup.pszFont = NULL;
popup.pszText = NULL; popup.pszText = NULL;
return CallHtmlHelpFunction(GetParentWindow(), str, HH_DISPLAY_TEXT_POPUP, return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_DISPLAY_TEXT_POPUP,
wxPtrToUInt(&popup)); wxPtrToUInt(&popup));
} }
@@ -195,7 +199,7 @@ bool wxCHMHelpController::ShowContextHelpPopup(const wxString& text,
popup.clrBackground = (COLORREF)-1; popup.clrBackground = (COLORREF)-1;
popup.rcMargins.top = popup.rcMargins.left = popup.rcMargins.right = popup.rcMargins.bottom = -1; popup.rcMargins.top = popup.rcMargins.left = popup.rcMargins.right = popup.rcMargins.bottom = -1;
popup.pszFont = NULL; popup.pszFont = NULL;
popup.pszText = (const wxChar*) text; popup.pszText = text.wx_str();
return CallHtmlHelpFunction(window, NULL, HH_DISPLAY_TEXT_POPUP, return CallHtmlHelpFunction(window, NULL, HH_DISPLAY_TEXT_POPUP,
wxPtrToUInt(&popup)); wxPtrToUInt(&popup));
@@ -224,7 +228,8 @@ bool wxCHMHelpController::KeywordSearch(const wxString& k,
link.pszWindow = NULL ; link.pszWindow = NULL ;
link.fIndexOnFail = TRUE ; link.fIndexOnFail = TRUE ;
return CallHtmlHelpFunction(GetParentWindow(), str, HH_KEYWORD_LOOKUP, return CallHtmlHelpFunction(GetParentWindow(),
str.wx_str(), HH_KEYWORD_LOOKUP,
wxPtrToUInt(&link)); wxPtrToUInt(&link));
} }

View File

@@ -63,7 +63,7 @@ bool wxWinHelpController::DisplayContents(void)
wxString str = GetValidFilename(m_helpFile); 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) bool wxWinHelpController::DisplaySection(int section)
@@ -73,7 +73,7 @@ bool wxWinHelpController::DisplaySection(int section)
wxString str = GetValidFilename(m_helpFile); 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) bool wxWinHelpController::DisplayContextPopup(int contextId)
@@ -82,7 +82,7 @@ bool wxWinHelpController::DisplayContextPopup(int contextId)
wxString str = GetValidFilename(m_helpFile); 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) bool wxWinHelpController::DisplayBlock(long block)
@@ -98,7 +98,7 @@ bool wxWinHelpController::KeywordSearch(const wxString& k,
wxString str = GetValidFilename(m_helpFile); 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 // 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 wxListBox::DoAppend(const wxString& item)
{ {
int index = ListBox_AddString(GetHwnd(), item); int index = ListBox_AddString(GetHwnd(), item.wx_str());
m_noItems++; m_noItems++;
#if wxUSE_OWNER_DRAWN #if wxUSE_OWNER_DRAWN
@@ -312,7 +312,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
unsigned int i; unsigned int i;
for (i = 0; i < m_noItems; i++) for (i = 0; i < m_noItems; i++)
{ {
ListBox_AddString(GetHwnd(), choices[i]); ListBox_AddString(GetHwnd(), choices[i].wx_str());
if ( clientData ) if ( clientData )
{ {
SetClientData(i, clientData[i]); SetClientData(i, clientData[i]);
@@ -349,7 +349,7 @@ int wxListBox::FindString(const wxString& s, bool bCase) const
if (bCase) if (bCase)
return wxItemContainerImmutable::FindString( s, 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) if (pos == LB_ERR)
return wxNOT_FOUND; return wxNOT_FOUND;
else else
@@ -520,7 +520,7 @@ wxListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
unsigned int nItems = items.GetCount(); unsigned int nItems = items.GetCount();
for ( unsigned int i = 0; i < nItems; i++ ) 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 wxUSE_OWNER_DRAWN
if ( m_windowStyle & wxLB_OWNERDRAW ) if ( m_windowStyle & wxLB_OWNERDRAW )
@@ -574,7 +574,7 @@ void wxListBox::SetString(unsigned int n, const wxString& s)
if ( n == (m_noItems - 1) ) if ( n == (m_noItems - 1) )
newN = -1; newN = -1;
ListBox_InsertString(GetHwnd(), newN, s); ListBox_InsertString(GetHwnd(), newN, s.wx_str());
// restore the client data // restore the client data
if ( oldData ) if ( oldData )

View File

@@ -1424,7 +1424,7 @@ long wxListCtrl::FindItem(long start, const wxString& str, bool partial)
findInfo.flags = LVFI_STRING; findInfo.flags = LVFI_STRING;
if ( partial ) if ( partial )
findInfo.flags |= LVFI_PARTIAL; findInfo.flags |= LVFI_PARTIAL;
findInfo.psz = str; findInfo.psz = str.wx_str();
// ListView_FindItem() excludes the first item from search and to look // 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 // 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; msflags &= ~WS_HSCROLL;
if ( !wxWindow::MSWCreate(wxMDIFrameClassName, if ( !wxWindow::MSWCreate(wxMDIFrameClassName,
title, title.wx_str(),
pos, size, pos, size,
msflags, msflags,
exflags) ) exflags) )
@@ -711,7 +711,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE
? wxMDIChildFrameClassName ? wxMDIChildFrameClassName
: wxMDIChildFrameClassNameNoRedraw; : wxMDIChildFrameClassNameNoRedraw;
mcs.szTitle = title; mcs.szTitle = title.wx_str();
mcs.hOwner = wxGetInstance(); mcs.hOwner = wxGetInstance();
if (x != wxDefaultCoord) if (x != wxDefaultCoord)
mcs.x = x; mcs.x = x;
@@ -1430,14 +1430,14 @@ static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu)
{ {
success = true; success = true;
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT)subMenu, _("&Window")); (UINT)subMenu, _("&Window").wx_str());
break; break;
} }
} }
if ( !success ) 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 ( !label.empty() )
{ {
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING, 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) ) !::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{ {
wxLogLastError(wxT("InsertMenu")); wxLogLastError(wxT("InsertMenu"));
@@ -767,7 +767,7 @@ void wxMenu::SetTitle(const wxString& label)
#else #else
if ( !ModifyMenu(hMenu, 0u, if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING, MF_BYPOSITION | MF_STRING,
(unsigned)idMenuTitle, m_title) ) (unsigned)idMenuTitle, m_title.wx_str()) )
{ {
wxLogLastError(wxT("ModifyMenu")); wxLogLastError(wxT("ModifyMenu"));
} }
@@ -979,7 +979,7 @@ WXHMENU wxMenuBar::Create()
{ {
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING, if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
(UINT)(*it)->GetHMenu(), (UINT)(*it)->GetHMenu(),
m_titles[i]) ) m_titles[i].wx_str()) )
{ {
wxLogLastError(wxT("AppendMenu")); wxLogLastError(wxT("AppendMenu"));
} }
@@ -1085,7 +1085,7 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
#else #else
if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld, if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld,
id, label) == (int)0xFFFFFFFF ) id, label.wx_str()) == (int)0xFFFFFFFF )
{ {
wxLogLastError(wxT("ModifyMenu")); wxLogLastError(wxT("ModifyMenu"));
} }
@@ -1130,7 +1130,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
if ( !::InsertMenu(GetHmenu(), (UINT)mswpos, if ( !::InsertMenu(GetHmenu(), (UINT)mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT)GetHmenuOf(menu), title) ) (UINT)GetHmenuOf(menu), title.wx_str()) )
{ {
wxLogLastError(wxT("InsertMenu")); wxLogLastError(wxT("InsertMenu"));
} }
@@ -1197,7 +1197,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
#else #else
if ( !::InsertMenu(GetHmenu(), mswpos, if ( !::InsertMenu(GetHmenu(), mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT)GetHmenuOf(menu), title) ) (UINT)GetHmenuOf(menu), title.wx_str()) )
{ {
wxLogLastError(wxT("InsertMenu")); wxLogLastError(wxT("InsertMenu"));
} }
@@ -1256,7 +1256,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
} }
#else #else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING, if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
(UINT)submenu, title) ) (UINT)submenu, title.wx_str()) )
{ {
wxLogLastError(wxT("AppendMenu")); wxLogLastError(wxT("AppendMenu"));
} }

View File

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

View File

@@ -109,7 +109,7 @@ int wxMessageDialog::ShowModal()
#endif // wxUSE_UNICODE #endif // wxUSE_UNICODE
// do show the dialog // 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; int ans;
switch (msAns) switch (msAns)
{ {

View File

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

View File

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

View File

@@ -573,7 +573,7 @@ void wxSlider::SetValue(int value)
if ( m_labels ) 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 ) if ( m_labels )
{ {
::SetWindowText((*m_labels)[SliderLabel_Min], Format(ValueInvertOrNot(m_rangeMin))); ::SetWindowText((*m_labels)[SliderLabel_Min],
::SetWindowText((*m_labels)[SliderLabel_Max], Format(ValueInvertOrNot(m_rangeMax))); 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) bool Create(const wxString& name)
{ {
m_hMutex = ::CreateMutex(NULL, FALSE, name); m_hMutex = ::CreateMutex(NULL, FALSE, name.wx_str());
if ( !m_hMutex ) if ( !m_hMutex )
{ {
wxLogLastError(_T("CreateMutex")); 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 // 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 // to leave it like this, while we really want to always show the
// current value in the control, so do it manually // 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(); m_oldValue = GetValue();

View File

@@ -500,13 +500,13 @@ void wxStaticBox::PaintForeground(wxDC& dc, const RECT& rc)
if ( !rtl ) if ( !rtl )
{ {
RECT rc2 = { x, 0, x + width, y }; 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_SINGLELINE | DT_VCENTER);
} }
else // RTL else // RTL
{ {
RECT rc2 = { x, 0, x - width, y }; 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); 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 // Pass both field number and style. MSDN library doesn't mention
// that nField and style have to be 'ORed' // 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")); wxLogLastError(wxT("StatusBar_SetText"));
} }
@@ -404,7 +404,7 @@ void wxStatusBar95::SetStatusStyles(int n, const int styles[])
// the fields' styles. MSDN library doesn't mention // the fields' styles. MSDN library doesn't mention
// that nField and style have to be 'ORed' // that nField and style have to be 'ORed'
wxString text = GetStatusText(i); wxString text = GetStatusText(i);
if (!StatusBar_SetText(GetHwnd(), style | i, text)) if (!StatusBar_SetText(GetHwnd(), style | i, text.wx_str()))
{ {
wxLogLastError(wxT("StatusBar_SetText")); wxLogLastError(wxT("StatusBar_SetText"));
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -107,7 +107,9 @@ bool wxCheckForInterrupt(wxWindow *wnd)
#ifndef __WXMICROWIN__ #ifndef __WXMICROWIN__
wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType) 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 ) if ( hResource == 0 )
return NULL; return NULL;

View File

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