]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/textctrl.cpp
Fix off-by-1 error in wxChoice and wxComboBox (OSX reports 1 as 0)
[wxWidgets.git] / src / osx / carbon / textctrl.cpp
index 2a280a752609333ddd8f9c1c2f83cd126f328d80..f385f45e0666e815f0648b61c98bce2e8792a9f7 100644 (file)
@@ -223,6 +223,10 @@ class wxMacMLTEControl : public wxMacControl, public wxTextWidgetImpl
 public :
     wxMacMLTEControl( wxTextCtrl *peer ) ;
     ~wxMacMLTEControl() {}
+    
+    virtual bool        CanFocus() const
+                        { return true; }
+
     virtual wxString GetStringValue() const ;
     virtual void SetStringValue( const wxString &str ) ;
 
@@ -238,7 +242,7 @@ public :
     virtual void Paste() ;
     virtual bool CanPaste() const ;
     virtual void SetEditable( bool editable ) ;
-    virtual wxTextPos GetLastPosition() const ;
+    virtual long GetLastPosition() const ;
     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 ;
@@ -290,7 +294,7 @@ public :
                              const wxSize& size, long style ) ;
     virtual ~wxMacMLTEHIViewControl() ;
 
-    virtual OSStatus SetFocus( ControlFocusPart focusPart ) ;
+    virtual bool SetFocus() ;
     virtual bool HasFocus() const ;
     virtual void SetBackgroundColour(const wxColour& col ) ;
 
@@ -1058,7 +1062,8 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo
     if ( typeAttrCount > 0 )
     {
         verify_noerr( TXNSetTypeAttributes( m_txn , typeAttrCount, typeAttr, from , to ) );
-        relayout = true;
+        if (from != to)
+            relayout = true;
     }
 
     if ( tabs != NULL )
@@ -1113,7 +1118,7 @@ void wxMacMLTEControl::SetEditable(bool editable)
     TXNSetTXNObjectControls( m_txn, false, WXSIZEOF(tag), tag, data ) ;
 }
 
-wxTextPos wxMacMLTEControl::GetLastPosition() const
+long wxMacMLTEControl::GetLastPosition() const
 {
     wxTextPos actualsize = 0 ;
 
@@ -1902,6 +1907,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer,
         MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
         &bounds, featureSet, &m_controlRef );
     verify_noerr( err );
+    SetControlReference( m_controlRef , (URefCon) wxPeer );
 
     DoCreate();
 
@@ -2222,7 +2228,7 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer,
     {
         HIViewAddSubview( m_scrollView , m_textView ) ;
         m_controlRef = m_scrollView ;
-        wxMacControl::MacInstallEventHandler( m_textView, wxPeer ) ;
+        InstallEventHandler( (WXWidget) m_textView ) ;
     }
     else
     {
@@ -2248,9 +2254,9 @@ wxMacMLTEHIViewControl::~wxMacMLTEHIViewControl()
 {
 }
 
-OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
+bool wxMacMLTEHIViewControl::SetFocus()
 {
-    return SetKeyboardFocus( GetControlOwner( m_textView ), m_textView, focusPart ) ;
+    return SetKeyboardFocus( GetControlOwner( m_textView ), m_textView, kControlFocusNextPart ) == noErr ;
 }
 
 bool wxMacMLTEHIViewControl::HasFocus() const