]> git.saurik.com Git - wxWidgets.git/commitdiff
added MLTE support for 10.2 via classic implementation
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Jul 2004 07:05:00 +0000 (07:05 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Jul 2004 07:05:00 +0000 (07:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/textctrl.cpp

index 84f87fafc25303baeee5e137268ba13fd2c1c190..0e5bf76b192ceccd8f15b087a68f8e2ae951120c 100644 (file)
 #ifndef __DARWIN__
 #include <Scrap.h>
 #endif
+
+#ifndef wxMAC_AWAYS_USE_MLTE
+#define wxMAC_AWAYS_USE_MLTE 1
+#endif
+
 #include <MacTextEditor.h>
 #include <ATSUnicode.h>
 #include <TextCommon.h>
@@ -277,7 +282,7 @@ protected :
     OSType m_valueTag ;
 } ;
 
-#else
+#endif
 
 // implementation available under classic
 
@@ -299,10 +304,6 @@ public :
     STPTextPaneVars*    m_macTXNvars ;
 } ;
 
-#endif
-// built-in TextCtrl
-
-
 #define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL
 
 #if !USE_SHARED_LIBRARY
@@ -367,20 +368,28 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         m_windowStyle |= wxTE_PROCESS_ENTER;
         style |= wxTE_PROCESS_ENTER ;
     }
+
 #if TARGET_API_MAC_OSX
 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
     if ( UMAGetSystemVersion() >= 0x1030 )
     {
         m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ;
     }
-    else
 #endif
+#if !wxMAC_AWAYS_USE_MLTE
+    if ( !m_peer )
     {     
         m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ;
     }
-#else
-    m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
 #endif
+#endif
+    if ( !m_peer )
+    {
+        // this control draws the border itself
+        if ( !HasFlag(wxNO_BORDER) )
+            m_windowStyle &= ~wxSUNKEN_BORDER ;
+        m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
+    }
 
     MacPostControlCreate(pos,size) ;
 
@@ -1853,8 +1862,6 @@ int  wxMacMLTEControl::GetLineLength(long lineNo) const
 // MLTE control implementation (classic part)
 // ----------------------------------------------------------------------------
 
-#if !TARGET_API_MAC_OSX
-
 // CS:TODO we still have a problem getting properly at the text events of a control because under Carbon
 // the MLTE engine registers itself for the key events thus the normal flow never occurs, the only measure for the
 // moment is to avoid setting the true focus on the control, the proper solution at the end would be to have
@@ -2071,7 +2078,20 @@ static pascal ControlPartCode TPPaneHitTestProc(ControlRef theControl, Point whe
         if (PtInRect(where, &varsp->fRBounds))
             result = kmUPTextPart;
         else 
-            result = 0;
+        {
+            // sometimes we get the coords also in control local coordinates, therefore test again
+            if ( textctrl->MacGetTopLevelWindow()->MacUsesCompositing() )
+            {
+                int x = 0 , y = 0 ;
+                textctrl->MacClientToRootWindow( &x , &y ) ;
+                where.h += x ;
+                where.v += y ;
+            }
+            if (PtInRect(where, &varsp->fRBounds))
+                result = kmUPTextPart;
+            else 
+                result = 0;
+        }
     }
     return result;
 }
@@ -2419,9 +2439,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate()
     return err;
 }
 
-
-#endif
-
 // ----------------------------------------------------------------------------
 // MLTE control implementation (OSX part)
 // ----------------------------------------------------------------------------