From 44aa865dfc8884ee42fc2d7033bb6ed443b59c57 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 2 Nov 2005 16:40:56 +0000 Subject: [PATCH] default implementations for Replace and Remove git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/textctrl.cpp | 46 +++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 59de4dc29d..13adf6556b 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -178,8 +178,8 @@ public : virtual bool CanPaste() const ; virtual void SetEditable(bool editable) ; virtual wxTextPos GetLastPosition() const ; - virtual void Replace( long from , long to , const wxString str ) ; - virtual void Remove( long from , long to ) = 0 ; + virtual void Replace( long from , long to , const wxString &str ) ; + virtual void Remove( long from , long to ) ; virtual void SetSelection( long from , long to ) = 0 ; virtual void GetSelection( long* from, long* to) const = 0 ; virtual void WriteText(const wxString& str) = 0 ; @@ -230,7 +230,7 @@ public : virtual bool CanPaste() const ; virtual void SetEditable(bool editable) ; virtual wxTextPos GetLastPosition() const ; - virtual void Replace( long from , long to , const wxString str ) ; + virtual void Replace( long from , long to , const wxString &str ) ; virtual void Remove( long from , long to ) ; virtual void GetSelection( long* from, long* to) const ; virtual void SetSelection( long from , long to ) ; @@ -271,6 +271,7 @@ public : const wxSize& size, long style ) ; virtual OSStatus SetFocus( ControlFocusPart focusPart ) ; virtual bool HasFocus() const ; + virtual void SetBackground( const wxBrush &brush) ; protected : HIViewRef m_scrollView ; HIViewRef m_textView ; @@ -294,7 +295,6 @@ public : virtual void Paste(); virtual bool CanPaste() const; virtual void SetEditable(bool editable) ; - virtual void Remove( long from , long to ) ; virtual void GetSelection( long* from, long* to) const ; virtual void SetSelection( long from , long to ) ; virtual void WriteText(const wxString& str) ; @@ -1173,8 +1173,16 @@ wxTextPos wxMacTextControl::GetLastPosition() const return GetStringValue().Length() ; } -void wxMacTextControl::Replace( long from , long to , const wxString str ) +void wxMacTextControl::Replace( long from , long to , const wxString &val ) +{ + SetSelection( from , to ) ; + WriteText( val) ; +} + +void wxMacTextControl::Remove( long from , long to ) { + SetSelection( from , to ) ; + WriteText( wxEmptyString) ; } void wxMacTextControl::Clear() @@ -1370,9 +1378,6 @@ void wxMacUnicodeTextControl::SetEditable(bool editable) { SetData( 0 , kControlEditTextLockedTag , (Boolean) !editable ) ; } -void wxMacUnicodeTextControl::Remove( long from , long to ) -{ -} void wxMacUnicodeTextControl::GetSelection( long* from, long* to) const { @@ -1757,7 +1762,7 @@ wxTextPos wxMacMLTEControl::GetLastPosition() const return actualsize ; } -void wxMacMLTEControl::Replace( long from , long to , const wxString str ) +void wxMacMLTEControl::Replace( long from , long to , const wxString &str ) { wxString value = str ; wxMacConvertNewlines10To13( &value ) ; @@ -2816,6 +2821,29 @@ bool wxMacMLTEHIViewControl::HasFocus() const return control == m_textView ; } +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4 +#define kCGColorSpaceGenericRGB CFSTR("kCGColorSpaceGenericRGB") +#endif + +void wxMacMLTEHIViewControl::SetBackground( const wxBrush &brush ) +{ + wxMacMLTEControl::SetBackground( brush ) ; +/* + CGColorSpaceRef rgbSpace = CGColorSpaceCreateDeviceRGB(); + RGBColor col = MAC_WXCOLORREF(brush.GetColour().GetPixel()) ; + + float component[4] ; + component[0] = col.red / 65536.0 ; + component[1] = col.green / 65536.0 ; + component[2] = col.blue / 65536.0 ; + component[3] = 1.0 ; // alpha + + CGColorRef color = CGColorCreate (rgbSpace , component ); + HITextViewSetBackgroundColor( m_textView , color ) ; + CGColorSpaceRelease( rgbSpace ); +*/ +} + #endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 -- 2.45.2