From a8988cb339baf4fb5e8ebc8065e0324a9e96c208 Mon Sep 17 00:00:00 2001 From: Stefan Neis Date: Fri, 6 Apr 2007 20:31:02 +0000 Subject: [PATCH] Compilation fix for wxCStrData handling. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/os2/radiobox.cpp | 2 +- src/os2/spinctrl.cpp | 2 +- src/os2/stattext.cpp | 5 +++-- src/os2/textctrl.cpp | 26 ++++++++++++++++---------- src/os2/tooltip.cpp | 2 +- src/os2/toplevel.cpp | 6 +++--- src/os2/window.cpp | 8 ++++---- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index 3632ef191b..26c89bd5ac 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -781,7 +781,7 @@ void wxRadioBox::SetString(unsigned int nItem, const wxString& rsLabel) wxCHECK_RET( IsValid(nItem), wxT("invalid radiobox index") ); m_pnRadioWidth[nItem] = m_pnRadioHeight[nItem] = -1; - ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], (PSZ)rsLabel.c_str()); + ::WinSetWindowText((HWND)m_ahRadioButtons[nItem], rsLabel.c_str()); } // end of wxRadioBox::SetString bool wxRadioBox::SetStringSelection(const wxString& rsStr) diff --git a/src/os2/spinctrl.cpp b/src/os2/spinctrl.cpp index 6fb50893aa..2aeef5f3d7 100644 --- a/src/os2/spinctrl.cpp +++ b/src/os2/spinctrl.cpp @@ -456,7 +456,7 @@ void wxSpinCtrl::SetValue( { long lVal; - lVal = atol((char*)rsText.c_str()); + lVal = atol(rsText.c_str()); wxSpinButton::SetValue(lVal); } // end of wxSpinCtrl::SetValue diff --git a/src/os2/stattext.cpp b/src/os2/stattext.cpp index 6d641a4417..3f6e73d522 100644 --- a/src/os2/stattext.cpp +++ b/src/os2/stattext.cpp @@ -236,7 +236,8 @@ void wxStaticText::SetLabel( m_labelOrig = rsLabel; // save original label // OS/2 does not support neither ellipsize nor markup in static text: - DoSetLabel(GetEllipsizedLabelWithoutMarkup(label)); + DoSetLabel(rsLabel); + DoSetLabel(GetEllipsizedLabelWithoutMarkup()); // // Adjust the size of the window to fit to the label unless autoresizing is @@ -277,7 +278,7 @@ MRESULT wxStaticText::OS2WindowProc( void wxStaticText::DoSetLabel(const wxString& str) { wxString sLabel = ::wxPMTextToLabel(str); - ::WinSetWindowText(GetHwnd(), (PSZ)sLabel.c_str()); + ::WinSetWindowText(GetHwnd(), sLabel.c_str()); } wxString wxStaticText::DoGetLabel() const diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index 111a63165b..24dca77ce6 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -160,7 +160,7 @@ bool wxTextCtrl::Create( { m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_MLE // Window class - ,(PSZ)rsValue.c_str() // Initial Text + ,rsValue.c_str() // Initial Text ,(ULONG)lSstyle // Style flags ,(LONG)0 // X pos of origin ,(LONG)0 // Y pos of origin @@ -177,7 +177,7 @@ bool wxTextCtrl::Create( { m_hWnd = (WXHWND)::WinCreateWindow( (HWND)GetHwndOf(pParent) // Parent window handle ,WC_ENTRYFIELD // Window class - ,(PSZ)rsValue.c_str() // Initial Text + ,rsValue.c_str() // Initial Text ,(ULONG)lSstyle // Style flags ,(LONG)0 // X pos of origin ,(LONG)0 // Y pos of origin @@ -329,7 +329,7 @@ void wxTextCtrl::SetupColours() wxString wxTextCtrl::GetValue() const { wxString sStr = wxGetWindowText(GetHWND()); - char* zStr = (char*)sStr.c_str(); + char* zStr = sStr.char_str(); for ( ; *zStr; zStr++ ) { @@ -341,7 +341,7 @@ wxString wxTextCtrl::GetValue() const if (*zStr == '\r') *zStr = '\n'; } - return sStr; + return zStr; } // end of wxTextCtrl::GetValue void wxTextCtrl::DoSetValue( @@ -360,7 +360,7 @@ void wxTextCtrl::DoSetValue( if ( flags & SetValue_SendEvent ) m_bSkipUpdate = true; - ::WinSetWindowText(GetHwnd(), (PSZ)rsValue.c_str()); + ::WinSetWindowText(GetHwnd(), rsValue.c_str()); AdjustSpaceLimit(); } } // end of wxTextCtrl::SetValue @@ -370,9 +370,9 @@ void wxTextCtrl::WriteText( ) { if (m_bIsMLE) - ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM((PCHAR)rsValue.c_str()), MPARAM(0)); + ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(rsValue.char_str()), MPARAM(0)); else - ::WinSetWindowText(GetHwnd(), (PSZ)rsValue.c_str()); + ::WinSetWindowText(GetHwnd(), rsValue.c_str()); AdjustSpaceLimit(); } // end of wxTextCtrl::WriteText @@ -1170,11 +1170,17 @@ void wxTextCtrl::AdjustSpaceLimit() } if (uLen >= uLimit) { - uLimit = uLen + 0x8000; // 32Kb - if (uLimit > 0xffff) + if (m_bIsMLE) { - uLimit = 0L; + uLimit = uLen + 0x8000; // 32Kb + if (uLimit > 0xffff) + { + uLimit = 0L; + } } + else + uLimit = 0x7fff; + if (m_bIsMLE) ::WinSendMsg(GetHwnd(), MLM_SETTEXTLIMIT, MPFROMLONG(uLimit), 0); else diff --git a/src/os2/tooltip.cpp b/src/os2/tooltip.cpp index 744db82fd5..300dedee4e 100644 --- a/src/os2/tooltip.cpp +++ b/src/os2/tooltip.cpp @@ -61,7 +61,7 @@ void wxToolTip::Create( m_hWnd = ::WinCreateWindow( HWND_DESKTOP ,WC_ENTRYFIELD - ,(PSZ)rsTip.c_str() + ,rsTip.c_str() ,lStyle ,0, 0, 0, 0 ,NULLHANDLE diff --git a/src/os2/toplevel.cpp b/src/os2/toplevel.cpp index 94819c9f83..8b467cc7c7 100644 --- a/src/os2/toplevel.cpp +++ b/src/os2/toplevel.cpp @@ -484,8 +484,8 @@ bool wxTopLevelWindowOS2::CreateFrame( const wxString& rsTitle, hFrame = ::WinCreateStdWindow( hParent ,ulStyleFlags // frame-window style ,(PULONG)&lFlags // window style - ,(PSZ)wxFrameClassName // class name - ,(PSZ)rsTitle.c_str() // window title + ,wxFrameClassName // class name + ,rsTitle.c_str() // window title ,0L // default client style ,NULLHANDLE // resource in executable file ,0 // resource id @@ -553,7 +553,7 @@ bool wxTopLevelWindowOS2::CreateFrame( const wxString& rsTitle, // if (nWidth == (int)CW_USEDEFAULT) { - // + // // The exact number doesn't matter, the dialog will be resized // again soon anyhow but it should be big enough to allow // calculation relying on "totalSize - clientSize > 0" work, i.e. diff --git a/src/os2/window.cpp b/src/os2/window.cpp index 43c6a8f13a..31fda2d2e4 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -512,7 +512,7 @@ void wxWindowOS2::Lower() void wxWindowOS2::SetLabel( const wxString& label ) { - ::WinSetWindowText(GetHwnd(), (PSZ)label.c_str()); + ::WinSetWindowText(GetHwnd(), label.c_str()); } // end of wxWindowOS2::SetLabel wxString wxWindowOS2::GetLabel() const @@ -1681,7 +1681,7 @@ void wxWindowOS2::GetTextExtent( const wxString& rString, l = rString.length(); if (l > 0L) { - pStr = (PCH)rString.c_str(); + pStr = rString.char_str(); // // In world coordinates. @@ -2971,8 +2971,8 @@ bool wxWindowOS2::OS2Create( PSZ zClass, sClassName += wxT("NR"); } m_hWnd = (WXHWND)::WinCreateWindow( (HWND)OS2GetParent() - ,(PSZ)sClassName.c_str() - ,(PSZ)(zTitle ? zTitle : wxEmptyString) + ,sClassName.c_str() + ,(zTitle ? zTitle : wxEmptyString) ,(ULONG)dwStyle ,(LONG)0L ,(LONG)0L -- 2.47.2