// Author: Stefan Csomor
// Modified by:
// Created: 2008-06-20
-// RCS-ID: $Id: window.mm 48805 2007-09-19 14:52:25Z SC $
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
}
#if wxUSE_UNICODE
- wxevent.m_uniChar = aunichar;
+ // OS X generates events with key codes in Unicode private use area for
+ // unprintable symbols such as cursor arrows (WXK_UP is mapped to U+F700)
+ // and function keys (WXK_F2 is U+F705). We don't want to use them as the
+ // result of wxKeyEvent::GetUnicodeKey() however as it's supposed to return
+ // WXK_NONE for "non characters" so explicitly exclude them.
+ //
+ // We only exclude the private use area inside the Basic Multilingual Plane
+ // as key codes beyond it don't seem to be currently used.
+ if ( !(aunichar >= 0xe000 && aunichar < 0xf900) )
+ wxevent.m_uniChar = aunichar;
#endif
wxevent.m_keyCode = keyval;
// [NSWindow setAllowsConcurrentViewDrawing:NO] does not affect it.
if ( !wxThread::IsMain() )
{
- // just call the superclass handler, we don't need any custom wx drawing
- // here and it seems to work fine:
- wxOSX_DrawRectHandlerPtr
- superimpl = (wxOSX_DrawRectHandlerPtr)
- [[self superclass] instanceMethodForSelector:_cmd];
- superimpl(self, _cmd, rect);
+ if ( impl->IsUserPane() )
+ {
+ wxWindow* win = impl->GetWXPeer();
+ if ( win->UseBgCol() )
+ {
+
+ CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
+ CGContextSaveGState( context );
+
+ CGContextSetFillColorWithColor( context, win->GetBackgroundColour().GetCGColor());
+ CGRect r = CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+ CGContextFillRect( context, r );
+
+ CGContextRestoreGState( context );
+ }
+ }
+ else
+ {
+ // just call the superclass handler, we don't need any custom wx drawing
+ // here and it seems to work fine:
+ wxOSX_DrawRectHandlerPtr
+ superimpl = (wxOSX_DrawRectHandlerPtr)
+ [[self superclass] instanceMethodForSelector:_cmd];
+ superimpl(self, _cmd, rect);
+ }
+
return;
}
#endif // wxUSE_THREADS
if ( !DoHandleMouseEvent(event) )
{
// for plain NSView mouse events would propagate to parents otherwise
- if (!m_wxPeer->MacIsUserPane())
+ if (!IsUserPane())
{
wxOSX_EventHandlerPtr superimpl = (wxOSX_EventHandlerPtr) [[slf superclass] instanceMethodForSelector:(SEL)_cmd];
superimpl(slf, (SEL)_cmd, event);
bool wxWidgetCocoaImpl::acceptsFirstResponder(WXWidget slf, void *_cmd)
{
- if ( m_wxPeer->MacIsUserPane() )
+ if ( IsUserPane() )
return m_wxPeer->AcceptsFocus();
else
{
#else
#define wxOSX_CLASS_ADD_METHOD( c, s, i, t ) \
- { s, t, i },
+ { s, (char*) t, i },
#endif
IMPLEMENT_DYNAMIC_CLASS( wxWidgetCocoaImpl , wxWidgetImpl )
-wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl ) :
- wxWidgetImpl( peer, isRootControl )
+wxWidgetCocoaImpl::wxWidgetCocoaImpl( wxWindowMac* peer , WXWidget w, bool isRootControl, bool isUserPane ) :
+ wxWidgetImpl( peer, isRootControl, isUserPane )
{
Init();
m_osxView = w;
- (id)init:(wxWindow *)win
{
- [super init];
+ self = [super init];
m_win = win;
m_isDone = false;
// this will fire higher level events, like insertText, to help
// us handle EVT_CHAR, etc.
- if ( m_wxPeer->MacIsUserPane() && [event type] == NSKeyDown)
+ if ( !result )
{
- if ( !result )
+ if ( IsUserPane() && [event type] == NSKeyDown)
{
if ( wxevent.GetKeyCode() < WXK_SPACE || wxevent.GetKeyCode() == WXK_DELETE || wxevent.GetKeyCode() >= WXK_START )
{
[v registerForDraggedTypes:[NSArray arrayWithObjects:
NSStringPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPICTPboardType, NSPDFPboardType, nil]];
- wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v );
+ wxWidgetCocoaImpl* c = new wxWidgetCocoaImpl( wxpeer, v, false, true );
return c;
}