added wxGetFontFromUser() similar to wxGetColourFromUser()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2002-01-21 17:53:00 +00:00
parent d741c58382
commit bf31fa26c7
3 changed files with 43 additions and 14 deletions

View File

@ -82,6 +82,7 @@ All (GUI):
- support for multiple images in one file added to wxImage (TIFF and ICO formats)
- support for CUR and ANI files in wxImage added (Chris Elliott)
- wxTextCtrl::GetRange() added
- added wxGetFontFromUser() convenience function
wxMSW:

View File

@ -15,6 +15,11 @@
# include "wx/os2/fontdlg.h"
#endif
// get the colour from user and return it
wxFont WXDLLEXPORT
wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL,
const wxFont& fontInit = wxNullFont);
#endif // wxUSE_FONTDLG
#endif

View File

@ -68,6 +68,7 @@
#if wxUSE_GUI
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#include "wx/notebook.h"
#include "wx/frame.h"
#include "wx/statusbr.h"
@ -962,26 +963,48 @@ wxString wxGetPasswordFromUser(const wxString& message,
wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
{
wxColourData data;
data.SetChooseFull(TRUE);
if ( colInit.Ok() )
{
data.SetColour((wxColour &)colInit); // const_cast
}
wxColourData data;
data.SetChooseFull(TRUE);
if ( colInit.Ok() )
{
data.SetColour((wxColour &)colInit); // const_cast
}
wxColour colRet;
wxColourDialog dialog(parent, &data);
if ( dialog.ShowModal() == wxID_OK )
{
colRet = dialog.GetColourData().GetColour();
}
//else: leave it invalid
wxColour colRet;
wxColourDialog dialog(parent, &data);
if ( dialog.ShowModal() == wxID_OK )
{
colRet = dialog.GetColourData().GetColour();
}
//else: leave it invalid
return colRet;
return colRet;
}
#endif // wxUSE_COLOURDLG
#if wxUSE_FONTDLG
wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit)
{
wxFontData data;
if ( fontInit.Ok() )
{
data.SetInitialFont(fontInit);
}
wxFont fontRet;
wxFontDialog dialog(parent, &data);
if ( dialog.ShowModal() == wxID_OK )
{
fontRet = dialog.GetFontData().GetChosenFont();
}
//else: leave it invalid
return fontRet;
}
#endif // wxUSE_FONTDLG
// ----------------------------------------------------------------------------
// missing C RTL functions (FIXME shouldn't be here at all)
// ----------------------------------------------------------------------------