#include "wx/osx/uma.h"
#else
#include "wx/osx/private.h"
-// bring in themeing
+// bring in theming
#include <Carbon/Carbon.h>
#endif
OSStatus err = cEvent.GetParameter<CGContextRef>(kEventParamCGContextRef, &cgContext) ;
if ( err != noErr )
{
- wxFAIL_MSG("Unable to retrieve CGContextRef");
+ // for non-composite drawing, since we don't support it ourselves, send it through the
+ // the default handler
+ // CallNextEventHandler( handler,event ) ;
+ // result = noErr ;
+ if ( allocatedRgn )
+ CFRelease( allocatedRgn ) ;
+ break;
}
thisWindow->MacSetCGContextRef( cgContext ) ;
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;
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);
return result ;
}
-pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+WXDLLEXPORT pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
{
OSStatus result = eventNotHandledErr ;
wxWindowMac* focus = (wxWindowMac*) data ;
uniChars = new wchar_t[ numChars ] ;
GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
charBuf[ numChars - 1 ] = 0;
-#if SIZEOF_WCHAR_T == 2
- 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 ;
numChars = converter.MB2WC( uniChars , (const char*)charBuf , numChars ) ;
-#endif
}
switch ( GetEventKind( event ) )
{
OSStatus err = noErr;
Rect bounds = wxMacGetBoundsForControl( wxpeer , pos , size ) ;
- wxMacControl* c = new wxMacControl(wxpeer) ;
+ wxMacControl* c = new wxMacControl(wxpeer, false, true) ;
UInt32 features = 0
| kControlSupportsEmbedding
| kControlSupportsLiveFeedback
Init();
}
-wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl ) :
- wxWidgetImpl( peer, isRootControl )
+wxMacControl::wxMacControl(wxWindowMac* peer , bool isRootControl, bool isUserPane ) :
+ wxWidgetImpl( peer, isRootControl, isUserPane )
{
Init();
}
void wxMacControl::Move(int x, int y, int width, int height)
{
+ UInt32 attr = 0 ;
+ GetWindowAttributes( GetControlOwner(m_controlRef) , &attr ) ;
+
HIRect hir = CGRectMake(x,y,width,height);
+ if ( !(attr & kWindowCompositingAttribute) )
+ {
+ HIRect parent;
+ HIViewGetFrame( HIViewGetSuperview(m_controlRef), &parent );
+ hir.origin.x += parent.origin.x;
+ hir.origin.y += parent.origin.y;
+ }
HIViewSetFrame ( m_controlRef , &hir );
}
GetControlBounds( m_controlRef , &r );
x = r.left;
y = r.top;
+
+ UInt32 attr = 0 ;
+ GetWindowAttributes( GetControlOwner(m_controlRef) , &attr ) ;
+
+ if ( !(attr & kWindowCompositingAttribute) )
+ {
+ HIRect parent;
+ HIViewGetFrame( HIViewGetSuperview(m_controlRef), &parent );
+ x -= (int)parent.origin.x;
+ y -= (int)parent.origin.y;
+ }
+
}
void wxMacControl::GetSize( int &width, int &height ) const
break ;
default:
- wxFAIL_MSG(_T("unexpected window variant"));
+ wxFAIL_MSG(wxT("unexpected window variant"));
break ;
}
// HITextViewSetBackgroundColor( m_textView , color );
}
+bool wxMacControl::SetBackgroundStyle(wxBackgroundStyle style)
+{
+ if ( style != wxBG_STYLE_PAINT )
+ {
+ OSStatus err = HIViewChangeFeatures(m_controlRef , 0 , kHIViewIsOpaque);
+ verify_noerr( err );
+ }
+ else
+ {
+ OSStatus err = HIViewChangeFeatures(m_controlRef , kHIViewIsOpaque , 0);
+ verify_noerr( err );
+ }
+
+ return true ;
+}
+
void wxMacControl::SetRange( SInt32 minimum , SInt32 maximum )
{
::SetControl32BitMinimum( m_controlRef , minimum );
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
}
// the root control level handler
- contentview->InstallEventHandler() ;
+ if ( !now->IsNativeWindowWrapper() )
+ contentview->InstallEventHandler() ;
+
return contentview;
}