X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e3aeade0d6f73101bc8ea9951737e1aa1f35c582..832f330f225b4909ec9565096528f26a2db332fd:/src/mac/carbon/window.cpp diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index ace53ef96b..ff50aba9ce 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -11,41 +11,47 @@ #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" +#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_CARET #include "wx/caret.h" #endif -#define MAC_SCROLLBAR_SIZE 15 -#define MAC_SMALL_SCROLLBAR_SIZE 11 +#if wxUSE_DRAG_AND_DROP +#include "wx/dnd.h" +#endif #include "wx/mac/uma.h" +#define MAC_SCROLLBAR_SIZE 15 +#define MAC_SMALL_SCROLLBAR_SIZE 11 + #ifndef __DARWIN__ #include #include @@ -59,14 +65,8 @@ #endif #endif -#if wxUSE_DRAG_AND_DROP -#include "wx/dnd.h" -#endif - #include -extern wxList wxPendingDelete; - #ifdef __WXUNIVERSAL__ IMPLEMENT_ABSTRACT_CLASS(wxWindowMac, wxWindowBase) #else @@ -89,8 +89,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 +140,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 @@ -160,16 +155,18 @@ static const EventTypeSpec eventList[] = { { kEventClassCommand, kEventProcessCommand } , { kEventClassCommand, kEventCommandUpdateStatus } , - + { kEventClassControl , kEventControlHit } , { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } , { kEventClassTextInput, kEventTextInputUpdateActiveInputArea } , - + { kEventClassControl , kEventControlDraw } , +#if TARGET_API_MAC_OSX { kEventClassControl , kEventControlVisibilityChanged } , { kEventClassControl , kEventControlEnabledStateChanged } , { kEventClassControl , kEventControlHiliteChanged } , +#endif { kEventClassControl , kEventControlSetFocusPart } , { kEventClassService , kEventServiceGetTypes }, @@ -199,15 +196,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 ) { @@ -215,29 +203,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 ; @@ -270,43 +245,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 ; @@ -492,36 +449,37 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even { OSStatus result = eventNotHandledErr ; wxWindowMac* focus = (wxWindowMac*) data ; - + wchar_t* uniChars = NULL ; UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; - - UniChar* charBuf; + + UniChar* charBuf = NULL; UInt32 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 = charBuf ; - memcpy( uniChars , charBuf , dataSize ) ; + uniChars = (wchar_t*) charBuf ; + memcpy( uniChars , charBuf , numChars * 2 ) ; #else // the resulting string will never have more chars than the utf16 version, so this is safe wxMBConvUTF16 converter ; numChars = converter.MB2WC( uniChars , (const char*)charBuf , numChars ) ; #endif } - + switch ( GetEventKind( event ) ) { case kEventTextInputUpdateActiveInputArea : @@ -530,18 +488,17 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even // EVT_CHAR for (int pos=0 ; pos < numChars ; pos++) { - WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; wxTheApp->MacSetCurrentEvent( event , handler ) ; - + UInt32 message = (0 << 8) + ((char)uniChars[pos] ); if ( wxTheApp->MacSendCharEvent( focus , message , 0 , when , 0 , 0 , uniChars[pos] ) ) { result = noErr ; } - + wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; } } @@ -558,24 +515,23 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even GetEventParameter( rawEvent, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode ); GetEventParameter( rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers ); GetEventParameter( rawEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &point ); - + UInt32 message = (keyCode << 8) + charCode; // An IME input event may return several characters, but we need to send one char at a time to // EVT_CHAR for (int pos=0 ; pos < numChars ; pos++) { - WXEVENTREF formerEvent = wxTheApp->MacGetCurrentEvent() ; WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ; wxTheApp->MacSetCurrentEvent( event , handler ) ; - + if ( wxTheApp->MacSendCharEvent( focus , message , modifiers , when , point.h , point.v , uniChars[pos] ) ) { result = noErr ; } - + wxTheApp->MacSetCurrentEvent( formerEvent , formerHandler ) ; } } @@ -583,40 +539,39 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even default: break ; } - - delete[] uniChars ; + + delete [] uniChars ; if ( charBuf != buf ) - delete[] charBuf ; - + delete [] charBuf ; + return result ; - } static pascal OSStatus wxMacWindowCommandEventHandler( EventHandlerCallRef handler , EventRef event , void *data ) { OSStatus result = eventNotHandledErr ; wxWindowMac* focus = (wxWindowMac*) data ; - + HICommand command ; - + wxMacCarbonEvent cEvent( event ) ; cEvent.GetParameter(kEventParamDirectObject,typeHICommand,&command) ; - + wxMenuItem* item = NULL ; wxMenu* itemMenu = wxFindMenuFromMacCommand( command , item ) ; int id = wxMacCommandToId( command.commandID ) ; - + if ( item ) { wxASSERT( itemMenu != NULL ) ; - + switch ( cEvent.GetKind() ) { case kEventProcessCommand : { if (item->IsCheckable()) item->Check( !item->IsChecked() ) ; - + if ( itemMenu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ) result = noErr ; else @@ -624,27 +579,27 @@ static pascal OSStatus wxMacWindowCommandEventHandler( EventHandlerCallRef handl wxCommandEvent event(wxEVT_COMMAND_MENU_SELECTED , id); event.SetEventObject(focus); event.SetInt(item->IsCheckable() ? item->IsChecked() : -1); - + if ( focus->GetEventHandler()->ProcessEvent(event) ) result = noErr ; } } break ; - + case kEventCommandUpdateStatus: { wxUpdateUIEvent event(id); event.SetEventObject( itemMenu ); - + bool processed = false; - + // Try the menu's event handler { wxEvtHandler *handler = itemMenu->GetEventHandler(); if ( handler ) processed = handler->ProcessEvent(event); } - + // Try the window the menu was popped up from // (and up through the hierarchy) if ( !processed ) @@ -658,16 +613,16 @@ static pascal OSStatus wxMacWindowCommandEventHandler( EventHandlerCallRef handl processed = win->GetEventHandler()->ProcessEvent(event); break; } - + menu = menu->GetParent(); } } - + if ( !processed ) { processed = focus->GetEventHandler()->ProcessEvent(event); } - + if ( processed ) { // if anything changed, update the changed attribute @@ -677,12 +632,12 @@ static pascal OSStatus wxMacWindowCommandEventHandler( EventHandlerCallRef handl itemMenu->Check(id, event.GetChecked()); if (event.GetSetEnabled()) itemMenu->Enable(id, event.GetEnabled()); - + result = noErr ; } } break ; - + default : break ; } @@ -714,6 +669,7 @@ pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef case kEventClassTextInput : result = wxMacUnicodeTextEventHandler( handler , event , data ) ; break ; + default : break ; } @@ -940,6 +896,7 @@ void wxWindowMac::Init() { m_peer = NULL ; m_frozenness = 0 ; + m_macAlpha = 255 ; #if WXWIN_COMPATIBILITY_2_4 m_backgroundTransparent = false; @@ -964,7 +921,6 @@ void wxWindowMac::Init() wxWindowBase::SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); } -// Destructor wxWindowMac::~wxWindowMac() { SendDestroyEvent(); @@ -985,7 +941,7 @@ wxWindowMac::~wxWindowMac() break; } } -#endif // __WXUNIVERSAL__ +#endif // destroy children before destroying this window itself DestroyChildren(); @@ -993,11 +949,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() ) @@ -1136,7 +1092,7 @@ 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); @@ -1238,7 +1194,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 ) ; @@ -1259,14 +1215,24 @@ void wxWindowMac::MacSetBackgroundBrush( const wxBrush &brush ) bool wxWindowMac::MacCanFocus() const { - // there is currently no way to determine whether the window is running in full keyboard - // access mode, therefore we cannot rely on these features, yet the only other way would be - // to issue a SetKeyboardFocus event and verify after whether it succeeded, this would risk problems - // in event handlers... - UInt32 features = 0 ; - m_peer->GetFeatures( &features ) ; + // TODO : evaluate performance hits by looking up this value, eventually cache the results for a 1 sec or so + // CAUTION : the value returned currently is 0 or 2, I've also found values of 1 having the same meaning, + // but the value range is nowhere documented + Boolean keyExistsAndHasValidFormat ; + CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue( CFSTR("AppleKeyboardUIMode" ) , + kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat ); + + if ( keyExistsAndHasValidFormat && fullKeyboardAccess > 0 ) + { + return true ; + } + else + { + UInt32 features = 0 ; + m_peer->GetFeatures( &features ) ; - return features & ( kControlSupportsFocus | kControlGetsFocusOnClick ) ; + return features & ( kControlSupportsFocus | kControlGetsFocusOnClick ) ; + } } void wxWindowMac::SetFocus() @@ -1329,7 +1295,7 @@ void wxWindowMac::DoCaptureMouse() wxApp::s_captureWindow = this ; } -wxWindow* wxWindowBase::GetCapture() +wxWindow * wxWindowBase::GetCapture() { return wxApp::s_captureWindow ; } @@ -1355,7 +1321,7 @@ void wxWindowMac::SetDropTarget(wxDropTarget *pDropTarget) #endif -// Old style file-manager drag&drop +// Old-style File Manager Drag & Drop void wxWindowMac::DragAcceptFiles(bool accept) { // TODO: @@ -1378,10 +1344,7 @@ bool wxWindowMac::MacGetBoundsForControl( int& x, int& y, int& w, int& h , bool adjustOrigin ) const { - bool isCompositing = MacGetTopLevelWindow()->MacUsesCompositing() ; - // the desired size, minus the border pixels gives the correct size of the control - x = (int)pos.x; y = (int)pos.y; @@ -1389,9 +1352,6 @@ bool wxWindowMac::MacGetBoundsForControl( w = wxMax(size.x, 0) ; // WidthDefault( size.x ); h = wxMax(size.y, 0) ; // HeightDefault( size.y ) ; - if ( !isCompositing ) - GetParent()->MacWindowToRootWindow( &x , &y ) ; - x += MacGetLeftBorderSize() ; y += MacGetTopBorderSize() ; w -= MacGetLeftBorderSize() + MacGetRightBorderSize() ; @@ -1753,7 +1713,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; @@ -1770,8 +1730,8 @@ bool wxWindowMac::DoPopupMenu(wxMenu *menu, int x, int y) { MenuCommand macid; GetMenuItemCommandID( GetMenuHandle(HiWord(menuResult)) , LoWord(menuResult) , &macid ); - int id = wxMacCommandToId( macid ); - wxMenuItem* item = NULL ; + int id = wxMacCommandToId( macid ); + wxMenuItem* item = NULL ; wxMenu* realmenu ; item = menu->FindItem( id, &realmenu ) ; if ( item ) @@ -2065,7 +2025,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 ; @@ -2080,7 +2040,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 ) ; @@ -2349,7 +2309,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() ; } @@ -2537,6 +2497,7 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible, int range, bool refresh) { bool showScroller; + bool triggerSizeEvent = false; if ( orient == wxHORIZONTAL ) { @@ -2544,7 +2505,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 ) ; } @@ -2555,13 +2519,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 @@ -2574,7 +2547,7 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) GetClientSize( &width , &height ) ; #if TARGET_API_MAC_OSX - if ( true /* m_peer->IsCompositing() */ ) + if ( true ) { // 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, @@ -2594,7 +2567,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 @@ -2615,7 +2588,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 @@ -3140,8 +3113,6 @@ WXWindow wxWindowMac::MacGetTopLevelWindowRef() const iter = iter->GetParent() ; } - wxASSERT_MSG( 1 , wxT("No valid mac root window") ) ; - return NULL ; } @@ -3153,11 +3124,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 ; @@ -3429,3 +3398,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 ; +}