Replaced incorrect or inefficient usage of char_str() by wx_str().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Neis 2007-04-07 12:21:15 +00:00
parent 6a74af89fc
commit 404aba09e5
10 changed files with 25 additions and 29 deletions

View File

@ -134,7 +134,7 @@ int wxChoice::DoAppend(
nIndex = (int)::WinSendMsg( GetHwnd()
,LM_INSERTITEM
,(MPARAM)nIndexType
,(MPARAM)rsItem.char_str()
,(MPARAM)rsItem.wx_str()
);
return nIndex;
} // end of wxChoice::DoAppend
@ -157,7 +157,7 @@ int wxChoice::DoInsert( const wxString& rsItem, unsigned int pos )
nIndex = (int)::WinSendMsg( GetHwnd()
,LM_INSERTITEM
,(MPARAM)nIndexType
,(MPARAM)rsItem.char_str()
,(MPARAM)rsItem.wx_str()
);
return nIndex;
} // end of wxChoice::DoInsert
@ -232,7 +232,7 @@ void wxChoice::SetString(unsigned int n, const wxString& rsStr)
::WinSendMsg( GetHwnd()
,LM_INSERTITEM
,(MPARAM)nIndexType
,(MPARAM)rsStr.char_str()
,(MPARAM)rsStr.wx_str()
);
if (pData)

View File

@ -1753,12 +1753,10 @@ void wxDC::DrawAnyText( const wxString& rsText,
vPtlStart.y = vY;
}
PCH pzStr = rsText.char_str();
::GpiMove(m_hPS, &vPtlStart);
lHits = ::GpiCharString( m_hPS
,rsText.length()
,pzStr
,rsText.wx_str()
);
if (lHits != GPI_OK)
{
@ -2178,7 +2176,7 @@ void wxDC::DoGetTextExtent(
//
bRc = ::GpiQueryTextBox( m_hPS
,l
,rsString.char_str()
,(char *)rsString.wx_str()
,TXTBOX_COUNT // return maximum information
,avPoint // array of coordinates points
);

View File

@ -41,8 +41,8 @@ wxPrinterDC::wxPrinterDC( const wxString& rsDriverName,
bool bInteractive,
int nOrientation )
{
DEVOPENSTRUC vDevOpen = { rsDeviceName.char_str()
,rsDriverName.char_str()
DEVOPENSTRUC vDevOpen = { (char*)rsDeviceName.wx_str()
,(char*)rsDriverName.wx_str()
,NULL
,NULL
,NULL

View File

@ -281,7 +281,7 @@ int wxListBox::DoAppend(const wxString& rsItem)
else
lIndexType = LIT_END;
lIndex = (long)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)rsItem.char_str());
lIndex = (long)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)rsItem.wx_str());
m_nNumItems++;
#if wxUSE_OWNER_DRAWN
@ -318,7 +318,7 @@ void wxListBox::DoSetItems( const wxArrayString& raChoices,
lIndexType = LIT_SORTASCENDING;
else
lIndexType = LIT_END;
::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)raChoices[i].char_str());
::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)raChoices[i].wx_str());
if (ppClientData)
{
@ -563,7 +563,7 @@ void wxListBox::DoInsertItems(const wxArrayString& asItems, unsigned int nPos)
int nIndex = (int)::WinSendMsg( GetHwnd(),
LM_INSERTITEM,
MPFROMLONG((LONG)(i + nPos)),
(MPARAM)asItems[i].char_str() );
(MPARAM)asItems[i].wx_str() );
wxOwnerDrawn* pNewItem = CreateItem(nIndex);
@ -613,7 +613,7 @@ void wxListBox::SetString(unsigned int n, const wxString& rsString)
::WinSendMsg( GetHwnd()
,LM_INSERTITEM
,(MPARAM)nNewN
,(MPARAM)rsString.char_str()
,(MPARAM)rsString.wx_str()
);
//

View File

@ -323,7 +323,7 @@ bool wxMenu::DoInsertOrAppend( wxMenuItem* pItem,
//
rItem.afStyle |= MIS_TEXT;
}
pData = pItem->GetText().char_str();
pData = (char*) pItem->GetText().wx_str();
}
if (nPos == (size_t)-1)
@ -804,7 +804,7 @@ WXHMENU wxMenuBar::Create()
(*it)->m_vMenuData.iPosition = (SHORT)i;
rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&(*it)->m_vMenuData, (MPARAM)m_titles[i].char_str());
rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&(*it)->m_vMenuData, (MPARAM)m_titles[i].wx_str());
if (rc == (APIRET)MIT_MEMERROR || rc == (APIRET)MIT_ERROR)
{
vError = ::WinGetLastError(vHabmain);
@ -879,7 +879,7 @@ void wxMenuBar::SetLabelTop(
}
nId = vItem.id;
if (::WinSendMsg(GetHmenu(), MM_SETITEMTEXT, MPFROMSHORT(nId), (MPARAM)rLabel.char_str()));
if (::WinSendMsg(GetHmenu(), MM_SETITEMTEXT, MPFROMSHORT(nId), (MPARAM)rLabel.wx_str()));
{
wxLogLastError(wxT("ModifyMenu"));
}
@ -925,7 +925,7 @@ wxMenu* wxMenuBar::Replace(
if (IsAttached())
{
::WinSendMsg((HWND)m_hMenu, MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0);
::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.char_str());
::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.wx_str());
#if wxUSE_ACCEL
if (pMenuOld->HasAccels() || pMenu->HasAccels())
@ -958,7 +958,7 @@ bool wxMenuBar::Insert( size_t nPos,
::WinSendMsg( (HWND)m_hMenu
,MM_INSERTITEM
,(MPARAM)&pMenu->m_vMenuData
,(MPARAM)sTitle.char_str()
,(MPARAM)sTitle.wx_str()
);
#if wxUSE_ACCEL
if (pMenu->HasAccels())
@ -990,7 +990,7 @@ bool wxMenuBar::Append( wxMenu* pMenu,
if ( IsAttached() )
{
pMenu->m_vMenuData.iPosition = MIT_END;
::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.char_str());
::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.wx_str());
#if wxUSE_ACCEL
if (pMenu->HasAccels())
{

View File

@ -427,7 +427,7 @@ void wxMenuItem::SetText( const wxString& rText )
#endif //owner drawn
{
uFlagsOld |= MIS_TEXT;
pData = m_text.char_str();
pData = (char*) m_text.wx_str();
}
//

View File

@ -351,7 +351,7 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
::GpiCharStringAt( rDC.GetHPS()
,&vPntStart
,sFullString.length()
,sFullString.char_str()
,sFullString.wx_str()
);
if (bFoundMnemonic)
{
@ -389,7 +389,7 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
::GpiCharStringAt( rDC.GetHPS()
,&vPntStart
,sAccel.length()
,sAccel.char_str()
,sAccel.wx_str()
);
}

View File

@ -329,7 +329,8 @@ void wxTextCtrl::SetupColours()
wxString wxTextCtrl::GetValue() const
{
wxString sStr = wxGetWindowText(GetHWND());
char* zStr = sStr.char_str();
wxCharBuffer buf(sStr.char_str());
char* zStr = buf.data();
for ( ; *zStr; zStr++ )
{
@ -370,7 +371,7 @@ void wxTextCtrl::WriteText(
)
{
if (m_bIsMLE)
::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(rsValue.char_str()), MPARAM(0));
::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(rsValue.wx_str()), MPARAM(0));
else
::WinSetWindowText(GetHwnd(), rsValue.c_str());
AdjustSpaceLimit();

View File

@ -157,7 +157,7 @@ bool wxShell( const wxString& rCommand )
SData.PgmName = (char*)zShell;
sInputs = _T("/C ") + rCommand;
SData.PgmInputs = (BYTE*)sInputs.char_str();
SData.PgmInputs = (BYTE*)sInputs.wx_str();
SData.TermQ = 0;
SData.Environment = 0;
SData.InheritOpt = SSF_INHERTOPT_SHELL;

View File

@ -1673,7 +1673,6 @@ void wxWindowOS2::GetTextExtent( const wxString& rString,
int l;
FONTMETRICS vFM; // metrics structure
BOOL bRc = FALSE;
char* pStr;
HPS hPS;
hPS = ::WinGetPS(GetHwnd());
@ -1681,14 +1680,12 @@ void wxWindowOS2::GetTextExtent( const wxString& rString,
l = rString.length();
if (l > 0L)
{
pStr = rString.char_str();
//
// In world coordinates.
//
bRc = ::GpiQueryTextBox( hPS,
l,
pStr,
(char*) rString.wx_str(),
TXTBOX_COUNT,// return maximum information
avPoint // array of coordinates points
);