]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/control.cpp
applied correction from Marc Newsam in calculations of linesize
[wxWidgets.git] / src / mac / carbon / control.cpp
index 0953356de7d7f53f1ed4bc45d2387e22e4935e98..63610676a06912f12de959f129bd651bd5ebeceb 100644 (file)
@@ -16,6 +16,7 @@
 #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"
@@ -266,6 +267,7 @@ void wxControl::MacPostControlCreate()
        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 ) ;
 }
@@ -416,12 +418,19 @@ void  wxControl::MacSuperShown( bool show )
        {
                if ( !show )
                {
-                       ::UMAHideControl( m_macControl ) ;
+                       if ( m_macControlIsShown )
+                       {
+                               ::UMAHideControl( m_macControl ) ;
+                               m_macControlIsShown = false ;
+                       }
                }
                else
                {
-                       if ( m_isShown )
+                       if ( MacIsReallyShown() && !m_macControlIsShown )
+                       {
                                ::UMAShowControl( m_macControl ) ;
+                               m_macControlIsShown = true ;
+                       }
                }
        }
                
@@ -541,10 +550,22 @@ bool  wxControl::Show(bool show)
                
        if ( m_macControl )
        {
-               if ( show )
-                       ::UMAShowControl( m_macControl ) ;
+               if ( !show )
+               {
+                       if ( m_macControlIsShown )
+                       {
+                               ::UMAHideControl( m_macControl ) ;
+                               m_macControlIsShown = false ;
+                       }
+               }
                else
-                       ::UMAHideControl( m_macControl ) ;
+               {
+                       if ( MacIsReallyShown() && !m_macControlIsShown )
+                       {
+                               ::UMAShowControl( m_macControl ) ;
+                               m_macControlIsShown = true ;
+                       }
+               }
        }
        return TRUE ;
 }
@@ -741,10 +762,12 @@ void  wxControl::OnMouseEvent( wxMouseEvent &event )
        
                controlpart = FindControl( localwhere , window , &control ) ;
                {
+               /*
                        if ( AcceptsFocus() && FindFocus() != this )
                        {
                                SetFocus() ;
                        }
+               */
                        if ( control && UMAIsControlActive( control ) )
                        {
                                {