]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toplevel.cpp
updates from Adrián González Alba
[wxWidgets.git] / src / mac / carbon / toplevel.cpp
index d0519c95c6a3cd86f113301afc05ed3985cd823b..2e4cd6eb3ed37881b90c37cbc118b489b2ab0b64 100644 (file)
     #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"
@@ -38,7 +39,6 @@
 
 #include "wx/mac/uma.h"
 #include "wx/mac/aga.h"
-#include "wx/app.h"
 #include "wx/tooltip.h"
 #include "wx/dnd.h"
 
@@ -123,9 +123,9 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
 
     unsigned char charCode ;
     wxChar uniChar[2] ;
-       uniChar[0] = 0;
-       uniChar[1] = 0;
-       
+    uniChar[0] = 0;
+    uniChar[1] = 0;
+
     UInt32 keyCode ;
     UInt32 modifiers ;
     Point point ;
@@ -143,13 +143,13 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
         if ( numChars * 2 > 4 )
             charBuf = new UniChar[ numChars ] ;
         GetEventParameter( event, kEventParamKeyUnicodes, typeUnicodeText, NULL, dataSize , NULL , charBuf ) ;
-               charBuf[ numChars - 1 ] = 0;
+        charBuf[ numChars - 1 ] = 0;
 
 #if SIZEOF_WCHAR_T == 2
         uniChar = charBuf[0] ;
 #else
         wxMBConvUTF16 converter ;
-        converter.MB2WC( &uniChar , (const char*)charBuf , 2 ) ;
+        converter.MB2WC( uniChar , (const char*)charBuf , 2 ) ;
 #endif
 
         if ( numChars * 2 > 4 )
@@ -200,7 +200,7 @@ static pascal OSStatus KeyboardEventHandler( EventHandlerCallRef handler , Event
                 event.m_y = point.v;
 
 #if wxUSE_UNICODE
-                event.m_uniChar = uniChar ;
+                event.m_uniChar = uniChar[0] ;
 #endif
 
                 event.SetTimestamp(when);
@@ -995,7 +995,7 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
     wxMacPortStateHelper help( (GrafPtr)GetWindowPort( (WindowRef)m_macWindow) ) ;
     wxMacWindowClipper clip( this );
 #endif
-
+#if 0
     if ( !IsWindowInStandardState( (WindowRef)m_macWindow, NULL, NULL ) )
     {
         Rect rect;
@@ -1004,8 +1004,18 @@ void wxTopLevelWindowMac::Maximize(bool maximize)
         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
@@ -1421,6 +1431,21 @@ bool wxTopLevelWindowMac::IsFullScreen() const
     return m_macFullScreenData != NULL ;
 }
 
+
+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 )
@@ -1789,4 +1814,3 @@ static pascal long wxShapedMacWindowDef(short varCode, WindowRef window, SInt16
 
     return 0;
 }
-