]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dialog.cpp
removing non-compositing code, adding individual transparency
[wxWidgets.git] / src / mac / carbon / dialog.cpp
index 61d903a38e19b1d5ddce2e0e52fa4bb49bee0742..0a478ad303b851a5814ece450ca381d7a0204efe 100644 (file)
@@ -1,29 +1,31 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        dialog.cpp
+// Name:        src/mac/carbon/dialog.cpp
 // Purpose:     wxDialog class
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
 // RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
 
 #include "wx/dialog.h"
-#include "wx/utils.h"
-#include "wx/frame.h"
-#include "wx/app.h"
-#include "wx/settings.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/frame.h"
+    #include "wx/settings.h"
+#endif // WX_PRECOMP
 
 #include "wx/mac/uma.h"
 
+
 // Lists to keep track of windows, so we can disable/enable them
 // for modal dialogs
 wxList wxModalDialogs;
-//wxList wxModelessWindows;  // Frames and modeless dialogs
-extern wxList wxPendingDelete;
 
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxTopLevelWindow)
 
@@ -39,45 +41,58 @@ BEGIN_EVENT_TABLE(wxDialog, wxDialogBase)
   EVT_CLOSE(wxDialog::OnCloseWindow)
 END_EVENT_TABLE()
 
+
 void wxDialog::Init()
 {
     m_isModalStyle = false;
 }
 
-bool wxDialog::Create(wxWindow *parent, wxWindowID id,
-           const wxString& title,
-           const wxPoint& pos,
-           const wxSize& size,
-           long style,
-           const wxString& name)
+bool wxDialog::Create( wxWindow *parent,
+    wxWindowID id,
+    const wxString& title,
+    const wxPoint& pos,
+    const wxSize& size,
+    long style,
+    const wxString& name )
 {
-    SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG);
+    SetExtraStyle( GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
 
-    // All dialogs should really have this style
+    // All dialogs should really have this style...
     style |= wxTAB_TRAVERSAL;
 
-    if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style & ~(wxYES|wxOK|wxNO /*|wxCANCEL*/) , name) )
+    // ...but not these styles
+    style &= ~(wxYES | wxOK | wxNO); // | wxCANCEL
+
+    if ( !wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ) )
         return false;
 
+#if TARGET_API_MAC_OSX
+    HIViewRef growBoxRef = 0 ;
+    OSStatus err = HIViewFindByID( HIViewGetRoot( (WindowRef)m_macWindow ), kHIViewWindowGrowBoxID, &growBoxRef  );
+    if ( err == noErr && growBoxRef != 0 )
+        HIGrowBoxViewSetTransparent( growBoxRef, true ) ;
+#endif
+
     return true;
 }
 
-void wxDialog::SetModal(bool flag)
+void wxDialog::SetModal( bool flag )
 {
     if ( flag )
     {
         m_isModalStyle = true;
 
-        wxModelessWindows.DeleteObject(this);
+        wxModelessWindows.DeleteObject( this );
+
 #if TARGET_CARBON
-        SetWindowModality( (WindowRef) MacGetWindowRef() , kWindowModalityAppModal , NULL ) ;
+        SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
 #endif
     }
     else
     {
         m_isModalStyle = false;
 
-        wxModelessWindows.Append(this);
+        wxModelessWindows.Append( this );
     }
 }
 
@@ -102,6 +117,7 @@ void wxDialog::OnCharHook(wxKeyEvent& event)
 
         return;
     }
+
     // We didn't process this event.
     event.Skip();
 }
@@ -121,16 +137,12 @@ bool wxDialog::IsModalShowing() const
 bool wxDialog::Show(bool show)
 {
     if ( !wxDialogBase::Show(show) )
-    {
         // nothing to do
         return false;
-    }
 
     if ( show )
-    {
         // usually will result in TransferDataToWindow() being called
         InitDialog();
-    }
 
     if ( m_isModalStyle )
     {
@@ -155,12 +167,12 @@ extern bool s_macIsInModalLoop ;
 
 void wxDialog::DoShowModal()
 {
-    wxCHECK_RET( !IsModalShowing(), _T("DoShowModal() called twice") );
+    wxCHECK_RET( !IsModalShowing(), wxT("DoShowModal() called twice") );
 
     wxModalDialogs.Append(this);
 
     SetFocus() ;
-    
+
 #if TARGET_CARBON
     BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
 #else
@@ -168,6 +180,7 @@ void wxDialog::DoShowModal()
     bool formerModal = s_macIsInModalLoop ;
     s_macIsInModalLoop = true ;
 #endif
+
     while ( IsModalShowing() )
     {
         wxTheApp->MacDoOneEvent() ;
@@ -190,6 +203,7 @@ int wxDialog::ShowModal()
         SetModal(true);
 
     Show(true);
+
     return GetReturnCode();
 }
 
@@ -257,4 +271,3 @@ void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
   SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
   Refresh();
 }
-