added wxApp::Set/GetAppDisplayName() (patch 1780414)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48623 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-09-09 23:26:18 +00:00
parent 5595181f48
commit 9cf3d21870
13 changed files with 36 additions and 25 deletions

View File

@ -182,6 +182,7 @@ All (GUI):
- Added XRC handler for wxSearchCtrl (Sander Berents)
- Read image resolution from TIFF, JPEG and BMP images (Maycon Aparecido Gasoto)
- Added wxSYS_DCLICK_TIME system metric constant
- Added wxApp::Get/SetAppDisplayName() (Brian A. Vanderburg II)
wxGTK:

View File

@ -31,10 +31,10 @@ public:
// accessors for various simply fields
// -----------------------------------
// name of the program, if not used defaults wxApp::GetAppName()
// name of the program, if not used defaults to wxApp::GetAppDisplayName()
void SetName(const wxString& name) { m_name = name; }
wxString GetName() const
{ return m_name.empty() ? wxTheApp->GetAppName() : m_name; }
{ return m_name.empty() ? wxTheApp->GetAppDisplayName() : m_name; }
// version of the program, in free format (but without "version" word)
void SetVersion(const wxString& version) { m_version = version; }

View File

@ -123,6 +123,17 @@ public:
}
void SetAppName(const wxString& name) { m_appName = name; }
// set/get the application display name: the display name is the name
// shown to the user in titles, reports, etc while the app name is
// used for paths, config, and other places the user doesn't see
//
// so the app name could be myapp while display name could be "My App"
wxString GetAppDisplayName() const
{
return m_appDisplayName.empty() ? GetAppName() : m_appDisplayName;
}
void SetAppDisplayName(const wxString& name) { m_appDisplayName = name; }
// set/get the app class name
wxString GetClassName() const { return m_className; }
void SetClassName(const wxString& name) { m_className = name; }
@ -325,9 +336,10 @@ protected:
wxEventLoopBase *CreateMainLoop();
// application info (must be set from the user code)
wxString m_vendorName, // vendor name (ACME Inc)
m_appName, // app name
m_className; // class name
wxString m_vendorName, // vendor name (e.g. "ACME Inc")
m_appName, // app name ("myapp")
m_appDisplayName, // app display name ("My Application")
m_className; // class name
// the class defining the application behaviour, NULL initially and created
// by GetTraits() when first needed
@ -458,7 +470,7 @@ public:
virtual bool SetDisplayMode(const wxVideoMode& WXUNUSED(info)) { return true; }
// set use of best visual flag (see below)
void SetUseBestVisual( bool flag, bool forceTrueColour = false )
void SetUseBestVisual( bool flag, bool forceTrueColour = false )
{ m_useBestVisual = flag; m_forceTrueColour = forceTrueColour; }
bool GetUseBestVisual() const { return m_useBestVisual; }

View File

@ -127,7 +127,7 @@ bool DrawingView::OnClose(bool deleteWindow)
canvas->view = (wxView *) NULL;
canvas = (MyCanvas *) NULL;
wxString s(wxTheApp->GetAppName());
wxString s(wxTheApp->GetAppDisplayName());
if (frame)
frame->SetTitle(s);

View File

@ -106,7 +106,7 @@ bool DrawingView::OnClose(bool deleteWindow)
canvas->view = (wxView *) NULL;
canvas = (MyCanvas *) NULL;
wxString s(wxTheApp->GetAppName());
wxString s(wxTheApp->GetAppDisplayName());
if (frame)
frame->SetTitle(s);

View File

@ -253,7 +253,7 @@ wxDebugReport::~wxDebugReport()
wxString wxDebugReport::GetReportName() const
{
if(wxTheApp)
return wxTheApp->GetAppName();
return wxTheApp->GetAppDisplayName();
return _T("wx");
}

View File

@ -468,8 +468,8 @@ bool wxDocument::OnSaveModified()
wxString title = GetUserReadableName();
wxString msgTitle;
if (!wxTheApp->GetAppName().empty())
msgTitle = wxTheApp->GetAppName();
if (!wxTheApp->GetAppDisplayName().empty())
msgTitle = wxTheApp->GetAppDisplayName();
else
msgTitle = wxString(_("Warning"));
@ -577,8 +577,8 @@ void wxDocument::SetFilename(const wxString& filename, bool notifyViews)
bool wxDocument::DoSaveDocument(const wxString& file)
{
wxString msgTitle;
if (!wxTheApp->GetAppName().empty())
msgTitle = wxTheApp->GetAppName();
if (!wxTheApp->GetAppDisplayName().empty())
msgTitle = wxTheApp->GetAppDisplayName();
else
msgTitle = wxString(_("File error"));
@ -1450,7 +1450,7 @@ wxString wxDocManager::MakeNewDocumentName()
// If docName is empty, a document is not currently active.
wxString wxDocManager::MakeFrameTitle(wxDocument* doc)
{
wxString appName = wxTheApp->GetAppName();
wxString appName = wxTheApp->GetAppDisplayName();
wxString title;
if (!doc)
title = appName;
@ -1631,8 +1631,8 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
if (!wxFileExists(pathTmp))
{
wxString msgTitle;
if (!wxTheApp->GetAppName().empty())
msgTitle = wxTheApp->GetAppName();
if (!wxTheApp->GetAppDisplayName().empty())
msgTitle = wxTheApp->GetAppDisplayName();
else
msgTitle = wxString(_("File error"));

View File

@ -194,7 +194,7 @@ wxFontMapper::CharsetToEncoding(const wxString& charset, bool interactive)
// the dialog title
wxString title(m_titleDialog);
if ( !title )
title << wxTheApp->GetAppName() << _(": unknown charset");
title << wxTheApp->GetAppDisplayName() << _(": unknown charset");
// the message
wxString msg;
@ -408,7 +408,7 @@ bool wxFontMapper::GetAltForEncoding(wxFontEncoding encoding,
{
wxString title(m_titleDialog);
if ( !title )
title << wxTheApp->GetAppName() << _(": unknown encoding");
title << wxTheApp->GetAppDisplayName() << _(": unknown encoding");
// built the message
wxString encDesc = GetEncodingDescription(encoding),

View File

@ -222,7 +222,7 @@ void wxMessageOutputMessageBox::Output(const wxString& str)
wxString title;
if ( wxTheApp )
title.Printf(_("%s message"), wxTheApp->GetAppName().c_str());
title.Printf(_("%s message"), wxTheApp->GetAppDisplayName().c_str());
::wxMessageBox(out, title);
}

View File

@ -281,9 +281,7 @@ void wxLogGui::Flush()
repeatCount = wxLog::DoLogNumberOfRepeats();
}
wxString appName = wxTheApp->GetAppName();
if ( !appName.empty() )
appName[0u] = (wxChar)wxToupper(appName[0u]);
wxString appName = wxTheApp->GetAppDisplayName();
long style;
wxString titleFormat;

View File

@ -287,7 +287,7 @@ bool wxClipboard::AddData( wxDataObject *data )
Display* xdisplay = wxGlobalDisplay();
Widget xwidget = (Widget)wxTheApp->GetTopLevelRealizedWidget();
Window xwindow = XtWindow( xwidget );
wxXmString label( wxTheApp->GetAppName() );
wxXmString label( wxTheApp->GetAppDisplayName() );
Time timestamp = XtLastTimestampProcessed( xdisplay );
long itemId;

View File

@ -186,7 +186,7 @@ bool wxHandleFatalExceptions(bool doit)
wxString name = wxString::Format
(
_T("%s_%s_%lu.dmp"),
wxTheApp ? (const wxChar*)wxTheApp->GetAppName().c_str()
wxTheApp ? (const wxChar*)wxTheApp->GetAppDisplayName().c_str()
: _T("wxwindows"),
wxDateTime::Now().Format(_T("%Y%m%dT%H%M%S")).c_str(),
::GetCurrentProcessId()

View File

@ -51,7 +51,7 @@ void abort()
{
wxString name;
if ( wxTheApp )
name = wxTheApp->GetAppName();
name = wxTheApp->GetAppDisplayName();
if ( name.empty() )
name = L"wxWidgets Application";