if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDocumentWindowBackground)) )
{
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDocumentWindowBackground, false ) ;
- SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+ m_wxPeer->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+ // call directly if object is not yet completely constructed
+ if ( m_wxPeer->GetNonOwnedPeer() == NULL )
+ SetBackgroundStyle(wxBG_STYLE_SYSTEM);
}
else if ( col == wxColour(wxMacCreateCGColorFromHITheme(kThemeBrushDialogBackgroundActive)) )
{
SetThemeWindowBackground( (WindowRef) m_macWindow, kThemeBrushDialogBackgroundActive, false ) ;
- SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+ m_wxPeer->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
+ // call directly if object is not yet completely constructed
+ if ( m_wxPeer->GetNonOwnedPeer() == NULL )
+ SetBackgroundStyle(wxBG_STYLE_SYSTEM);
}
return true;
}
}
bool wxNonOwnedWindowCarbonImpl::SetBackgroundStyle(wxBackgroundStyle style)
-{
+{
if ( style == wxBG_STYLE_TRANSPARENT )
{
OSStatus err = HIWindowChangeFeatures( m_macWindow, 0, kWindowIsOpaque );
// for wx.
// TODO: Determine if we need this on Leopard as well. (should be harmless either way,
// though)
- // since when creating the peering is not yet completely set-up we call both setters
+ // since when creating the peering is not yet completely set-up we call both setters
// explicitely
m_wxPeer->SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ;
SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ) ;
// instead of its children (wxToolBarTools)
ControlRef parent ;
GetSuperControl(control, &parent );
- wxWindow *wxParent = (wxWindow*) wxFindWindowFromWXWidget((WXWidget) parent ) ;
- if ( wxParent && wxParent->IsKindOf( CLASSINFO( wxToolBar ) ) )
- currentMouseWindow = wxParent ;
+ wxWindow *wxparent = (wxWindow*) wxFindWindowFromWXWidget((WXWidget) parent ) ;
+ if ( wxparent && wxparent->IsKindOf( CLASSINFO( wxToolBar ) ) )
+ currentMouseWindow = wxparent ;
#endif
}
#endif
::HiliteMenu(0);
result = noErr ;
}
- }
+ }
else if ( window && windowPart == inProxyIcon )
{
// special case proxy icon bar, as we are having a low-level runloop we must do it ourselves
}
else // currentMouseWindow == NULL
{
+ if (toplevelWindow && !control)
+ {
+ extern wxCursor gGlobalCursor;
+ if (!gGlobalCursor.IsOk())
+ {
+ // update cursor when over toolbar and titlebar etc.
+ wxSTANDARD_CURSOR->MacInstall() ;
+ }
+ }
+
// don't mess with controls we don't know about
// for some reason returning eventNotHandledErr does not lead to the correct behaviour
// so we try sending them the correct control directly
if ( (attributes & kWindowBoundsChangeSizeChanged) || (attributes & kWindowBoundsChangeOriginChanged) )
{
// all (Mac) rects are in content area coordinates, all wxRects in structure coordinates
- int left , top , right , bottom ;
-
- toplevelWindow->GetNonOwnedPeer()->GetContentArea(left, top, right, bottom);
-
+ int left , top , width , height ;
+ // structure width
+ int swidth, sheight;
+
+ toplevelWindow->GetNonOwnedPeer()->GetContentArea(left, top, width, height);
+ toplevelWindow->GetNonOwnedPeer()->GetSize(swidth, sheight);
+ int deltawidth = swidth - width;
+ int deltaheight = sheight - height;
wxRect adjustR(
newRect.left - left,
newRect.top - top,
- newRect.right - newRect.left + left + right,
- newRect.bottom - newRect.top + top + bottom ) ;
+ newRect.right - newRect.left + deltawidth,
+ newRect.bottom - newRect.top + deltaheight ) ;
toplevelWindow->HandleResizing( cEvent.GetTicks(), &adjustR );
-
- const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + adjustR.height - bottom , adjustR.x + adjustR.width - right } ;
+
+ const Rect adjustedRect = { adjustR.y + top , adjustR.x + left , adjustR.y + top + adjustR.height - deltaheight ,
+ adjustR.x + left + adjustR.width - deltawidth } ;
if ( !EqualRect( &newRect , &adjustedRect ) )
cEvent.SetParameter<Rect>( kEventParamCurrentBounds , &adjustedRect ) ;
}
}
void wxNonOwnedWindowCarbonImpl::Destroy()
-{
+{
if ( m_macEventHandler )
{
::RemoveEventHandler((EventHandlerRef) m_macEventHandler);
wxWindow* parent,
const wxPoint& pos,
const wxSize& size,
- long style, long extraStyle,
- const wxString& name )
+ long style, long extraStyle,
+ const wxString& WXUNUSED(name) )
{
OSStatus err = noErr ;
transition = kWindowZoomTransitionEffect;
break;
+ case wxSHOW_EFFECT_NONE:
+ // wxNonOwnedWindow is supposed to call Show() itself in this case
+ wxFAIL_MSG( "ShowWithEffect() shouldn't be called" );
+ return false;
+
case wxSHOW_EFFECT_MAX:
wxFAIL_MSG( "invalid effect flag" );
return false;
return true;
}
-void wxNonOwnedWindowCarbonImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
+void wxNonOwnedWindowCarbonImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
{
SetWindowTitleWithCFString( m_macWindow , wxCFStringRef( title , encoding ) ) ;
}
-
+
bool wxNonOwnedWindowCarbonImpl::IsMaximized() const
{
return IsWindowInStandardState( m_macWindow , NULL , NULL ) ;
}
-
+
bool wxNonOwnedWindowCarbonImpl::IsIconized() const
{
return IsWindowCollapsed((WindowRef)GetWXWindow() ) ;
}
-
+
void wxNonOwnedWindowCarbonImpl::Iconize( bool iconize )
{
if ( IsWindowCollapsable( m_macWindow ) )
CollapseWindow( m_macWindow , iconize ) ;
}
-
+
void wxNonOwnedWindowCarbonImpl::Maximize(bool maximize)
{
Point idealSize = { 0 , 0 } ;
}
ZoomWindowIdeal( (WindowRef)GetWXWindow() , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
}
-
+
bool wxNonOwnedWindowCarbonImpl::IsFullScreen() const
{
return m_macFullScreenData != NULL ;
}
-
+
bool wxNonOwnedWindowCarbonImpl::ShowFullScreen(bool show, long style)
{
if ( show )
wxRect client = wxGetClientDisplayRect() ;
- int left , top , right , bottom ;
+ int left, top, width, height ;
int x, y, w, h ;
x = client.x ;
w = client.width ;
h = client.height ;
- GetContentArea( left , top , right , bottom ) ;
+ GetContentArea( left, top, width, height ) ;
+ int outerwidth, outerheight;
+ GetSize( outerwidth, outerheight );
if ( style & wxFULLSCREEN_NOCAPTION )
{
y -= top ;
h += top ;
+ // avoid adding the caption twice to the height
+ outerheight -= top;
}
if ( style & wxFULLSCREEN_NOBORDER )
{
x -= left ;
- w += left + right ;
- h += bottom ;
+ w += outerwidth - width;
+ h += outerheight - height;
}
if ( style & wxFULLSCREEN_NOTOOLBAR )
HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
HIPointConvert( &p, kHICoordSpace72DPIGlobal, NULL, kHICoordSpaceView, contentView );
if ( x )
- *x = p.x;
+ *x = (int)p.x;
if ( y )
- *y = p.y;
+ *y = (int)p.y;
}
void wxNonOwnedWindowCarbonImpl::WindowToScreen( int *x, int *y )
HIViewFindByID( HIViewGetRoot( m_macWindow ), kHIViewWindowContentID , &contentView) ;
HIPointConvert( &p, kHICoordSpaceView, contentView, kHICoordSpace72DPIGlobal, NULL );
if ( x )
- *x = p.x;
+ *x = (int)p.x;
if ( y )
- *y = p.y;
+ *y = (int)p.y;
}
wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,