always call SetIcon() on the main frame of the sample; some small cleanup

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-02-08 01:01:00 +00:00
parent 27721528c4
commit 41f02b9acc
21 changed files with 435 additions and 304 deletions

View File

@@ -44,6 +44,10 @@
#include "wx/fontpicker.h" #include "wx/fontpicker.h"
#include "wx/aboutdlg.h" #include "wx/aboutdlg.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -166,6 +170,8 @@ MyFrame::MyFrame()
wxDefaultPosition, wxSize(420, 300), wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{ {
SetIcon(wxICON(sample));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR

View File

@@ -25,6 +25,10 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/config.h" #include "wx/config.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// classes // classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -150,6 +154,8 @@ int MyApp::OnExit()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame((wxFrame *) NULL, wxID_ANY, _T("wxConfig Demo")) : wxFrame((wxFrame *) NULL, wxID_ANY, _T("wxConfig Demo"))
{ {
SetIcon(wxICON(sample));
// menu // menu
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;

View File

@@ -36,6 +36,10 @@
#include "wx/dialup.h" #include "wx/dialup.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// private classes // private classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -220,6 +224,8 @@ void MyApp::OnConnected(wxDialUpEvent& event)
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{ {
SetIcon(wxICON(sample));
// create a menu bar // create a menu bar
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;

View File

@@ -30,6 +30,10 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// event constants // event constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -214,6 +218,8 @@ bool MyApp::OnInit()
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
{ {
SetIcon(wxICON(sample));
// init members // init members
m_nPush = 0; m_nPush = 0;

View File

@@ -39,6 +39,10 @@
#include "griddemo.h" #include "griddemo.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxWin macros // wxWin macros
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -148,6 +152,8 @@ GridFrame::GridFrame()
wxDefaultPosition, wxDefaultPosition,
wxDefaultSize ) wxDefaultSize )
{ {
SetIcon(wxICON(sample));
wxMenu *fileMenu = new wxMenu; wxMenu *fileMenu = new wxMenu;
fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V")); fileMenu->Append( ID_VTABLE, _T("&Virtual table test\tCtrl-V"));
fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B")); fileMenu->Append( ID_BUGS_TABLE, _T("&Bugs table test\tCtrl-B"));

View File

@@ -46,6 +46,9 @@
#include "canvas.h" #include "canvas.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ============================================================================ // ============================================================================
// declarations // declarations
@@ -575,6 +578,8 @@ MyFrame::MyFrame()
: wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxImage sample"), : wxFrame( (wxFrame *)NULL, wxID_ANY, _T("wxImage sample"),
wxPoint(20, 20), wxSize(950, 700) ) wxPoint(20, 20), wxSize(950, 700) )
{ {
SetIcon(wxICON(sample));
wxMenuBar *menu_bar = new wxMenuBar(); wxMenuBar *menu_bar = new wxMenuBar();
wxMenu *menuImage = new wxMenu; wxMenu *menuImage = new wxMenu;

View File

@@ -18,6 +18,9 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// Define a new frame type: this is going to be our main frame // Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame class MyFrame : public wxFrame
@@ -77,6 +80,8 @@ MyFrame::MyFrame(const wxString& title)
m_inputWin(NULL), m_inputWin(NULL),
m_skip(true) m_skip(true)
{ {
SetIcon(wxICON(sample));
// IDs for menu items // IDs for menu items
enum enum
{ {

View File

@@ -34,6 +34,11 @@
#include "layout.h" #include "layout.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// MyApp // MyApp
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -76,6 +81,8 @@ MyFrame::MyFrame()
wxPoint(30,30), wxDefaultSize, wxPoint(30,30), wxDefaultSize,
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{ {
SetIcon(wxICON(sample));
// Make a menubar // Make a menubar
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;

View File

@@ -67,6 +67,10 @@
#include "wx/filename.h" //For wxFileName::GetName() #include "wx/filename.h" //For wxFileName::GetName()
#include "wx/config.h" //for native wxConfig #include "wx/config.h" //for native wxConfig
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Bail out if the user doesn't want one of the // Bail out if the user doesn't want one of the
// things we need // things we need
@@ -481,6 +485,8 @@ void wxMediaPlayerApp::MacOpenFile(const wxString & fileName )
wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title) wxMediaPlayerFrame::wxMediaPlayerFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600,600)) : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600,600))
{ {
SetIcon(wxICON(sample));
// //
// Create Menus // Create Menus
// //

View File

@@ -59,6 +59,10 @@
#include "copy.xpm" #include "copy.xpm"
#endif #endif
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// classes // classes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -371,6 +375,8 @@ bool MyApp::OnInit()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame((wxFrame *)NULL, wxID_ANY, _T("wxWidgets menu sample")) : wxFrame((wxFrame *)NULL, wxID_ANY, _T("wxWidgets menu sample"))
{ {
SetIcon(wxICON(sample));
#if USE_LOG_WINDOW #if USE_LOG_WINDOW
m_textctrl = NULL; m_textctrl = NULL;
#endif #endif

View File

@@ -24,10 +24,17 @@
#error Sorry, this sample is only appropriate under Windows. #error Sorry, this sample is only appropriate under Windows.
#endif #endif
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
#include <ctype.h> #include <ctype.h>
#include "nativdlg.h" #include "nativdlg.h"
#include "resource.h" #include "resource.h"
IMPLEMENT_APP(MyApp) IMPLEMENT_APP(MyApp)
bool MyApp::OnInit(void) bool MyApp::OnInit(void)
@@ -75,6 +82,8 @@ END_EVENT_TABLE()
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size): MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size):
wxFrame(parent, id, title, pos, size) wxFrame(parent, id, title, pos, size)
{ {
SetIcon(wxICON(sample));
panel = NULL; panel = NULL;
} }

View File

@@ -68,6 +68,9 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
// wxSampleMultiButtonEditor // wxSampleMultiButtonEditor
@@ -2062,6 +2065,8 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
(wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION| (wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCAPTION|
wxTAB_TRAVERSAL|wxCLOSE_BOX|wxNO_FULL_REPAINT_ON_RESIZE) ) wxTAB_TRAVERSAL|wxCLOSE_BOX|wxNO_FULL_REPAINT_ON_RESIZE) )
{ {
SetIcon(wxICON(sample));
m_propGrid = NULL; m_propGrid = NULL;
m_panel = NULL; m_panel = NULL;

View File

@@ -22,6 +22,10 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/tglbtn.h" #include "wx/tglbtn.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// a trivial example // a trivial example
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -854,6 +858,8 @@ END_EVENT_TABLE()
MyFrame::MyFrame() MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "wxWidgets scroll sample") : wxFrame(NULL, wxID_ANY, "wxWidgets scroll sample")
{ {
SetIcon(wxICON(sample));
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(wxID_ABOUT, "&About.."); menuFile->Append(wxID_ABOUT, "&About..");
menuFile->AppendSeparator(); menuFile->AppendSeparator();

View File

@@ -40,6 +40,9 @@
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/image.h" #include "wx/image.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
@@ -246,6 +249,8 @@ MainFrame::MainFrame()
: wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample", : wxFrame(NULL, wxID_ANY, "wxWidgets Shaped Sample",
wxDefaultPosition, wxSize(200, 100)) wxDefaultPosition, wxSize(200, 100))
{ {
SetIcon(wxICON(sample));
wxMenuBar * const mbar = new wxMenuBar; wxMenuBar * const mbar = new wxMenuBar;
wxMenu * const menuFrames = new wxMenu; wxMenu * const menuFrames = new wxMenu;
menuFrames->Append(Show_Shaped, "Show &shaped window\tCtrl-S"); menuFrames->Append(Show_Shaped, "Show &shaped window\tCtrl-S");

View File

@@ -39,6 +39,10 @@
#include "wx/splitter.h" #include "wx/splitter.h"
#include "wx/dcmirror.h" #include "wx/dcmirror.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -197,6 +201,8 @@ MyFrame::MyFrame()
wxDefaultPosition, wxSize(420, 300), wxDefaultPosition, wxSize(420, 300),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{ {
SetIcon(wxICON(sample));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR

View File

@@ -49,6 +49,10 @@
#include "wx/datetime.h" #include "wx/datetime.h"
#include "wx/numdlg.h" #include "wx/numdlg.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// define this for the platforms which don't support wxBitmapButton (such as // define this for the platforms which don't support wxBitmapButton (such as
// Motif), else a wxBitmapButton will be used // Motif), else a wxBitmapButton will be used
@@ -312,6 +316,8 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxWindow *)NULL, wxID_ANY, title, pos, size) : wxFrame((wxWindow *)NULL, wxID_ANY, title, pos, size)
#endif #endif
{ {
SetIcon(wxICON(sample));
m_statbarDefault = NULL; m_statbarDefault = NULL;
m_statbarCustom = NULL; m_statbarCustom = NULL;

View File

@@ -39,6 +39,9 @@
#include "edit.h" // Edit module #include "edit.h" // Edit module
#include "prefs.h" // Prefs #include "prefs.h" // Prefs
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// resources // resources
@@ -300,7 +303,9 @@ END_EVENT_TABLE ()
AppFrame::AppFrame (const wxString &title) AppFrame::AppFrame (const wxString &title)
: wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550), : wxFrame ((wxFrame *)NULL, wxID_ANY, title, wxDefaultPosition, wxSize(750,550),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE) { wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
SetIcon(wxICON(sample));
// intitialize important variables // intitialize important variables
m_edit = NULL; m_edit = NULL;

View File

@@ -39,6 +39,11 @@
#include "wx/notebook.h" #include "wx/notebook.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// constants // constants
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -189,6 +194,8 @@ MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, _T("TabOrder wxWidgets Sample"), : wxFrame(NULL, wxID_ANY, _T("TabOrder wxWidgets Sample"),
wxDefaultPosition, wxSize(700, 450)) wxDefaultPosition, wxSize(700, 450))
{ {
SetIcon(wxICON(sample));
wxMenu *menuFile = new wxMenu; wxMenu *menuFile = new wxMenu;
menuFile->Append(TabOrder_About); menuFile->Append(TabOrder_About);
menuFile->AppendSeparator(); menuFile->AppendSeparator();

View File

@@ -45,6 +45,10 @@
#include "wx/numdlg.h" #include "wx/numdlg.h"
#include "wx/tokenzr.h" #include "wx/tokenzr.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// class definitions // class definitions
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -1369,6 +1373,8 @@ END_EVENT_TABLE()
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h) MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) ) : wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
{ {
SetIcon(wxICON(sample));
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
CreateStatusBar(2); CreateStatusBar(2);
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR

View File

@@ -3,7 +3,7 @@
// Purpose: wxWidgets sample demonstrating wxWrapSizer use // Purpose: wxWidgets sample demonstrating wxWrapSizer use
// Author: Arne Steinarson // Author: Arne Steinarson
// Created: 21.01.2008 // Created: 21.01.2008
// RCS-ID: $Id:$ // RCS-ID: $Id$
// Copyright: (c) Arne Steinarson // Copyright: (c) Arne Steinarson
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -21,12 +21,76 @@
#include "wx/wrapsizer.h" #include "wx/wrapsizer.h"
#include "wx/artprov.h" #include "wx/artprov.h"
#ifndef __WXMSW__
#include "../sample.xpm"
#endif
// ----------------------------------------------------------------------------
// definitions
// ----------------------------------------------------------------------------
class WrapSizerFrame : public wxFrame class WrapSizerFrame : public wxFrame
{ {
public: public:
WrapSizerFrame() WrapSizerFrame();
private:
void OnButton(wxCommandEvent& WXUNUSED(event))
{
Close();
}
void AddToolBarButton(wxToolBar *tb,
const wxString& label,
const wxString& artid)
{
wxBitmap
bm = wxArtProvider::GetBitmap(artid, wxART_TOOLBAR, wxSize(16, 16));
tb->AddTool(wxID_ANY, label, bm);
}
wxToolBar *MakeToolBar()
{
wxToolBar *tb = new wxToolBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxTB_NODIVIDER);
AddToolBarButton(tb, "Help", wxART_HELP_BOOK);
tb->AddSeparator( );
AddToolBarButton(tb, "Open", wxART_FILE_OPEN);
tb->AddSeparator( );
AddToolBarButton(tb, "Up", wxART_GO_DIR_UP);
AddToolBarButton(tb, "Execute", wxART_EXECUTABLE_FILE);
tb->Realize( );
return tb;
}
};
class WrapSizerApp : public wxApp
{
public:
WrapSizerApp() {}
virtual bool OnInit()
{
new WrapSizerFrame;
return true;
}
};
IMPLEMENT_APP(WrapSizerApp);
// ----------------------------------------------------------------------------
// WrapSizerFrame
// ----------------------------------------------------------------------------
WrapSizerFrame::WrapSizerFrame()
: wxFrame(NULL, wxID_ANY, "wxWrapSizer Sample") : wxFrame(NULL, wxID_ANY, "wxWrapSizer Sample")
{ {
SetIcon(wxICON(sample));
// Root sizer, vertical // Root sizer, vertical
wxSizer * const sizerRoot = new wxBoxSizer(wxVERTICAL); wxSizer * const sizerRoot = new wxBoxSizer(wxVERTICAL);
@@ -86,50 +150,3 @@ public:
Show(); Show();
} }
private:
void OnButton(wxCommandEvent& WXUNUSED(event))
{
Close();
}
void AddToolBarButton(wxToolBar *tb,
const wxString& label,
const wxString& artid)
{
wxBitmap
bm = wxArtProvider::GetBitmap(artid, wxART_TOOLBAR, wxSize(16, 16));
tb->AddTool(wxID_ANY, label, bm);
}
wxToolBar *MakeToolBar()
{
wxToolBar *tb = new wxToolBar(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxTB_NODIVIDER);
AddToolBarButton(tb, "Help", wxART_HELP_BOOK);
tb->AddSeparator( );
AddToolBarButton(tb, "Open", wxART_FILE_OPEN);
tb->AddSeparator( );
AddToolBarButton(tb, "Up", wxART_GO_DIR_UP);
AddToolBarButton(tb, "Execute", wxART_EXECUTABLE_FILE);
tb->Realize( );
return tb;
}
};
class WrapSizerApp : public wxApp
{
public:
WrapSizerApp() {}
virtual bool OnInit()
{
new WrapSizerFrame;
return true;
}
};
IMPLEMENT_APP(WrapSizerApp);