]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxGetFontFromUser() similar to wxGetColourFromUser()
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 21 Jan 2002 17:53:00 +0000 (17:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 21 Jan 2002 17:53:00 +0000 (17:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/fontdlg.h
src/common/utilscmn.cpp

index a1c2b040d3c0889c17d48d438a4702a003c87f1b..3c1756b6c5434608d09939aaa4fa1361b0f66c78 100644 (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:
 
index 88205f033f68f29744c8d942f71b8792e55a60aa..681c6ab5c12e2ef71bcd652012280a1e6802c08b 100644 (file)
 #   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
index 9962127b6ba2cbdcec62033906cf61f30e2c7f7a..488be4bec8a6a292ba88c0b6ed4852c0f23a32e9 100644 (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)
 // ----------------------------------------------------------------------------