- Fix handling of composite windows in wxToolTip (Armel Asselin).
- Add VT_I8 support to wxAutomationObject (PB).
- Fix wxListbook size calculations to avoid spurious scrollbars.
-- Fix non-GUI code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
+- Fix code compilation with wxUSE_UNICODE_UTF8 (Kolya Kosenko).
OSX:
// the first 2 HtmlHelp() parameters
bool CallHtmlHelp(unsigned cmd, WXWPARAM param)
{
- return CallHtmlHelp(GetParentWindow(), GetValidFilename().wx_str(),
+ return CallHtmlHelp(GetParentWindow(), GetValidFilename().t_str(),
cmd, param);
}
{
if ( IsRegistered() )
{
- if ( !::UnregisterClass(m_clsname.wx_str(), wxGetInstance()) )
+ if ( !::UnregisterClass(m_clsname.t_str(), wxGetInstance()) )
{
wxLogLastError(wxT("UnregisterClass"));
}
{
m_refData = new wxAcceleratorRefData;
- HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.wx_str());
+ HACCEL hAccel = ::LoadAccelerators(wxGetInstance(), resource.t_str());
M_ACCELDATA->m_hAccel = hAccel;
M_ACCELDATA->m_ok = hAccel != 0;
}
// first we need to compute its bounding rect
RECT rc;
::CopyRect(&rc, pRect);
- ::DrawText(hdc, text.wx_str(), text.length(), &rc,
+ ::DrawText(hdc, text.t_str(), text.length(), &rc,
DT_CENTER | DT_CALCRECT);
// now center this rect inside the entire button area
rc.top = pRect->top + (pRect->bottom - pRect->top)/2 - h/2;
rc.bottom = rc.top+h;
- ::DrawText(hdc, text.wx_str(), text.length(), &rc, flags);
+ ::DrawText(hdc, text.t_str(), text.length(), &rc, flags);
}
else // single line label
{
// notice that we must have DT_SINGLELINE for vertical alignment flags
// to work
- ::DrawText(hdc, text.wx_str(), text.length(), pRect,
+ ::DrawText(hdc, text.t_str(), text.length(), pRect,
flags | DT_SINGLELINE );
}
}
return false;
}
- if ( !::WriteConsole(m_hStderr, text.wx_str(), text.length(), &ret, NULL) )
+ if ( !::WriteConsole(m_hStderr, text.t_str(), text.length(), &ret, NULL) )
{
wxLogLastError(wxT("WriteConsole"));
return false;
ClassRegInfo regClass(name);
- wndclass.lpszClassName = regClass.regname.wx_str();
+ wndclass.lpszClassName = regClass.regname.t_str();
if ( !::RegisterClass(&wndclass) )
{
wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
}
wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW);
- wndclass.lpszClassName = regClass.regnameNR.wx_str();
+ wndclass.lpszClassName = regClass.regnameNR.t_str();
if ( !::RegisterClass(&wndclass) )
{
wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
// function returns (it could be invalidated later if new elements are
// added to the vector and it's reallocated but this shouldn't matter as
// this pointer should be used right now, not stored)
- return gs_regClassesInfo.back().regname.wx_str();
+ return gs_regClassesInfo.back().regname.t_str();
}
bool wxApp::IsRegisteredClassName(const wxString& name)
}
const wxChar * const clsname = s_clsMonthCal.IsRegistered()
- ? s_clsMonthCal.GetName().wx_str()
+ ? s_clsMonthCal.GetName().t_str()
: MONTHCAL_CLASS;
if ( !MSWCreateControl(clsname, wxEmptyString, pos, size) )
// around it
if ( isFocused )
{
- if ( !::DrawText(hdc, label.wx_str(), label.length(), &rectLabel,
+ if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel,
fmt | DT_CALCRECT) )
{
wxLogLastError(wxT("DrawText(DT_CALCRECT)"));
::SetTextColor(hdc, ::GetSysColor(COLOR_GRAYTEXT));
}
- if ( !::DrawText(hdc, label.wx_str(), label.length(), &rectLabel, fmt) )
+ if ( !::DrawText(hdc, label.t_str(), label.length(), &rectLabel, fmt) )
{
wxLogLastError(wxT("DrawText()"));
}
else
{
int pos = (int)SendMessage(GetHwnd(), CB_FINDSTRINGEXACT,
- (WPARAM)-1, (LPARAM)s.wx_str());
+ (WPARAM)-1, wxMSW_CONV_LPARAM(s));
return pos == LB_ERR ? wxNOT_FOUND : pos;
}
const bool wasSelected = static_cast<int>(n) == GetSelection();
::SendMessage(GetHwnd(), CB_DELETESTRING, n, 0);
- ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, (LPARAM)s.wx_str() );
+ ::SendMessage(GetHwnd(), CB_INSERTSTRING, n, wxMSW_CONV_LPARAM(s) );
// restore the client data
if ( oldData )
const wxString title = dialog->GetTitle();
if ( !title.empty() )
- ::SetWindowText(hwnd, title.wx_str());
+ ::SetWindowText(hwnd, title.t_str());
dialog->MSWOnInitDone((WXHWND)hwnd);
}
// 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.wx_str());
+ ::SetWindowText(GetHwnd(), value.t_str());
{
wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, GetId());
if ( HasNativeCommandLinkButton() )
{
wxButton::SetLabel(mainLabel);
- ::SendMessage(m_hWnd, BCM_SETNOTE, 0, (LPARAM) note.wx_str());
+ ::SendMessage(m_hWnd, BCM_SETNOTE, 0, wxMSW_CONV_LPARAM(note));
// Preserve the user-specified label for GetLabel()
m_labelOrig = mainLabel;
(
exstyle, // extended style
classname, // the kind of control to create
- label.wx_str(), // the window name
+ label.t_str(), // the window name
style, // the window style
x, y, w, h, // the window position and size
GetHwndOf(GetParent()), // parent
// Notice that 0xffff is not a valid Unicode character so the problem
// doesn't arise in Unicode build.
if ( !label.empty() && label[0] == -1 )
- ::SetWindowText(GetHwnd(), label.wx_str());
+ ::SetWindowText(GetHwnd(), label.t_str());
#endif // !wxUSE_UNICODE
// saving the label in m_labelOrig to return it verbatim
unsigned wm)
{
LRESULT n = SendMessage((HWND)MSWGetItemsHWND(), wm, pos,
- (LPARAM)item.wx_str());
+ wxMSW_CONV_LPARAM(item));
if ( n == CB_ERR || n == CB_ERRSPACE )
{
wxLogLastError(wxT("SendMessage(XX_ADD/INSERTSTRING)"));
SIZE sizeRect;
const size_t len = string.length();
- if ( !::GetTextExtentPoint32(GetHdc(), string.wx_str(), len, &sizeRect) )
+ if ( !::GetTextExtentPoint32(GetHdc(), string.t_str(), len, &sizeRect) )
{
wxLogLastError(wxT("GetTextExtentPoint32()"));
}
{
if ( !driver_name.empty() && !device_name.empty() && !file.empty() )
{
- m_hDC = (WXHDC) CreateDC(driver_name.wx_str(),
- device_name.wx_str(),
+ m_hDC = (WXHDC) CreateDC(driver_name.t_str(),
+ device_name.t_str(),
file.fn_str(),
NULL);
}
{
DOCINFO docinfo;
docinfo.cbSize = sizeof(DOCINFO);
- docinfo.lpszDocName = message.wx_str();
+ docinfo.lpszDocName = message.t_str();
wxString filename(m_printData.GetFilename());
if (filename.empty())
docinfo.lpszOutput = NULL;
else
- docinfo.lpszOutput = filename.wx_str();
+ docinfo.lpszOutput = filename.t_str();
docinfo.lpszDatatype = NULL;
docinfo.fwType = 0;
HDC hDC = ::CreateDC
(
NULL, // no driver name as we use device name
- deviceName.wx_str(),
+ deviceName.t_str(),
NULL, // unused
static_cast<DEVMODE *>(lockDevMode.Get())
);
#endif
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
bi.lpfn = BrowseCallbackProc;
- bi.lParam = (LPARAM)m_path.wx_str(); // param for the callback
+ bi.lParam = wxMSW_CONV_LPARAM(m_path); // param for the callback
static const int verComCtl32 = wxApp::GetComCtl32Version();
}
SendMessage(hwnd, BFFM_SETSTATUSTEXT,
- 0, (LPARAM)strDir.wx_str());
+ 0, wxMSW_CONV_LPARAM(strDir));
}
}
break;
// do change the mode
switch ( pfnChangeDisplaySettingsEx
(
- GetName().wx_str(), // display name
+ GetName().t_str(), // display name
pDevMode, // dev mode or NULL to reset
NULL, // reserved
flags,
// 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.wx_str(); }
+ { return !fn ? NULL : wxMSW_CONV_LPCTSTR(fn); }
// ============================================================================
// implementation
}
m_hDC = (WXHDC)::CreateEnhMetaFile(hdcRef, GetMetaFileName(filename),
- pRect, description.wx_str());
+ pRect, description.t_str());
if ( !m_hDC )
{
wxLogLastError(wxT("CreateEnhMetaFile"));
FINDREPLACE *pFR = (FINDREPLACE *)lParam;
wxFindReplaceDialog *dialog = (wxFindReplaceDialog *)pFR->lCustData;
- ::SetWindowText(hwnd, dialog->GetTitle().wx_str());
+ ::SetWindowText(hwnd, dialog->GetTitle().t_str());
// don't return FALSE from here or the dialog won't be shown
return TRUE;
of.lStructSize = gs_ofStructSize;
of.hwndOwner = hWnd;
- of.lpstrTitle = m_message.wx_str();
+ of.lpstrTitle = m_message.t_str();
of.lpstrFileTitle = titleBuffer;
of.nMaxFileTitle = wxMAXFILE + 1 + wxMAXEXT;
}
}
- of.lpstrFilter = (LPTSTR)filterBuffer.wx_str();
+ of.lpstrFilter = filterBuffer.t_str();
of.nFilterIndex = m_filterIndex + 1;
//=== Setting defaultFileName >>=========================================
wxString defextBuffer; // we need it to be alive until GetSaveFileName()!
if (HasFdFlag(wxFD_SAVE))
{
- const wxChar* extension = filterBuffer.wx_str();
+ const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension
(of.nFileExtension && fileNameBuffer[of.nFileExtension] == wxT('\0')) )
{
// User has typed a filename without an extension:
- const wxChar* extension = filterBuffer.wx_str();
+ const wxChar* extension = filterBuffer.t_str();
int maxFilter = (int)(of.nFilterIndex*2L) - 1;
for( int i = 0; i < maxFilter; i++ ) // get extension
#ifdef __WXWINCE__
::EnumFontFamilies(hDC,
- m_facename.empty() ? NULL : m_facename.wx_str(),
+ m_facename.empty() ? NULL : wxMSW_CONV_LPCTSTR(m_facename),
(wxFONTENUMPROC)wxFontEnumeratorProc,
(LPARAM)this) ;
#else // __WIN32__
int WXUNUSED(desiredHeight))
{
// TODO: load colourmap.
- bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name.wx_str()));
+ bitmap->SetHBITMAP((WXHBITMAP)::LoadBitmap(wxGetInstance(), name.t_str()));
if ( !bitmap->IsOk() )
{
desiredHeight == ::GetSystemMetrics(SM_CYICON) )
{
// get the specified large icon from file
- if ( !::ExtractIconEx(nameReal.wx_str(), iconIndex, &hicon, NULL, 1) )
+ if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, &hicon, NULL, 1) )
{
// it is not an error, but it might still be useful to be informed
// about it optionally
desiredHeight == ::GetSystemMetrics(SM_CYSMICON) )
{
// get the specified small icon from file
- if ( !::ExtractIconEx(nameReal.wx_str(), iconIndex, NULL, &hicon, 1) )
+ if ( !::ExtractIconEx(nameReal.t_str(), iconIndex, NULL, &hicon, 1) )
{
wxLogTrace(wxT("iconload"),
wxT("No small icons found in the file '%s'."),
if ( !hicon )
{
// take any size icon from the file by index
- hicon = ::ExtractIcon(wxGetInstance(), nameReal.wx_str(), iconIndex);
+ hicon = ::ExtractIcon(wxGetInstance(), nameReal.t_str(), iconIndex);
}
#endif
// some icon rescaling internally which results in very ugly 16x16 icons
if ( hasSize )
{
- hicon = (HICON)::LoadImage(wxGetInstance(), name.wx_str(), IMAGE_ICON,
+ hicon = (HICON)::LoadImage(wxGetInstance(), name.t_str(), IMAGE_ICON,
desiredWidth, desiredHeight,
LR_DEFAULTCOLOR);
}
else
{
- hicon = ::LoadIcon(wxGetInstance(), name.wx_str());
+ hicon = ::LoadIcon(wxGetInstance(), name.t_str());
}
// next check if it's not a standard icon
// notice that we need to store the string we use the pointer to until we
// pass it to the control
hdi.mask |= HDI_TEXT;
- wxWxCharBuffer buf = col.GetTitle().wx_str();
+ wxWxCharBuffer buf = col.GetTitle().t_str();
hdi.pszText = buf.data();
hdi.cchTextMax = wxStrlen(buf);
if ( section.Find(wxT(".htm")) != wxNOT_FOUND )
{
// interpret as a file name
- return CallHtmlHelp(HH_DISPLAY_TOPIC, section.wx_str());
+ return CallHtmlHelp(HH_DISPLAY_TOPIC, wxMSW_CONV_LPCTSTR(section));
}
return KeywordSearch(section);
const wxPoint& pos,
wxWindow *window)
{
- return DoDisplayTextPopup(text.wx_str(), pos, 0, window);
+ return DoDisplayTextPopup(text.t_str(), pos, 0, window);
}
bool wxCHMHelpController::DisplayBlock(long block)
HH_AKLINK link;
link.cbStruct = sizeof(HH_AKLINK);
link.fReserved = FALSE;
- link.pszKeywords = k.wx_str();
+ link.pszKeywords = k.t_str();
link.pszUrl = NULL;
link.pszMsgText = NULL;
link.pszMsgTitle = NULL;
wxString str = GetValidFilename(m_helpFile);
- return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_FINDER, 0L) != 0);
+ return (WinHelp(GetSuitableHWND(this), str.t_str(), HELP_FINDER, 0L) != 0);
}
bool wxWinHelpController::DisplaySection(int section)
wxString str = GetValidFilename(m_helpFile);
- return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_CONTEXT, (DWORD)section) != 0);
+ return (WinHelp(GetSuitableHWND(this), str.t_str(), HELP_CONTEXT, (DWORD)section) != 0);
}
bool wxWinHelpController::DisplayContextPopup(int contextId)
wxString str = GetValidFilename(m_helpFile);
- return (WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
+ return (WinHelp(GetSuitableHWND(this), str.t_str(), HELP_CONTEXTPOPUP, (DWORD) contextId) != 0);
}
bool wxWinHelpController::DisplayBlock(long block)
wxString str = GetValidFilename(m_helpFile);
- return WinHelp(GetSuitableHWND(this), str.wx_str(), HELP_PARTIALKEY,
- (ULONG_PTR)k.wx_str()) != 0;
+ return WinHelp(GetSuitableHWND(this), str.t_str(), HELP_PARTIALKEY,
+ (ULONG_PTR)wxMSW_CONV_LPCTSTR(k)) != 0;
}
// Can't close the help window explicitly in WinHelp
{
wxChar szBuf[1024];
- GetPrivateProfileString(m_strGroup.wx_str(), NULL, wxT(""),
+ GetPrivateProfileString(m_strGroup.t_str(), NULL, wxT(""),
szBuf, WXSIZEOF(szBuf),
- m_strLocalFilename.wx_str());
+ m_strLocalFilename.t_str());
if ( !wxIsEmpty(szBuf) )
return false;
- GetProfileString(m_strGroup.wx_str(), NULL, wxT(""), szBuf, WXSIZEOF(szBuf));
+ GetProfileString(m_strGroup.t_str(), NULL, wxT(""), szBuf, WXSIZEOF(szBuf));
if ( !wxIsEmpty(szBuf) )
return false;
// first look in the private INI file
// NB: the lpDefault param to GetPrivateProfileString can't be NULL
- GetPrivateProfileString(m_strGroup.wx_str(), strKey.wx_str(), wxT(""),
+ GetPrivateProfileString(m_strGroup.t_str(), strKey.t_str(), wxT(""),
szBuf, WXSIZEOF(szBuf),
- m_strLocalFilename.wx_str());
+ m_strLocalFilename.t_str());
if ( wxIsEmpty(szBuf) ) {
// now look in win.ini
wxString strKey = GetKeyName(path.Name());
- GetProfileString(m_strGroup.wx_str(), strKey.wx_str(),
+ GetProfileString(m_strGroup.t_str(), strKey.t_str(),
wxT(""), szBuf, WXSIZEOF(szBuf));
}
static const int nMagic = 17; // 17 is some "rare" number
static const int nMagic2 = 28; // arbitrary number != nMagic
- long lVal = GetPrivateProfileInt(m_strGroup.wx_str(), strKey.wx_str(),
- nMagic, m_strLocalFilename.wx_str());
+ long lVal = GetPrivateProfileInt(m_strGroup.t_str(), strKey.t_str(),
+ nMagic, m_strLocalFilename.t_str());
if ( lVal != nMagic ) {
// the value was read from the file
*pl = lVal;
}
// is it really nMagic?
- lVal = GetPrivateProfileInt(m_strGroup.wx_str(), strKey.wx_str(),
- nMagic2, m_strLocalFilename.wx_str());
+ lVal = GetPrivateProfileInt(m_strGroup.t_str(), strKey.t_str(),
+ nMagic2, m_strLocalFilename.t_str());
if ( lVal != nMagic2 ) {
// the nMagic it returned was indeed read from the file
*pl = lVal;
wxConfigPathChanger path(this, szKey);
wxString strKey = GetPrivateKeyName(path.Name());
- bool bOk = WritePrivateProfileString(m_strGroup.wx_str(), strKey.wx_str(),
- szValue.wx_str(),
- m_strLocalFilename.wx_str()) != 0;
+ bool bOk = WritePrivateProfileString(m_strGroup.t_str(), strKey.t_str(),
+ szValue.t_str(),
+ m_strLocalFilename.t_str()) != 0;
if ( !bOk )
{
{
// this is just the way it works
return WritePrivateProfileString(NULL, NULL, NULL,
- m_strLocalFilename.wx_str()) != 0;
+ m_strLocalFilename.t_str()) != 0;
}
// ----------------------------------------------------------------------------
wxConfigPathChanger path(this, szKey);
wxString strKey = GetPrivateKeyName(path.Name());
- if (WritePrivateProfileString(m_strGroup.wx_str(), strKey.wx_str(),
- NULL, m_strLocalFilename.wx_str()) == 0)
+ if (WritePrivateProfileString(m_strGroup.t_str(), strKey.t_str(),
+ NULL, m_strLocalFilename.t_str()) == 0)
return false;
if ( !bGroupIfEmptyAlso || !IsEmpty() )
return true;
// delete the current group too
- bool bOk = WritePrivateProfileString(m_strGroup.wx_str(), NULL,
- NULL, m_strLocalFilename.wx_str()) != 0;
+ bool bOk = WritePrivateProfileString(m_strGroup.t_str(), NULL,
+ NULL, m_strLocalFilename.t_str()) != 0;
if ( !bOk )
{
// passing NULL as section name to WritePrivateProfileString deletes the
// whole section according to the docs
- bool bOk = WritePrivateProfileString(path.Name().wx_str(), NULL,
- NULL, m_strLocalFilename.wx_str()) != 0;
+ bool bOk = WritePrivateProfileString(path.Name().t_str(), NULL,
+ NULL, m_strLocalFilename.t_str()) != 0;
if ( !bOk )
{
bool wxIniConfig::DeleteAll()
{
// first delete our group in win.ini
- WriteProfileString(GetVendorName().wx_str(), NULL, NULL);
+ WriteProfileString(GetVendorName().t_str(), NULL, NULL);
// then delete our own ini file
wxChar szBuf[MAX_PATH];
if (bCase)
return wxItemContainerImmutable::FindString( s, bCase );
- int pos = ListBox_FindStringExact(GetHwnd(), -1, s.wx_str());
+ int pos = ListBox_FindStringExact(GetHwnd(), -1, s.t_str());
if (pos == LB_ERR)
return wxNOT_FOUND;
else
if ( n == (m_noItems - 1) )
newN = -1;
- ListBox_InsertString(GetHwnd(), newN, s.wx_str());
+ ListBox_InsertString(GetHwnd(), newN, s.t_str());
// restore the client data
if ( oldData )
findInfo.flags = LVFI_STRING;
if ( partial )
findInfo.flags |= LVFI_PARTIAL;
- findInfo.psz = str.wx_str();
+ findInfo.psz = str.t_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
else
{
// pszText is not const, hence the cast
- lvItem.pszText = (wxChar *)info.m_text.wx_str();
+ lvItem.pszText = wxMSW_CONV_LPTSTR(info.m_text);
if ( lvItem.pszText )
lvItem.cchTextMax = info.m_text.length();
else
if ( item.m_mask & wxLIST_MASK_TEXT )
{
lvCol.mask |= LVCF_TEXT;
- lvCol.pszText = (wxChar *)item.m_text.wx_str(); // cast is safe
+ lvCol.pszText = wxMSW_CONV_LPTSTR(item.m_text);
}
if ( item.m_mask & wxLIST_MASK_FORMAT )
argv = new wxChar *[argc + 1];
for ( int i = 0; i < argc; i++ )
{
- argv[i] = wxStrdup(args[i].wx_str());
+ argv[i] = wxStrdup(args[i].t_str());
}
// argv[] must be NULL-terminated
msflags &= ~WS_HSCROLL;
if ( !wxWindow::MSWCreate(wxApp::GetRegisteredClassName(wxT("wxMDIFrame")),
- title.wx_str(),
+ title.t_str(),
pos, size,
msflags,
exflags) )
if ( !(style & wxFULL_REPAINT_ON_RESIZE) )
className += wxApp::GetNoRedrawClassSuffix();
- mcs.szClass = className.wx_str();
- mcs.szTitle = title.wx_str();
+ mcs.szClass = className.t_str();
+ mcs.szTitle = title.t_str();
mcs.hOwner = wxGetInstance();
if (x != wxDefaultCoord)
mcs.x = x;
inserted = true;
::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING,
(UINT_PTR)menuWin,
- wxString(wxGetTranslation(WINDOW_MENU_LABEL)).wx_str());
+ wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str());
break;
}
}
{
::AppendMenu(hmenu, MF_POPUP,
(UINT_PTR)menuWin,
- wxString(wxGetTranslation(WINDOW_MENU_LABEL)).wx_str());
+ wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str());
}
}
}
mii.cch = itemText.length();
- mii.dwTypeData = const_cast<wxChar *>(itemText.wx_str());
+ mii.dwTypeData = wxMSW_CONV_LPTSTR(itemText);
if ( flags & MF_POPUP )
{
itemText = wxMenuItem::GetLabelText(itemText);
#endif
- pData = (wxChar*)itemText.wx_str();
+ pData = itemText.t_str();
}
// item might have already been inserted by InsertMenuItem() above
if ( !label.empty() )
{
if ( !::InsertMenu(hMenu, 0u, MF_BYPOSITION | MF_STRING,
- (UINT_PTR)idMenuTitle, m_title.wx_str()) ||
+ (UINT_PTR)idMenuTitle, m_title.t_str()) ||
!::InsertMenu(hMenu, 1u, MF_BYPOSITION, (unsigned)-1, NULL) )
{
wxLogLastError(wxT("InsertMenu"));
info.fMask = MIIM_TYPE;
info.fType = MFT_STRING;
info.cch = m_title.length();
- info.dwTypeData = const_cast<wxChar *>(m_title.wx_str());
+ info.dwTypeData = wxMSW_CONV_LPTSTR(m_title);
if ( !SetMenuItemInfo(hMenu, 0, TRUE, & info) )
{
wxLogLastError(wxT("SetMenuItemInfo"));
#else
if ( !ModifyMenu(hMenu, 0u,
MF_BYPOSITION | MF_STRING,
- (UINT_PTR)idMenuTitle, m_title.wx_str()) )
+ (UINT_PTR)idMenuTitle, m_title.t_str()) )
{
wxLogLastError(wxT("ModifyMenu"));
}
HMENU hPopupMenu = (HMENU) GetMenu(i)->GetHMenu();
tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(GetMenuLabel(i));
- tbButton.iString = (int) label.wx_str();
+ tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label);
tbButton.idCommand = NewControlId();
if ( !::SendMessage(hCommandBar, TB_INSERTBUTTON, i, (LPARAM)&tbButton) )
{
if ( !::AppendMenu((HMENU)m_hMenu, MF_POPUP | MF_STRING,
(UINT_PTR)(*it)->GetHMenu(),
- (*it)->GetTitle().wx_str()) )
+ (*it)->GetTitle().t_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}
info.fMask = MIIM_TYPE;
info.fType = MFT_STRING;
info.cch = label.length();
- info.dwTypeData = const_cast<wxChar *>(label.wx_str());
+ info.dwTypeData = wxMSW_CONV_LPTSTR(label);
if ( !SetMenuItemInfo(GetHmenu(), id, TRUE, &info) )
{
wxLogLastError(wxT("SetMenuItemInfo"));
#else
if ( ::ModifyMenu(GetHmenu(), mswpos, MF_BYPOSITION | MF_STRING | flagsOld,
- id, label.wx_str()) == (int)0xFFFFFFFF )
+ id, label.t_str()) == (int)0xFFFFFFFF )
{
wxLogLastError(wxT("ModifyMenu"));
}
if ( !::InsertMenu(GetHmenu(), (UINT)mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING,
- (UINT_PTR)GetHmenuOf(menu), title.wx_str()) )
+ (UINT_PTR)GetHmenuOf(menu), title.t_str()) )
{
wxLogLastError(wxT("InsertMenu"));
}
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title);
- tbButton.iString = (int) label.wx_str();
+ tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label);
tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
#else
if ( !::InsertMenu(GetHmenu(), mswpos,
MF_BYPOSITION | MF_POPUP | MF_STRING,
- (UINT_PTR)GetHmenuOf(menu), title.wx_str()) )
+ (UINT_PTR)GetHmenuOf(menu), title.t_str()) )
{
wxLogLastError(wxT("InsertMenu"));
}
HMENU hPopupMenu = (HMENU) menu->GetHMenu() ;
tbButton.dwData = (DWORD)hPopupMenu;
wxString label = wxStripMenuCodes(title);
- tbButton.iString = (int) label.wx_str();
+ tbButton.iString = (int) wxMSW_CONV_LPCTSTR(label);
tbButton.idCommand = NewControlId();
if (!::SendMessage((HWND) GetToolBar()->GetHWND(), TB_INSERTBUTTON, pos, (LPARAM)&tbButton))
}
#else
if ( !::AppendMenu(GetHmenu(), MF_POPUP | MF_STRING,
- (UINT_PTR)submenu, title.wx_str()) )
+ (UINT_PTR)submenu, title.t_str()) )
{
wxLogLastError(wxT("AppendMenu"));
}
if ( isLaterThanWin95 )
info.fMask |= MIIM_STRING;
//else: MIIM_TYPE already specified
- info.dwTypeData = (LPTSTR)m_text.wx_str();
+ info.dwTypeData = wxMSW_CONV_LPTSTR(m_text);
info.cch = m_text.length();
if ( !::SetMenuItemInfo(hMenu, id, FALSE, &info) )
{
int x = rcText.left;
int y = rcText.top + (rcText.bottom - rcText.top - textSize.cy) / 2;
- ::DrawState(hdc, NULL, NULL, (LPARAM)text.wx_str(),
+ ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text),
text.length(), x, y, 0, 0, flags);
// ::SetTextAlign(hdc, TA_RIGHT) doesn't work with DSS_DISABLED or DSS_MONO
int y = rcText.top + (rcText.bottom - rcText.top - accelSize.cy) / 2;
- ::DrawState(hdc, NULL, NULL, (LPARAM)accel.wx_str(),
+ ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(accel),
accel.length(), x, y, 0, 0, flags);
}
}
m_maxY = -10000;
if ( !file.empty() && wxFileExists(file) )
wxRemoveFile(file);
- m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : file.wx_str());
+ m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : wxMSW_CONV_LPCTSTR(file));
m_ok = true;
HWND hwndEdit = ::CreateWindow
(
wxT("EDIT"),
- wxTextBuffer::Translate(text).wx_str(),
+ wxTextBuffer::Translate(text).t_str(),
WS_CHILD | WS_VSCROLL | WS_VISIBLE |
ES_MULTILINE | ES_READONLY | ES_AUTOVSCROLL,
rc.left, rc.top,
if ( widthNeeded > wBtnNew )
wBtnNew = widthNeeded;
- ::SetWindowText(hwndBtn, label.wx_str());
+ ::SetWindowText(hwndBtn, label.t_str());
}
if ( wBtnNew <= wBtnOld )
#endif // wxUSE_MSGBOX_HOOK
// do show the dialog
- int msAns = MessageBox(hWnd, message.wx_str(), m_caption.wx_str(), msStyle);
+ int msAns = MessageBox(hWnd, message.t_str(), m_caption.t_str(), msStyle);
return MSWTranslateReturnCode(msAns);
}
TDF_POSITION_RELATIVE_TO_WINDOW |
TDF_SIZE_TO_CONTENT;
tdc.hInstance = wxGetInstance();
- tdc.pszWindowTitle = caption.wx_str();
+ tdc.pszWindowTitle = caption.t_str();
// use the top level window as parent if none specified
tdc.hwndParent = parent ? GetHwndOf(parent) : NULL;
// message in our ctor, see comment there.
if ( !extendedMessage.empty() )
{
- tdc.pszMainInstruction = message.wx_str();
- tdc.pszContent = extendedMessage.wx_str();
+ tdc.pszMainInstruction = message.t_str();
+ tdc.pszContent = extendedMessage.t_str();
}
else
{
- tdc.pszContent = message.wx_str();
+ tdc.pszContent = message.t_str();
}
// set an icon to be used, if possible
TASKDIALOG_BUTTON &tdBtn = buttons[tdc.cButtons];
tdBtn.nButtonID = btnCustomId;
- tdBtn.pszButtonText = customLabel.wx_str();
+ tdBtn.pszButtonText = customLabel.t_str();
tdc.cButtons++;
// We should never have more than 4 buttons currently as this is the
TC_ITEM tcItem;
tcItem.mask = TCIF_TEXT;
- tcItem.pszText = (wxChar *)strText.wx_str();
+ tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
if ( !HasFlag(wxNB_MULTILINE) )
return TabCtrl_SetItem(GetHwnd(), nPage, &tcItem) != 0;
if ( !strText.empty() )
{
tcItem.mask |= TCIF_TEXT;
- tcItem.pszText = const_cast<wxChar *>(strText.wx_str());
+ tcItem.pszText = wxMSW_CONV_LPTSTR(strText);
}
// hide the page: unless it is selected, it shouldn't be shown (and if it
void wxDataFormat::SetId(const wxString& format)
{
- m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.wx_str());
+ m_format = (wxDataFormat::NativeFormat)::RegisterClipboardFormat(format.t_str());
if ( !m_format )
{
wxLogError(_("Couldn't register clipboard format '%s'."), format);
#endif // wxUSE_UNICODE_MSLU
{
len = m_filenames[i].length();
- memcpy(pbuf, m_filenames[i].wx_str(), len*sizeOfChar);
+ memcpy(pbuf, m_filenames[i].t_str(), len*sizeOfChar);
}
pbuf += len*sizeOfChar;
int cx = rc.GetWidth() - GetMarginWidth();
int cy = sizeRect.cy;
- ::DrawState(hdc, NULL, NULL, (LPARAM)text.wx_str(),
+ ::DrawState(hdc, NULL, NULL, wxMSW_CONV_LPARAM(text),
text.length(), x, y, cx, cy, flags);
} // reset to default the font, colors and brush
BOOL Open( const wxString& printerName, LPPRINTER_DEFAULTS pDefault=(LPPRINTER_DEFAULTS)NULL )
{
Close();
- return OpenPrinter( (LPTSTR)printerName.wx_str(), &m_hPrinter, pDefault );
+ return OpenPrinter( wxMSW_CONV_LPTSTR(printerName), &m_hPrinter, pDefault );
}
BOOL Close()
if (m_devMode)
return;
- LPTSTR szPrinterName = (LPTSTR)printerName.wx_str();
+ LPTSTR szPrinterName = wxMSW_CONV_LPTSTR(printerName);
// From MSDN: How To Modify Printer Settings with the DocumentProperties() Function
// The purpose of this is to fill the DEVMODE with privdata from printer driver.
bool wxWindowsPrintNativeData::TransferFrom( const wxPrintData &data )
{
WinPrinter printer;
- LPTSTR szPrinterName = (LPTSTR)data.GetPrinterName().wx_str();
+ LPTSTR szPrinterName = wxMSW_CONV_LPTSTR(data.GetPrinterName());
if (!m_devMode)
InitializeDevMode(data.GetPrinterName(), &printer);
// NB: the cast is needed in the ANSI build, strangely enough
// dmDeviceName is BYTE[] and not char[] there
wxStrlcpy(reinterpret_cast<wxChar *>(devMode->dmDeviceName),
- name.wx_str(),
+ name.t_str(),
WXSIZEOF(devMode->dmDeviceName));
}
{
sharedData->m_labelCancel = _("Close");
SendMessage( hwnd, WM_SETTEXT, 0,
- (LPARAM) sharedData->m_labelCancel.wx_str() );
+ wxMSW_CONV_LPARAM(sharedData->m_labelCancel) );
return FALSE;
}
}
if ( sharedData->m_notifications & wxSPDD_TITLE_CHANGED )
- ::SetWindowText( hwnd, sharedData->m_title.wx_str() );
+ ::SetWindowText( hwnd, sharedData->m_title.t_str() );
if ( sharedData->m_notifications & wxSPDD_MESSAGE_CHANGED )
{
::SendMessage( hwnd,
TDM_SET_ELEMENT_TEXT,
TDE_MAIN_INSTRUCTION,
- (LPARAM) title.wx_str() );
+ wxMSW_CONV_LPARAM(title) );
::SendMessage( hwnd,
TDM_SET_ELEMENT_TEXT,
TDE_CONTENT,
- (LPARAM) body.wx_str() );
+ wxMSW_CONV_LPARAM(body) );
}
if ( sharedData->m_notifications & wxSPDD_EXPINFO_CHANGED )
::SendMessage( hwnd,
TDM_SET_ELEMENT_TEXT,
TDE_EXPANDED_INFORMATION,
- (LPARAM) expandedInformation.wx_str() );
+ wxMSW_CONV_LPARAM(expandedInformation) );
}
}
if ( !m_sharedData.m_expandedInformation.empty() )
{
tdc.pszExpandedInformation =
- m_sharedData.m_expandedInformation.wx_str();
+ m_sharedData.m_expandedInformation.t_str();
}
}
wxWindowIDRef subid = NewControlId();
HWND hwndBtn = ::CreateWindow(wxT("BUTTON"),
- choices[i].wx_str(),
+ choices[i].t_str(),
styleBtn,
0, 0, 0, 0, // will be set in SetSize()
GetHwndOf(parent),
#include "wx/dynlib.h"
#include "wx/file.h"
#include "wx/wfstream.h"
+#include "wx/msw/private.h"
// Windows headers
#ifdef __WXWINCE__
-#include "wx/msw/private.h"
#include <winbase.h>
#include <winreg.h>
#endif
// add a checkbox
if ( !m_checkBoxText.empty() )
{
- tdc.pszVerificationText = m_checkBoxText.wx_str();
+ tdc.pszVerificationText = m_checkBoxText.t_str();
if ( m_checkBoxValue )
tdc.dwFlags |= TDF_VERIFICATION_FLAG_CHECKED;
}
// add collapsible footer
if ( !m_detailedText.empty() )
- tdc.pszExpandedInformation = m_detailedText.wx_str();
+ tdc.pszExpandedInformation = m_detailedText.t_str();
TaskDialogIndirect_t taskDialogIndirect = GetTaskDialogIndirectFunc();
if ( !taskDialogIndirect )
if ( m_labels )
{
- ::SetWindowText((*m_labels)[SliderLabel_Value], Format(value).wx_str());
+ ::SetWindowText((*m_labels)[SliderLabel_Value], Format(value).t_str());
}
}
if ( m_labels )
{
::SetWindowText((*m_labels)[SliderLabel_Min],
- Format(ValueInvertOrNot(m_rangeMin)).wx_str());
+ Format(ValueInvertOrNot(m_rangeMin)).t_str());
::SetWindowText((*m_labels)[SliderLabel_Max],
- Format(ValueInvertOrNot(m_rangeMax)).wx_str());
+ Format(ValueInvertOrNot(m_rangeMax)).t_str());
}
// When emulating wxSL_INVERSE style in wxWidgets, we need to update the
// 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(wxT("%d"), val).wx_str());
+ wxString::Format(wxT("%d"), val).t_str());
}
m_oldValue = GetValue();
if ( !rtl )
{
RECT rc2 = { x, 0, x + width, y };
- ::DrawText(hdc, label.wx_str(), label.length(), &rc2,
+ ::DrawText(hdc, label.t_str(), label.length(), &rc2,
drawTextFlags);
}
else // RTL
{
RECT rc2 = { x, 0, x - width, y };
- ::DrawText(hdc, label.wx_str(), label.length(), &rc2,
+ ::DrawText(hdc, label.t_str(), label.length(), &rc2,
drawTextFlags | DT_RTLREADING);
}
}
// Set the status text in the native control passing both field number and style.
// NOTE: MSDN library doesn't mention that nField and style have to be 'ORed'
- if ( !StatusBar_SetText(GetHwnd(), nField | style, text.wx_str()) )
+ if ( !StatusBar_SetText(GetHwnd(), nField | style, text.t_str()) )
{
wxLogLastError("StatusBar_SetText");
}
// the fields' styles.
// NOTE: MSDN library doesn't mention that nField and style have to be 'ORed'
wxString text = GetStatusText(i);
- if (!StatusBar_SetText(GetHwnd(), style | i, text.wx_str()))
+ if (!StatusBar_SetText(GetHwnd(), style | i, text.t_str()))
{
wxLogLastError("StatusBar_SetText");
}
notifyData.uFlags |= NIF_TIP;
if ( !tooltip.empty() )
{
- wxStrlcpy(notifyData.szTip, tooltip.wx_str(), WXSIZEOF(notifyData.szTip));
+ wxStrlcpy(notifyData.szTip, tooltip.t_str(), WXSIZEOF(notifyData.szTip));
}
bool ok = wxShellNotifyIcon(m_iconAdded ? NIM_MODIFY
notifyData = NotifyIconData(hwnd);
notifyData.uFlags |= NIF_INFO;
notifyData.uTimeout = msec;
- wxStrlcpy(notifyData.szInfo, text.wx_str(), WXSIZEOF(notifyData.szInfo));
- wxStrlcpy(notifyData.szInfoTitle, title.wx_str(),
+ wxStrlcpy(notifyData.szInfo, text.t_str(), WXSIZEOF(notifyData.szInfo));
+ wxStrlcpy(notifyData.szInfoTitle, title.t_str(),
WXSIZEOF(notifyData.szInfoTitle));
if ( flags & wxICON_INFORMATION )
// implementation detail
m_updatesCount = -2;
- if ( !MSWCreateControl(windowClass.wx_str(), msStyle, pos, size, valueWin) )
+ if ( !MSWCreateControl(windowClass.t_str(), msStyle, pos, size, valueWin) )
return false;
m_updatesCount = -1;
::SendMessage(GetHwnd(), selectionOnly ? EM_REPLACESEL : WM_SETTEXT,
// EM_REPLACESEL takes 1 to indicate the operation should be redoable
- selectionOnly ? 1 : 0, (LPARAM)valueDos.wx_str());
+ selectionOnly ? 1 : 0, wxMSW_CONV_LPARAM(valueDos));
if ( !ucf.GotUpdate() && (flags & SetValue_SendEvent) )
{
void wxTextEntry::WriteText(const wxString& text)
{
- ::SendMessage(GetEditHwnd(), EM_REPLACESEL, 0, (LPARAM)text.wx_str());
+ ::SendMessage(GetEditHwnd(), EM_REPLACESEL, 0, wxMSW_CONV_LPARAM(text));
}
wxString wxTextEntry::DoGetValue() const
{
const wxString& label = tool->GetLabel();
if ( !label.empty() )
- button.iString = (INT_PTR)label.wx_str();
+ button.iString = (INT_PTR) wxMSW_CONV_LPCTSTR(label);
}
button.idCommand = tool->GetId();
// NMTTDISPINFO struct -- and setting the tooltip here we can have tooltips
// of any length
ti.hwnd = hwnd;
- ti.lpszText = const_cast<wxChar *>(m_text.wx_str());
+ ti.lpszText = wxMSW_CONV_LPTSTR(m_text);
if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, &ti) )
{
const wxString token = tokenizer.GetNextToken();
SIZE sz;
- if ( !::GetTextExtentPoint32(hdc, token.wx_str(),
+ if ( !::GetTextExtentPoint32(hdc, token.t_str(),
token.length(), &sz) )
{
wxLogLastError(wxT("GetTextExtentPoint32"));
// replace the '\n's with spaces because otherwise they appear as
// unprintable characters in the tooltip string
m_text.Replace(wxT("\n"), wxT(" "));
- ti.lpszText = const_cast<wxChar *>(m_text.wx_str());
+ ti.lpszText = wxMSW_CONV_LPTSTR(m_text);
if ( !SendTooltipMessage(GetToolTipCtrl(), TTM_ADDTOOL, &ti) )
{
ti.lpszText = const_cast<wxChar *>(wxT(""));
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti);
- ti.lpszText = const_cast<wxChar *>(m_text.wx_str());
+ ti.lpszText = wxMSW_CONV_LPTSTR(m_text);
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, &ti);
}
if ( !title.empty() )
{
- ::SetWindowText(GetHwnd(), title.wx_str());
+ ::SetWindowText(GetHwnd(), title.t_str());
}
SubclassWin(m_hWnd);
#endif
return MSWCreate(MSWGetRegisteredClassName(),
- title.wx_str(), pos, sz, flags, exflags);
+ title.t_str(), pos, sz, flags, exflags);
}
bool wxTopLevelWindowMSW::Create(wxWindow *parent,
return;
wxTreeViewItem tvItem(item, TVIF_TEXT);
- tvItem.pszText = (wxChar *)text.wx_str(); // conversion is ok
+ tvItem.pszText = wxMSW_CONV_LPTSTR(text);
DoSetItem(&tvItem);
// when setting the text of the item being edited, the text control should
{
if ( item == m_idEdited )
{
- ::SetWindowText(hwndEdit, text.wx_str());
+ ::SetWindowText(hwndEdit, text.t_str());
}
}
}
if ( !text.empty() )
{
mask |= TVIF_TEXT;
- tvIns.item.pszText = (wxChar *)text.wx_str(); // cast is ok
+ tvIns.item.pszText = wxMSW_CONV_LPTSTR(text);
}
else
{
!regKey.QueryValue(wxT("Name"), hostName) )
return false;
- wxStrlcpy(buf, hostName.wx_str(), maxSize);
+ wxStrlcpy(buf, hostName.t_str(), maxSize);
#else // !__WXWINCE__
DWORD nSize = maxSize;
if ( !::GetComputerName(buf, &nSize) )
wxUnusedVar(flags);
WinStruct<SHELLEXECUTEINFO> sei;
- sei.lpFile = document.wx_str();
+ sei.lpFile = document.t_str();
#ifdef __WXWINCE__
sei.nShow = SW_SHOWNORMAL; // SW_SHOWDEFAULT not defined under CE (#10216)
#else
}
SHFILEINFO fi;
- long rc = SHGetFileInfo(m_volName.wx_str(), 0, &fi, sizeof(fi), flags);
+ long rc = SHGetFileInfo(m_volName.t_str(), 0, &fi, sizeof(fi), flags);
m_icons[type].SetHICON((WXHICON)fi.hIcon);
if (!rc || !fi.hIcon)
{
const wxString& label = tool->GetLabel();
if ( !label.empty() )
{
- button.iString = (int)label.wx_str();
+ button.iString = (int) wxMSW_CONV_LPCTSTR(label);
}
}
SIZE sizeRect;
TEXTMETRIC tm;
- ::GetTextExtentPoint32(hdc, string.wx_str(), string.length(), &sizeRect);
+ ::GetTextExtentPoint32(hdc, string.t_str(), string.length(), &sizeRect);
GetTextMetrics(hdc, &tm);
if ( x )
m_hWnd = (WXHWND)::CreateWindowEx
(
extendedStyle,
- className.wx_str(),
- title ? title : m_windowName.wx_str(),
+ className.t_str(),
+ title ? title : m_windowName.t_str(),
style,
x, y, w, h,
(HWND)MSWGetParent(),
(
CP_ACP,
0, // no flags
- ttip.wx_str(),
+ ttip.t_str(),
tipLength,
buf,
WXSIZEOF(buf) - 1
wxMenuItem *item = (wxMenuItem*)mii.dwItemData;
const wxString label(item->GetItemLabel());
- const wxChar *p = wxStrchr(label.wx_str(), wxT('&'));
+ const wxChar *p = wxStrchr(label.t_str(), wxT('&'));
while ( p++ )
{
if ( *p == wxT('&') )