#pragma hdrstop
#endif
+#include "wx/toplevel.h"
+
#ifndef WX_PRECOMP
#include "wx/app.h"
- #include "wx/toplevel.h"
#include "wx/frame.h"
#include "wx/string.h"
#include "wx/log.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
-#include "wx/app.h"
#include "wx/tooltip.h"
#include "wx/dnd.h"
{ kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
{ kEventClassTextInput, kEventTextInputUpdateActiveInputArea } ,
-
+
{ kEventClassWindow , kEventWindowShown } ,
{ kEventClassWindow , kEventWindowActivated } ,
{ kEventClassWindow , kEventWindowDeactivated } ,
focus = (wxTopLevelWindowMac*) data ;
unsigned char charCode ;
- wxChar uniChar = 0 ;
+ wxChar uniChar[2] ;
+ uniChar[0] = 0;
+ uniChar[1] = 0;
+
UInt32 keyCode ;
UInt32 modifiers ;
Point point ;
if ( GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr )
{
UniChar buf[2] ;
+ int numChars = dataSize / sizeof( UniChar) + 1;
UniChar* charBuf = buf ;
- if ( dataSize > 4 )
- charBuf = new UniChar[ dataSize / sizeof( UniChar) ] ;
+ if ( numChars * 2 > 4 )
+ charBuf = new UniChar[ numChars ] ;
GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
+ charBuf[ numChars - 1 ] = 0;
#if SIZEOF_WCHAR_T == 2
uniChar = charBuf[0] ;
#else
wxMBConvUTF16 converter ;
- converter.MB2WC( &uniChar , (const char*)charBuf , 1 ) ;
+ converter.MB2WC( uniChar , (const char*)charBuf , 2 ) ;
#endif
- if ( dataSize > 4 )
+ if ( numChars * 2 > 4 )
delete[] charBuf ;
}
#endif
WXEVENTHANDLERCALLREF formerHandler = wxTheApp->MacGetCurrentEventHandlerCallRef() ;
wxTheApp->MacSetCurrentEvent( event , handler ) ;
if ( /* focus && */ wxTheApp->MacSendKeyDownEvent(
- focus , message , modifiers , when , point.h , point.v , uniChar ) )
+ focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
{
result = noErr ;
}
case kEventRawKeyUp :
if ( /* focus && */ wxTheApp->MacSendKeyUpEvent(
- focus , message , modifiers , when , point.h , point.v , uniChar ) )
+ focus , message , modifiers , when , point.h , point.v , uniChar[0] ) )
{
result = noErr ;
}
event.m_y = point.v;
#if wxUSE_UNICODE
- event.m_uniChar = uniChar ;
+ event.m_uniChar = uniChar[0] ;
#endif
event.SetTimestamp(when);
Point screenMouseLocation = cEvent.GetParameter<Point>(kEventParamMouseLocation) ;
Point windowMouseLocation = screenMouseLocation ;
- WindowRef window ;
+ WindowRef window = NULL;
short windowPart = ::FindWindow(screenMouseLocation, &window);
wxWindow* currentMouseWindow = NULL ;
wxMacPortStateHelper help( (GrafPtr)GetWindowPort( (WindowRef)m_macWindow) ) ;
wxMacWindowClipper clip( this );
#endif
-
+#if 0
if ( !IsWindowInStandardState( (WindowRef)m_macWindow, NULL, NULL ) )
{
Rect rect;
SetWindowIdealUserState((WindowRef)m_macWindow, &rect);
SetWindowUserState((WindowRef)m_macWindow, &rect);
}
-
ZoomWindow( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , false ) ;
+#else
+ Point idealSize = { 0 , 0 } ;
+ if ( maximize )
+ {
+ Rect rect ;
+ GetAvailableWindowPositioningBounds(GetMainDevice(),&rect) ;
+ idealSize.h = rect.right - rect.left ;
+ idealSize.v = rect.bottom - rect.top ;
+ }
+ ZoomWindowIdeal( (WindowRef)m_macWindow , maximize ? inZoomOut : inZoomIn , &idealSize ) ;
+#endif
}
bool wxTopLevelWindowMac::IsMaximized() const
// the root control level handler
MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ) ;
-#if TARGET_API_MAC_OSX
+ // Causes the inner part of the window not to be metal
+ // if the style is used before window creation.
+#if 0 // TARGET_API_MAC_OSX
if ( m_macUsesCompositing && m_macWindow != NULL )
{
if ( GetExtraStyle() & wxFRAME_EX_METAL )
return m_macFullScreenData != NULL ;
}
-void wxTopLevelWindowMac::SetExtraStyle(long exStyle)
+
+bool wxTopLevelWindowMac::SetTransparent(wxByte alpha)
+{
+ WindowRef handle = GetControlOwner((OpaqueControlRef*)GetHandle());
+ OSStatus result = SetWindowAlpha(handle, float(alpha)/255.0);
+ return result == noErr;
+}
+
+
+bool wxTopLevelWindowMac::CanSetTransparent()
+{
+ return true;
+}
+
+
+void wxTopLevelWindowMac::SetExtraStyle(long exStyle)
{
if ( GetExtraStyle() == exStyle )
return ;
-
+
wxTopLevelWindowBase::SetExtraStyle( exStyle ) ;
#if TARGET_API_MAC_OSX
#endif
}
+// TODO: switch to structure bounds -
// we are still using coordinates of the content view
-// TODO: switch to structure bounds
//
void wxTopLevelWindowMac::MacGetContentAreaInset( int &left , int &top , int &right , int &bottom )
{
return 0;
}
-