X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a1b806b98241ab649c169aaa1f134df85e80fb8b..f0d3d77b975ba9f7c2cdf9281a3545167a07db3d:/src/osx/window_osx.cpp diff --git a/src/osx/window_osx.cpp b/src/osx/window_osx.cpp index 628f51c44d..a164fdea47 100644 --- a/src/osx/window_osx.cpp +++ b/src/osx/window_osx.cpp @@ -58,15 +58,15 @@ #endif #if wxUSE_DRAG_AND_DROP -#include "wx/dnd.h" + #include "wx/dnd.h" #endif #include "wx/graphics.h" #if wxOSX_USE_CARBON -#include "wx/osx/uma.h" + #include "wx/osx/uma.h" #else -#include "wx/osx/private.h" + #include "wx/osx/private.h" #endif #define MAC_SCROLLBAR_SIZE 15 @@ -444,7 +444,8 @@ void wxWindowMac::MacChildAdded() #endif } -void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), const wxSize& size) +void wxWindowMac::MacPostControlCreate(const wxPoint& WXUNUSED(pos), + const wxSize& WXUNUSED(size)) { // todo remove if refactoring works correctly #if 0 @@ -1064,6 +1065,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height) if ( doResize ) { MacRepositionScrollBars() ; + MacOnInternalSize(); wxSize size(actualWidth, actualHeight); wxSizeEvent event(size, m_windowId); event.SetEventObject(this); @@ -1147,6 +1149,7 @@ void wxWindowMac::DoSetSize(int x, int y, int width, int height, int sizeFlags) if (sizeFlags & wxSIZE_FORCE_EVENT) { + MacOnInternalSize(); wxSizeEvent event( wxSize(width,height), GetId() ); event.SetEventObject( this ); HandleWindowEvent( event ); @@ -1251,12 +1254,18 @@ wxString wxWindowMac::GetLabel() const bool wxWindowMac::Show(bool show) { + if ( !show ) + MacInvalidateBorders(); + if ( !wxWindowBase::Show(show) ) return false; if ( GetPeer() ) GetPeer()->SetVisibility( show ) ; + if ( show ) + MacInvalidateBorders(); + #ifdef __WXOSX_IPHONE__ // only when there's no native event support if ( !IsTopLevel() ) @@ -1597,15 +1606,11 @@ void wxWindowMac::MacPaintBorders( int WXUNUSED(leftOrigin) , int WXUNUSED(right GetPeer()->GetSize( tw, th ); GetPeer()->GetPosition( tx, ty ); - Rect rect = { ty,tx, ty+th, tx+tw }; - #if wxOSX_USE_COCOA_OR_CARBON - InsetRect( &rect, -1 , -1 ) ; - { - CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left , - rect.bottom - rect.top ) ; + CGRect cgrect = CGRectMake( tx-1 , ty-1 , tw+2 , + th+2 ) ; CGContextRef cgContext = (CGContextRef) GetParent()->MacGetCGContextRef() ; wxASSERT( cgContext ) ; @@ -1683,6 +1688,7 @@ void wxWindowMac::DoUpdateScrollbarVisibility() MacRepositionScrollBars() ; if ( triggerSizeEvent ) { + MacOnInternalSize(); wxSizeEvent event(GetSize(), m_windowId); event.SetEventObject(this); HandleWindowEvent(event); @@ -2102,6 +2108,11 @@ bool wxWindowMac::MacDoRedraw( long time ) } m_updateRegion = formerUpdateRgn; + + wxNonOwnedWindow* top = MacGetTopLevelWindow(); + if (top) + top->WindowWasPainted() ; + return handled; } @@ -2520,7 +2531,7 @@ Rect wxMacGetBoundsForControl( wxWindowMac* window , const wxPoint& pos , const int x, y, w, h ; window->MacGetBoundsForControl( pos , size , x , y, w, h , adjustForOrigin ) ; - Rect bounds = { y, x, y + h, x + w }; + Rect bounds = { static_cast(y), static_cast(x), static_cast(y + h), static_cast(x + w) }; return bounds ; } @@ -2603,15 +2614,18 @@ bool wxWindowMac::IsShownOnScreen() const #if wxUSE_HOTKEY && wxOSX_USE_COCOA_OR_CARBON -OSStatus wxHotKeyHandler(EventHandlerCallRef nextHandler,EventRef event, void *userData) +OSStatus +wxHotKeyHandler(EventHandlerCallRef WXUNUSED(nextHandler), + EventRef event, + void* WXUNUSED(userData)) { EventHotKeyID hotKeyId; GetEventParameter( event, kEventParamDirectObject, typeEventHotKeyID, NULL, sizeof(hotKeyId), NULL, &hotKeyId); - for ( int i = 0; i < s_hotkeys.size(); ++i ) + for ( unsigned i = 0; i < s_hotkeys.size(); ++i ) { - if ( s_hotkeys[i].keyId == hotKeyId.id ) + if ( s_hotkeys[i].keyId == static_cast(hotKeyId.id) ) { unsigned char charCode ; UInt32 keyCode ; @@ -2640,7 +2654,7 @@ OSStatus wxHotKeyHandler(EventHandlerCallRef nextHandler,EventRef event, void *u bool wxWindowMac::RegisterHotKey(int hotkeyId, int modifiers, int keycode) { - for ( int i = 0; i < s_hotkeys.size(); ++i ) + for ( unsigned i = 0; i < s_hotkeys.size(); ++i ) { if ( s_hotkeys[i].keyId == hotkeyId ) { @@ -2666,9 +2680,9 @@ bool wxWindowMac::RegisterHotKey(int hotkeyId, int modifiers, int keycode) mac_modifiers |= optionKey; if ( modifiers & wxMOD_SHIFT ) mac_modifiers |= shiftKey; - if ( modifiers & wxMOD_CONTROL ) + if ( modifiers & wxMOD_RAW_CONTROL ) mac_modifiers |= controlKey; - if ( modifiers & wxMOD_META ) + if ( modifiers & wxMOD_CONTROL ) mac_modifiers |= cmdKey; EventHotKeyRef hotKeyRef; @@ -2699,7 +2713,7 @@ bool wxWindowMac::RegisterHotKey(int hotkeyId, int modifiers, int keycode) bool wxWindowMac::UnregisterHotKey(int hotkeyId) { - for ( int i = s_hotkeys.size()-1; i>=0; -- i ) + for ( int i = ((int)s_hotkeys.size())-1; i>=0; -- i ) { if ( s_hotkeys[i].keyId == hotkeyId ) {