]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/fontdlgosx.mm
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / osx / carbon / fontdlgosx.mm
index a83b7d5e028970d428676dd9631ad7e75ae71e05..2129527f3e9f38f952a0b4b5b92c26d2a5de97a2 100644 (file)
@@ -1,10 +1,9 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/osx/carbon/fontdlgosx.cpp
+// Name:        src/osx/carbon/fontdlgosx.mm
 // Purpose:     wxFontDialog class.
 // Author:      Ryan Norton
 // Modified by:
 // Created:     2004-10-03
 // Purpose:     wxFontDialog class.
 // Author:      Ryan Norton
 // Modified by:
 // Created:     2004-10-03
-// RCS-ID:      $Id$
 // Copyright:   (c) Ryan Norton
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 // Copyright:   (c) Ryan Norton
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -28,6 +27,7 @@
 #endif
 
 #include "wx/fontutil.h"
 #endif
 
 #include "wx/fontutil.h"
+#include "wx/modalhook.h"
 
 // ============================================================================
 // implementation
 
 // ============================================================================
 // implementation
@@ -167,6 +167,7 @@ int RunMixedFontDialog(wxFontDialog* dialog)
         NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 );
         accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox];
         [fontPanel setAccessoryView:accessoryView];
         NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 );
         accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox];
         [fontPanel setAccessoryView:accessoryView];
+        [accessoryView release];
 
         [fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ;
     }
 
         [fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ;
     }
@@ -174,14 +175,14 @@ int RunMixedFontDialog(wxFontDialog* dialog)
     [accessoryView resetFlags];
 #if wxOSX_USE_COCOA
     wxFont font = *wxNORMAL_FONT ;
     [accessoryView resetFlags];
 #if wxOSX_USE_COCOA
     wxFont font = *wxNORMAL_FONT ;
-    if ( fontdata.m_initialFont.Ok() )
+    if ( fontdata.m_initialFont.IsOk() )
     {
         font = fontdata.m_initialFont ;
     }
 
     [[NSFontPanel sharedFontPanel] setPanelFont: font.OSXGetNSFont() isMultiple:NO];
 
     {
         font = fontdata.m_initialFont ;
     }
 
     [[NSFontPanel sharedFontPanel] setPanelFont: font.OSXGetNSFont() isMultiple:NO];
 
-    if(fontdata.m_fontColour.Ok())
+    if(fontdata.m_fontColour.IsOk())
         [[NSColorPanel sharedColorPanel] setColor:
             [NSColor colorWithCalibratedRed:fontdata.m_fontColour.Red() / 255.0
                                         green:fontdata.m_fontColour.Green() / 255.0
         [[NSColorPanel sharedColorPanel] setColor:
             [NSColor colorWithCalibratedRed:fontdata.m_fontColour.Red() / 255.0
                                         green:fontdata.m_fontColour.Green() / 255.0
@@ -220,7 +221,6 @@ int RunMixedFontDialog(wxFontDialog* dialog)
         retval = wxID_OK ;
     }
     [fontPanel setAccessoryView:nil];
         retval = wxID_OK ;
     }
     [fontPanel setAccessoryView:nil];
-    [accessoryView release];
 
     return retval ;
 }
 
     return retval ;
 }
@@ -351,6 +351,11 @@ wxFontDialog::wxFontDialog()
 {
 }
 
 {
 }
 
+wxFontDialog::wxFontDialog(wxWindow *parent)
+{
+    Create(parent);
+}
+
 wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData&  data)
 {
     Create(parent, data);
 wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData&  data)
 {
     Create(parent, data);
@@ -360,10 +365,20 @@ wxFontDialog::~wxFontDialog()
 {
 }
 
 {
 }
 
+bool wxFontDialog::Create(wxWindow *parent)
+{
+    return Create(parent);
+}
+
 bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data)
 {
     m_fontData = data;
 
 bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data)
 {
     m_fontData = data;
 
+    return Create(parent);
+}
+
+bool wxFontDialog::Create(wxWindow *parent)
+{
     //autorelease pool - req'd for carbon
     NSAutoreleasePool *thePool;
     thePool = [[NSAutoreleasePool alloc] init];
     //autorelease pool - req'd for carbon
     NSAutoreleasePool *thePool;
     thePool = [[NSAutoreleasePool alloc] init];
@@ -373,7 +388,7 @@ bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data)
 
     //if the font is valid set the default (selected) font of the
     //NSFontDialog to that font
 
     //if the font is valid set the default (selected) font of the
     //NSFontDialog to that font
-    if (thewxfont.Ok())
+    if (thewxfont.IsOk())
     {
         NSFontTraitMask theMask = 0;
 
     {
         NSFontTraitMask theMask = 0;
 
@@ -401,7 +416,7 @@ bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data)
 
     }
 
 
     }
 
-    if(m_fontData.m_fontColour.Ok())
+    if(m_fontData.m_fontColour.IsOk())
         [[NSColorPanel sharedColorPanel] setColor:
             [NSColor colorWithCalibratedRed:m_fontData.m_fontColour.Red() / 255.0
                                         green:m_fontData.m_fontColour.Green() / 255.0
         [[NSColorPanel sharedColorPanel] setColor:
             [NSColor colorWithCalibratedRed:m_fontData.m_fontColour.Red() / 255.0
                                         green:m_fontData.m_fontColour.Green() / 255.0
@@ -419,6 +434,8 @@ bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data)
 
 int wxFontDialog::ShowModal()
 {
 
 int wxFontDialog::ShowModal()
 {
+    WX_HOOK_MODAL_DIALOG();
+
     //Start the pool.  Required for carbon interaction
     //(For those curious, the only thing that happens
     //if you don't do this is a bunch of error
     //Start the pool.  Required for carbon interaction
     //(For those curious, the only thing that happens
     //if you don't do this is a bunch of error