X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2e91d506b28baaa2234725751b1805864c970d58..dedf5d9f66a309691a4459efe9c1244bfb8c71af:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index 47a280bc4d..2a6f6dfd9c 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -11,31 +11,43 @@ #include "wx/wxprec.h" -#include "wx/menu.h" #include "wx/window.h" -#include "wx/dc.h" -#include "wx/dcclient.h" -#include "wx/utils.h" -#include "wx/app.h" -#include "wx/panel.h" -#include "wx/layout.h" -#include "wx/dialog.h" -#include "wx/scrolbar.h" -#include "wx/statbox.h" -#include "wx/button.h" -#include "wx/settings.h" -#include "wx/msgdlg.h" -#include "wx/frame.h" + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/panel.h" + #include "wx/frame.h" + #include "wx/dc.h" + #include "wx/dcclient.h" + #include "wx/button.h" + #include "wx/menu.h" + #include "wx/dialog.h" + #include "wx/settings.h" + #include "wx/msgdlg.h" + #include "wx/scrolbar.h" + #include "wx/statbox.h" + #include "wx/textctrl.h" + #include "wx/toolbar.h" + #include "wx/layout.h" + #include "wx/statusbr.h" + #include "wx/menuitem.h" + #include "wx/treectrl.h" + #include "wx/listctrl.h" +#endif + #include "wx/tooltip.h" -#include "wx/statusbr.h" -#include "wx/menuitem.h" #include "wx/spinctrl.h" -#include "wx/log.h" #include "wx/geometry.h" -#include "wx/textctrl.h" -#include "wx/toolbar.h" -#include "wx/dc.h" +#if wxUSE_LISTCTRL + #include "wx/listctrl.h" +#endif + +#if wxUSE_TREECTRL + #include "wx/treectrl.h" +#endif #if wxUSE_CARET #include "wx/caret.h" @@ -65,8 +77,6 @@ #include -extern wxList wxPendingDelete; - #ifdef __WXUNIVERSAL__ IMPLEMENT_ABSTRACT_CLASS(wxWindowMac, wxWindowBase) #else @@ -89,8 +99,6 @@ END_EVENT_TABLE() #define wxMAC_DEBUG_REDRAW 0 #endif -#define wxMAC_USE_THEME_BORDER 1 - // --------------------------------------------------------------------------- // Utility Routines to move between different coordinate systems // --------------------------------------------------------------------------- @@ -142,9 +150,6 @@ void wxMacWindowToNative( const wxWindow* window , Rect *rect ) // Carbon Events // --------------------------------------------------------------------------- -extern long wxMacTranslateKey(unsigned char key, unsigned char code) ; -pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor ) ; - #if TARGET_API_MAC_OSX #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 @@ -161,6 +166,7 @@ static const EventTypeSpec eventList[] = { kEventClassCommand, kEventProcessCommand } , { kEventClassCommand, kEventCommandUpdateStatus } , + { kEventClassControl , kEventControlGetClickActivation } , { kEventClassControl , kEventControlHit } , { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , @@ -171,6 +177,9 @@ static const EventTypeSpec eventList[] = { kEventClassControl , kEventControlVisibilityChanged } , { kEventClassControl , kEventControlEnabledStateChanged } , { kEventClassControl , kEventControlHiliteChanged } , + + { kEventClassControl , kEventControlActivate } , + { kEventClassControl , kEventControlDeactivate } , #endif { kEventClassControl , kEventControlSetFocusPart } , @@ -201,15 +210,6 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl RgnHandle updateRgn = NULL ; RgnHandle allocatedRgn = NULL ; wxRegion visRegion = thisWindow->MacGetVisibleRegion() ; - Rect controlBounds ; - - if ( ! thisWindow->GetPeer()->IsCompositing() ) - { - if ( thisWindow->GetPeer()->IsRootControl() ) - thisWindow->GetPeer()->GetRect( &controlBounds ) ; - else - GetControlBounds( thisWindow->GetPeer()->GetControlRef() , &controlBounds ) ; - } if ( cEvent.GetParameter(kEventParamRgnHandle, &updateRgn) != noErr ) { @@ -217,29 +217,16 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl } else { - if ( ! thisWindow->GetPeer()->IsCompositing() ) + if ( thisWindow->MacGetLeftBorderSize() != 0 || thisWindow->MacGetTopBorderSize() != 0 ) { + // as this update region is in native window locals we must adapt it to wx window local allocatedRgn = NewRgn() ; CopyRgn( updateRgn , allocatedRgn ) ; - OffsetRgn( allocatedRgn , -controlBounds.left , -controlBounds.top ) ; // hide the given region by the new region that must be shifted wxMacNativeToWindow( thisWindow , allocatedRgn ) ; updateRgn = allocatedRgn ; } - else - { - if ( thisWindow->MacGetLeftBorderSize() != 0 || thisWindow->MacGetTopBorderSize() != 0 ) - { - // as this update region is in native window locals we must adapt it to wx window local - allocatedRgn = NewRgn() ; - CopyRgn( updateRgn , allocatedRgn ) ; - - // hide the given region by the new region that must be shifted - wxMacNativeToWindow( thisWindow , allocatedRgn ) ; - updateRgn = allocatedRgn ; - } - } } Rect rgnBounds ; @@ -272,43 +259,25 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl #if wxMAC_USE_CORE_GRAPHICS bool created = false ; CGContextRef cgContext = NULL ; - if ( cEvent.GetParameter(kEventParamCGContextRef, &cgContext) != noErr ) - { - wxASSERT( thisWindow->GetPeer()->IsCompositing() == false ) ; - - // this parameter is not provided on non-composited windows - created = true ; - - // rest of the code expects this to be already transformed and clipped for local - CGrafPtr port = GetWindowPort( (WindowRef) thisWindow->MacGetTopLevelWindowRef() ) ; - Rect bounds ; - GetPortBounds( port , &bounds ) ; - CreateCGContextForPort( port , &cgContext ) ; - - wxMacWindowToNative( thisWindow , updateRgn ) ; - OffsetRgn( updateRgn , controlBounds.left , controlBounds.top ) ; - ClipCGContextToRegion( cgContext , &bounds , updateRgn ) ; - wxMacNativeToWindow( thisWindow , updateRgn ) ; - OffsetRgn( updateRgn , -controlBounds.left , -controlBounds.top ) ; - - CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ; - CGContextScaleCTM( cgContext , 1 , -1 ) ; - - CGContextTranslateCTM( cgContext , controlBounds.left , controlBounds.top ) ; - -#if 0 - CGContextSetRGBFillColor( cgContext , 1.0 , 1.0 , 1.0 , 1.0 ) ; - CGContextFillRect( cgContext , - CGRectMake( 0 , 0 , - controlBounds.right - controlBounds.left , - controlBounds.bottom - controlBounds.top ) ); -#endif - } - + OSStatus err = cEvent.GetParameter(kEventParamCGContextRef, &cgContext) ; + wxASSERT_MSG( err == noErr , wxT("Unable to retrieve CGContextRef") ) ; thisWindow->MacSetCGContextRef( cgContext ) ; { wxMacCGContextStateSaver sg( cgContext ) ; + float alpha = 1.0 ; + { + wxWindow* iter = thisWindow ; + while ( iter ) + { + alpha *= (float) iter->GetTransparent()/255.0 ; + if ( iter->IsTopLevel() ) + iter = NULL ; + else + iter = iter->GetParent() ; + } + } + CGContextSetAlpha( cgContext , alpha ) ; #endif if ( thisWindow->MacDoRedraw( updateRgn , cEvent.GetTicks() ) ) result = noErr ; @@ -338,7 +307,20 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl case kEventControlHiliteChanged : thisWindow->MacHiliteChanged() ; break ; + + case kEventControlActivate : + case kEventControlDeactivate : + // FIXME: we should have a virtual function for this! +#if wxUSE_TREECTRL + if ( thisWindow->IsKindOf( CLASSINFO( wxTreeCtrl ) ) ) + thisWindow->Refresh(); #endif +#if wxUSE_LISTCTRL + if ( thisWindow->IsKindOf( CLASSINFO( wxListCtrl ) ) ) + thisWindow->Refresh(); +#endif + break ; +#endif // TARGET_API_MAC_OSX // we emulate this event under Carbon CFM case kEventControlSetFocusPart : @@ -395,6 +377,18 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl result = thisWindow->MacControlHit( handler , event ) ; break ; + case kEventControlGetClickActivation : + { + // fix to always have a proper activation for DataBrowser controls (stay in bkgnd otherwise) + WindowRef owner = cEvent.GetParameter(kEventParamWindowRef); + if ( !IsWindowActive(owner) ) + { + cEvent.SetParameter(kEventParamClickActivation,(UInt32) kActivateAndIgnoreClick) ; + result = noErr ; + } + } + break ; + default : break ; } @@ -498,25 +492,26 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even wchar_t* uniChars = NULL ; UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; - UniChar* charBuf; - UInt32 dataSize = 0 ; + UniChar* charBuf = NULL; + ByteCount dataSize = 0 ; int numChars = 0 ; UniChar buf[2] ; if ( GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr ) { - numChars = dataSize / sizeof( UniChar) ; + numChars = dataSize / sizeof( UniChar) + 1; charBuf = buf ; - if ( dataSize > sizeof(buf) ) + if ( (size_t) numChars * 2 > sizeof(buf) ) charBuf = new UniChar[ numChars ] ; else charBuf = buf ; uniChars = new wchar_t[ numChars ] ; GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ; + charBuf[ numChars - 1 ] = 0; #if SIZEOF_WCHAR_T == 2 uniChars = (wchar_t*) charBuf ; - memcpy( uniChars , charBuf , dataSize ) ; + memcpy( uniChars , charBuf , numChars * 2 ) ; #else // the resulting string will never have more chars than the utf16 version, so this is safe wxMBConvUTF16 converter ; @@ -940,6 +935,7 @@ void wxWindowMac::Init() { m_peer = NULL ; m_frozenness = 0 ; + m_macAlpha = 255 ; #if WXWIN_COMPATIBILITY_2_4 m_backgroundTransparent = false; @@ -992,11 +988,11 @@ wxWindowMac::~wxWindowMac() // wxRemoveMacControlAssociation( this ) ; // If we delete an item, we should initialize the parent panel, // because it could now be invalid. - wxWindow *parent = GetParent() ; - if ( parent ) + wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( tlw ) { - if (parent->GetDefaultItem() == (wxButton*) this) - parent->SetDefaultItem(NULL); + if ( tlw->GetDefaultItem() == (wxButton*) this) + tlw->SetDefaultItem(NULL); } if ( m_peer && m_peer->Ok() ) @@ -1122,7 +1118,7 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size) { wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ; - m_peer->SetReference( (long)this ) ; + m_peer->SetReference( (URefCon) this ) ; GetParent()->AddChild( this ); MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ); @@ -1135,10 +1131,10 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size) // adjust font, controlsize etc DoSetWindowVariant( m_windowVariant ) ; - m_peer->SetLabel( wxStripMenuCodes(m_label) ) ; + m_peer->SetLabel( wxStripMenuCodes(m_label, wxStrip_Mnemonics) ) ; if (!m_macIsUserPane) - SetInitialBestSize(size); + SetInitialSize(size); SetCursor( *wxSTANDARD_CURSOR ) ; } @@ -1237,7 +1233,7 @@ bool wxWindowMac::SetBackgroundColour(const wxColour& col ) wxBrush brush ; wxColour newCol(GetBackgroundColour()); - if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) ) + if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ) brush.MacSetTheme( kThemeBrushDocumentWindowBackground ) ; else if ( newCol == wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) ) brush.MacSetTheme( kThemeBrushDialogBackgroundActive ) ; @@ -1395,10 +1391,6 @@ bool wxWindowMac::MacGetBoundsForControl( w = wxMax(size.x, 0) ; // WidthDefault( size.x ); h = wxMax(size.y, 0) ; // HeightDefault( size.y ) ; - bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ; - if ( !isCompositing ) - GetParent()->MacWindowToRootWindow( &x , &y ) ; - x += MacGetLeftBorderSize() ; y += MacGetTopBorderSize() ; w -= MacGetLeftBorderSize() + MacGetRightBorderSize() ; @@ -1477,7 +1469,7 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const if (y) localwhere.v = *y ; - QDGlobalToLocalPoint( GetWindowPort( window ) , &localwhere ) ; + wxMacGlobalToLocal( window , &localwhere ) ; if (x) *x = localwhere.h ; @@ -1512,7 +1504,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const if (y) localwhere.v = *y ; - QDLocalToGlobalPoint( GetWindowPort( window ) , &localwhere ) ; + wxMacLocalToGlobal( window, &localwhere ) ; if (x) *x = localwhere.h ; @@ -1708,10 +1700,10 @@ void wxWindowMac::DoGetClientSize( int *x, int *y ) const bool wxWindowMac::SetCursor(const wxCursor& cursor) { - if (m_cursor == cursor) + if (m_cursor.IsSameAs(cursor)) return false; - if (wxNullCursor == cursor) + if (!cursor.IsOk()) { if ( ! wxWindowBase::SetCursor( *wxSTANDARD_CURSOR ) ) return false ; @@ -1729,23 +1721,33 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) { wxTopLevelWindowMac *tlw = MacGetTopLevelWindow() ; WindowRef window = (WindowRef) ( tlw ? tlw->MacGetWindowRef() : 0 ) ; + + ControlPartCode part ; + ControlRef control ; + Point pt ; + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + HIPoint hiPoint ; + HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint); + pt.h = hiPoint.x; + pt.v = hiPoint.y; + #else CGrafPtr savePort ; Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ; // TODO: If we ever get a GetCurrentEvent... replacement // for the mouse position, use it... - Point pt ; - ControlPartCode part ; - ControlRef control ; GetMouse( &pt ) ; +#endif control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ; if ( control ) mouseWin = wxFindControlFromMacControl( control ) ; - if ( swapped ) +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + if ( swapped ) QDSwapPort( savePort , NULL ) ; +#endif } if ( mouseWin == this && !wxIsBusy() ) @@ -1760,7 +1762,7 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) menu->SetInvokingWindow(this); menu->UpdateUI(); - if ( x == -1 && y == -1 ) + if ( x == wxDefaultCoord && y == wxDefaultCoord ) { wxPoint mouse = wxGetMousePosition(); x = mouse.x; @@ -2072,7 +2074,7 @@ wxPoint wxWindowMac::GetClientAreaOrigin() const void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) { - if ( clientheight != wxDefaultCoord || clientheight != wxDefaultCoord ) + if ( clientwidth != wxDefaultCoord || clientheight != wxDefaultCoord ) { int currentclientwidth , currentclientheight ; int currentwidth , currentheight ; @@ -2087,7 +2089,7 @@ void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight) void wxWindowMac::SetLabel(const wxString& title) { - m_label = wxStripMenuCodes(title) ; + m_label = wxStripMenuCodes(title, wxStrip_Mnemonics) ; if ( m_peer && m_peer->Ok() ) m_peer->SetLabel( m_label ) ; @@ -2338,6 +2340,11 @@ void wxWindowMac::Thaw() #endif } +bool wxWindowMac::IsFrozen() const +{ + return m_frozenness != 0; +} + wxWindowMac *wxGetActiveWindow() { // actually this is a windows-only concept @@ -2356,7 +2363,7 @@ void wxWindowMac::OnEraseBackground(wxEraseEvent& event) return ; #if TARGET_API_MAC_OSX - if ( MacGetTopLevelWindow()->MacUsesCompositing() && (!m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) ) + if ( !m_macBackgroundBrush.Ok() || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) { event.Skip() ; } @@ -2454,8 +2461,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin ) m_peer->GetRect( &rect ) ; InsetRect( &rect, -1 , -1 ) ; -#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 ) +#if wxMAC_USE_CORE_GRAPHICS { CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left , rect.bottom - rect.top ) ; @@ -2502,8 +2508,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin ) HIThemeDrawGrowBox( &cgpoint , &info , cgContext , kHIThemeOrientationNormal ) ; } } - else -#endif + #else { wxTopLevelWindowMac* top = MacGetTopLevelWindow(); if ( top ) @@ -2527,6 +2532,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin ) // DrawThemeStandaloneNoGrowBox } } +#endif } void wxWindowMac::RemoveChild( wxWindowBase *child ) @@ -2544,6 +2550,7 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible, int range, bool refresh) { bool showScroller; + bool triggerSizeEvent = false; if ( orient == wxHORIZONTAL ) { @@ -2551,7 +2558,10 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible, { showScroller = ((range != 0) && (range > thumbVisible)); if ( m_hScrollBar->IsShown() != showScroller ) - m_hScrollBar->Show( showScroller ) ; + { + m_hScrollBar->Show( showScroller ); + triggerSizeEvent = true; + } m_hScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ; } @@ -2562,13 +2572,22 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible, { showScroller = ((range != 0) && (range > thumbVisible)); if ( m_vScrollBar->IsShown() != showScroller ) + { m_vScrollBar->Show( showScroller ) ; + triggerSizeEvent = true; + } m_vScrollBar->SetScrollbar( pos , thumbVisible , range , thumbVisible , refresh ) ; } } MacRepositionScrollBars() ; + if ( triggerSizeEvent ) + { + wxSizeEvent event(GetSize(), m_windowId); + event.SetEventObject(this); + GetEventHandler()->ProcessEvent(event); + } } // Does a physical scroll @@ -2580,8 +2599,6 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) int width , height ; GetClientSize( &width , &height ) ; -#if TARGET_API_MAC_OSX - if ( true /* m_peer->IsCompositing() */ ) { // note there currently is a bug in OSX which makes inefficient refreshes in case an entire control // area is scrolled, this does not occur if width and height are 2 pixels less, @@ -2601,7 +2618,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) // this would be the preferred version for fast drawing controls #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 && m_peer->IsCompositing() ) + if ( UMAGetSystemVersion() >= 0x1030 ) HIViewRender(m_peer->GetControlRef()) ; else #endif @@ -2621,69 +2638,9 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) #else // this would be the preferred version for fast drawing controls -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 && m_peer->IsCompositing() ) - HIViewRender(m_peer->GetControlRef()) ; - else -#endif - Update() ; + HIViewRender(m_peer->GetControlRef()) ; #endif } - else -#endif - { - wxPoint pos; - pos.x = - pos.y = 0; - - Rect scrollrect; - RgnHandle updateRgn = NewRgn() ; - - { - wxClientDC dc(this) ; - wxMacPortSetter helper(&dc) ; - - m_peer->GetRectInWindowCoords( &scrollrect ) ; - //scrollrect.top += MacGetTopBorderSize() ; - //scrollrect.left += MacGetLeftBorderSize() ; - scrollrect.bottom = scrollrect.top + height ; - scrollrect.right = scrollrect.left + width ; - - if ( rect ) - { - Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) , - dc.XLOG2DEVMAC(rect->x + rect->width) } ; - SectRect( &scrollrect , &r , &scrollrect ) ; - } - - ScrollRect( &scrollrect , dx , dy , updateRgn ) ; - - // now scroll the former update region as well and add the new update region - WindowRef rootWindow = (WindowRef) MacGetTopLevelWindowRef() ; - RgnHandle formerUpdateRgn = NewRgn() ; - RgnHandle scrollRgn = NewRgn() ; - RectRgn( scrollRgn , &scrollrect ) ; - GetWindowUpdateRgn( rootWindow , formerUpdateRgn ) ; - Point pt = {0, 0} ; - LocalToGlobal( &pt ) ; - OffsetRgn( formerUpdateRgn , -pt.h , -pt.v ) ; - SectRgn( formerUpdateRgn , scrollRgn , formerUpdateRgn ) ; - - if ( !EmptyRgn( formerUpdateRgn ) ) - { - MacOffsetRgn( formerUpdateRgn , dx , dy ) ; - SectRgn( formerUpdateRgn , scrollRgn , formerUpdateRgn ) ; - InvalWindowRgn( rootWindow, formerUpdateRgn ) ; - } - - InvalWindowRgn(rootWindow, updateRgn ) ; - DisposeRgn( updateRgn ) ; - DisposeRgn( formerUpdateRgn ) ; - DisposeRgn( scrollRgn ) ; - } - - Update() ; - } wxWindowMac *child; int x, y, w, h; @@ -2774,7 +2731,7 @@ void wxWindowMac::OnSetFocus( wxFocusEvent& event ) Rect rect ; m_peer->GetRect( &rect ) ; - // auf den umgebenden Rahmen zurŸck + // auf den umgebenden Rahmen zurŸck InsetRect( &rect, -1 , -1 ) ; wxTopLevelWindowMac* top = MacGetTopLevelWindow(); @@ -3113,19 +3070,16 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) eventNc.SetEventObject( child ); if ( !child->GetEventHandler()->ProcessEvent( eventNc ) ) { -#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 ) - { - child->MacPaintBorders(0, 0) ; - } - else -#endif +#if wxMAC_USE_CORE_GRAPHICS + child->MacPaintBorders(0, 0) ; +#else { wxWindowDC dc(this) ; dc.SetClippingRegion(wxRegion(updatergn)); wxMacPortSetter helper(&dc) ; child->MacPaintBorders(0, 0) ; } +#endif } } } @@ -3147,8 +3101,6 @@ WXWindow wxWindowMac::MacGetTopLevelWindowRef() const iter = iter->GetParent() ; } - wxASSERT_MSG( 1 , wxT("No valid mac root window") ) ; - return NULL ; } @@ -3160,11 +3112,9 @@ void wxWindowMac::MacCreateScrollBars( long style ) { bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ; int scrlsize = MAC_SCROLLBAR_SIZE ; - wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL ; if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL || GetWindowVariant() == wxWINDOW_VARIANT_MINI ) { scrlsize = MAC_SMALL_SCROLLBAR_SIZE ; - variant = wxWINDOW_VARIANT_SMALL ; } int adjust = hasBoth ? scrlsize - 1: 0 ; @@ -3436,3 +3386,32 @@ bool wxWindowMac::Reparent(wxWindowBase *newParentBase) return true; } + +bool wxWindowMac::SetTransparent(wxByte alpha) +{ +#if wxMAC_USE_CORE_GRAPHICS + if ( alpha != m_macAlpha ) + { + m_macAlpha = alpha ; + Refresh() ; + } + return true ; +#else + return false ; +#endif +} + + +bool wxWindowMac::CanSetTransparent() +{ +#if wxMAC_USE_CORE_GRAPHICS + return true ; +#else + return false ; +#endif +} + +wxByte wxWindowMac::GetTransparent() const +{ + return m_macAlpha ; +}