]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/fontdlgg.cpp
Applied patch [ 603104 ] wxX11 wxClientDC, wxPaintDC fix
[wxWidgets.git] / src / generic / fontdlgg.cpp
index f7e1eb93754ff4addcd125bc90f129597418cf74..0de608cd458ebdc8228c1055943dfd12d150658a 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        fontdlgg.cpp
+// Name:        src/generic/fontdlgg.cpp
 // Purpose:     Generic font dialog
 // Author:      Julian Smart
 // Modified by:
@@ -41,7 +41,7 @@
 
 #include "wx/cmndata.h"
 #include "wx/sizer.h"
-#include "wx/generic/fontdlgg.h"
+#include "wx/fontdlg.h"
 
 //-----------------------------------------------------------------------------
 // helper class - wxFontPreviewer
@@ -163,23 +163,16 @@ static wxString wxColourDialogNames[NUM_COLS]={wxT("ORANGE"),
  * Generic wxFontDialog
  */
 
-wxGenericFontDialog::wxGenericFontDialog(void)
+void wxGenericFontDialog::Init()
 {
   m_useEvents = FALSE;
   m_previewer = NULL;
-  dialogParent = NULL;
-}
-
-wxGenericFontDialog::wxGenericFontDialog(wxWindow *parent, wxFontData *data):
-  wxDialog(parent, -1, _("Font"), wxDefaultPosition, wxDefaultSize,
-           wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL|wxRESIZE_BORDER)
-{
-  m_useEvents = FALSE;
-  m_previewer = NULL;
-  Create(parent, data);
+#ifdef __WXMAC__
+  Create( m_parent ) ;
+#endif
 }
 
-wxGenericFontDialog::~wxGenericFontDialog(void)
+wxGenericFontDialog::~wxGenericFontDialog()
 {
 }
 
@@ -188,32 +181,35 @@ void wxGenericFontDialog::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
   EndModal(wxID_CANCEL);
 }
 
-bool wxGenericFontDialog::Create(wxWindow *parent, wxFontData *data)
+bool wxGenericFontDialog::DoCreate(wxWindow *parent)
 {
-  dialogParent = parent;
-
-  if (data)
-    fontData = *data;
-
+#ifdef __WXMAC__
+    if ( !wxDialog::Create( parent , -1 , _T("Choose Font") , wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
+        _T("fontdialog") ) )
+    {
+        wxFAIL_MSG( wxT("wxFontDialog creation failed") );
+        return FALSE;
+    }
+#endif
   InitializeFont();
   CreateWidgets();
  
   return TRUE;
 }
 
-int wxGenericFontDialog::ShowModal(void)
+int wxGenericFontDialog::ShowModal()
 {
-  int ret = wxDialog::ShowModal();
+    int ret = wxDialog::ShowModal();
 
     if (ret != wxID_CANCEL)
     {
-      fontData.chosenFont = dialogFont;
+      m_fontData.chosenFont = dialogFont;
     }
 
     return ret;
 }
 
-void wxGenericFontDialog::CreateWidgets(void)
+void wxGenericFontDialog::CreateWidgets()
 {
   wxBusyCursor bcur;
 
@@ -260,7 +256,7 @@ void wxGenericFontDialog::CreateWidgets(void)
   familyChoice->SetStringSelection( wxFontFamilyIntToString(dialogFont.GetFamily()) );
   styleChoice->SetStringSelection(wxFontStyleIntToString(dialogFont.GetStyle()));
   weightChoice->SetStringSelection(wxFontWeightIntToString(dialogFont.GetWeight()));
-  wxString name(wxTheColourDatabase->FindName(fontData.fontColour));
+  wxString name(wxTheColourDatabase->FindName(m_fontData.fontColour));
   colourChoice->SetStringSelection(name);
 
   underLineCheckBox->SetValue(dialogFont.GetUnderlined());
@@ -305,7 +301,7 @@ void wxGenericFontDialog::CreateWidgets(void)
   m_useEvents = TRUE;
 }
 
-void wxGenericFontDialog::InitializeFont(void)
+void wxGenericFontDialog::InitializeFont()
 {
   int fontFamily = wxSWISS;
   int fontWeight = wxNORMAL;
@@ -313,13 +309,13 @@ void wxGenericFontDialog::InitializeFont(void)
   int fontSize = 12;
   int fontUnderline = FALSE;
 
-  if (fontData.initialFont.Ok())
+  if (m_fontData.initialFont.Ok())
   {
-      fontFamily = fontData.initialFont.GetFamily();
-      fontWeight = fontData.initialFont.GetWeight();
-      fontStyle = fontData.initialFont.GetStyle();
-      fontSize = fontData.initialFont.GetPointSize();
-      fontUnderline = fontData.initialFont.GetUnderlined();
+      fontFamily = m_fontData.initialFont.GetFamily();
+      fontWeight = m_fontData.initialFont.GetWeight();
+      fontStyle = m_fontData.initialFont.GetStyle();
+      fontSize = m_fontData.initialFont.GetPointSize();
+      fontUnderline = m_fontData.initialFont.GetUnderlined();
   }
 
   dialogFont = wxFont(fontSize, fontFamily, fontStyle, fontWeight, (fontUnderline != 0));
@@ -349,14 +345,14 @@ void wxGenericFontDialog::OnChangeFont(wxCommandEvent& WXUNUSED(event))
     col = wxTheColourDatabase->FindColour(colourChoice->GetStringSelection());
     if (col)
     {
-      fontData.fontColour = *col;
+      m_fontData.fontColour = *col;
       m_previewer->SetForegroundColour(*col);
     }
   }
   m_previewer->Refresh();
 }
 
-wxChar *wxFontWeightIntToString(int weight)
+const wxChar *wxFontWeightIntToString(int weight)
 {
   switch (weight)
   {
@@ -370,7 +366,7 @@ wxChar *wxFontWeightIntToString(int weight)
   }
 }
 
-wxChar *wxFontStyleIntToString(int style)
+const wxChar *wxFontStyleIntToString(int style)
 {
   switch (style)
   {
@@ -384,7 +380,7 @@ wxChar *wxFontStyleIntToString(int style)
   }
 }
 
-wxChar *wxFontFamilyIntToString(int family)
+const wxChar *wxFontFamilyIntToString(int family)
 {
   switch (family)
   {