]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/control.cpp
added conversion routines to CIconHandle, removing pre 8.6 routines
[wxWidgets.git] / src / mac / control.cpp
index 1d23a5eaaee279e18b8dda8aa972cbf46ed9e925..55aca27152a82ccab49da0bad6bacba5df0e66c3 100644 (file)
@@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE(wxControl, wxWindow)
 END_EVENT_TABLE()
 #endif
 
 END_EVENT_TABLE()
 #endif
 
-#include <wx/mac/uma.h>
+#include "wx/mac/uma.h"
 
 // Item members
 
 
 // Item members
 
@@ -111,7 +111,7 @@ wxControl::~wxControl()
     }
     if ( m_macControl )
     {
     }
     if ( m_macControl )
     {
-       UMADisposeControl( m_macControl ) ;
+       ::DisposeControl( m_macControl ) ;
        m_macControl = NULL ;
     }
 }
        m_macControl = NULL ;
     }
 }
@@ -146,7 +146,7 @@ wxSize wxControl::DoGetBestSize() const
        Rect    bestsize = { 0 , 0 , 0 , 0 } ;
        short   baselineoffset ;
        int bestWidth, bestHeight ;
        Rect    bestsize = { 0 , 0 , 0 , 0 } ;
        short   baselineoffset ;
        int bestWidth, bestHeight ;
-       UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
+       ::GetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
 
        if ( EmptyRect( &bestsize ) )
        {
 
        if ( EmptyRect( &bestsize ) )
        {
@@ -297,7 +297,7 @@ void wxControl::MacPostControlCreate()
                controlstyle.flags = kControlUseFontMask ;
                controlstyle.font = kControlFontSmallBoldSystemFont ;
                
                controlstyle.flags = kControlUseFontMask ;
                controlstyle.font = kControlFontSmallBoldSystemFont ;
                
-               ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
+               ::SetControlFontStyle( m_macControl , &controlstyle ) ;
        }
        else
        {
        }
        else
        {
@@ -305,11 +305,11 @@ void wxControl::MacPostControlCreate()
                controlstyle.flags = kControlUseFontMask ;
                controlstyle.font = kControlFontSmallSystemFont ;
                
                controlstyle.flags = kControlUseFontMask ;
                controlstyle.font = kControlFontSmallSystemFont ;
                
-               ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
+               ::SetControlFontStyle( m_macControl , &controlstyle ) ;
        }
        ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
        wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
        }
        ControlHandle container = GetParent()->MacGetContainerForEmbedding() ;
        wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
-       ::UMAEmbedControl( m_macControl , container ) ;
+       ::EmbedControl( m_macControl , container ) ;
        m_macControlIsShown  = true ;
 
        wxAssociateControlWithMacControl( m_macControl , this ) ;
        m_macControlIsShown  = true ;
 
        wxAssociateControlWithMacControl( m_macControl , this ) ;
@@ -342,7 +342,7 @@ void wxControl::MacAdjustControlRect()
                Rect    bestsize = { 0 , 0 , 0 , 0 } ;
                short   baselineoffset ;
                
                Rect    bestsize = { 0 , 0 , 0 , 0 } ;
                short   baselineoffset ;
                
-               UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
+               ::GetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
 
                if ( EmptyRect( &bestsize ) )
                {
 
                if ( EmptyRect( &bestsize ) )
                {
@@ -415,7 +415,7 @@ void wxControl::MacSuperChangedPosition()
                
                WindowRef rootwindow = GetMacRootWindow() ;
                wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
                
                WindowRef rootwindow = GetMacRootWindow() ;
                wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
-               UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
+               ::SetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
                wxMacDrawingHelper focus( wxrootwindow ) ;
        
                if ( mac_x != former_mac_x || mac_y != former_mac_y )
                wxMacDrawingHelper focus( wxrootwindow ) ;
        
                if ( mac_x != former_mac_x || mac_y != former_mac_y )
@@ -435,7 +435,7 @@ void wxControl::MacSuperChangedPosition()
                }
                else
                {
                }
                else
                {
-                       UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
+                       ::SetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
                }
        }
 
                }
        }
 
@@ -484,7 +484,7 @@ void  wxControl::MacSuperShown( bool show )
                {
                        if ( m_macControlIsShown )
                        {
                {
                        if ( m_macControlIsShown )
                        {
-                               ::UMAHideControl( m_macControl ) ;
+                               ::HideControl( m_macControl ) ;
                                m_macControlIsShown = false ;
                        }
                }
                                m_macControlIsShown = false ;
                        }
                }
@@ -619,7 +619,7 @@ void  wxControl::DoSetSize(int x, int y,
          wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
          wxMacDrawingHelper focus( wxrootwindow );
  
          wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
          wxMacDrawingHelper focus( wxrootwindow );
  
-         UMASetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
+         ::SetThemeWindowBackground( rootwindow , kThemeBrushDialogBackgroundActive , false ) ;
          // Update window at old and new positions
          SetRect(&newbounds, m_x, m_y, m_x + m_width, m_y + m_height);
          InvalWindowRect( rootwindow , &oldbounds );
          // Update window at old and new positions
          SetRect(&newbounds, m_x, m_y, m_x + m_width, m_y + m_height);
          InvalWindowRect( rootwindow , &oldbounds );
@@ -629,7 +629,7 @@ void  wxControl::DoSetSize(int x, int y,
  
          if ( !wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
          {
  
          if ( !wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
          {
-             UMASetThemeWindowBackground( rootwindow, kThemeBrushDocumentWindowBackground, false );
+             ::SetThemeWindowBackground( rootwindow, kThemeBrushDocumentWindowBackground, false );
          }
      }
 }
          }
      }
 }
@@ -645,7 +645,7 @@ bool  wxControl::Show(bool show)
                {
                        if ( m_macControlIsShown )
                        {
                {
                        if ( m_macControlIsShown )
                        {
-                               ::UMAHideControl( m_macControl ) ;
+                               ::HideControl( m_macControl ) ;
                                m_macControlIsShown = false ;
                        }
                }
                                m_macControlIsShown = false ;
                        }
                }
@@ -707,7 +707,7 @@ void wxControl::MacRedrawControl()
                                {
                                        if( parent->MacGetWindowData() )
                                        {
                                {
                                        if( parent->MacGetWindowData() )
                                        {
-                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
                                                break ;
                                        }
                                        
                                                break ;
                                        }
                                        
@@ -722,7 +722,7 @@ void wxControl::MacRedrawControl()
                                } 
                                
                                UMADrawControl( m_macControl ) ;
                                } 
                                
                                UMADrawControl( m_macControl ) ;
-                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
                        }
                }
        }
                        }
                }
        }
@@ -747,7 +747,7 @@ void wxControl::OnPaint(wxPaintEvent& event)
                                {
                                        if( parent->MacGetWindowData() )
                                        {
                                {
                                        if( parent->MacGetWindowData() )
                                        {
-                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
                                                break ;
                                        }
                                        
                                                break ;
                                        }
                                        
@@ -762,7 +762,7 @@ void wxControl::OnPaint(wxPaintEvent& event)
                                } 
 
                                UMADrawControl( m_macControl ) ;
                                } 
 
                                UMADrawControl( m_macControl ) ;
-                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
+                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
                        }
                }
        }
                        }
                }
        }
@@ -791,7 +791,7 @@ void  wxControl::OnKeyDown( wxKeyEvent &event )
        keychar = short(ev->message & charCodeMask);
        keycode = short(ev->message & keyCodeMask) >> 8 ;
 
        keychar = short(ev->message & charCodeMask);
        keycode = short(ev->message & keyCodeMask) >> 8 ;
 
-       UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
+       ::HandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
 }
 
 void  wxControl::OnMouseEvent( wxMouseEvent &event ) 
 }
 
 void  wxControl::OnMouseEvent( wxMouseEvent &event ) 
@@ -834,8 +834,13 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
        
                if ( event.m_metaDown )
                        modifiers |= cmdKey ;
        
                if ( event.m_metaDown )
                        modifiers |= cmdKey ;
-       
+
+#if TARGET_CARBON
+        control = FindControlUnderMouse( localwhere , window , &controlpart ) ;
+#else
+//        control = FindControlUnderMouse( localwhere , window , &controlpart ) ;
                controlpart = FindControl( localwhere , window , &control ) ;
                controlpart = FindControl( localwhere , window , &control ) ;
+#endif
                {
                /*
                        if ( AcceptsFocus() && FindFocus() != this )
                {
                /*
                        if ( AcceptsFocus() && FindFocus() != this )
@@ -843,15 +848,15 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
                                SetFocus() ;
                        }
                */
                                SetFocus() ;
                        }
                */
-                       if ( control && UMAIsControlActive( control ) )
+                       if ( control && ::IsControlActive( control ) )
                        {
                                {
                                        if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
                        {
                                {
                                        if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
-                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
+                                               controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
                                        else
                                        else
-                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
+                                               controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
                                        wxTheApp->s_lastMouseDown = 0 ;
                                        wxTheApp->s_lastMouseDown = 0 ;
-                                       if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) ) 
+                                       if ( control && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) ) 
                                                && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
                                        {
                                                MacHandleControlClick( control , controlpart ) ;
                                                && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
                                        {
                                                MacHandleControlClick( control , controlpart ) ;