fixed wxFontDialog API: accept const ref instead of (well, in addition to) a possibly NULL pointer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -167,10 +167,29 @@ This class represents the font chooser dialog.
|
|||||||
|
|
||||||
\membersection{wxFontDialog::wxFontDialog}
|
\membersection{wxFontDialog::wxFontDialog}
|
||||||
|
|
||||||
\func{}{wxFontDialog}{\param{wxWindow* }{parent}, \param{wxFontData* }{data = NULL}}
|
\func{}{wxFontDialog}{\void}
|
||||||
|
|
||||||
Constructor. Pass a parent window, and optionally a pointer to a block of font
|
\func{}{wxFontDialog}{\param{wxWindow* }{parent}}
|
||||||
data, which will be copied to the font dialog's font data.
|
|
||||||
|
\func{}{wxFontDialog}{\param{wxWindow* }{parent}, \param{const wxFontData\& }{data}}
|
||||||
|
|
||||||
|
Constructor. Pass a parent window, and optionally the
|
||||||
|
\helpref{font data}{wxfontdata} object to be used to initialize the dialog
|
||||||
|
controls. If the default constructor is used,
|
||||||
|
\helpref{Create()}{wxfontdialogcreate} must be called before the dialog can be
|
||||||
|
shown.
|
||||||
|
|
||||||
|
\membersection{wxFontDialog::Create}\label{wxfontdialogcreate}
|
||||||
|
|
||||||
|
\func{bool}{Create}{\void}
|
||||||
|
|
||||||
|
\func{bool}{Create}{\param{wxWindow* }{parent}}
|
||||||
|
|
||||||
|
\func{bool}{Create}{\param{wxWindow* }{parent}, \param{const wxFontData\& }{data}}
|
||||||
|
|
||||||
|
Creates the dialog if it the wxFontDialog object had been initialized using the
|
||||||
|
default constructor. Returns {\tt TRUE} on success and {\tt FALSE} if an error
|
||||||
|
occured.
|
||||||
|
|
||||||
\membersection{wxFontDialog::\destruct{wxFontDialog}}
|
\membersection{wxFontDialog::\destruct{wxFontDialog}}
|
||||||
|
|
||||||
@@ -180,6 +199,8 @@ Destructor.
|
|||||||
|
|
||||||
\membersection{wxFontDialog::GetFontData}
|
\membersection{wxFontDialog::GetFontData}
|
||||||
|
|
||||||
|
\constfunc{const wxFontData\&}{GetFontData}{\void}
|
||||||
|
|
||||||
\func{wxFontData\&}{GetFontData}{\void}
|
\func{wxFontData\&}{GetFontData}{\void}
|
||||||
|
|
||||||
Returns the \helpref{font data}{wxfontdata} associated with the font dialog.
|
Returns the \helpref{font data}{wxfontdata} associated with the font dialog.
|
||||||
@@ -188,10 +209,10 @@ Returns the \helpref{font data}{wxfontdata} associated with the font dialog.
|
|||||||
|
|
||||||
\func{int}{ShowModal}{\void}
|
\func{int}{ShowModal}{\void}
|
||||||
|
|
||||||
Shows the dialog, returning wxID\_OK if the user pressed Ok, and wxID\_CANCEL
|
Shows the dialog, returning {\tt wxID\_OK} if the user pressed Ok, and
|
||||||
otherwise.
|
{\tt wxID\_CANCEL} otherwise.
|
||||||
|
|
||||||
If the user cancels the dialog (ShowModal returns wxID\_CANCEL), no font will be
|
If the user cancels the dialog (ShowModal returns {\tt wxID\_CANCEL}), no font
|
||||||
created. If the user presses OK (ShowModal returns wxID\_OK), a new wxFont will
|
will be created. If the user presses OK, a new wxFont will be created and
|
||||||
be created and stored in the font dialog's wxFontData structure.
|
stored in the font dialog's wxFontData structure.
|
||||||
|
|
||||||
|
@@ -1,20 +1,80 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: wx/fontdlg.h
|
||||||
|
// Purpose: common interface for different wxFontDialog classes
|
||||||
|
// Author: Vadim Zeitlin
|
||||||
|
// Modified by:
|
||||||
|
// Created: 12.05.02
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) 1997-2002 wxWindows team
|
||||||
|
// Licence: wxWindows license
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_FONTDLG_H_BASE_
|
#ifndef _WX_FONTDLG_H_BASE_
|
||||||
#define _WX_FONTDLG_H_BASE_
|
#define _WX_FONTDLG_H_BASE_
|
||||||
|
|
||||||
|
#include "wx/defs.h" // for wxUSE_FONTDLG
|
||||||
|
|
||||||
#if wxUSE_FONTDLG
|
#if wxUSE_FONTDLG
|
||||||
|
|
||||||
|
#include "wx/dialog.h" // the base class
|
||||||
|
#include "wx/cmndata.h" // wxFontData
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxFontDialog interface
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class WXDLLEXPORT wxFontDialogBase : public wxDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// create the font dialog
|
||||||
|
wxFontDialogBase() { }
|
||||||
|
wxFontDialogBase(wxWindow *parent) { }
|
||||||
|
wxFontDialogBase(wxWindow *parent, const wxFontData& data) { }
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent)
|
||||||
|
{ return DoCreate(parent); }
|
||||||
|
bool Create(wxWindow *parent, const wxFontData& data)
|
||||||
|
{ m_fontData = data; return Create(parent); }
|
||||||
|
|
||||||
|
virtual ~wxFontDialogBase();
|
||||||
|
|
||||||
|
// retrieve the font data
|
||||||
|
const wxFontData& GetFontData() const { return m_fontData; }
|
||||||
|
wxFontData& GetFontData() { return m_fontData; }
|
||||||
|
|
||||||
|
// deprecated interface, for compatibility only, don't use
|
||||||
|
wxFontDialogBase(wxWindow *parent, const wxFontData *data)
|
||||||
|
{ Init(); Create(parent, data); }
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent, const wxFontData *data)
|
||||||
|
{ if ( data ) m_fontData = *data; return Create(parent); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool DoCreate(wxWindow *parent) { m_parent = parent; return TRUE; }
|
||||||
|
|
||||||
|
wxFontData m_fontData;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// platform-specific wxFontDialog implementation
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if defined(__WXUNIVERSAL__) || defined(__WXMOTIF__) || defined(__WXMAC__)
|
#if defined(__WXUNIVERSAL__) || defined(__WXMOTIF__) || defined(__WXMAC__)
|
||||||
# include "wx/generic/fontdlgg.h"
|
#include "wx/generic/fontdlgg.h"
|
||||||
# define wxFontDialog wxGenericFontDialog
|
#define wxFontDialog wxGenericFontDialog
|
||||||
# define sm_classwxFontDialog sm_classwxGenericFontDialog
|
#define sm_classwxFontDialog sm_classwxGenericFontDialog
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
# include "wx/msw/fontdlg.h"
|
#include "wx/msw/fontdlg.h"
|
||||||
#elif defined(__WXGTK__)
|
#elif defined(__WXGTK__)
|
||||||
# include "wx/gtk/fontdlg.h"
|
#include "wx/gtk/fontdlg.h"
|
||||||
#elif defined(__WXPM__)
|
#elif defined(__WXPM__)
|
||||||
# include "wx/os2/fontdlg.h"
|
#include "wx/os2/fontdlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// global public functions
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// get the font from user and return it, returns wxNullFont if the dialog was
|
// get the font from user and return it, returns wxNullFont if the dialog was
|
||||||
// cancelled
|
// cancelled
|
||||||
wxFont WXDLLEXPORT
|
wxFont WXDLLEXPORT
|
||||||
|
@@ -15,33 +15,31 @@
|
|||||||
#pragma interface "fontdlg.h"
|
#pragma interface "fontdlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/setup.h"
|
|
||||||
#include "wx/gdicmn.h"
|
|
||||||
#include "wx/font.h"
|
|
||||||
#include "wx/dialog.h"
|
|
||||||
#include "wx/cmndata.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// classes
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxFontDialog;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxFontDialog: public wxDialog
|
class wxFontDialog : public wxFontDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFontDialog() {}
|
wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
|
||||||
wxFontDialog( wxWindow *parent, wxFontData *data = (wxFontData *) NULL );
|
wxFontDialog(wxWindow *parent)
|
||||||
~wxFontDialog();
|
: wxFontDialogBase(parent) { Create(parent); }
|
||||||
|
wxFontDialog(wxWindow *parent, const wxFontData& data)
|
||||||
|
: wxFontDialogBase(parent, data) { Create(parent, data); }
|
||||||
|
|
||||||
wxFontData& GetFontData() { return m_fontData; }
|
virtual ~wxFontDialog();
|
||||||
|
|
||||||
//protected:
|
// implementation only
|
||||||
wxFontData m_fontData;
|
void SetChosenFont(const char *name);
|
||||||
|
|
||||||
|
// deprecated interface, don't use
|
||||||
|
wxFontDialog(wxWindow *parent, const wxFontData *data)
|
||||||
|
: wxFontDialogBase(parent, data) { Create(parent, data); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// create the GTK dialog
|
||||||
|
virtual bool DoCreate(wxWindow *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
||||||
|
@@ -15,33 +15,31 @@
|
|||||||
#pragma interface "fontdlg.h"
|
#pragma interface "fontdlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/setup.h"
|
|
||||||
#include "wx/gdicmn.h"
|
|
||||||
#include "wx/font.h"
|
|
||||||
#include "wx/dialog.h"
|
|
||||||
#include "wx/cmndata.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// classes
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxFontDialog;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxFontDialog: public wxDialog
|
class wxFontDialog : public wxFontDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFontDialog() {}
|
wxFontDialog() : wxFontDialogBase() { /* must be Create()d later */ }
|
||||||
wxFontDialog( wxWindow *parent, wxFontData *data = (wxFontData *) NULL );
|
wxFontDialog(wxWindow *parent)
|
||||||
~wxFontDialog();
|
: wxFontDialogBase(parent) { Create(parent); }
|
||||||
|
wxFontDialog(wxWindow *parent, const wxFontData& data)
|
||||||
|
: wxFontDialogBase(parent, data) { Create(parent, data); }
|
||||||
|
|
||||||
wxFontData& GetFontData() { return m_fontData; }
|
virtual ~wxFontDialog();
|
||||||
|
|
||||||
//protected:
|
// implementation only
|
||||||
wxFontData m_fontData;
|
void SetChosenFont(const char *name);
|
||||||
|
|
||||||
|
// deprecated interface, don't use
|
||||||
|
wxFontDialog(wxWindow *parent, const wxFontData *data)
|
||||||
|
: wxFontDialogBase(parent, data) { Create(parent, data); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// create the GTK dialog
|
||||||
|
virtual bool DoCreate(wxWindow *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
||||||
|
@@ -16,28 +16,25 @@
|
|||||||
#pragma interface "fontdlg.h"
|
#pragma interface "fontdlg.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/dialog.h"
|
|
||||||
#include "wx/cmndata.h"
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxFontDialog : public wxDialog
|
class WXDLLEXPORT wxFontDialog : public wxFontDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFontDialog();
|
wxFontDialog() : wxFontDialogBase() { }
|
||||||
wxFontDialog(wxWindow *parent, wxFontData *data = NULL);
|
wxFontDialog(wxWindow *parent) : wxFontDialogBase(parent) { }
|
||||||
|
wxFontDialog(wxWindow *parent, const wxFontData& data)
|
||||||
bool Create(wxWindow *parent, wxFontData *data = NULL);
|
: wxFontDialogBase(parent, data) { }
|
||||||
|
|
||||||
virtual int ShowModal();
|
virtual int ShowModal();
|
||||||
|
|
||||||
wxFontData& GetFontData() { return m_fontData; }
|
// deprecated
|
||||||
|
wxFontDialog(wxWindow *parent, wxFontData *data)
|
||||||
|
: wxFontDialogBase(parent, data) { }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxFontData m_fontData;
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
DECLARE_DYNAMIC_CLASS(wxFontDialog)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -239,19 +239,25 @@ void MyFrame::ChooseColour(wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::ChooseFont(wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
wxFontData data;
|
wxFontData data;
|
||||||
data.SetInitialFont(wxGetApp().m_canvasFont);
|
data.SetInitialFont(wxGetApp().m_canvasFont);
|
||||||
data.SetColour(wxGetApp().m_canvasTextColour);
|
data.SetColour(wxGetApp().m_canvasTextColour);
|
||||||
|
|
||||||
wxFontDialog *dialog = new wxFontDialog(this, &data);
|
// you might also do this:
|
||||||
if (dialog->ShowModal() == wxID_OK)
|
//
|
||||||
{
|
// wxFontDialog dialog;
|
||||||
wxFontData retData = dialog->GetFontData();
|
// if ( !dialog.Create(this, data) { ... error ... }
|
||||||
|
//
|
||||||
|
wxFontDialog dialog(this, data);
|
||||||
|
|
||||||
|
if (dialog.ShowModal() == wxID_OK)
|
||||||
|
{
|
||||||
|
wxFontData retData = dialog.GetFontData();
|
||||||
wxGetApp().m_canvasFont = retData.GetChosenFont();
|
wxGetApp().m_canvasFont = retData.GetChosenFont();
|
||||||
wxGetApp().m_canvasTextColour = retData.GetColour();
|
wxGetApp().m_canvasTextColour = retData.GetColour();
|
||||||
myCanvas->Refresh();
|
myCanvas->Refresh();
|
||||||
}
|
}
|
||||||
dialog->Destroy();
|
//else: cancelled by the user, don't change the font
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
|
#if defined(__WXMSW__) && wxTEST_GENERIC_DIALOGS_IN_MSW
|
||||||
|
@@ -39,6 +39,10 @@
|
|||||||
#include "wx/cmndata.h"
|
#include "wx/cmndata.h"
|
||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
|
#if wxUSE_FONTDLG
|
||||||
|
#include "wx/fontdlg.h"
|
||||||
|
#endif // wxUSE_FONTDLG
|
||||||
|
|
||||||
// For compatibility
|
// For compatibility
|
||||||
#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)|| defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT
|
#if (defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)|| defined(__WXPM__) || defined(__WXMAC__)) && wxUSE_POSTSCRIPT
|
||||||
#define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
|
#define wxCOMPATIBILITY_WITH_PRINTSETUPDATA 1
|
||||||
@@ -178,6 +182,14 @@ wxFontData::~wxFontData()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if wxUSE_FONTDLG
|
||||||
|
|
||||||
|
wxFontDialogBase::~wxFontDialogBase()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // wxUSE_FONTDLG
|
||||||
|
|
||||||
#if wxUSE_PRINTING_ARCHITECTURE
|
#if wxUSE_PRINTING_ARCHITECTURE
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Print data
|
// Print data
|
||||||
|
@@ -76,7 +76,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
|
|||||||
|
|
||||||
gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg);
|
gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg);
|
||||||
|
|
||||||
dialog->m_fontData.SetChosenFont(wxFont(fontname));
|
dialog->SetChosenFont(fontname);
|
||||||
|
|
||||||
g_free( fontname );
|
g_free( fontname );
|
||||||
|
|
||||||
@@ -105,10 +105,9 @@ void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialo
|
|||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog,wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
||||||
|
|
||||||
wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata )
|
bool wxFontDialog::DoCreate(wxWindow *parent)
|
||||||
: m_fontData(*fontdata)
|
|
||||||
{
|
{
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
|
||||||
@@ -116,8 +115,8 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata )
|
|||||||
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
|
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
|
||||||
wxDefaultValidator, wxT("fontdialog") ))
|
wxDefaultValidator, wxT("fontdialog") ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxXX creation failed") );
|
wxFAIL_MSG( wxT("wxFontDialog creation failed") );
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString m_message( _("Choose font") );
|
wxString m_message( _("Choose font") );
|
||||||
@@ -166,11 +165,18 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata )
|
|||||||
wxFAIL_MSG(_T("font is ok but no native font info?"));
|
wxFAIL_MSG(_T("font is ok but no native font info?"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFontDialog::~wxFontDialog()
|
wxFontDialog::~wxFontDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFontDialog::SetChosenFont(const char *fontname)
|
||||||
|
{
|
||||||
|
m_fontData.SetChosenFont(wxFont(fontname));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FONTDLG
|
#endif // wxUSE_FONTDLG
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ void gtk_fontdialog_ok_callback( GtkWidget *WXUNUSED(widget), wxFontDialog *dial
|
|||||||
|
|
||||||
gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg);
|
gchar *fontname = gtk_font_selection_dialog_get_font_name(fontdlg);
|
||||||
|
|
||||||
dialog->m_fontData.SetChosenFont(wxFont(fontname));
|
dialog->SetChosenFont(fontname);
|
||||||
|
|
||||||
g_free( fontname );
|
g_free( fontname );
|
||||||
|
|
||||||
@@ -105,10 +105,9 @@ void gtk_fontdialog_cancel_callback( GtkWidget *WXUNUSED(w), wxFontDialog *dialo
|
|||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog,wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
||||||
|
|
||||||
wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata )
|
bool wxFontDialog::DoCreate(wxWindow *parent)
|
||||||
: m_fontData(*fontdata)
|
|
||||||
{
|
{
|
||||||
m_needParent = FALSE;
|
m_needParent = FALSE;
|
||||||
|
|
||||||
@@ -116,8 +115,8 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata )
|
|||||||
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
|
!CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
|
||||||
wxDefaultValidator, wxT("fontdialog") ))
|
wxDefaultValidator, wxT("fontdialog") ))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxXX creation failed") );
|
wxFAIL_MSG( wxT("wxFontDialog creation failed") );
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString m_message( _("Choose font") );
|
wxString m_message( _("Choose font") );
|
||||||
@@ -166,11 +165,18 @@ wxFontDialog::wxFontDialog( wxWindow *parent, wxFontData *fontdata )
|
|||||||
wxFAIL_MSG(_T("font is ok but no native font info?"));
|
wxFAIL_MSG(_T("font is ok but no native font info?"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFontDialog::~wxFontDialog()
|
wxFontDialog::~wxFontDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxFontDialog::SetChosenFont(const char *fontname)
|
||||||
|
{
|
||||||
|
m_fontData.SetChosenFont(wxFont(fontname));
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_FONTDLG
|
#endif // wxUSE_FONTDLG
|
||||||
|
|
||||||
|
@@ -64,27 +64,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
|||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxFontDialog::wxFontDialog()
|
|
||||||
{
|
|
||||||
m_parent = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFontDialog::wxFontDialog(wxWindow *parent, wxFontData *data)
|
|
||||||
{
|
|
||||||
Create(parent, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxFontDialog::Create(wxWindow *parent, wxFontData *data)
|
|
||||||
{
|
|
||||||
m_parent = parent;
|
|
||||||
|
|
||||||
wxCHECK_MSG( data, FALSE, _T("no font data in wxFontDialog") );
|
|
||||||
|
|
||||||
m_fontData = *data;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxFontDialog::ShowModal()
|
int wxFontDialog::ShowModal()
|
||||||
{
|
{
|
||||||
DWORD flags = CF_SCREENFONTS | CF_NOSIMULATIONS;
|
DWORD flags = CF_SCREENFONTS | CF_NOSIMULATIONS;
|
||||||
|
Reference in New Issue
Block a user