#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"
#include <string.h>
-extern wxList wxPendingDelete;
-
#ifdef __WXUNIVERSAL__
IMPLEMENT_ABSTRACT_CLASS(wxWindowMac, wxWindowBase)
#else
#define wxMAC_DEBUG_REDRAW 0
#endif
-#define wxMAC_USE_THEME_BORDER 1
-
// ---------------------------------------------------------------------------
// Utility Routines to move between different coordinate systems
// ---------------------------------------------------------------------------
// 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
{ kEventClassCommand, kEventProcessCommand } ,
{ kEventClassCommand, kEventCommandUpdateStatus } ,
+ { kEventClassControl , kEventControlGetClickActivation } ,
{ kEventClassControl , kEventControlHit } ,
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
{ kEventClassTextInput, kEventTextInputUpdateActiveInputArea } ,
{ kEventClassControl , kEventControlDraw } ,
+#if TARGET_API_MAC_OSX
{ kEventClassControl , kEventControlVisibilityChanged } ,
{ kEventClassControl , kEventControlEnabledStateChanged } ,
{ kEventClassControl , kEventControlHiliteChanged } ,
+
+ { kEventClassControl , kEventControlActivate } ,
+ { kEventClassControl , kEventControlDeactivate } ,
+#endif
{ kEventClassControl , kEventControlSetFocusPart } ,
{ kEventClassService , kEventServiceGetTypes },
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<RgnHandle>(kEventParamRgnHandle, &updateRgn) != noErr )
{
}
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 ;
#if wxMAC_USE_CORE_GRAPHICS
bool created = false ;
CGContextRef cgContext = NULL ;
- if ( cEvent.GetParameter<CGContextRef>(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<CGContextRef>(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 ;
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 :
}
#endif
+ if ( thisWindow->MacIsUserPane() )
+ result = noErr ;
+
if ( controlPart == kControlFocusNoPart )
{
#if wxUSE_CARET
event.SetEventObject(thisWindow);
thisWindow->GetEventHandler()->ProcessEvent(event) ;
}
-
- if ( thisWindow->MacIsUserPane() )
- result = noErr ;
}
break ;
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<WindowRef>(kEventParamWindowRef);
+ if ( !IsWindowActive(owner) )
+ {
+ cEvent.SetParameter(kEventParamClickActivation,(UInt32) kActivateAndIgnoreClick) ;
+ result = noErr ;
+ }
+ }
+ break ;
+
default :
break ;
}
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 = charBuf ;
- memcpy( uniChars , charBuf , dataSize ) ;
+ uniChars = (wchar_t*) charBuf ;
+/* memcpy( uniChars , charBuf , numChars * 2 ) ;*/ // is there any point in copying charBuf over itself? (in fact, memcpy isn't even guaranteed to work correctly if the source and destination ranges overlap...)
#else
// the resulting string will never have more chars than the utf16 version, so this is safe
wxMBConvUTF16 converter ;
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ;
+ UInt32 message = uniChars[pos] < 128 ? (char)uniChars[pos] : '?';
+/*
+ NB: faking a charcode here is problematic. The kEventTextInputUpdateActiveInputArea event is sent
+ multiple times to update the active range during inline input, so this handler will often receive
+ uncommited text, which should usually not trigger side effects. It might be a good idea to check the
+ kEventParamTextInputSendFixLen parameter and verify if input is being confirmed (see CarbonEvents.h).
+ On the other hand, it can be useful for some applications to react to uncommitted text (for example,
+ to update a status display), as long as it does not disrupt the inline input session. Ideally, wx
+ should add new event types to support advanced text input. For now, I would keep things as they are.
+
+ However, the code that was being used caused additional problems:
UInt32 message = (0 << 8) + ((char)uniChars[pos] );
+ Since it simply truncated the unichar to the last byte, it ended up causing weird bugs with inline
+ input, such as switching to another field when one attempted to insert the character U+4E09 (the kanji
+ for "three"), because it was truncated to 09 (kTabCharCode), which was later "converted" to WXK_TAB
+ (still 09) in wxMacTranslateKey; or triggering the default button when one attempted to insert U+840D
+ (the kanji for "name"), which got truncated to 0D and interpreted as a carriage return keypress.
+ Note that even single-byte characters could have been misinterpreted, since MacRoman charcodes only
+ overlap with Unicode within the (7-bit) ASCII range.
+ But simply passing a NUL charcode would disable text updated events, because wxTextCtrl::OnChar checks
+ for codes within a specific range. Therefore I went for the solution seen above, which keeps ASCII
+ characters as they are and replaces the rest with '?', ensuring that update events are triggered.
+ It would be better to change wxTextCtrl::OnChar to look at the actual unicode character instead, but
+ I don't have time to look into that right now.
+ -- CL
+*/
if ( wxTheApp->MacSendCharEvent(
focus , message , 0 , when , 0 , 0 , uniChars[pos] ) )
{
delete [] uniChars ;
if ( charBuf != buf )
delete [] charBuf ;
-
+
return result ;
}
{
m_peer = NULL ;
m_frozenness = 0 ;
-
-#if WXWIN_COMPATIBILITY_2_4
- m_backgroundTransparent = false;
-#endif
+ m_macAlpha = 255 ;
#if wxMAC_USE_CORE_GRAPHICS
m_cgContextRef = NULL ;
// 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() )
{
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() );
// 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 ) ;
}
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 ) ;
bool wxWindowMac::MacCanFocus() const
{
// 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
+ // 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);
-
+ CFIndex fullKeyboardAccess = CFPreferencesGetAppIntegerValue( CFSTR("AppleKeyboardUIMode" ) ,
+ kCFPreferencesCurrentApplication, &keyExistsAndHasValidFormat );
+
if ( keyExistsAndHasValidFormat && fullKeyboardAccess > 0 )
+ {
return true ;
+ }
else
{
UInt32 features = 0 ;
wxApp::s_captureWindow = this ;
}
-wxWindow* wxWindowBase::GetCapture()
+wxWindow * wxWindowBase::GetCapture()
{
return wxApp::s_captureWindow ;
}
#endif
-// Old style file-manager drag&drop
+// Old-style File Manager Drag & Drop
void wxWindowMac::DragAcceptFiles(bool accept)
{
// TODO:
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;
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() ;
if (y)
localwhere.v = *y ;
- QDGlobalToLocalPoint( GetWindowPort( window ) , &localwhere ) ;
+ wxMacGlobalToLocal( window , &localwhere ) ;
if (x)
*x = localwhere.h ;
if (y)
localwhere.v = *y ;
- QDLocalToGlobalPoint( GetWindowPort( window ) , &localwhere ) ;
+ wxMacLocalToGlobal( window, &localwhere ) ;
if (x)
*x = localwhere.h ;
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 ;
{
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() )
menu->SetInvokingWindow(this);
menu->UpdateUI();
- if ( x == -1 && y == -1 )
+ if ( x == wxDefaultCoord && y == wxDefaultCoord )
{
wxPoint mouse = wxGetMousePosition();
x = mouse.x;
void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight)
{
- if ( clientheight != wxDefaultCoord || clientheight != wxDefaultCoord )
+ if ( clientwidth != wxDefaultCoord || clientheight != wxDefaultCoord )
{
int currentclientwidth , currentclientheight ;
int currentwidth , currentheight ;
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 ) ;
return true;
}
-bool wxWindowMac::Enable(bool enable)
+void wxWindowMac::DoEnable(bool enable)
{
- wxASSERT( m_peer->Ok() ) ;
- bool former = MacIsReallyEnabled() ;
- if ( !wxWindowBase::Enable(enable) )
- return false;
-
m_peer->Enable( enable ) ;
-
- if ( former != MacIsReallyEnabled() )
- MacPropagateEnabledStateChanged() ;
-
- return true;
}
//
#endif
}
-void wxWindowMac::MacPropagateEnabledStateChanged()
+void wxWindowMac::OnEnabled(bool enabled)
{
#if !TARGET_API_MAC_OSX
MacEnabledStateChanged() ;
-
- wxWindowMac *child;
- wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
- while ( node )
- {
- child = node->GetData();
- if ( child->IsEnabled() )
- child->MacPropagateEnabledStateChanged() ;
-
- node = node->GetNext();
- }
#endif
}
fontToUse = &m_font;
wxClientDC dc( (wxWindowMac*) this ) ;
- long lx,ly,ld,le ;
+ wxCoord lx,ly,ld,le ;
dc.GetTextExtent( string , &lx , &ly , &ld, &le, (wxFont *)fontToUse ) ;
if ( externalLeading )
*externalLeading = le ;
#endif
}
+bool wxWindowMac::IsFrozen() const
+{
+ return m_frozenness != 0;
+}
+
wxWindowMac *wxGetActiveWindow()
{
// actually this is a windows-only concept
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() ;
}
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 ) ;
HIThemeDrawGrowBox( &cgpoint , &info , cgContext , kHIThemeOrientationNormal ) ;
}
}
- else
-#endif
+ #else
{
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
if ( top )
// DrawThemeStandaloneNoGrowBox
}
}
+#endif
}
void wxWindowMac::RemoveChild( wxWindowBase *child )
int range, bool refresh)
{
bool showScroller;
+ bool triggerSizeEvent = false;
if ( orient == wxHORIZONTAL )
{
{
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 ) ;
}
{
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
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,
if ( m_peer->GetNeedsDisplay() )
{
// because HIViewScrollRect does not scroll the already invalidated area we have two options:
+ // in case there is already a pending redraw on that area
// either immediate redraw or full invalidate
#if 1
// is the better overall solution, as it does not slow down scrolling
// 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
scrollrect.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
m_peer->ScrollRect( &scrollrect , dx , dy ) ;
- // becuase HIViewScrollRect does not scroll the already invalidated area we have two options
- // either immediate redraw or full invalidate
#if 0
- // is the better overall solution, as it does not slow down scrolling
- m_peer->SetNeedsDisplay() ;
-#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
+ HIViewRender(m_peer->GetControlRef()) ;
#endif
- Update() ;
-#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;
{
wxRect rc( x, y, w, h );
if (rect->Intersects( rc ))
- child->SetSize( x + dx, y + dy, w, h );
+ child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
}
else
{
- child->SetSize( x + dx, y + dy, w, h );
+ child->SetSize( x + dx, y + dy, w, h, wxSIZE_AUTO|wxSIZE_ALLOW_MINUS_ONE );
}
}
}
Rect rect ;
m_peer->GetRect( &rect ) ;
- // auf den umgebenden Rahmen zur\9fck
+ // auf den umgebenden Rahmen zur\81Â\9fck
InsetRect( &rect, -1 , -1 ) ;
wxTopLevelWindowMac* top = MacGetTopLevelWindow();
void wxWindowMac::Update()
{
#if TARGET_API_MAC_OSX
- MacGetTopLevelWindow()->MacPerformUpdates() ;
+ wxTopLevelWindowMac* top = MacGetTopLevelWindow();
+ if (top)
+ top->MacPerformUpdates() ;
#else
::Draw1Control( m_peer->GetControlRef() ) ;
#endif
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
}
}
}
iter = iter->GetParent() ;
}
- wxASSERT_MSG( 1 , wxT("No valid mac root window") ) ;
-
return NULL ;
}
{
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 ;
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 ;
+}