/////////////////////////////////////////////////////////////////////////////
-// Name: src/osx/carbon/fontdlgosx.cpp
+// Name: src/osx/carbon/fontdlgosx.mm
// Purpose: wxFontDialog class.
// Author: Ryan Norton
// Modified by:
#endif
#include "wx/fontutil.h"
+#include "wx/modalhook.h"
// ============================================================================
// implementation
NSRect rectBox = NSMakeRect( 0 , 0 , 192 , 40 );
accessoryView = [[wxMacFontPanelAccView alloc] initWithFrame:rectBox];
[fontPanel setAccessoryView:accessoryView];
+ [accessoryView release];
[fontPanel setDefaultButtonCell:[[accessoryView okButton] cell]] ;
}
[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];
- 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
retval = wxID_OK ;
}
[fontPanel setAccessoryView:nil];
- [accessoryView release];
return retval ;
}
{
}
+wxFontDialog::wxFontDialog(wxWindow *parent)
+{
+ Create(parent);
+}
+
wxFontDialog::wxFontDialog(wxWindow *parent, const wxFontData& data)
{
Create(parent, data);
{
}
+bool wxFontDialog::Create(wxWindow *parent)
+{
+ return Create(parent);
+}
+
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];
//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;
}
- 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
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