]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/control.cpp
applied Paul A. Thiessen's patches for correcting coordinates when having borders...
[wxWidgets.git] / src / mac / control.cpp
index 1d23a5eaaee279e18b8dda8aa972cbf46ed9e925..5c2a5d785d6f519cfc5ccbced383e2a12fca5c4b 100644 (file)
@@ -40,7 +40,7 @@ BEGIN_EVENT_TABLE(wxControl, wxWindow)
 END_EVENT_TABLE()
 #endif
 
-#include <wx/mac/uma.h>
+#include "wx/mac/uma.h"
 
 // Item members
 
@@ -111,7 +111,7 @@ wxControl::~wxControl()
     }
     if ( m_macControl )
     {
-       UMADisposeControl( m_macControl ) ;
+       ::DisposeControl( m_macControl ) ;
        m_macControl = NULL ;
     }
 }
@@ -146,7 +146,7 @@ wxSize wxControl::DoGetBestSize() const
        Rect    bestsize = { 0 , 0 , 0 , 0 } ;
        short   baselineoffset ;
        int bestWidth, bestHeight ;
-       UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
+       ::GetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
 
        if ( EmptyRect( &bestsize ) )
        {
@@ -297,7 +297,7 @@ void wxControl::MacPostControlCreate()
                controlstyle.flags = kControlUseFontMask ;
                controlstyle.font = kControlFontSmallBoldSystemFont ;
                
-               ::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
+               ::SetControlFontStyle( m_macControl , &controlstyle ) ;
        }
        else
        {
@@ -305,11 +305,11 @@ void wxControl::MacPostControlCreate()
                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") ) ;
-       ::UMAEmbedControl( m_macControl , container ) ;
+       ::EmbedControl( m_macControl , container ) ;
        m_macControlIsShown  = true ;
 
        wxAssociateControlWithMacControl( m_macControl , this ) ;
@@ -342,7 +342,7 @@ void wxControl::MacAdjustControlRect()
                Rect    bestsize = { 0 , 0 , 0 , 0 } ;
                short   baselineoffset ;
                
-               UMAGetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
+               ::GetBestControlRect( m_macControl , &bestsize , &baselineoffset ) ;
 
                if ( EmptyRect( &bestsize ) )
                {
@@ -415,7 +415,7 @@ void wxControl::MacSuperChangedPosition()
                
                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 )
@@ -435,7 +435,7 @@ void wxControl::MacSuperChangedPosition()
                }
                else
                {
-                       UMASetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
+                       ::SetThemeWindowBackground( rootwindow , kThemeBrushDocumentWindowBackground , false ) ;
                }
        }
 
@@ -484,7 +484,7 @@ void  wxControl::MacSuperShown( bool show )
                {
                        if ( m_macControlIsShown )
                        {
-                               ::UMAHideControl( m_macControl ) ;
+                               ::HideControl( m_macControl ) ;
                                m_macControlIsShown = false ;
                        }
                }
@@ -619,7 +619,7 @@ void  wxControl::DoSetSize(int x, int y,
          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 );
@@ -629,7 +629,7 @@ void  wxControl::DoSetSize(int x, int y,
  
          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 )
                        {
-                               ::UMAHideControl( m_macControl ) ;
+                               ::HideControl( m_macControl ) ;
                                m_macControlIsShown = false ;
                        }
                }
@@ -707,7 +707,7 @@ void wxControl::MacRedrawControl()
                                {
                                        if( parent->MacGetWindowData() )
                                        {
-                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
                                                break ;
                                        }
                                        
@@ -722,7 +722,7 @@ void wxControl::MacRedrawControl()
                                } 
                                
                                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() )
                                        {
-                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
                                                break ;
                                        }
                                        
@@ -762,7 +762,7 @@ void wxControl::OnPaint(wxPaintEvent& event)
                                } 
 
                                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 ;
 
-       UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
+       ::HandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
 }
 
 void  wxControl::OnMouseEvent( wxMouseEvent &event ) 
@@ -834,8 +834,13 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
        
                if ( event.m_metaDown )
                        modifiers |= cmdKey ;
-       
+/*
+#if TARGET_CARBON
+        control = FindControlUnderMouse( localwhere , window , &controlpart ) ;
+#else
                controlpart = FindControl( localwhere , window , &control ) ;
+#endif
+*/
                {
                /*
                        if ( AcceptsFocus() && FindFocus() != this )
@@ -843,18 +848,17 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
                                SetFocus() ;
                        }
                */
-                       if ( control && UMAIsControlActive( control ) )
+                   control = m_macControl ;
+                       if ( control && ::IsControlActive( control ) )
                        {
                                {
-                                       if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
-                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
-                                       else
-                                               controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
+                                       controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
                                        wxTheApp->s_lastMouseDown = 0 ;
-                                       if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) ) 
-                                               && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
+                                       if ( control && controlpart != kControlNoPart &&
+                                           ! IsKindOf( CLASSINFO( wxScrollBar ) ) 
+                                       ) // otherwise we will get the event twice for scrollbar
                                        {
-                                               MacHandleControlClick( control , controlpart ) ;
+                                           MacHandleControlClick( control , controlpart ) ;
                                        }
                                }
                        }