move wxApp::GetStdIcon to wxArtProvider

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14746 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2002-03-24 00:19:01 +00:00
parent d956a9d8fd
commit 0e04ef47f6
19 changed files with 19 additions and 243 deletions

View File

@@ -47,6 +47,10 @@ class WXDLLEXPORT wxCmdLineParser;
#include "wx/log.h" #include "wx/log.h"
#endif #endif
#if WXWIN_COMPATIBILITY_2_2
#include "wx/icon.h"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -275,10 +279,13 @@ public:
#endif // wxUSE_LOG #endif // wxUSE_LOG
#if wxUSE_GUI #if wxUSE_GUI
#if WXWIN_COMPATIBILITY_2_2
// get the standard icon used by wxWin dialogs - this allows the user // get the standard icon used by wxWin dialogs - this allows the user
// to customize the standard dialogs. The 'which' parameter is one of // to customize the standard dialogs. The 'which' parameter is one of
// wxICON_XXX values // wxICON_XXX values
virtual wxIcon GetStdIcon(int which) const = 0; virtual wxIcon GetStdIcon(int WXUNUSED(which)) const { return wxNullIcon; }
#endif
// Get display mode that is used use. This is only used in framebuffer wxWin ports // Get display mode that is used use. This is only used in framebuffer wxWin ports
// (such as wxMGL). // (such as wxMGL).

View File

@@ -34,14 +34,15 @@ typedef wxString wxArtID;
// Art clients // Art clients
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#define wxART_TOOLBAR _T("toolbar_C") #define wxART_TOOLBAR _T("toolbar_C")
#define wxART_MENU _T("menu_C") #define wxART_MENU _T("menu_C")
#define wxART_FRAME_ICON _T("frame_icon_C") #define wxART_FRAME_ICON _T("frame_icon_C")
#define wxART_CMN_DIALOG _T("cmn_dialog_C") #define wxART_CMN_DIALOG _T("cmn_dialog_C")
#define wxART_HELP_BROWSER _T("help_browser_C") #define wxART_HELP_BROWSER _T("help_browser_C")
#define wxART_MESSAGE_BOX _T("message_box_C")
#define wxART_OTHER _T("other_C") #define wxART_OTHER _T("other_C")
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Art IDs // Art IDs
@@ -73,6 +74,10 @@ typedef wxString wxArtID;
#define wxART_NORMAL_FILE _T("normal_file") #define wxART_NORMAL_FILE _T("normal_file")
#define wxART_TICK_MARK _T("tick") #define wxART_TICK_MARK _T("tick")
#define wxART_CROSS_MARK _T("cross") #define wxART_CROSS_MARK _T("cross")
#define wxART_ERROR _T("error")
#define wxART_QUESTION _T("question")
#define wxART_WARNING _T("warning")
#define wxART_INFORMATION _T("information")
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxArtProvider class // wxArtProvider class

View File

@@ -48,8 +48,6 @@ public:
virtual void Dispatch(); virtual void Dispatch();
virtual bool Yield(bool onlyIfNeeded = FALSE); virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual wxIcon GetStdIcon(int which) const;
// implementation only from now on // implementation only from now on
void OnIdle( wxIdleEvent &event ); void OnIdle( wxIdleEvent &event );
bool SendIdleEvents(); bool SendIdleEvents();

View File

@@ -48,8 +48,6 @@ public:
virtual void Dispatch(); virtual void Dispatch();
virtual bool Yield(bool onlyIfNeeded = FALSE); virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual wxIcon GetStdIcon(int which) const;
// implementation only from now on // implementation only from now on
void OnIdle( wxIdleEvent &event ); void OnIdle( wxIdleEvent &event );
bool SendIdleEvents(); bool SendIdleEvents();

View File

@@ -53,7 +53,6 @@ class WXDLLEXPORT wxApp: public wxAppBase
virtual void Dispatch() ; virtual void Dispatch() ;
virtual bool Yield(bool onlyIfNeeded = FALSE); virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual wxIcon GetStdIcon(int which) const;
virtual void SetPrintMode(int mode) { m_printMode = mode; } virtual void SetPrintMode(int mode) { m_printMode = mode; }
virtual int GetPrintMode() const { return m_printMode; } virtual int GetPrintMode() const { return m_printMode; }

View File

@@ -48,8 +48,6 @@ public:
virtual bool Pending(); virtual bool Pending();
virtual void Dispatch(); virtual void Dispatch();
virtual wxIcon GetStdIcon(int which) const;
// implementation only from now on // implementation only from now on
void OnIdle(wxIdleEvent &event); void OnIdle(wxIdleEvent &event);
bool SendIdleEvents(); bool SendIdleEvents();

View File

@@ -57,8 +57,6 @@ public:
virtual bool OnInitGui(); virtual bool OnInitGui();
virtual wxIcon GetStdIcon(int which) const;
// implementation from now on // implementation from now on
// -------------------------- // --------------------------

View File

@@ -43,8 +43,6 @@ public:
virtual void Dispatch(); virtual void Dispatch();
virtual bool Yield(bool onlyIfNeeded = FALSE); virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual wxIcon GetStdIcon(int which) const;
virtual void SetPrintMode(int mode) { m_printMode = mode; } virtual void SetPrintMode(int mode) { m_printMode = mode; }
virtual int GetPrintMode() const { return m_printMode; } virtual int GetPrintMode() const { return m_printMode; }

View File

@@ -78,8 +78,6 @@ public:
virtual void Dispatch(void); virtual void Dispatch(void);
virtual bool Yield(bool onlyIfNeeded = FALSE); virtual bool Yield(bool onlyIfNeeded = FALSE);
virtual wxIcon GetStdIcon(int which) const;
virtual void SetPrintMode(int mode) { m_nPrintMode = mode; } virtual void SetPrintMode(int mode) { m_nPrintMode = mode; }
virtual int GetPrintMode(void) const { return m_nPrintMode; } virtual int GetPrintMode(void) const { return m_nPrintMode; }

View File

@@ -58,8 +58,6 @@ public:
virtual bool OnInitGui(); virtual bool OnInitGui();
virtual wxIcon GetStdIcon(int which) const;
// implementation from now on // implementation from now on
// -------------------------- // --------------------------

View File

@@ -821,47 +821,6 @@ int wxEntry( int argc, char *argv[] )
return retValue; return retValue;
} }
#ifndef __WXUNIVERSAL__
// XPM hack: make the arrays const
#define static static const
#include "wx/gtk/info.xpm"
#include "wx/gtk/error.xpm"
#include "wx/gtk/question.xpm"
#include "wx/gtk/warning.xpm"
#undef static
wxIcon wxApp::GetStdIcon(int which) const
{
switch(which)
{
case wxICON_INFORMATION:
return wxIcon(info_xpm);
case wxICON_QUESTION:
return wxIcon(question_xpm);
case wxICON_EXCLAMATION:
return wxIcon(warning_xpm);
default:
wxFAIL_MSG(wxT("requested non existent standard icon"));
// still fall through
case wxICON_HAND:
return wxIcon(error_xpm);
}
}
#else
wxIcon wxApp::GetStdIcon(int which) const
{
return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
}
#endif // !__WXUNIVERSAL__
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg) void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)

View File

@@ -821,47 +821,6 @@ int wxEntry( int argc, char *argv[] )
return retValue; return retValue;
} }
#ifndef __WXUNIVERSAL__
// XPM hack: make the arrays const
#define static static const
#include "wx/gtk/info.xpm"
#include "wx/gtk/error.xpm"
#include "wx/gtk/question.xpm"
#include "wx/gtk/warning.xpm"
#undef static
wxIcon wxApp::GetStdIcon(int which) const
{
switch(which)
{
case wxICON_INFORMATION:
return wxIcon(info_xpm);
case wxICON_QUESTION:
return wxIcon(question_xpm);
case wxICON_EXCLAMATION:
return wxIcon(warning_xpm);
default:
wxFAIL_MSG(wxT("requested non existent standard icon"));
// still fall through
case wxICON_HAND:
return wxIcon(error_xpm);
}
}
#else
wxIcon wxApp::GetStdIcon(int which) const
{
return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
}
#endif // !__WXUNIVERSAL__
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg) void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)

View File

@@ -953,29 +953,6 @@ void wxApp::DeletePendingObjects()
} }
} }
wxIcon
wxApp::GetStdIcon(int which) const
{
switch(which)
{
case wxICON_INFORMATION:
return wxIcon("wxICON_INFO");
case wxICON_QUESTION:
return wxIcon("wxICON_QUESTION");
case wxICON_EXCLAMATION:
return wxIcon("wxICON_WARNING");
default:
wxFAIL_MSG(wxT("requested non existent standard icon"));
// still fall through
case wxICON_HAND:
return wxIcon("wxICON_ERROR");
}
}
void wxExit() void wxExit()
{ {
wxLogError(_("Fatal error: exiting")); wxLogError(_("Fatal error: exiting"));

View File

@@ -953,29 +953,6 @@ void wxApp::DeletePendingObjects()
} }
} }
wxIcon
wxApp::GetStdIcon(int which) const
{
switch(which)
{
case wxICON_INFORMATION:
return wxIcon("wxICON_INFO");
case wxICON_QUESTION:
return wxIcon("wxICON_QUESTION");
case wxICON_EXCLAMATION:
return wxIcon("wxICON_WARNING");
default:
wxFAIL_MSG(wxT("requested non existent standard icon"));
// still fall through
case wxICON_HAND:
return wxIcon("wxICON_ERROR");
}
}
void wxExit() void wxExit()
{ {
wxLogError(_("Fatal error: exiting")); wxLogError(_("Fatal error: exiting"));

View File

@@ -444,11 +444,6 @@ bool wxApp::Initialize()
return TRUE; return TRUE;
} }
wxIcon wxApp::GetStdIcon(int which) const
{
return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
}
void wxApp::CleanUp() void wxApp::CleanUp()
{ {
#if wxUSE_LOG #if wxUSE_LOG

View File

@@ -745,41 +745,6 @@ bool wxApp::Yield(bool onlyIfNeeded)
return TRUE; return TRUE;
} }
// TODO use XmGetPixmap (?) to get the really standard icons!
// XPM hack: make the arrays const
#define static static const
#include "wx/generic/info.xpm"
#include "wx/generic/error.xpm"
#include "wx/generic/question.xpm"
#include "wx/generic/warning.xpm"
#undef static
wxIcon
wxApp::GetStdIcon(int which) const
{
switch(which)
{
case wxICON_INFORMATION:
return wxIcon(info_xpm);
case wxICON_QUESTION:
return wxIcon(question_xpm);
case wxICON_EXCLAMATION:
return wxIcon(warning_xpm);
default:
wxFAIL_MSG("requested non existent standard icon");
// still fall through
case wxICON_HAND:
return wxIcon(error_xpm);
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// accessors for C modules // accessors for C modules
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -1481,29 +1481,6 @@ void wxWakeUpIdle()
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxIcon
wxApp::GetStdIcon(int which) const
{
switch(which)
{
case wxICON_INFORMATION:
return wxIcon("wxICON_INFO");
case wxICON_QUESTION:
return wxIcon("wxICON_QUESTION");
case wxICON_EXCLAMATION:
return wxIcon("wxICON_WARNING");
default:
wxFAIL_MSG(wxT("requested non existent standard icon"));
// still fall through
case wxICON_HAND:
return wxIcon("wxICON_ERROR");
}
}
// For some reason, with MSVC++ 1.5, WinMain isn't linked in properly // For some reason, with MSVC++ 1.5, WinMain isn't linked in properly
// if in a separate file. So include it here to ensure it's linked. // if in a separate file. So include it here to ensure it's linked.
#if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__TWIN32__) && !defined(WXMAKINGDLL)) #if (defined(__VISUALC__) && !defined(__WIN32__)) || (defined(__GNUWIN32__) && !defined(__TWIN32__) && !defined(WXMAKINGDLL))

View File

@@ -1175,31 +1175,6 @@ bool wxApp::Yield(bool onlyIfNeeded)
return TRUE; return TRUE;
} // end of wxYield } // end of wxYield
wxIcon wxApp::GetStdIcon(
int nWhich
) const
{
switch(nWhich)
{
case wxICON_INFORMATION:
return wxIcon("wxICON_INFO");
case wxICON_QUESTION:
return wxIcon("wxICON_QUESTION");
case wxICON_EXCLAMATION:
return wxIcon("wxICON_WARNING");
default:
wxFAIL_MSG(wxT("requested non existent standard icon"));
// still fall through
case wxICON_HAND:
return wxIcon("wxICON_ERROR");
}
return wxIcon("wxICON_ERROR");
} // end of wxApp::GetStdIcon
int wxApp::AddSocketHandler(int handle, int mask, int wxApp::AddSocketHandler(int handle, int mask,
void (*callback)(void*), void * gsock) void (*callback)(void*), void * gsock)
{ {

View File

@@ -1004,11 +1004,6 @@ bool wxApp::Yield(bool onlyIfNeeded)
return TRUE; return TRUE;
} }
wxIcon wxApp::GetStdIcon(int which) const
{
return wxTheme::Get()->GetRenderer()->GetStdIcon(which);
}
void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg) void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)
{ {
// While the GUI isn't working that well, just print out the // While the GUI isn't working that well, just print out the