}
// ---------------------------------------------------------------------------
// Carbon Events
// ---------------------------------------------------------------------------
}
// ---------------------------------------------------------------------------
// 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
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
{ kEventClassControl , kEventControlEnabledStateChanged } ,
{ kEventClassControl , kEventControlHiliteChanged } ,
{ kEventClassControl , kEventControlSetFocusPart } ,
{ kEventClassControl , kEventControlEnabledStateChanged } ,
{ kEventClassControl , kEventControlHiliteChanged } ,
{ kEventClassControl , kEventControlSetFocusPart } ,
-
- { kEventClassService , kEventServiceGetTypes },
- { kEventClassService , kEventServiceCopy },
- { kEventClassService , kEventServicePaste },
-
- // { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only
+
+ { kEventClassService , kEventServiceGetTypes },
+ { kEventClassService , kEventServiceCopy },
+ { kEventClassService , kEventServicePaste },
+
+ // { kEventClassControl , kEventControlInvalidateForSizeChange } , // 10.3 only
RgnHandle updateRgn = NULL ;
RgnHandle allocatedRgn = NULL ;
wxRegion visRegion = thisWindow->MacGetVisibleRegion() ;
RgnHandle updateRgn = NULL ;
RgnHandle allocatedRgn = NULL ;
wxRegion visRegion = thisWindow->MacGetVisibleRegion() ;
// in case we would need a coregraphics compliant background erase first
// now usable to track redraws
CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
// in case we would need a coregraphics compliant background erase first
// now usable to track redraws
CGContextRef cgContext = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef) ;
- HIRect bounds;
- HIViewGetBounds( controlRef, &bounds );
- CGContextSetRGBFillColor( cgContext, channel == 0 ? color : 0.5 ,
- channel == 1 ? color : 0.5 , channel == 2 ? color : 0.5 , 1 );
- CGContextFillRect( cgContext, bounds );
- color += 0.1 ;
- if ( color > 0.9 )
- {
- color = 0.5 ;
- channel++ ;
- if ( channel == 3 )
- channel = 0 ;
- }
+ HIRect bounds;
+ HIViewGetBounds( controlRef, &bounds );
+ CGContextSetRGBFillColor( cgContext, channel == 0 ? color : 0.5 ,
+ channel == 1 ? color : 0.5 , channel == 2 ? color : 0.5 , 1 );
+ CGContextFillRect( cgContext, bounds );
+ color += 0.1 ;
+ if ( color > 0.9 )
+ {
+ color = 0.5 ;
+ channel++ ;
+ if ( channel == 3 )
+ channel = 0 ;
+ }
// panel wants to track the window which was the last to have focus in it
wxChildFocusEvent eventFocus(thisWindow);
thisWindow->GetEventHandler()->ProcessEvent(eventFocus);
// panel wants to track the window which was the last to have focus in it
wxChildFocusEvent eventFocus(thisWindow);
thisWindow->GetEventHandler()->ProcessEvent(eventFocus);
ControlRef controlRef ;
wxWindowMac* thisWindow = (wxWindowMac*) data ;
wxTextCtrl* textCtrl = wxDynamicCast( thisWindow , wxTextCtrl ) ;
ControlRef controlRef ;
wxWindowMac* thisWindow = (wxWindowMac*) data ;
wxTextCtrl* textCtrl = wxDynamicCast( thisWindow , wxTextCtrl ) ;
if( from != to )
copyTypes = cEvent.GetParameter< CFMutableArrayRef >( kEventParamServiceCopyTypes , typeCFMutableArrayRef ) ;
if ( textCtrl->IsEditable() )
pasteTypes = cEvent.GetParameter< CFMutableArrayRef >( kEventParamServicePasteTypes , typeCFMutableArrayRef ) ;
if( from != to )
copyTypes = cEvent.GetParameter< CFMutableArrayRef >( kEventParamServiceCopyTypes , typeCFMutableArrayRef ) ;
if ( textCtrl->IsEditable() )
pasteTypes = cEvent.GetParameter< CFMutableArrayRef >( kEventParamServicePasteTypes , typeCFMutableArrayRef ) ;
-
- static const OSType textDataTypes[] = { kTXNTextData /* , 'utxt' , 'PICT', 'MooV', 'AIFF' */ };
+
+ static const OSType textDataTypes[] = { kTXNTextData /* , 'utxt' , 'PICT', 'MooV', 'AIFF' */ };
for ( size_t i = 0 ; i < WXSIZEOF(textDataTypes) ; ++i )
{
CFStringRef typestring = CreateTypeStringWithOSType(textDataTypes[i]);
for ( size_t i = 0 ; i < WXSIZEOF(textDataTypes) ; ++i )
{
CFStringRef typestring = CreateTypeStringWithOSType(textDataTypes[i]);
verify_noerr( GetScrapFlavorSize (scrapRef, kTXNTextData, &textSize) ) ;
textSize++ ;
char *content = new char[textSize] ;
verify_noerr( GetScrapFlavorSize (scrapRef, kTXNTextData, &textSize) ) ;
textSize++ ;
char *content = new char[textSize] ;
- GetScrapFlavorData (scrapRef, kTXNTextData, &pastedSize, content );
+ GetScrapFlavorData (scrapRef, kTXNTextData, &pastedSize, content );
content[textSize-1] = 0 ;
#if wxUSE_UNICODE
textCtrl->WriteText( wxString( content , wxConvLocal ) );
content[textSize-1] = 0 ;
#if wxUSE_UNICODE
textCtrl->WriteText( wxString( content , wxConvLocal ) );
pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
pascal OSStatus wxMacWindowEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
// ---------------------------------------------------------------------------
// UserPane events for non OSX builds
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
// UserPane events for non OSX builds
// ---------------------------------------------------------------------------
static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
{
wxWindow * win = wxFindControlFromMacControl(control) ;
static pascal void wxMacControlUserPaneDrawProc(ControlRef control, SInt16 part)
{
wxWindow * win = wxFindControlFromMacControl(control) ;
-wxInt16 wxWindowMac::MacControlUserPaneKeyDownProc(wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
+wxInt16 wxWindowMac::MacControlUserPaneKeyDownProc(wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
// we have to setup the brush in the current port and return noErr
ControlColorUPP wxMacSetupControlBackgroundUPP = NULL ;
// we have to setup the brush in the current port and return noErr
// hierarchy to find a correct background
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
// hierarchy to find a correct background
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
// ----------------------------------------------------------------------------
wxWindowMac::wxWindowMac()
// ----------------------------------------------------------------------------
wxWindowMac::wxWindowMac()
if ( gControlUserPaneDrawUPP == NULL )
{
gControlUserPaneDrawUPP = NewControlUserPaneDrawUPP( wxMacControlUserPaneDrawProc ) ;
if ( gControlUserPaneDrawUPP == NULL )
{
gControlUserPaneDrawUPP = NewControlUserPaneDrawUPP( wxMacControlUserPaneDrawProc ) ;
if ( IsShown() && ( outerBorder > 0 ) )
{
// as the borders are drawn on the parent we have to properly invalidate all these areas
RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
if ( IsShown() && ( outerBorder > 0 ) )
{
// as the borders are drawn on the parent we have to properly invalidate all these areas
RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
DisposeRgn(updateOuter) ;
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
DisposeRgn(updateOuter) ;
// wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
// wxRemoveMacControlAssociation( this ) ;
// If we delete an item, we should initialize the parent panel,
// because it could now be invalid.
{
wxAssociateControlWithMacControl( (ControlRef) control , this ) ;
InstallControlEventHandler( (ControlRef) control , GetwxMacWindowEventHandlerUPP(),
{
wxAssociateControlWithMacControl( (ControlRef) control , this ) ;
InstallControlEventHandler( (ControlRef) control , GetwxMacWindowEventHandlerUPP(),
- GetEventTypeCount(eventList), eventList, this,
+ GetEventTypeCount(eventList), eventList, this,
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE;
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE;
- | kControlSupportsEmbedding
-// | kControlSupportsLiveFeedback
-// | kControlHasSpecialBackground
-// | kControlSupportsCalcBestRect
-// | kControlHandlesTracking
- | kControlSupportsFocus
-// | kControlWantsActivate
-// | kControlWantsIdle
- ;
+ | kControlSupportsEmbedding
+// | kControlSupportsLiveFeedback
+// | kControlHasSpecialBackground
+// | kControlSupportsCalcBestRect
+// | kControlHandlesTracking
+ | kControlSupportsFocus
+// | kControlWantsActivate
+// | kControlWantsIdle
+ ;
m_peer = new wxMacControl() ;
::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, features , m_peer->GetControlRefAddr() );
m_peer = new wxMacControl() ;
::CreateUserPaneControl( MAC_WXHWND(GetParent()->MacGetTopLevelWindowRef()) , &bounds, features , m_peer->GetControlRefAddr() );
m_peer->SetData<ControlUserPaneActivateUPP>(kControlEntireControl,kControlUserPaneActivateProcTag,&gControlUserPaneActivateUPP) ;
m_peer->SetData<ControlUserPaneFocusUPP>(kControlEntireControl,kControlUserPaneFocusProcTag,&gControlUserPaneFocusUPP) ;
m_peer->SetData<ControlUserPaneBackgroundUPP>(kControlEntireControl,kControlUserPaneBackgroundProcTag,&gControlUserPaneBackgroundUPP) ;
m_peer->SetData<ControlUserPaneActivateUPP>(kControlEntireControl,kControlUserPaneActivateProcTag,&gControlUserPaneActivateUPP) ;
m_peer->SetData<ControlUserPaneFocusUPP>(kControlEntireControl,kControlUserPaneFocusProcTag,&gControlUserPaneFocusUPP) ;
m_peer->SetData<ControlUserPaneBackgroundUPP>(kControlEntireControl,kControlUserPaneBackgroundProcTag,&gControlUserPaneBackgroundUPP) ;
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
m_peer->SetReference( (long) this ) ;
wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ;
m_peer->SetReference( (long) this ) ;
wxMacCarbonEvent cEvent( evRef ) ;
cEvent.SetParameter<ControlRef>( kEventParamDirectObject , (ControlRef) former->GetHandle() ) ;
cEvent.SetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode , kControlFocusNoPart ) ;
wxMacCarbonEvent cEvent( evRef ) ;
cEvent.SetParameter<ControlRef>( kEventParamDirectObject , (ControlRef) former->GetHandle() ) ;
cEvent.SetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode , kControlFocusNoPart ) ;
wxMacCarbonEvent cEvent( evRef ) ;
cEvent.SetParameter<ControlRef>( kEventParamDirectObject , (ControlRef) GetHandle() ) ;
cEvent.SetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode , kControlFocusNextPart ) ;
wxMacCarbonEvent cEvent( evRef ) ;
cEvent.SetParameter<ControlRef>( kEventParamDirectObject , (ControlRef) GetHandle() ) ;
cEvent.SetParameter<ControlPartCode>(kEventParamControlPart , typeControlPartCode , kControlFocusNextPart ) ;
// this is the content area root control
void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
// this is the content area root control
void wxWindowMac::MacGetPositionAndSizeFromControl(int& x, int& y,
y += MacGetTopBorderSize() ;
w -= MacGetLeftBorderSize() + MacGetRightBorderSize() ;
h -= MacGetTopBorderSize() + MacGetBottomBorderSize() ;
y += MacGetTopBorderSize() ;
w -= MacGetLeftBorderSize() + MacGetRightBorderSize() ;
h -= MacGetTopBorderSize() + MacGetBottomBorderSize() ;
w1 += MacGetLeftBorderSize() + MacGetRightBorderSize() ;
h1 += MacGetTopBorderSize() + MacGetBottomBorderSize() ;
w1 += MacGetLeftBorderSize() + MacGetRightBorderSize() ;
h1 += MacGetTopBorderSize() + MacGetBottomBorderSize() ;
void wxWindowMac::DoScreenToClient(int *x, int *y) const
{
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
void wxWindowMac::DoScreenToClient(int *x, int *y) const
{
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
{
Point localwhere = {0,0} ;
if(x) localwhere.h = * x ;
if(y) localwhere.v = * y ;
{
Point localwhere = {0,0} ;
if(x) localwhere.h = * x ;
if(y) localwhere.v = * y ;
QDGlobalToLocalPoint( GetWindowPort( window ) , &localwhere ) ;
if(x) *x = localwhere.h ;
if(y) *y = localwhere.v ;
}
MacRootWindowToWindow( x , y ) ;
QDGlobalToLocalPoint( GetWindowPort( window ) , &localwhere ) ;
if(x) *x = localwhere.h ;
if(y) *y = localwhere.v ;
}
MacRootWindowToWindow( x , y ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
left = content.left - structure.left ;
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
left = content.left - structure.left ;
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
{
GetRegionBounds( rgn , &content ) ;
if ( m_peer->GetRegion( kControlContentMetaPart , rgn ) == noErr )
{
GetRegionBounds( rgn , &content ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
sizeTotal.x += (structure.right - structure.left) - (content.right - content.left) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
#endif
sizeTotal.x += (structure.right - structure.left) - (content.right - content.left) ;
sizeTotal.x += MacGetLeftBorderSize( ) + MacGetRightBorderSize( ) ;
sizeTotal.y += MacGetTopBorderSize( ) + MacGetBottomBorderSize( ) ;
sizeTotal.x += MacGetLeftBorderSize( ) + MacGetRightBorderSize( ) ;
sizeTotal.y += MacGetTopBorderSize( ) + MacGetBottomBorderSize( ) ;
Rect structure ;
m_peer->GetRect( &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
Rect structure ;
m_peer->GetRect( &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
MacClientToRootWindow( &x1 , &y1 ) ;
MacClientToRootWindow( &w , &h ) ;
MacClientToRootWindow( &x1 , &y1 ) ;
MacClientToRootWindow( &w , &h ) ;
wxASSERT_MSG( m_cursor.Ok(),
wxT("cursor must be valid after call to the base version"));
wxASSERT_MSG( m_cursor.Ok(),
wxT("cursor must be valid after call to the base version"));
wxWindowMac *mouseWin = 0 ;
{
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
CGrafPtr savePort ;
Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ;
wxWindowMac *mouseWin = 0 ;
{
WindowRef window = (WindowRef) MacGetTopLevelWindowRef() ;
CGrafPtr savePort ;
Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ;
control = wxMacFindControlUnderMouse( pt , window , &part ) ;
if ( control )
mouseWin = wxFindControlFromMacControl( control ) ;
control = wxMacFindControlUnderMouse( pt , window , &part ) ;
if ( control )
mouseWin = wxFindControlFromMacControl( control ) ;
// we don't adjust twice for the origin
Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
bool vis = m_peer->IsVisible();
// we don't adjust twice for the origin
Rect r = wxMacGetBoundsForControl(this , wxPoint( actualX,actualY), wxSize( actualWidth, actualHeight ) , false ) ;
bool vis = m_peer->IsVisible();
if ( vis && ( outerBorder > 0 ) )
{
// as the borders are drawn on the parent we have to properly invalidate all these areas
RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
if ( vis && ( outerBorder > 0 ) )
{
// as the borders are drawn on the parent we have to properly invalidate all these areas
RgnHandle updateInner = NewRgn() , updateOuter = NewRgn() , updateTotal = NewRgn() ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
rect = r ;
RectRgn( updateInner , &rect ) ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
rect = r ;
RectRgn( updateInner , &rect ) ;
InsetRect( &rect , -outerBorder , -outerBorder ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
DisposeRgn(updateOuter) ;
GetParent()->m_peer->SetNeedsDisplay( true , updateTotal ) ;
DisposeRgn(updateOuter) ;
Rect bestsize = { 0 , 0 , 0 , 0 } ;
int bestWidth, bestHeight ;
m_peer->GetBestRect( &bestsize ) ;
Rect bestsize = { 0 , 0 , 0 , 0 } ;
int bestWidth, bestHeight ;
m_peer->GetBestRect( &bestsize ) ;
m_peer->GetRect( &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
}
m_peer->GetRect( &structure ) ;
OffsetRect( &content , -structure.left , -structure.top ) ;
}
- bool former = MacIsReallyShown() ;
-
- m_peer->SetVisibility( show , true ) ;
- if ( former != MacIsReallyShown() )
- MacPropagateVisibilityChanged() ;
+ if ( m_peer )
+ {
+ bool former = MacIsReallyShown() ;
+
+ m_peer->SetVisibility( show , true ) ;
+ if ( former != MacIsReallyShown() )
+ MacPropagateVisibilityChanged() ;
+ }
else
{
RgnHandle update = NewRgn() ;
SetRectRgn( update , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ;
wxPoint origin = GetClientAreaOrigin() ;
else
{
RgnHandle update = NewRgn() ;
SetRectRgn( update , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
SectRgn( (RgnHandle) MacGetVisibleRegion().GetWXHRGN() , update , update ) ;
wxPoint origin = GetClientAreaOrigin() ;
// right now this is wx' window coordinates, as our native peer does not have borders, this is
// inset
OffsetRgn( update , -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
// right now this is wx' window coordinates, as our native peer does not have borders, this is
// inset
OffsetRgn( update , -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ;
else
{
SetRectRgn( updateRgn , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
else
{
SetRectRgn( updateRgn , rect->x , rect->y , rect->x + rect->width , rect->y + rect->height ) ;
- m_peer->SetDrawingEnabled( true ) ;
- m_peer->InvalidateWithChildren() ;
+ if ( m_peer && m_peer->Ok() )
+ {
+ m_peer->SetDrawingEnabled( true ) ;
+ m_peer->InvalidateWithChildren() ;
+ }
SInt32 border = 0 ;
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
InsetRect( &srect , border , border );
SInt32 border = 0 ;
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
InsetRect( &srect , border , border );
GetClientSize( &width , &height ) ;
#if TARGET_API_MAC_OSX
// note there currently is a bug in OSX which makes inefficient refreshes in case an entire control
GetClientSize( &width , &height ) ;
#if TARGET_API_MAC_OSX
// note there currently is a bug in OSX which makes inefficient refreshes in case an entire control
// TODO write optimal workaround
wxRect scrollrect( MacGetLeftBorderSize() , MacGetTopBorderSize() , width , height ) ;
// TODO write optimal workaround
wxRect scrollrect( MacGetLeftBorderSize() , MacGetTopBorderSize() , width , height ) ;
// is the better overall solution, as it does not slow down scrolling
m_peer->SetNeedsDisplay( true ) ;
#else
// is the better overall solution, as it does not slow down scrolling
m_peer->SetNeedsDisplay( true ) ;
#else
m_peer->GetRect( &scrollrect ) ;
scrollrect.top += MacGetTopBorderSize() ;
scrollrect.left += MacGetLeftBorderSize() ;
scrollrect.bottom = scrollrect.top + height ;
scrollrect.right = scrollrect.left + width ;
m_peer->GetRect( &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) ,
if ( rect )
{
Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) ,
- child->SetSize( x+dx, y+dy, w, h );
- }
+ child->SetSize( x+dx, y+dy, w, h );
+ }
// as this erases part of the frame we have to redraw borders
// and because our z-ordering is not always correct (staticboxes)
// we have to invalidate things, we cannot simple redraw
// as this erases part of the frame we have to redraw borders
// and because our z-ordering is not always correct (staticboxes)
// we have to invalidate things, we cannot simple redraw
InsetRect( &rect , -4 , -4 ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
InsetRect( &rect , -4 , -4 ) ;
RectRgn( updateOuter , &rect ) ;
DiffRgn( updateOuter , updateInner ,updateOuter ) ;
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
GetParent()->MacWindowToRootWindow( &parent.x , &parent.y ) ;
parent -= GetParent()->GetClientAreaOrigin() ;
OffsetRgn( updateOuter , -parent.x , -parent.y ) ;
// for composited windows this also triggers a redraw of all
// invalid views in the window
if( UMAGetSystemVersion() >= 0x1030 )
// for composited windows this also triggers a redraw of all
// invalid views in the window
if( UMAGetSystemVersion() >= 0x1030 )
{
currentEventClass = ::GetEventClass( currentEvent ) ;
currentEventKind = ::GetEventKind( currentEvent ) ;
{
currentEventClass = ::GetEventClass( currentEvent ) ;
currentEventKind = ::GetEventKind( currentEvent ) ;
if ( currentEventClass != kEventClassMenu )
{
// when tracking a menu, strange redraw errors occur if we flush now, so leave..
if ( currentEventClass != kEventClassMenu )
{
// when tracking a menu, strange redraw errors occur if we flush now, so leave..
// also a window dc uses this, in this case we only clip in the hierarchy for hard
// borders like a scrollwindow, splitter etc otherwise we end up in a paranoia having
// to add focus borders everywhere
// also a window dc uses this, in this case we only clip in the hierarchy for hard
// borders like a scrollwindow, splitter etc otherwise we end up in a paranoia having
// to add focus borders everywhere
r.top -= MacGetTopBorderSize() ;
r.bottom += MacGetBottomBorderSize() ;
r.right += MacGetRightBorderSize() ;
r.top -= MacGetTopBorderSize() ;
r.bottom += MacGetBottomBorderSize() ;
r.right += MacGetRightBorderSize() ;
if (! MacGetTopLevelWindow()->MacUsesCompositing() )
{
MacRootWindowToWindow( &r.left , & r.top ) ;
if (! MacGetTopLevelWindow()->MacUsesCompositing() )
{
MacRootWindowToWindow( &r.left , & r.top ) ;
MacRootWindowToWindow( &x , &y ) ;
if ( !includeOuterStructures || (
MacRootWindowToWindow( &x , &y ) ;
if ( !includeOuterStructures || (
- parent->IsKindOf( CLASSINFO( wxScrolledWindow ) ) ||
- parent->IsKindOf( CLASSINFO( wxSashLayoutWindow ) ) ||
- ( parent->GetParent() && parent->GetParent()->IsKindOf( CLASSINFO( wxSplitterWindow ) ) )
+ parent->MacClipChildren() ||
+ ( parent->GetParent() && parent->GetParent()->MacClipGrandChildren() )
wxPoint origin = GetClientAreaOrigin() ;
SetRectRgn( newupdate , origin.x , origin.y , origin.x + point.x , origin.y+point.y ) ;
SectRgn( newupdate , updatergn , newupdate ) ;
wxPoint origin = GetClientAreaOrigin() ;
SetRectRgn( newupdate , origin.x , origin.y , origin.x + point.x , origin.y+point.y ) ;
SectRgn( newupdate , updatergn , newupdate ) ;
// calculate a client-origin version of the update rgn and set m_updateRegion to that
OffsetRgn( newupdate , -origin.x , -origin.y ) ;
m_updateRegion = newupdate ;
// calculate a client-origin version of the update rgn and set m_updateRegion to that
OffsetRgn( newupdate , -origin.x , -origin.y ) ;
m_updateRegion = newupdate ;
// now we cannot rely on having its borders drawn by a window itself, as it does not
// get the updateRgn wide enough to always do so, so we do it from the parent
// this would also be the place to draw any custom backgrounds for native controls
// in Composited windowing
wxPoint clientOrigin = GetClientAreaOrigin() ;
// now we cannot rely on having its borders drawn by a window itself, as it does not
// get the updateRgn wide enough to always do so, so we do it from the parent
// this would also be the place to draw any custom backgrounds for native controls
// in Composited windowing
wxPoint clientOrigin = GetClientAreaOrigin() ;
for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
wxWindowMac *child = node->GetData();
for (wxWindowListNode *node = GetChildren().GetFirst(); node; node = node->GetNext())
{
wxWindowMac *child = node->GetData();
CopyRgn( updatergn , ownUpdateRgn ) ;
if ( MacGetTopLevelWindow()->MacUsesCompositing() == false )
CopyRgn( updatergn , ownUpdateRgn ) ;
if ( MacGetTopLevelWindow()->MacUsesCompositing() == false )
Rect bounds;
m_peer->GetRectInWindowCoords( &bounds );
RgnHandle controlRgn = NewRgn();
RectRgn( controlRgn, &bounds );
//KO: This sets the ownUpdateRgn to the area of this control that is inside
// the window update region
Rect bounds;
m_peer->GetRectInWindowCoords( &bounds );
RgnHandle controlRgn = NewRgn();
RectRgn( controlRgn, &bounds );
//KO: This sets the ownUpdateRgn to the area of this control that is inside
// the window update region
MacDoRedraw( ownUpdateRgn , time ) ;
DisposeRgn( ownUpdateRgn ) ;
MacDoRedraw( ownUpdateRgn , time ) ;
DisposeRgn( ownUpdateRgn ) ;
- wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL ;
- if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL || GetWindowVariant() == wxWINDOW_VARIANT_MINI )
- {
- scrlsize = MAC_SMALL_SCROLLBAR_SIZE ;
- variant = wxWINDOW_VARIANT_SMALL ;
- }
+ wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL ;
+ if ( GetWindowVariant() == wxWINDOW_VARIANT_SMALL || GetWindowVariant() == wxWINDOW_VARIANT_MINI )
+ {
+ scrlsize = MAC_SMALL_SCROLLBAR_SIZE ;
+ variant = wxWINDOW_VARIANT_SMALL ;
+ }
bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ;
int scrlsize = m_hScrollBar ? m_hScrollBar->GetSize().y : ( m_vScrollBar ? m_vScrollBar->GetSize().x : MAC_SCROLLBAR_SIZE ) ;
int adjust = hasBoth ? scrlsize - 1 : 0 ;
bool hasBoth = ( m_hScrollBar && m_hScrollBar->IsShown()) && ( m_vScrollBar && m_vScrollBar->IsShown()) ;
int scrlsize = m_hScrollBar ? m_hScrollBar->GetSize().y : ( m_vScrollBar ? m_vScrollBar->GetSize().x : MAC_SCROLLBAR_SIZE ) ;
int adjust = hasBoth ? scrlsize - 1 : 0 ;
-void wxWindowMac::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
+void wxWindowMac::MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool WXUNUSED( mouseStillDown ) )
-Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin )
+Rect wxMacGetBoundsForControl( wxWindow* window , const wxPoint& pos , const wxSize &size , bool adjustForOrigin )
window->MacGetBoundsForControl( pos , size , x , y, w, h , adjustForOrigin) ;
Rect bounds = { y , x , y+h , x+w };
return bounds ;
}
window->MacGetBoundsForControl( pos , size , x , y, w, h , adjustForOrigin) ;
Rect bounds = { y , x , y+h , x+w };
return bounds ;
}