]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/control.cpp
Translated a double click into just a second click for Scintilla
[wxWidgets.git] / src / mac / carbon / control.cpp
index 3e5679a826fe5876a508e810586a3a63e4019643..4ffb21ccacb5136d1908ff82bb8cd3e46bcb44aa 100644 (file)
@@ -16,6 +16,7 @@
 #include "wx/control.h"
 #include "wx/panel.h"
 #include "wx/app.h"
 #include "wx/control.h"
 #include "wx/panel.h"
 #include "wx/app.h"
+#include "wx/dc.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/radiobox.h"
 #include "wx/notebook.h"
 #include "wx/tabctrl.h"
 #include "wx/radiobox.h"
@@ -69,7 +70,7 @@ wxControl::wxControl()
 
        if ( wxMacLiveScrollbarActionUPP == NULL )
        {
 
        if ( wxMacLiveScrollbarActionUPP == NULL )
        {
-#ifdef __UNIX__
+#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
         wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
 #else
                wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
         wxMacLiveScrollbarActionUPP = NewControlActionUPP( wxMacLiveScrollbarActionProc );
 #else
                wxMacLiveScrollbarActionUPP = NewControlActionProc( wxMacLiveScrollbarActionProc ) ;
@@ -135,6 +136,7 @@ void wxControl::SetLabel(const wxString& title)
 #endif
                ::SetControlTitle( m_macControl , maclabel ) ;
        }
 #endif
                ::SetControlTitle( m_macControl , maclabel ) ;
        }
+       Refresh() ;
 }
 
 wxSize wxControl::DoGetBestSize() const
 }
 
 wxSize wxControl::DoGetBestSize() const
@@ -266,8 +268,10 @@ void wxControl::MacPostControlCreate()
        ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
        wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
        ::UMAEmbedControl( m_macControl , container ) ;
        ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
        wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
        ::UMAEmbedControl( m_macControl , container ) ;
+       m_macControlIsShown  = true ;
        MacAdjustControlRect() ;
        wxAssociateControlWithMacControl( m_macControl , this ) ;
        MacAdjustControlRect() ;
        wxAssociateControlWithMacControl( m_macControl , this ) ;
+       UMAShowControl( m_macControl ) ;
 }
 
 void wxControl::MacAdjustControlRect() 
 }
 
 void wxControl::MacAdjustControlRect() 
@@ -301,6 +305,8 @@ void wxControl::MacAdjustControlRect()
                        if ( IsKindOf( CLASSINFO( wxButton ) ) )
                        {
                                m_width = m_label.Length() * 8 + 12 ;
                        if ( IsKindOf( CLASSINFO( wxButton ) ) )
                        {
                                m_width = m_label.Length() * 8 + 12 ;
+                               if ( m_width < 70 )
+                                 m_width = 70 ;
                        }
                        else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
                        {
                        }
                        else if ( IsKindOf( CLASSINFO( wxStaticText ) ) )
                        {
@@ -354,15 +360,7 @@ void wxControl::MacSuperChangedPosition()
        
                if ( mac_x != former_mac_x || mac_y != former_mac_y )
                {
        
                if ( mac_x != former_mac_x || mac_y != former_mac_y )
                {
-                       {
-                               Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
-                               InvalWindowRect( rootwindow , &inval ) ;
-                       }
                        UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
                        UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y + m_macVerticalBorder ) ;
-                       {
-                               Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                               InvalWindowRect( rootwindow , &inval ) ;
-                       }
                }
                if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
                {
                }
                if ( wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
                {
@@ -416,12 +414,19 @@ void  wxControl::MacSuperShown( bool show )
        {
                if ( !show )
                {
        {
                if ( !show )
                {
-                       ::UMAHideControl( m_macControl ) ;
+                       if ( m_macControlIsShown )
+                       {
+                               ::UMAHideControl( m_macControl ) ;
+                               m_macControlIsShown = false ;
+                       }
                }
                else
                {
                }
                else
                {
-                       if ( m_isShown )
+                       if ( MacIsReallyShown() && !m_macControlIsShown )
+                       {
                                ::UMAShowControl( m_macControl ) ;
                                ::UMAShowControl( m_macControl ) ;
+                               m_macControlIsShown = true ;
+                       }
                }
        }
                
                }
        }
                
@@ -483,15 +488,7 @@ void  wxControl::DoSetSize(int x, int y,
        
        if ( mac_x != former_mac_x || mac_y != former_mac_y )
        {
        
        if ( mac_x != former_mac_x || mac_y != former_mac_y )
        {
-               {
-                       Rect inval = { former_mac_y , former_mac_x , former_mac_y + m_height , former_mac_x + m_width } ;
-                       InvalWindowRect( macrootwindow, &inval ) ;
-               }
                UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y  + m_macVerticalBorder ) ;
                UMAMoveControl( m_macControl , mac_x + m_macHorizontalBorder , mac_y  + m_macVerticalBorder ) ;
-               {
-                       Rect inval = { mac_y , mac_x , mac_y + m_height , mac_x + m_width } ;
-                       InvalWindowRect(macrootwindow, &inval ) ;
-               }
        }
 
        if ( actualX != former_x || actualY != former_y )
        }
 
        if ( actualX != former_x || actualY != former_y )
@@ -541,10 +538,22 @@ bool  wxControl::Show(bool show)
                
        if ( m_macControl )
        {
                
        if ( m_macControl )
        {
-               if ( show )
-                       ::UMAShowControl( m_macControl ) ;
+               if ( !show )
+               {
+                       if ( m_macControlIsShown )
+                       {
+                               ::UMAHideControl( m_macControl ) ;
+                               m_macControlIsShown = false ;
+                       }
+               }
                else
                else
-                       ::UMAHideControl( m_macControl ) ;
+               {
+                       if ( MacIsReallyShown() && !m_macControlIsShown )
+                       {
+                               ::UMAShowControl( m_macControl ) ;
+                               m_macControlIsShown = true ;
+                       }
+               }
        }
        return TRUE ;
 }
        }
        return TRUE ;
 }
@@ -556,21 +565,10 @@ bool  wxControl::Enable(bool enable)
 
        if ( m_macControl )
        {
 
        if ( m_macControl )
        {
-               
-               if ( UMAHasAppearance() )
-               {
-                       if ( enable )
-                               ::ActivateControl( m_macControl ) ;
-                       else
-                               ::DeactivateControl( m_macControl ) ;
-               }
+               if ( enable )
+                   UMAActivateControl( m_macControl ) ;
                else
                else
-               {
-                       if ( enable )
-                               ::HiliteControl( m_macControl , 0 ) ;
-                       else
-                               ::HiliteControl( m_macControl , 255 ) ;
-               }
+                   UMADeactivateControl( m_macControl ) ;
        }
        return TRUE ;
 }
        }
        return TRUE ;
 }
@@ -641,8 +639,9 @@ void wxControl::OnPaint(wxPaintEvent& event)
                                wxMacDrawingHelper help( win ) ;
                                // the mac control manager always assumes to have the origin at 0,0
                                SetOrigin( 0 , 0 ) ;
                                wxMacDrawingHelper help( win ) ;
                                // the mac control manager always assumes to have the origin at 0,0
                                SetOrigin( 0 , 0 ) ;
+
                                
                                
-                               bool                    hasTabBehind = false ;
+                               bool hasTabBehind = false ;
                                wxWindow* parent = GetParent() ;
                                while ( parent )
                                {
                                wxWindow* parent = GetParent() ;
                                while ( parent )
                                {
@@ -661,7 +660,7 @@ void wxControl::OnPaint(wxPaintEvent& event)
                                        
                                        parent = parent->GetParent() ;
                                } 
                                        
                                        parent = parent->GetParent() ;
                                } 
-                               
+
                                UMADrawControl( m_macControl ) ;
                                UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
                        }
                                UMADrawControl( m_macControl ) ;
                                UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
                        }
@@ -739,10 +738,12 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
        
                controlpart = FindControl( localwhere , window , &control ) ;
                {
        
                controlpart = FindControl( localwhere , window , &control ) ;
                {
+               /*
                        if ( AcceptsFocus() && FindFocus() != this )
                        {
                                SetFocus() ;
                        }
                        if ( AcceptsFocus() && FindFocus() != this )
                        {
                                SetFocus() ;
                        }
+               */
                        if ( control && UMAIsControlActive( control ) )
                        {
                                {
                        if ( control && UMAIsControlActive( control ) )
                        {
                                {