#include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
-// bring in themeing
+// bring in theming
#include <Carbon/Carbon.h>
#endif
#define wxMAC_DEBUG_REDRAW 0
#endif
+// Get the window with the focus
+WXWidget wxWidgetImpl::FindFocus()
+{
+ ControlRef control = NULL ;
+ GetKeyboardFocus( GetUserFocusWindow() , &control ) ;
+ return control;
+}
+
// ---------------------------------------------------------------------------
// Carbon Events
// ---------------------------------------------------------------------------
#endif
{
- bool created = false ;
CGContextRef cgContext = NULL ;
OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ;
if ( err != noErr )
iter = iter->GetParent() ;
}
}
- CGContextSetAlpha( cgContext , alpha ) ;
+ CGContextSetAlpha( cgContext, alpha ) ;
if ( thisWindow->GetBackgroundStyle() == wxBG_STYLE_TRANSPARENT )
{
if ( !thisWindow->MacDoRedraw( cEvent.GetTicks() ) )
{
// for native controls: call their native paint method
- if ( !thisWindow->MacIsUserPane() ||
+ if ( !thisWindow->MacIsUserPane() ||
( thisWindow->IsTopLevel() && thisWindow->GetBackgroundStyle() == wxBG_STYLE_SYSTEM ) )
{
if ( thisWindow->GetBackgroundStyle() != wxBG_STYLE_TRANSPARENT )
- CallNextEventHandler( handler ,event ) ;
+ {
+ CallNextEventHandler( handler,event ) ;
+ result = noErr ;
+ }
}
}
+ else
+ {
+ result = noErr ;
+ }
thisWindow->MacPaintChildrenBorders();
}
thisWindow->MacSetCGContextRef( NULL ) ;
}
-
- if ( created )
- CGContextRelease( cgContext ) ;
}
if ( allocatedRgn )
thisWindow->GetCaret()->OnKillFocus();
#endif
- wxLogTrace(_T("Focus"), _T("focus lost(%p)"), static_cast<void*>(thisWindow));
-
+ wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast<void*>(thisWindow));
+
// remove this as soon as posting the synthesized event works properly
static bool inKillFocusEvent = false ;
{
// set focus
// panel wants to track the window which was the last to have focus in it
- wxLogTrace(_T("Focus"), _T("focus set(%p)"), static_cast<void*>(thisWindow));
+ wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast<void*>(thisWindow));
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
thisWindow->HandleWindowEvent(eventFocus);
if ( controlPart != kControlFocusNoPart )
{
targetFocusWindow = thisWindow;
- wxLogTrace(_T("Focus"), _T("focus to be set(%p)"), static_cast<void*>(thisWindow));
+ wxLogTrace(wxT("Focus"), wxT("focus to be set(%p)"), static_cast<void*>(thisWindow));
}
else
{
formerFocusWindow = thisWindow;
- wxLogTrace(_T("Focus"), _T("focus to be lost(%p)"), static_cast<void*>(thisWindow));
+ wxLogTrace(wxT("Focus"), wxT("focus to be lost(%p)"), static_cast<void*>(thisWindow));
}
-
+
ControlPartCode previousControlPart = 0;
verify_noerr( HIViewGetFocusPart(controlRef, &previousControlPart));
iEvent.SetParameter<EventTargetRef>( kEventParamPostTarget, typeEventTargetRef, GetControlEventTarget( controlRef ) );
iEvent.SetParameter<ControlPartCode>( kEventParamControlPreviousPart, typeControlPartCode, previousControlPart );
iEvent.SetParameter<ControlPartCode>( kEventParamControlCurrentPart, typeControlPartCode, currentControlPart );
-
+
#if 1
// TODO test this first, avoid double posts etc...
PostEventToQueue( GetMainEventQueue(), evRef , kEventPriorityHigh );
thisWindow->GetCaret()->OnKillFocus();
#endif
- wxLogTrace(_T("Focus"), _T("focus lost(%p)"), static_cast<void*>(thisWindow));
+ wxLogTrace(wxT("Focus"), wxT("focus lost(%p)"), static_cast<void*>(thisWindow));
static bool inKillFocusEvent = false ;
else
{
// panel wants to track the window which was the last to have focus in it
- wxLogTrace(_T("Focus"), _T("focus set(%p)"), static_cast<void*>(thisWindow));
+ wxLogTrace(wxT("Focus"), wxT("focus set(%p)"), static_cast<void*>(thisWindow));
wxChildFocusEvent eventFocus((wxWindow*)thisWindow);
thisWindow->HandleWindowEvent(eventFocus);
{
wxWindow* wx = wxFindWindowFromWXWidget( (WXWidget) control ) ;
if ( wx )
- {
+ {
wxEventType scrollEvent = wxEVT_NULL;
switch ( partCode )
{
}
wxMAC_DEFINE_PROC_GETTER( ControlActionUPP , wxMacLiveScrollbarActionProc ) ;
-wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer, wxWindowMac* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
- long style, long extraStyle)
+wxWidgetImplType* wxWidgetImpl::CreateUserPane( wxWindowMac* wxpeer,
+ wxWindowMac* WXUNUSED(parent),
+ wxWindowID WXUNUSED(id),
+ const wxPoint& pos,
+ const wxSize& size,
+ long WXUNUSED(style),
+ long WXUNUSED(extraStyle))
{
OSStatus err = noErr;
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
{
verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderAbove, NULL ) );
}
-
+
void wxMacControl::Lower()
{
verify_noerr( HIViewSetZOrder( m_controlRef, kHIViewZOrderBelow, NULL ) );
void wxMacControl::GetContentArea(int &left , int &top , int &width , int &height) const
{
HIShapeRef rgn = NULL;
- Rect content ;
+ Rect content ;
if ( HIViewCopyShape(m_controlRef, kHIViewContentMetaPart, &rgn) == noErr)
{
CGRect cgrect;
HIShapeGetBounds(rgn, &cgrect);
- content = (Rect){ cgrect.origin.y, cgrect.origin.x, cgrect.origin.y+cgrect.size.height, cgrect.origin.x+cgrect.size.width };
+ content = (Rect){ (short)cgrect.origin.y,
+ (short)cgrect.origin.x,
+ (short)(cgrect.origin.y+cgrect.size.height),
+ (short)(cgrect.origin.x+cgrect.size.width) };
CFRelease(rgn);
}
else
height = r.bottom - r.top;
}
-void wxMacControl::SetControlSize( wxWindowVariant variant )
+void wxMacControl::SetControlSize( wxWindowVariant variant )
{
ControlSize size ;
switch ( variant )
break ;
default:
- wxFAIL_MSG(_T("unexpected window variant"));
+ wxFAIL_MSG(wxT("unexpected window variant"));
break ;
}
if ( err == errCouldntSetFocus )
return false ;
SetUserFocusWindow(GetControlOwner( m_controlRef ) );
-
+
return true;
}
flush = kHIThemeTextHorizontalFlushCenter;
else if ( ( windowStyle & wxALIGN_MASK ) & wxALIGN_RIGHT )
flush = kHIThemeTextHorizontalFlushRight;
- HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.GetCTFont() );
+ HIViewSetTextFont( m_controlRef , part , (CTFontRef) font.OSXGetCTFont() );
HIViewSetTextHorizontalFlush( m_controlRef, part, flush );
if ( foreground != *wxBLACK || ignoreBlack == false )
return NULL;
}
+wxBitmap wxMacControl::GetBitmap() const
+{
+ return wxNullBitmap;
+}
+
void wxMacControl::SetBitmap( const wxBitmap& WXUNUSED(bmp) )
{
// implemented in the respective subclasses
}
+void wxMacControl::SetBitmapPosition( wxDirection WXUNUSED(dir) )
+{
+ // implemented in the same subclasses that implement SetBitmap()
+}
+
void wxMacControl::SetScrollThumb( wxInt32 WXUNUSED(pos), wxInt32 WXUNUSED(viewsize) )
{
// implemented in respective subclass
// Control Factory
-wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
+wxWidgetImplType* wxWidgetImpl::CreateContentView( wxNonOwnedWindow* now )
{
// There is a bug in 10.2.X for ::GetRootControl returning the window view instead of
// the content view, so we have to retrieve it explicitly
-
+
wxMacControl* contentview = new wxMacControl(now , true /*isRootControl*/);
HIViewFindByID( HIViewGetRoot( (WindowRef) now->GetWXWindow() ) , kHIViewWindowContentID ,
contentview->GetControlRefAddr() ) ;