\helpref{wxApp::GetTopWindow}{wxappgettopwindow}, \helpref{wxApp::OnInit}{wxapponinit}
+\membersection{wxApp::GetStdIcon}\label{wxappgetstdicon}
+
+\func{virtual wxIcon}{GetStdIcon}{\param{int }{which}} const
+
+Returns the icons used by wxWindows internally, e.g. the ones used for
+message boxes. This function is used internally and
+can be overridden by the user to change the default icons.
+
+\wxheading{Parameters}
+
+\docparam{which}{One of the wxICON_XXX defines and chooses which icon to return.}
+
wxMGL_UNIX, // MGL with direct hardware access
wxMGL_X, // MGL on X
wxMGL_WIN32, // MGL on Win32
- wxMGL_OS2, // MGL on OS/2
+ wxMGL_OS2 // MGL on OS/2
};
// ----------------------------------------------------------------------------
#define wxICON_EXCLAMATION 0x00000040
#define wxICON_HAND 0x00000080
+#define wxICON_WARNING wxICON_EXCLAMATION
+#define wxICON_ERROR wxICON_HAND
#define wxICON_QUESTION 0x00000100
#define wxICON_INFORMATION 0x00000200
#define wxICON_STOP wxICON_HAND
/* XPM */
-static char * error[] = {
+static char * error_xpm[] = {
"48 48 78 1",
" c None",
". c #000000",
/* XPM */
-static char * info[] = {
+static char * info_xpm[] = {
"48 48 159 2",
" c None",
". c #12165C",
/* XPM */
-static char * question[] = {
+static char * question_xpm[] = {
"48 48 165 2",
" c None",
". c #000000",
/* XPM */
-static char * warning[] = {
+static char * warning_xpm[] = {
"48 48 151 2",
" c None",
". c #C70707",
#include "wx/defs.h"
#include "wx/window.h"
#include "wx/frame.h"
+#include "wx/icon.h"
//-----------------------------------------------------------------------------
// classes
virtual bool Pending();
virtual void Dispatch();
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
inline void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
#include "wx/defs.h"
#include "wx/window.h"
#include "wx/frame.h"
+#include "wx/icon.h"
//-----------------------------------------------------------------------------
// classes
virtual bool Pending();
virtual void Dispatch();
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
inline void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; }
inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
+
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
+
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
+
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/event.h"
+#include "wx/icon.h"
class WXDLLEXPORT wxFrame;
class WXDLLEXPORT wxWindow;
// Called to set off the main loop
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
// called when a fatal exception occurs, this function should take care not
// to do anything which might provoke a nested exception!
// Called to set off the main loop
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
virtual int OnRun() { return MainLoop(); };
virtual int OnExit() { return 0; }
+ /** Returns the standard icons for the msg dialogs, implemented in
+ src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
+ virtual wxIcon GetStdIcon(int which) const;
+
inline void SetPrintMode(int mode) { m_printMode = mode; }
inline int GetPrintMode() const { return m_printMode; }
#include "wx/layout.h"
#include "wx/intl.h"
#include "wx/icon.h"
+# include "wx/app.h"
#endif
#include <stdio.h>
// icons
// ----------------------------------------------------------------------------
-// MSW icons are in the ressources, for all other platforms - in XPM files
-#ifndef __WXMSW__
- #include "wx/generic/info.xpm"
- #include "wx/generic/question.xpm"
- #include "wx/generic/warning.xpm"
- #include "wx/generic/error.xpm"
-#endif // __WXMSW__
#if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog)
#endif
+#ifdef _WXGTK__
+# include "wx/gtk/info.xpm"
+# include "wx/gtk/error.xpm"
+# include "wx/gtk/question.xpm"
+# include "wx/gtk/warning.xpm"
+#else
+ // MSW icons are in the ressources, for all other platforms - in XPM files
+# ifndef __WXMSW__
+# include "wx/generic/info.xpm"
+# include "wx/generic/question.xpm"
+# include "wx/generic/warning.xpm"
+# include "wx/generic/error.xpm"
+# endif // __WXMSW__
+#endif
+
+wxIcon
+wxApp::GetStdIcon(int which) const
+{
+ switch(which)
+ {
+ case wxICON_INFORMATION:
+ return wxIcon(info_xpm);
+ break;
+ case wxICON_HAND:
+ return wxIcon(error_xpm);
+ break;
+ case wxICON_QUESTION:
+ return wxIcon(question_xpm);
+ break;
+ case wxICON_EXCLAMATION:
+ return wxIcon(warning_xpm);
+ break;
+ default:
+ wxFAIL_MSG("requested non existent standard icon");
+ return wxIcon(error_xpm);
+ break;
+ }
+}
+
+
wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
const wxString& message,
const wxString& caption,
wxLayoutConstraints *c;
SetAutoLayout(TRUE);
- // create an icon
- enum
- {
- Icon_Information,
- Icon_Question,
- Icon_Warning,
- Icon_Error
- } which;
-
-#ifdef __WXMSW__
- static char *icons[] =
- {
- "wxICON_INFO",
- "wxICON_QUESTION",
- "wxICON_WARNING",
- "wxICON_ERROR",
- };
-#else // XPM icons
- static char **icons[] =
- {
- info,
- question,
- warning,
- error,
- };
-#endif // !XPM/XPM
-
- if ( style & wxICON_EXCLAMATION )
- which = Icon_Warning;
- else if ( style & wxICON_HAND )
- which = Icon_Error;
- else if ( style & wxICON_QUESTION )
- which = Icon_Question;
- else
- which = Icon_Information;
-
- wxStaticBitmap *icon = new wxStaticBitmap(this, -1, wxIcon(icons[which]));
+ wxStaticBitmap *icon = new wxStaticBitmap(this, -1,
+ wxTheApp->GetStdIcon(style & wxICON_MASK));
const int iconSize = icon->GetBitmap().GetWidth();
// split the message in lines
m_msg = new wxStaticText(this, -1, message);
c = new wxLayoutConstraints;
- c->left.SameAs(this, wxLeft, 10);
- c->top.SameAs(this, wxTop, 10);
+ c->left.SameAs(this, wxLeft, 2*LAYOUT_X_MARGIN);
+ c->top.SameAs(this, wxTop, 2*LAYOUT_Y_MARGIN);
c->width.AsIs();
c->height.AsIs();
m_msg->SetConstraints(c);
m_btnAbort->SetLabel(_("Close"));
}
- if ( !newmsg )
+/*I think the default should be the other way round. If the
+ application wants to set a "Done." message at the end, it should
+ supply it. Any serious objections to this change? Makes the
+ application programmers' work a little easier.
+ if ( !newmsg )
{
// also provide the finishing message if the application didn't
m_msg->SetLabel(_("Done."));
}
-
+*/
m_state = Finished;
// so that we return TRUE below
return retValue;
}
+# include "wx/gtk/info.xpm"
+# include "wx/gtk/error.xpm"
+# include "wx/gtk/question.xpm"
+# include "wx/gtk/warning.xpm"
+
+wxIcon
+wxApp::GetStdIcon(int which) const
+{
+ switch(which)
+ {
+ case wxICON_INFORMATION:
+ return wxIcon(info_xpm);
+ break;
+ case wxICON_HAND:
+ return wxIcon(error_xpm);
+ break;
+ case wxICON_QUESTION:
+ return wxIcon(question_xpm);
+ break;
+ case wxICON_EXCLAMATION:
+ return wxIcon(warning_xpm);
+ break;
+ default:
+ wxFAIL_MSG("requested non existent standard icon");
+ return wxIcon(error_xpm);
+ break;
+ }
+}
SetSize( m_x, m_y, m_width, m_height );
}
-static wxSize wxButton::GetDefaultSize()
+/* static */
+wxSize wxButton::GetDefaultSize()
{
return wxSize(80,26);
}
#include "wx/layout.h"
#include "wx/intl.h"
#include "wx/bitmap.h"
+#include "wx/app.h"
#endif
#include <stdio.h>
#include "wx/gtk/msgdlg.h"
#include "wx/statline.h"
-#include "wx/gtk/info.xpm"
-#include "wx/gtk/error.xpm"
-#include "wx/gtk/question.xpm"
-#include "wx/gtk/warning.xpm"
-
///////////////////////////////////////////////////////////////////
// New dialog box implementations
wxSize message_size( wxSplitMessage2( message, this, text_pos_x ) );
if (m_dialogStyle & wxICON_MASK)
- if (message_size.y < 50) message_size.y = 50;
-
- if (m_dialogStyle & wxICON_INFORMATION)
- (void) new wxStaticBitmap( this, -1, wxBitmap( info_xpm ), wxPoint(15,message_size.y/2-16) );
- else
- if (m_dialogStyle & wxICON_HAND)
- (void) new wxStaticBitmap( this, -1, wxBitmap( error_xpm ), wxPoint(15,message_size.y/2-16) );
- else
- if (m_dialogStyle & wxICON_QUESTION)
- (void) new wxStaticBitmap( this, -1, wxBitmap( question_xpm ), wxPoint(15,message_size.y/2-16) );
- else
- if (m_dialogStyle & wxICON_EXCLAMATION)
- (void) new wxStaticBitmap( this, -1, wxBitmap( warning_xpm ), wxPoint(15,message_size.y/2-16) );
+ {
+ if (message_size.y < 50) message_size.y = 50;
+ (void) new wxStaticBitmap( this, -1,
+ wxTheApp->GetStdIcon(m_dialogStyle
+ & wxICON_MASK),
+ wxPoint(15,message_size.y/2-16) );
+ }
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
return retValue;
}
+# include "wx/gtk/info.xpm"
+# include "wx/gtk/error.xpm"
+# include "wx/gtk/question.xpm"
+# include "wx/gtk/warning.xpm"
+
+wxIcon
+wxApp::GetStdIcon(int which) const
+{
+ switch(which)
+ {
+ case wxICON_INFORMATION:
+ return wxIcon(info_xpm);
+ break;
+ case wxICON_HAND:
+ return wxIcon(error_xpm);
+ break;
+ case wxICON_QUESTION:
+ return wxIcon(question_xpm);
+ break;
+ case wxICON_EXCLAMATION:
+ return wxIcon(warning_xpm);
+ break;
+ default:
+ wxFAIL_MSG("requested non existent standard icon");
+ return wxIcon(error_xpm);
+ break;
+ }
+}
SetSize( m_x, m_y, m_width, m_height );
}
-static wxSize wxButton::GetDefaultSize()
+/* static */
+wxSize wxButton::GetDefaultSize()
{
return wxSize(80,26);
}
#include "wx/layout.h"
#include "wx/intl.h"
#include "wx/bitmap.h"
+#include "wx/app.h"
#endif
#include <stdio.h>
#include "wx/gtk/msgdlg.h"
#include "wx/statline.h"
-#include "wx/gtk/info.xpm"
-#include "wx/gtk/error.xpm"
-#include "wx/gtk/question.xpm"
-#include "wx/gtk/warning.xpm"
-
///////////////////////////////////////////////////////////////////
// New dialog box implementations
wxSize message_size( wxSplitMessage2( message, this, text_pos_x ) );
if (m_dialogStyle & wxICON_MASK)
- if (message_size.y < 50) message_size.y = 50;
-
- if (m_dialogStyle & wxICON_INFORMATION)
- (void) new wxStaticBitmap( this, -1, wxBitmap( info_xpm ), wxPoint(15,message_size.y/2-16) );
- else
- if (m_dialogStyle & wxICON_HAND)
- (void) new wxStaticBitmap( this, -1, wxBitmap( error_xpm ), wxPoint(15,message_size.y/2-16) );
- else
- if (m_dialogStyle & wxICON_QUESTION)
- (void) new wxStaticBitmap( this, -1, wxBitmap( question_xpm ), wxPoint(15,message_size.y/2-16) );
- else
- if (m_dialogStyle & wxICON_EXCLAMATION)
- (void) new wxStaticBitmap( this, -1, wxBitmap( warning_xpm ), wxPoint(15,message_size.y/2-16) );
+ {
+ if (message_size.y < 50) message_size.y = 50;
+ (void) new wxStaticBitmap( this, -1,
+ wxTheApp->GetStdIcon(m_dialogStyle
+ & wxICON_MASK),
+ wxPoint(15,message_size.y/2-16) );
+ }
wxButton *ok = (wxButton *) NULL;
wxButton *cancel = (wxButton *) NULL;
#include "wx/msgdlg.h"
#include "wx/intl.h"
#include "wx/dynarray.h"
- #include "wx/wxchar.h"
+# include "wx/wxchar.h"
+# include "wx/icon.h"
#endif
#include "wx/log.h"
return TRUE;
}
+wxIcon
+wxApp::GetStdIcon(int which) const
+{
+ switch(which)
+ {
+ case wxICON_INFORMATION:
+ return wxIcon("wxICON_INFO");
+ break;
+ case wxICON_HAND:
+ return wxIcon("wxICON_ERROR");
+ break;
+ case wxICON_QUESTION:
+ return wxIcon("wxICON_QUESTION");
+ break;
+ case wxICON_EXCLAMATION:
+ return wxIcon("wxICON_WARNING");
+ break;
+ default:
+ wxFAIL_MSG("requested non existent standard icon");
+ return wxIcon("wxICON_ERROR");
+ break;
+ }
+}
+
HINSTANCE wxGetInstance()
{