]> git.saurik.com Git - wxWidgets.git/commitdiff
default implementations for Replace and Remove
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 2 Nov 2005 16:40:56 +0000 (16:40 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 2 Nov 2005 16:40:56 +0000 (16:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/textctrl.cpp

index 59de4dc29d29b262acfe73c53b6c4b5e9c3d3a64..13adf6556bf01e1ee2f6f878af8389d432ab0647 100644 (file)
@@ -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<Boolean>( 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