]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/control.cpp
formatting
[wxWidgets.git] / src / mac / control.cpp
index 1d23a5eaaee279e18b8dda8aa972cbf46ed9e925..8c19e3cec28ee9585c8508cd60fa0213d8038fde 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 ;
                        }
                }
@@ -609,6 +609,7 @@ void  wxControl::DoSetSize(int x, int y,
                              m_width - 2 * m_macHorizontalBorder,
                              m_height -  2 * m_macVerticalBorder ) ;
  
              wxSizeEvent event(wxSize(m_width, m_height), m_windowId);
              event.SetEventObject(this);
              GetEventHandler()->ProcessEvent(event);
@@ -619,7 +620,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 +630,7 @@ void  wxControl::DoSetSize(int x, int y,
  
          if ( !wxrootwindow->IsKindOf( CLASSINFO( wxDialog ) ) )
          {
-             UMASetThemeWindowBackground( rootwindow, kThemeBrushDocumentWindowBackground, false );
+             ::SetThemeWindowBackground( rootwindow, kThemeBrushDocumentWindowBackground, false );
          }
      }
 }
@@ -645,7 +646,7 @@ bool  wxControl::Show(bool show)
                {
                        if ( m_macControlIsShown )
                        {
-                               ::UMAHideControl( m_macControl ) ;
+                               ::HideControl( m_macControl ) ;
                                m_macControlIsShown = false ;
                        }
                }
@@ -707,7 +708,7 @@ void wxControl::MacRedrawControl()
                                {
                                        if( parent->MacGetWindowData() )
                                        {
-                                               UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
+                                               ::SetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
                                                break ;
                                        }
                                        
@@ -722,7 +723,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 +748,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 +763,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 +792,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 +835,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 +849,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 ) ;
                                        }
                                }
                        }