]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/toplevel.cpp
expose metal appearance
[wxWidgets.git] / src / mac / carbon / toplevel.cpp
index 6d038b6fa8de22c3e5b8060a831462c7b3e2995d..4fd7b3e40b313e49eb6abe7f90725bf60c264b82 100644 (file)
@@ -74,7 +74,7 @@ extern long wxMacTranslateKey(unsigned char key, unsigned char code) ;
 static const EventTypeSpec eventList[] =
 {
     // TODO remove control related event like key and mouse (except for WindowLeave events)
-#if !TARGET_API_MAC_OSX    
+#if 1
     { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } ,
 
     { kEventClassKeyboard, kEventRawKeyDown } ,
@@ -827,6 +827,16 @@ void  wxTopLevelWindowMac::MacSetBackgroundBrush( const wxBrush &brush )
     }
 }
 
+void wxTopLevelWindowMac::MacInstallTopLevelWindowEventHandler() 
+{
+    if ( m_macEventHandler != NULL )
+    {
+        verify_noerr( ::RemoveEventHandler( (EventHandlerRef) m_macEventHandler ) ) ;
+    }
+    InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacTopLevelEventHandlerUPP(),
+        GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_macEventHandler);
+}
+
 void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
            const wxPoint& pos,
            const wxSize& size,
@@ -950,13 +960,12 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     else
     {
         ::CreateRootControl( (WindowRef)m_macWindow , (ControlRef*)&m_macControl ) ;
-        MacInstallEventHandler() ;
     }
+    MacInstallEventHandler() ;
 
     InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
-    InstallWindowEventHandler(MAC_WXHWND(m_macWindow), GetwxMacTopLevelEventHandlerUPP(),
-        GetEventTypeCount(eventList), eventList, this, (EventHandlerRef *)&m_macEventHandler);
-
+    MacInstallTopLevelWindowEventHandler() ;
+    
     m_macFocus = NULL ;
 
     if ( HasFlag(wxFRAME_SHAPED) )
@@ -1098,6 +1107,15 @@ void wxTopLevelWindowMac::MacSetMetalAppearance( bool set )
 #endif
 }
 
+bool wxTopLevelWindowMac::MacGetMetalAppearance() const 
+{
+#if TARGET_API_MAC_OSX
+    return MacGetWindowAttributes() & kWindowMetalAttribute ;
+#else
+    return false ;
+#endif
+}
+
 void wxTopLevelWindowMac::MacChangeWindowAttributes( wxUint32 attributesToSet , wxUint32 attributesToClear ) 
 {
     ChangeWindowAttributes ( (WindowRef) m_macWindow , attributesToSet, attributesToClear ) ;