From dacaa6f142afa4cc4e56457b8fc776d502852ab8 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 11 Dec 2003 11:25:46 +0000 Subject: [PATCH] Applied patch [ 846809 ] Cleaning of 11 samples git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/drawing/drawing.cpp | 4 ++-- samples/internat/internat.cpp | 3 +-- samples/keyboard/keyboard.cpp | 2 +- samples/listbox/lboxtest.cpp | 11 ++++------ samples/mobile/wxedit/wxedit.cpp | 36 ++++++++++++++++++++------------ samples/notebook/notebook.cpp | 4 +--- samples/treectrl/treetest.cpp | 3 +++ samples/typetest/typetest.cpp | 11 +++++----- samples/vscroll/vstest.cpp | 1 + samples/widgets/checkbox.cpp | 4 ++-- samples/widgets/radiobox.cpp | 4 +++- samples/wxtest/test_wdr.h | 1 - 12 files changed, 46 insertions(+), 38 deletions(-) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index 8287997293..bf43a853b0 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -150,7 +150,7 @@ public: void OnPaint(wxPaintEvent &event); void OnMouseMove(wxMouseEvent &event); - void Show(ScreenToShow show) { m_show = show; Refresh(); } + void ToShow(ScreenToShow show) { m_show = show; Refresh(); } // set or remove the clipping region void Clip(bool clip) { m_clip = clip; Refresh(); } @@ -1141,7 +1141,7 @@ void MyFrame::OnClip(wxCommandEvent& event) void MyFrame::OnShow(wxCommandEvent& event) { - m_canvas->Show((ScreenToShow)(event.GetId() - MenuShow_First)); + m_canvas->ToShow((ScreenToShow)(event.GetId() - MenuShow_First)); } void MyFrame::OnOption(wxCommandEvent& event) diff --git a/samples/internat/internat.cpp b/samples/internat/internat.cpp index 71304b917d..ba105e911c 100644 --- a/samples/internat/internat.cpp +++ b/samples/internat/internat.cpp @@ -337,8 +337,7 @@ void MyFrame::OnTest2(wxCommandEvent& WXUNUSED(event)) { const wxChar* title = _("Testing _N() (ngettext)"); wxTextEntryDialog d(this, - _("Please enter range for plural forms of \"n files deleted\"" - "phrase"), + _("Please enter range for plural forms of \"n files deleted\" phrase"), title, _T("0-10")); if (d.ShowModal() == wxID_OK) { diff --git a/samples/keyboard/keyboard.cpp b/samples/keyboard/keyboard.cpp index 29cc5abb96..ae4b8022e5 100644 --- a/samples/keyboard/keyboard.cpp +++ b/samples/keyboard/keyboard.cpp @@ -352,7 +352,7 @@ void MyFrame::OnSize(wxSizeEvent& WXUNUSED(event)) void TextWindow::LogEvent(const wxChar *name, wxKeyEvent& event) { wxString key; - long keycode = event.KeyCode(); + long keycode = event.GetKeyCode(); switch ( keycode ) { case WXK_BACK: key = _T("BACK"); break; diff --git a/samples/listbox/lboxtest.cpp b/samples/listbox/lboxtest.cpp index 2e38ba5d72..df14dbd815 100644 --- a/samples/listbox/lboxtest.cpp +++ b/samples/listbox/lboxtest.cpp @@ -38,6 +38,7 @@ // for all others, include the necessary headers #ifndef WX_PRECOMP + #include "wx/wx.h" #include "wx/app.h" #include "wx/frame.h" #include "wx/dcclient.h" @@ -257,11 +258,6 @@ private: IMPLEMENT_APP(LboxTestApp) -#ifdef __WXUNIVERSAL__ - WX_USE_THEME(win32); - WX_USE_THEME(gtk); -#endif // __WXUNIVERSAL__ - // ---------------------------------------------------------------------------- // event tables // ---------------------------------------------------------------------------- @@ -670,14 +666,15 @@ void LboxTestFrame::OnUpdateUIAddSeveral(wxUpdateUIEvent& event) void LboxTestFrame::OnListbox(wxCommandEvent& event) { int sel = event.GetInt(); - m_textDelete->SetValue(wxString::Format(_T("%ld"), sel)); + m_textDelete->SetValue(wxString::Format(_T("%d"), sel)); wxLogMessage(_T("Listbox item %d selected"), sel); } void LboxTestFrame::OnListboxDClick(wxCommandEvent& event) { - wxLogMessage(_T("Listbox item %d double clicked"), event.GetInt()); + int sel = event.GetInt(); + wxLogMessage(_T("Listbox item %d double clicked"), sel); } void LboxTestFrame::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/mobile/wxedit/wxedit.cpp b/samples/mobile/wxedit/wxedit.cpp index 5213691c09..5798973d77 100644 --- a/samples/mobile/wxedit/wxedit.cpp +++ b/samples/mobile/wxedit/wxedit.cpp @@ -152,19 +152,19 @@ void MyFrame::CreateMyMenuBar() SetMenuBar( menu_bar ); } -void MyFrame::OnCopy( wxCommandEvent &event ) +void MyFrame::OnCopy( wxCommandEvent& WXUNUSED(event) ) { } -void MyFrame::OnCut( wxCommandEvent &event ) +void MyFrame::OnCut( wxCommandEvent& WXUNUSED(event) ) { } -void MyFrame::OnPaste( wxCommandEvent &event ) +void MyFrame::OnPaste( wxCommandEvent& WXUNUSED(event) ) { } -void MyFrame::OnDelete( wxCommandEvent &event ) +void MyFrame::OnDelete( wxCommandEvent& WXUNUSED(event) ) { } @@ -177,17 +177,27 @@ void MyFrame::OnLastFiles( wxCommandEvent &event ) size_t index = event.GetId() - ID_LAST_1; - wxASSERT( index < m_history.GetCount() ); - + if( index < m_history.GetCount() ) + { m_filename = m_history[index]; m_text->Clear(); m_text->LoadFile( m_filename ); SetStatusText( m_filename ); + } + else + { + wxMessageBox( + _T("This entry is empty. It should be filled once you will start opening."), + _T("Empty entry"), + wxOK | wxICON_INFORMATION, + this + ); + } } -void MyFrame::OnNew( wxCommandEvent &event ) +void MyFrame::OnNew( wxCommandEvent& WXUNUSED(event) ) { if (!Discard()) return; @@ -201,7 +211,7 @@ void MyFrame::OnNew( wxCommandEvent &event ) SetStatusText( _T("") ); } -void MyFrame::OnOpen( wxCommandEvent &event ) +void MyFrame::OnOpen( wxCommandEvent& WXUNUSED(event) ) { if (!Discard()) return; @@ -246,12 +256,12 @@ void MyFrame::OnOpen( wxCommandEvent &event ) } } -void MyFrame::OnSave( wxCommandEvent &event ) +void MyFrame::OnSave( wxCommandEvent& WXUNUSED(event) ) { Save(); } -void MyFrame::OnSaveAs( wxCommandEvent &event ) +void MyFrame::OnSaveAs( wxCommandEvent& WXUNUSED(event) ) { wxFileDialog dialog( this, _T("Open text"), _T(""), _T(""), _T("Text file (*.txt)|*.txt|Any file (*)|*"), @@ -265,14 +275,14 @@ void MyFrame::OnSaveAs( wxCommandEvent &event ) } } -void MyFrame::OnAbout( wxCommandEvent &event ) +void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) { wxMessageDialog dialog( this, _T("Welcome to wxEdit\n(C)opyright Robert Roebling"), _T("About wxEdit"), wxOK|wxICON_INFORMATION ); dialog.ShowModal(); } -void MyFrame::OnQuit( wxCommandEvent &event ) +void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) { Close( TRUE ); } @@ -340,7 +350,7 @@ void MyFrame::OnUpdateUI( wxUpdateUIEvent &event ) } } -void MyFrame::OnCloseWindow( wxCloseEvent &event ) +void MyFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) ) { // Save changes? if (!Discard()) return; diff --git a/samples/notebook/notebook.cpp b/samples/notebook/notebook.cpp index ab4506cbd7..01ed0558dd 100644 --- a/samples/notebook/notebook.cpp +++ b/samples/notebook/notebook.cpp @@ -161,11 +161,9 @@ wxPanel *MyNotebook::CreateInsertPage() void MyNotebook::CreateInitialPages() { - wxPanel *panel = (wxPanel *) NULL; - // Create and add some panels to the notebook - panel = CreateRadioButtonsPage(); + wxPanel *panel = CreateRadioButtonsPage(); AddPage( panel, RADIOBUTTONS_PAGE_NAME, FALSE, GetIconIndex() ); panel = CreateVetoPage(); diff --git a/samples/treectrl/treetest.cpp b/samples/treectrl/treetest.cpp index 270161f9ca..13ba5b3b37 100644 --- a/samples/treectrl/treetest.cpp +++ b/samples/treectrl/treetest.cpp @@ -46,7 +46,10 @@ #include "icon3.xpm" #include "icon4.xpm" #include "icon5.xpm" + +#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) #include "mondrian.xpm" +#endif // verify that the item is ok and insult the user if it is not diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 8ee42c8455..695f8fec2b 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -728,7 +728,6 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("\nTesting Ungetch():\n\n") ); char ch = 0; - size_t pos = 0; wxString str; textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") ); @@ -744,7 +743,7 @@ void MyApp::DoStreamDemo6(wxCommandEvent& WXUNUSED(event)) wxFileInputStream file_input( wxString(_T("test_wx.dat")) ); ch = file_input.GetC(); - pos = file_input.TellI(); + size_t pos = file_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); @@ -808,7 +807,6 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event)) textCtrl.WriteText( _T("\nTesting Ungetch() in buffered input stream:\n\n") ); char ch = 0; - size_t pos = 0; wxString str; textCtrl.WriteText( _T("Writing number 0 to 9 to wxFileOutputStream...\n\n") ); @@ -825,7 +823,7 @@ void MyApp::DoStreamDemo7(wxCommandEvent& WXUNUSED(event)) wxBufferedInputStream buf_input( file_input ); ch = buf_input.GetC(); - pos = buf_input.TellI(); + size_t pos = buf_input.TellI(); str.Printf( wxT("Read char: %d. Now at position %d\n\n"), (int) ch, (int) pos ); textCtrl.WriteText( str ); @@ -977,10 +975,11 @@ void MyApp::DoByteOrderDemo(wxCommandEvent& WXUNUSED(event)) textCtrl.Clear(); textCtrl << _T("\nTest byte order macros:\n\n"); - if (wxBYTE_ORDER == wxLITTLE_ENDIAN) + #if wxBYTE_ORDER == wxLITTLE_ENDIAN textCtrl << _T("This is a little endian system.\n\n"); - else + #else textCtrl << _T("This is a big endian system.\n\n"); + #endif wxString text; diff --git a/samples/vscroll/vstest.cpp b/samples/vscroll/vstest.cpp index 378fe4cebc..d5e9b9a263 100644 --- a/samples/vscroll/vstest.cpp +++ b/samples/vscroll/vstest.cpp @@ -27,6 +27,7 @@ // for all others, include the necessary headers (this file is usually all you // need because it includes almost all "standard" wxWindows headers) #ifndef WX_PRECOMP + #include "wx/wx.h" #include "wx/app.h" #include "wx/frame.h" #endif diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index fe14ea9657..4cd2da6f66 100644 --- a/samples/widgets/checkbox.cpp +++ b/samples/widgets/checkbox.cpp @@ -148,8 +148,8 @@ void CheckBoxWidgetsPage::OnCheckBox(wxCommandEvent& event) }; wxCheckBoxState state = (wxCheckBoxState) event.GetInt(); - wxCHECK_RET( (state >= 0) && (state < WXSIZEOF(stateNames)), - "event.GetInt() returned an invalid wxCheckBoxState" ); + wxCHECK_RET( (state >= (wxCheckBoxState)0) && (state < (wxCheckBoxState)WXSIZEOF(stateNames)), + _T("event.GetInt() returned an invalid wxCheckBoxState") ); wxLogMessage(wxT("Checkbox now set to state: %s"), stateNames[state].c_str()); diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index 612c3fe515..4967b10661 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -384,10 +384,12 @@ void RadioWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) void RadioWidgetsPage::OnRadioBox(wxCommandEvent& event) { int sel = m_radio->GetSelection(); + int event_sel = event.GetSelection(); + wxUnusedVar(event_sel); wxLogMessage(_T("Radiobox selection changed, now %d"), sel); - wxASSERT_MSG( sel == event.GetSelection(), + wxASSERT_MSG( sel == event_sel, _T("selection should be the same in event and radiobox") ); m_textCurSel->SetValue(wxString::Format(_T("%d"), sel)); diff --git a/samples/wxtest/test_wdr.h b/samples/wxtest/test_wdr.h index 352fe7a4ef..f45b301ca1 100644 --- a/samples/wxtest/test_wdr.h +++ b/samples/wxtest/test_wdr.h @@ -24,7 +24,6 @@ #include #include #include -#include // Declare window functions