Added caption parameter to wxGetFontFromUser and wxGetColourFromUser.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-01-02 14:26:36 +00:00
parent 99c613c5c4
commit f14d6dd133
5 changed files with 50 additions and 6 deletions

View File

@@ -44,6 +44,7 @@ All (GUI):
- Added space after list item number in wxHTML. - Added space after list item number in wxHTML.
- Implemented <sub> and <sup> handling in wxHTML (based on patch - Implemented <sub> and <sup> handling in wxHTML (based on patch
by Sandro Sigala) by Sandro Sigala)
- Added caption parameter to wxGetFontFromUser and wxGetColourFromUser.
wxMSW: wxMSW:

View File

@@ -1904,7 +1904,7 @@ See also \helpref{wxIsBusy}{wxisbusy}, \helpref{wxBusyCursor}{wxbusycursor}.
\membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser} \membersection{::wxGetColourFromUser}\label{wxgetcolourfromuser}
\func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}} \func{wxColour}{wxGetColourFromUser}{\param{wxWindow *}{parent}, \param{const wxColour\& }{colInit}, \param{const wxString\& }{caption = wxEmptyString}}
Shows the colour selection dialog and returns the colour selected by user or Shows the colour selection dialog and returns the colour selected by user or
invalid colour (use \helpref{wxColour::Ok}{wxcolourok} to test whether a colour invalid colour (use \helpref{wxColour::Ok}{wxcolourok} to test whether a colour
@@ -1916,6 +1916,8 @@ is valid) if the dialog was cancelled.
\docparam{colInit}{If given, this will be the colour initially selected in the dialog.} \docparam{colInit}{If given, this will be the colour initially selected in the dialog.}
\docparam{caption}{If given, this will be used for the dialog caption.}
\wxheading{Include files} \wxheading{Include files}
<wx/colordlg.h> <wx/colordlg.h>
@@ -1923,7 +1925,7 @@ is valid) if the dialog was cancelled.
\membersection{::wxGetFontFromUser}\label{wxgetfontfromuser} \membersection{::wxGetFontFromUser}\label{wxgetfontfromuser}
\func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}} \func{wxFont}{wxGetFontFromUser}{\param{wxWindow *}{parent}, \param{const wxFont\& }{fontInit}, \param{const wxString\& }{caption = wxEmptyString}}
Shows the font selection dialog and returns the font selected by user or Shows the font selection dialog and returns the font selected by user or
invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font invalid font (use \helpref{wxFont::Ok}{wxfontok} to test whether a font
@@ -1935,6 +1937,8 @@ is valid) if the dialog was cancelled.
\docparam{fontInit}{If given, this will be the font initially selected in the dialog.} \docparam{fontInit}{If given, this will be the font initially selected in the dialog.}
\docparam{caption}{If given, this will be used for the dialog caption.}
\wxheading{Include files} \wxheading{Include files}
<wx/fontdlg.h> <wx/fontdlg.h>

View File

@@ -33,7 +33,7 @@
// get the colour from user and return it // get the colour from user and return it
wxColour WXDLLEXPORT wxColour WXDLLEXPORT
wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL, wxGetColourFromUser(wxWindow *parent = (wxWindow *)NULL,
const wxColour& colInit = wxNullColour); const wxColour& colInit = wxNullColour, const wxString& caption = wxEmptyString);
#endif // wxUSE_COLOURDLG #endif // wxUSE_COLOURDLG

View File

@@ -102,7 +102,7 @@ protected:
// cancelled // cancelled
wxFont WXDLLEXPORT wxFont WXDLLEXPORT
wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL, wxGetFontFromUser(wxWindow *parent = (wxWindow *)NULL,
const wxFont& fontInit = wxNullFont); const wxFont& fontInit = wxNullFont, const wxString& caption = wxEmptyString);
#endif // wxUSE_FONTDLG #endif // wxUSE_FONTDLG

View File

@@ -82,6 +82,13 @@
#include "wx/msw/wince/time.h" #include "wx/msw/wince/time.h"
#endif #endif
#ifdef __WXMAC__
#include "wx/mac/private.h"
#ifndef __DARWIN__
#include "InternetConfig.h"
#endif
#endif
#if !defined(__MWERKS__) && !defined(__WXWINCE__) #if !defined(__MWERKS__) && !defined(__WXWINCE__)
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -607,6 +614,34 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
#endif // __WXDEBUG__ #endif // __WXDEBUG__
return true; return true;
} }
#elif defined(__WXMAC__)
OSStatus err;
ICInstance inst;
SInt32 startSel;
SInt32 endSel;
err = ICStart(&inst, 'STKA'); // put your app creator code here
if (err == noErr) {
#if !TARGET_CARBON
err = ICFindConfigFile(inst, 0, nil);
#endif
if (err == noErr)
{
ConstStr255Param hint = 0;
startSel = 0;
endSel = url.Length();
err = ICLaunchURL(inst, hint, url.fn_str(), endSel, &startSel, &endSel);
if (err != noErr)
wxLogDebug(wxT("ICLaunchURL error %d"), (int) err);
}
ICStop(inst);
return true;
}
else
{
wxLogDebug(wxT("ICStart error %d"), (int) err);
return false;
}
#elif wxUSE_MIMETYPE #elif wxUSE_MIMETYPE
// Non-windows way // Non-windows way
wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension (_T("html")); wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension (_T("html"));
@@ -954,7 +989,7 @@ wxString wxGetPasswordFromUser(const wxString& message,
#if wxUSE_COLOURDLG #if wxUSE_COLOURDLG
wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit) wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit, const wxString& caption)
{ {
wxColourData data; wxColourData data;
data.SetChooseFull(true); data.SetChooseFull(true);
@@ -965,6 +1000,8 @@ wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
wxColour colRet; wxColour colRet;
wxColourDialog dialog(parent, &data); wxColourDialog dialog(parent, &data);
if (!caption.IsEmpty())
dialog.SetTitle(caption);
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
{ {
colRet = dialog.GetColourData().GetColour(); colRet = dialog.GetColourData().GetColour();
@@ -978,7 +1015,7 @@ wxColour wxGetColourFromUser(wxWindow *parent, const wxColour& colInit)
#if wxUSE_FONTDLG #if wxUSE_FONTDLG
wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit) wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit, const wxString& caption)
{ {
wxFontData data; wxFontData data;
if ( fontInit.Ok() ) if ( fontInit.Ok() )
@@ -988,6 +1025,8 @@ wxFont wxGetFontFromUser(wxWindow *parent, const wxFont& fontInit)
wxFont fontRet; wxFont fontRet;
wxFontDialog dialog(parent, data); wxFontDialog dialog(parent, data);
if (!caption.IsEmpty())
dialog.SetTitle(caption);
if ( dialog.ShowModal() == wxID_OK ) if ( dialog.ShowModal() == wxID_OK )
{ {
fontRet = dialog.GetFontData().GetChosenFont(); fontRet = dialog.GetFontData().GetChosenFont();