From 2f6c54eb076d760cbb6fb15e899f15fbbd575850 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Mar 2002 14:16:03 +0000 Subject: [PATCH] patch from Dimitri fixing a few memory leaks and unTABbing the sources git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/db/dbtest.cpp | 2 +- samples/db/dbtest.h | 10 +- samples/db/listdb.cpp | 4 +- samples/docview/doc.cpp | 2 +- samples/docview/doc.h | 2 +- samples/docview/docview.cpp | 2 +- samples/docview/docview.h | 2 +- samples/docview/view.cpp | 2 +- samples/docview/view.h | 2 +- samples/docvwmdi/doc.cpp | 18 +- samples/docvwmdi/doc.h | 2 +- samples/docvwmdi/docview.cpp | 2 +- samples/docvwmdi/docview.h | 2 +- samples/docvwmdi/view.cpp | 2 +- samples/docvwmdi/view.h | 2 +- samples/dragimag/dragimag.cpp | 6 +- samples/erase/erase.cpp | 7 +- samples/grid/grid.cpp | 299 ++++++++++++---------- samples/html/help/help.cpp | 4 +- samples/html/printing/printing.cpp | 13 +- samples/image/image.cpp | 4 +- samples/ipc/client.cpp | 13 +- samples/ipc/client.h | 1 - samples/joytest/joytest.cpp | 4 +- samples/joytest/joytest.h | 2 +- samples/layout/layout.cpp | 2 +- samples/layout/layout.h | 2 +- samples/memcheck/memcheck.cpp | 2 +- samples/mfc/mfctest.cpp | 52 ++-- samples/mfc/mfctest.h | 16 +- samples/minifram/minifram.h | 2 +- samples/nativdlg/nativdlg.cpp | 12 +- samples/nativdlg/nativdlg.h | 2 +- samples/newgrid/griddemo.cpp | 32 +-- samples/oleauto/oleauto.cpp | 32 +-- samples/opengl/cube/cube.cpp | 6 +- samples/opengl/cube/cube.h | 2 +- samples/opengl/isosurf/isosurf.cpp | 88 +++---- samples/opengl/isosurf/isosurf.h | 2 +- samples/opengl/penguin/lw.cpp | 26 +- samples/opengl/penguin/penguin.cpp | 22 +- samples/opengl/penguin/penguin.h | 2 +- samples/png/pngdemo.cpp | 21 +- samples/png/pngdemo.h | 3 +- samples/proplist/proplist.cpp | 397 +++++++++++++++-------------- samples/proplist/proplist.h | 2 +- samples/resource/resource.cpp | 16 +- samples/resource/resource.h | 2 +- samples/samples.dsw | 2 +- samples/sashtest/sashtest.cpp | 6 +- samples/sashtest/sashtest.h | 2 +- samples/scrollsub/scrollsub.cpp | 20 +- samples/statbar/statbar.cpp | 2 +- samples/tab/tab.cpp | 2 +- samples/tab/tab.h | 2 +- samples/taskbar/tbtest.cpp | 2 +- samples/taskbar/tbtest.h | 4 +- samples/treelay/treelay.cpp | 13 +- samples/treelay/treelay.h | 5 +- samples/typetest/typetest.cpp | 2 +- samples/widgets/combobox.cpp | 6 +- samples/wizard/wizard.cpp | 6 +- 62 files changed, 645 insertions(+), 581 deletions(-) diff --git a/samples/db/dbtest.cpp b/samples/db/dbtest.cpp index 5b7ff2fa70..3abb6ffb0c 100644 --- a/samples/db/dbtest.cpp +++ b/samples/db/dbtest.cpp @@ -2871,7 +2871,7 @@ END_EVENT_TABLE() DbGridFrame::DbGridFrame(wxWindow *parent) : wxFrame (parent, -1, wxT("Database Table"), - wxDefaultPosition, wxSize(400, 325)) + wxDefaultPosition, wxSize(400, 325)) { initialized = FALSE; } diff --git a/samples/db/dbtest.h b/samples/db/dbtest.h index 4e19c5a3db..d20fd3d9b5 100644 --- a/samples/db/dbtest.h +++ b/samples/db/dbtest.h @@ -187,14 +187,14 @@ DECLARE_EVENT_TABLE() class DbGridFrame : public wxFrame { public: - bool initialized; + bool initialized; - DbGridFrame(wxWindow *parent); + DbGridFrame(wxWindow *parent); - void OnCloseWindow(wxCloseEvent& event); - bool Initialize(); + void OnCloseWindow(wxCloseEvent& event); + bool Initialize(); - DECLARE_EVENT_TABLE() + DECLARE_EVENT_TABLE() }; #endif diff --git a/samples/db/listdb.cpp b/samples/db/listdb.cpp index f60902a4e6..ccf40bebb6 100644 --- a/samples/db/listdb.cpp +++ b/samples/db/listdb.cpp @@ -190,7 +190,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName, widgetPtrsSet = TRUE; // Query the lookup table and display the result set - lookup = new Clookup(tableName, colName, pDb, defDir); + lookup = new Clookup(tableName, colName, pDb, defDir); if (!lookup) { wxMessageBox(wxT("Error allocating memory for 'Clookup'object."),wxT("Error...")); @@ -295,7 +295,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName, widgetPtrsSet = TRUE; // Query the lookup table and display the result set - lookup2 = new Clookup2(tableName, dispCol1, dispCol2, pDb, defDir); + lookup2 = new Clookup2(tableName, dispCol1, dispCol2, pDb, defDir); if (!lookup2) { wxMessageBox(wxT("Error allocating memory for 'Clookup2' object."),wxT("Error...")); diff --git a/samples/docview/doc.cpp b/samples/docview/doc.cpp index 725d39d685..da03ec3214 100644 --- a/samples/docview/doc.cpp +++ b/samples/docview/doc.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docview/doc.h b/samples/docview/doc.h index a843fc2f78..fde6be752a 100644 --- a/samples/docview/doc.h +++ b/samples/docview/doc.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docview/docview.cpp b/samples/docview/docview.cpp index 96661165e1..4282c81e64 100644 --- a/samples/docview/docview.cpp +++ b/samples/docview/docview.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docview/docview.h b/samples/docview/docview.h index 473e8b526e..d28a204e64 100644 --- a/samples/docview/docview.h +++ b/samples/docview/docview.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docview/view.cpp b/samples/docview/view.cpp index 06e35d3a84..9c89122f40 100644 --- a/samples/docview/view.cpp +++ b/samples/docview/view.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docview/view.h b/samples/docview/view.h index 950d8b6dcd..2826393da1 100644 --- a/samples/docview/view.h +++ b/samples/docview/view.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docvwmdi/doc.cpp b/samples/docvwmdi/doc.cpp index c5be85a308..5a327aefe3 100644 --- a/samples/docvwmdi/doc.cpp +++ b/samples/docvwmdi/doc.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -163,8 +163,8 @@ wxSTD ostream& DoodleSegment::SaveObject(wxSTD ostream& stream) DoodleLine *line = (DoodleLine *)node->Data(); stream << line->x1 << " " << line->y1 << " " << - line->x2 << " " << - line->y2 << "\n"; + line->x2 << " " << + line->y2 << "\n"; node = node->Next(); } @@ -184,8 +184,8 @@ wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream) DoodleLine *line = (DoodleLine *)node->Data(); text_stream << line->x1 << " " << line->y1 << " " << - line->x2 << " " << - line->y2 << "\n"; + line->x2 << " " << + line->y2 << "\n"; node = node->Next(); } @@ -204,8 +204,8 @@ wxSTD istream& DoodleSegment::LoadObject(wxSTD istream& stream) DoodleLine *line = new DoodleLine; stream >> line->x1 >> line->y1 >> - line->x2 >> - line->y2; + line->x2 >> + line->y2; lines.Append(line); } @@ -224,8 +224,8 @@ wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream) DoodleLine *line = new DoodleLine; text_stream >> line->x1 >> line->y1 >> - line->x2 >> - line->y2; + line->x2 >> + line->y2; lines.Append(line); } diff --git a/samples/docvwmdi/doc.h b/samples/docvwmdi/doc.h index 9440f374e0..54a233fed1 100644 --- a/samples/docvwmdi/doc.h +++ b/samples/docvwmdi/doc.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docvwmdi/docview.cpp b/samples/docvwmdi/docview.cpp index 900f20cfdd..ab2f34640f 100644 --- a/samples/docvwmdi/docview.cpp +++ b/samples/docvwmdi/docview.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docvwmdi/docview.h b/samples/docvwmdi/docview.h index 937c6f0e54..3d0ad4274d 100644 --- a/samples/docvwmdi/docview.h +++ b/samples/docvwmdi/docview.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docvwmdi/view.cpp b/samples/docvwmdi/view.cpp index 5a41fff149..d359871f46 100644 --- a/samples/docvwmdi/view.cpp +++ b/samples/docvwmdi/view.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/docvwmdi/view.h b/samples/docvwmdi/view.h index f446349856..11f2ff6aed 100644 --- a/samples/docvwmdi/view.h +++ b/samples/docvwmdi/view.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/dragimag/dragimag.cpp b/samples/dragimag/dragimag.cpp index 7f169d5d1d..13a4f50085 100644 --- a/samples/dragimag/dragimag.cpp +++ b/samples/dragimag/dragimag.cpp @@ -394,9 +394,9 @@ bool MyApp::OnInit() { wxString filename; filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i); - /* For some reason under wxX11, the 2nd LoadFile in this loop fails, with - a BadMatch inside CreateFromImage (inside ConvertToBitmap). This happens even if you copy - the first file over the second file. */ + /* For some reason under wxX11, the 2nd LoadFile in this loop fails, with + a BadMatch inside CreateFromImage (inside ConvertToBitmap). This happens even if you copy + the first file over the second file. */ if (image.LoadFile(filename, wxBITMAP_TYPE_PNG)) { DragShape* newShape = new DragShape(image.ConvertToBitmap()); diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index ec15d7978e..9f159bbebc 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -195,13 +195,14 @@ void MyCanvas::OnPaint( wxPaintEvent &event ) wxSize client_size = GetClientSize(); wxLogDebug( "size %d %d client_size %d %d", size.x, size.y, client_size.x, client_size.y ); #endif - + + int i; dc.SetPen( *wxWHITE_PEN ); - for (int i = 0; i < 20; i += 2) + for (i = 0; i < 20; i += 2) dc.DrawLine( i,i, i+100,i ); dc.SetPen( *wxWHITE_PEN ); - for (int i = 200; i < 220; i += 2) + for (i = 200; i < 220; i += 2) dc.DrawLine( i-200,i, i-100,i ); wxRegion region( 110, 110, 80, 80 ); diff --git a/samples/grid/grid.cpp b/samples/grid/grid.cpp index 2e1d4544d2..3f37efaf5e 100644 --- a/samples/grid/grid.cpp +++ b/samples/grid/grid.cpp @@ -1,9 +1,9 @@ /* - * File: grid.cpp - * Purpose: wxGrid test - * Author: Julian Smart - * Created: 1995 - * Updated: + * File: grid.cpp + * Purpose: wxGrid test + * Author: Julian Smart + * Created: 1995 + * Updated: * Copyright: (c) 1995, AIAI, University of Edinburgh */ @@ -25,8 +25,10 @@ static const char sccsid[] = "%W% %G%"; // Define a new application type class MyApp: public wxApp -{ public: - bool OnInit(void); +{ +public: + virtual bool OnInit(void); + virtual int OnExit(); }; @@ -85,235 +87,258 @@ IMPLEMENT_APP(MyApp) bool MyApp::OnInit(void) { #ifdef __WXMSW__ - cellBitmap1 = new wxBitmap("bitmap1"); - cellBitmap2 = new wxBitmap("bitmap2"); + cellBitmap1 = new wxBitmap("bitmap1"); + cellBitmap2 = new wxBitmap("bitmap2"); #endif - // Create the main frame window - MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxGrid Sample", wxPoint(50, 50), wxSize(450, 300)); - - // Give it an icon + // Create the main frame window + MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxGrid Sample", wxPoint(50, 50), wxSize(450, 300)); + + // Give it an icon #ifdef __WXMSW__ - frame->SetIcon(wxIcon("mondrian")); + frame->SetIcon(wxIcon("mondrian")); #endif - // Make a menubar - wxMenu *file_menu = new wxMenu; - file_menu->Append(GRID_QUIT, "E&xit"); - - wxMenu *settings_menu = new wxMenu; - settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable"); - settings_menu->Append(GRID_TOGGLE_EDITINPLACE, "&Toggle edit in place"); - settings_menu->Append(GRID_TOGGLE_ROW_LABEL, "Toggle ro&w label"); - settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label"); - settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle ÷rs"); - settings_menu->AppendSeparator(); - settings_menu->Append(GRID_LEFT_CELL, "&Left cell alignment "); - settings_menu->Append(GRID_CENTRE_CELL, "&Centre cell alignment "); - settings_menu->Append(GRID_RIGHT_CELL, "&Right cell alignment "); - settings_menu->AppendSeparator(); - settings_menu->Append(GRID_COLOUR_LABEL_BACKGROUND, "Choose a label &background colour"); - settings_menu->Append(GRID_COLOUR_LABEL_TEXT, "Choose a label fore&ground colour"); - settings_menu->Append(GRID_NORMAL_LABEL_COLOURING, "&Normal label colouring"); - settings_menu->AppendSeparator(); - settings_menu->Append(GRID_COLOUR_CELL_BACKGROUND, "Choo&se a cell &background colour"); - settings_menu->Append(GRID_COLOUR_CELL_TEXT, "Choose &a cell foreground colour"); - settings_menu->Append(GRID_NORMAL_CELL_COLOURING, "N&ormal cell colouring"); - - wxMenuBar *menu_bar = new wxMenuBar; - menu_bar->Append(file_menu, "&File"); - menu_bar->Append(settings_menu, "&Settings"); - frame->SetMenuBar(menu_bar); - - // Make a grid - frame->grid = new wxGrid(frame, 0, 0, 400, 400); - - frame->grid->CreateGrid(10, 8); - frame->grid->SetColumnWidth(3, 200); - frame->grid->SetRowHeight(4, 45); - frame->grid->SetCellValue("First cell", 0, 0); - frame->grid->SetCellValue("Another cell", 1, 1); - frame->grid->SetCellValue("Yet another cell", 2, 2); - frame->grid->SetCellTextFont(wxFont(10, wxROMAN, wxITALIC, wxNORMAL), 0, 0); - frame->grid->SetCellTextColour(*wxRED, 1, 1); - frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2); - if (cellBitmap1 && cellBitmap2) - { - frame->grid->SetCellAlignment(wxCENTRE, 5, 0); - frame->grid->SetCellAlignment(wxCENTRE, 6, 0); - frame->grid->SetCellBitmap(cellBitmap1, 5, 0); - frame->grid->SetCellBitmap(cellBitmap2, 6, 0); - } - - frame->grid->UpdateDimensions(); - - // Show the frame - frame->Show(TRUE); - - SetTopWindow(frame); - return TRUE; + // Make a menubar + wxMenu *file_menu = new wxMenu; + file_menu->Append(GRID_QUIT, "E&xit"); + + wxMenu *settings_menu = new wxMenu; + settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable"); + settings_menu->Append(GRID_TOGGLE_EDITINPLACE, "&Toggle edit in place"); + settings_menu->Append(GRID_TOGGLE_ROW_LABEL, "Toggle ro&w label"); + settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label"); + settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle ÷rs"); + settings_menu->AppendSeparator(); + settings_menu->Append(GRID_LEFT_CELL, "&Left cell alignment "); + settings_menu->Append(GRID_CENTRE_CELL, "&Centre cell alignment "); + settings_menu->Append(GRID_RIGHT_CELL, "&Right cell alignment "); + settings_menu->AppendSeparator(); + settings_menu->Append(GRID_COLOUR_LABEL_BACKGROUND, "Choose a label &background colour"); + settings_menu->Append(GRID_COLOUR_LABEL_TEXT, "Choose a label fore&ground colour"); + settings_menu->Append(GRID_NORMAL_LABEL_COLOURING, "&Normal label colouring"); + settings_menu->AppendSeparator(); + settings_menu->Append(GRID_COLOUR_CELL_BACKGROUND, "Choo&se a cell &background colour"); + settings_menu->Append(GRID_COLOUR_CELL_TEXT, "Choose &a cell foreground colour"); + settings_menu->Append(GRID_NORMAL_CELL_COLOURING, "N&ormal cell colouring"); + + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + menu_bar->Append(settings_menu, "&Settings"); + frame->SetMenuBar(menu_bar); + + // Make a grid + frame->grid = new wxGrid(frame, 0, 0, 400, 400); + + frame->grid->CreateGrid(10, 8); + frame->grid->SetColumnWidth(3, 200); + frame->grid->SetRowHeight(4, 45); + frame->grid->SetCellValue("First cell", 0, 0); + frame->grid->SetCellValue("Another cell", 1, 1); + frame->grid->SetCellValue("Yet another cell", 2, 2); + frame->grid->SetCellTextFont(wxFont(10, wxROMAN, wxITALIC, wxNORMAL), 0, 0); + frame->grid->SetCellTextColour(*wxRED, 1, 1); + frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2); + if (cellBitmap1 && cellBitmap2) + { + frame->grid->SetCellAlignment(wxCENTRE, 5, 0); + frame->grid->SetCellAlignment(wxCENTRE, 6, 0); + frame->grid->SetCellBitmap(cellBitmap1, 5, 0); + frame->grid->SetCellBitmap(cellBitmap2, 6, 0); + } + + frame->grid->UpdateDimensions(); + + // Show the frame + frame->Show(TRUE); + + SetTopWindow(frame); + return TRUE; +} + +int MyApp::OnExit() +{ + if (cellBitmap1) + { + delete cellBitmap1; + cellBitmap1 = (wxBitmap *) NULL; + } + + if (cellBitmap2) + { + delete cellBitmap2; + cellBitmap1 = (wxBitmap *) NULL; + } + + // exit code is 0, everything is ok + return 0; } + // My frame constructor -MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size): - wxFrame(frame, -1, title, pos, size) +MyFrame::MyFrame(wxFrame *frame, const wxString& title, + const wxPoint& pos, const wxSize& size): + wxFrame(frame, -1, title, pos, size) { - grid = (wxGrid*) NULL; + grid = (wxGrid*) NULL; } BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable) - EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace) - EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel) - EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel) - EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers) - EVT_MENU(GRID_LEFT_CELL, MyFrame::LeftCell) - EVT_MENU(GRID_CENTRE_CELL, MyFrame::CentreCell) - EVT_MENU(GRID_RIGHT_CELL, MyFrame::RightCell) - EVT_MENU(GRID_COLOUR_LABEL_BACKGROUND, MyFrame::ColourLabelBackground) - EVT_MENU(GRID_COLOUR_LABEL_TEXT, MyFrame::ColourLabelText) - EVT_MENU(GRID_NORMAL_LABEL_COLOURING, MyFrame::NormalLabelColouring) - EVT_MENU(GRID_COLOUR_CELL_BACKGROUND, MyFrame::ColourCellBackground) - EVT_MENU(GRID_COLOUR_CELL_TEXT, MyFrame::ColourCellText) - EVT_MENU(GRID_NORMAL_CELL_COLOURING, MyFrame::NormalCellColouring) - EVT_MENU(GRID_QUIT, MyFrame::Quit) + EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable) + EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace) + EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel) + EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel) + EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers) + EVT_MENU(GRID_LEFT_CELL, MyFrame::LeftCell) + EVT_MENU(GRID_CENTRE_CELL, MyFrame::CentreCell) + EVT_MENU(GRID_RIGHT_CELL, MyFrame::RightCell) + EVT_MENU(GRID_COLOUR_LABEL_BACKGROUND, MyFrame::ColourLabelBackground) + EVT_MENU(GRID_COLOUR_LABEL_TEXT, MyFrame::ColourLabelText) + EVT_MENU(GRID_NORMAL_LABEL_COLOURING, MyFrame::NormalLabelColouring) + EVT_MENU(GRID_COLOUR_CELL_BACKGROUND, MyFrame::ColourCellBackground) + EVT_MENU(GRID_COLOUR_CELL_TEXT, MyFrame::ColourCellText) + EVT_MENU(GRID_NORMAL_CELL_COLOURING, MyFrame::NormalCellColouring) + EVT_MENU(GRID_QUIT, MyFrame::Quit) END_EVENT_TABLE() void MyFrame::ToggleEditable(wxCommandEvent& WXUNUSED(event)) { - grid->SetEditable(!grid->GetEditable()); - grid->Refresh(); + grid->SetEditable(!grid->GetEditable()); + grid->Refresh(); } void MyFrame::ToggleEditInPlace(wxCommandEvent& WXUNUSED(event)) { - grid->SetEditInPlace(!grid->GetEditInPlace()); - grid->Refresh(); + grid->SetEditInPlace(!grid->GetEditInPlace()); + grid->Refresh(); } void MyFrame::ToggleRowLabel(wxCommandEvent& WXUNUSED(event)) { - if (grid->GetLabelSize(wxVERTICAL) > 0) + if (grid->GetLabelSize(wxVERTICAL) > 0) grid->SetLabelSize(wxVERTICAL, 0); - else + else grid->SetLabelSize(wxVERTICAL, 40); - grid->Refresh(); + + grid->Refresh(); } void MyFrame::ToggleColLabel(wxCommandEvent& WXUNUSED(event)) { - if (grid->GetLabelSize(wxHORIZONTAL) > 0) + if (grid->GetLabelSize(wxHORIZONTAL) > 0) grid->SetLabelSize(wxHORIZONTAL, 0); - else + else grid->SetLabelSize(wxHORIZONTAL, 20); + grid->Refresh(); } void MyFrame::ToggleDividers(wxCommandEvent& WXUNUSED(event)) { - if (!grid->GetDividerPen().Ok()) + if (!grid->GetDividerPen().Ok()) grid->SetDividerPen(wxPen(wxT("LIGHT GREY"), 1, wxSOLID)); - else + else grid->SetDividerPen(wxNullPen); - grid->Refresh(); + +grid->Refresh(); } void MyFrame::LeftCell(wxCommandEvent& WXUNUSED(event)) { - grid->SetCellAlignment(wxLEFT); - grid->Refresh(); + grid->SetCellAlignment(wxLEFT); + grid->Refresh(); } void MyFrame::CentreCell(wxCommandEvent& WXUNUSED(event)) { - grid->SetCellAlignment(wxCENTRE); - grid->Refresh(); + grid->SetCellAlignment(wxCENTRE); + grid->Refresh(); } void MyFrame::RightCell(wxCommandEvent& WXUNUSED(event)) { - grid->SetCellAlignment(wxRIGHT); - grid->Refresh(); + grid->SetCellAlignment(wxRIGHT); + grid->Refresh(); } void MyFrame::ColourLabelBackground(wxCommandEvent& WXUNUSED(event)) { - wxColourData data; - data.SetChooseFull(TRUE); - wxColourDialog dialog(this, &data); - if (dialog.ShowModal() != wxID_CANCEL) - { + wxColourData data; + data.SetChooseFull(TRUE); + wxColourDialog dialog(this, &data); + if (dialog.ShowModal() != wxID_CANCEL) + { wxColourData retData = dialog.GetColourData(); wxColour col = retData.GetColour(); grid->SetLabelBackgroundColour(col); grid->Refresh(); - } + } } void MyFrame::ColourLabelText(wxCommandEvent& WXUNUSED(event)) { - wxColourData data; - data.SetChooseFull(TRUE); - wxColourDialog dialog(this, &data); - if (dialog.ShowModal() != wxID_CANCEL) - { + wxColourData data; + data.SetChooseFull(TRUE); + wxColourDialog dialog(this, &data); + if (dialog.ShowModal() != wxID_CANCEL) + { wxColourData retData = dialog.GetColourData(); wxColour col = retData.GetColour(); grid->SetLabelTextColour(col); grid->Refresh(); - } + } } void MyFrame::NormalLabelColouring(wxCommandEvent& WXUNUSED(event)) { - grid->SetLabelBackgroundColour(*wxLIGHT_GREY); - grid->SetLabelTextColour(*wxBLACK); - grid->Refresh(); + grid->SetLabelBackgroundColour(*wxLIGHT_GREY); + grid->SetLabelTextColour(*wxBLACK); + grid->Refresh(); } void MyFrame::ColourCellBackground(wxCommandEvent& WXUNUSED(event)) { - wxColourData data; - data.SetChooseFull(TRUE); - wxColourDialog dialog(this, &data); - if (dialog.ShowModal() != wxID_CANCEL) - { + wxColourData data; + data.SetChooseFull(TRUE); + wxColourDialog dialog(this, &data); + if (dialog.ShowModal() != wxID_CANCEL) + { wxColourData retData = dialog.GetColourData(); wxColour col = retData.GetColour(); grid->SetCellBackgroundColour(col); grid->Refresh(); - } + } } void MyFrame::ColourCellText(wxCommandEvent& WXUNUSED(event)) { - wxColourData data; - data.SetChooseFull(TRUE); - wxColourDialog dialog(this, &data); - if (dialog.ShowModal() != wxID_CANCEL) - { + wxColourData data; + data.SetChooseFull(TRUE); + wxColourDialog dialog(this, &data); + if (dialog.ShowModal() != wxID_CANCEL) + { wxColourData retData = dialog.GetColourData(); wxColour col = retData.GetColour(); grid->SetCellTextColour(col); grid->Refresh(); - } + } } void MyFrame::NormalCellColouring(wxCommandEvent& WXUNUSED(event)) { - grid->SetCellBackgroundColour(*wxWHITE); - grid->SetCellTextColour(*wxBLACK); - grid->Refresh(); + grid->SetCellBackgroundColour(*wxWHITE); + grid->SetCellTextColour(*wxBLACK); + grid->Refresh(); } void MyFrame::Quit(wxCommandEvent& WXUNUSED(event)) { - this->Close(TRUE); + this->Close(TRUE); } // Ensure that the grid's edit control always has the focus. void MyFrame::OnActivate(wxActivateEvent& event) { - if (grid) grid->OnActivate(event.GetActive()); + if (grid) grid->OnActivate(event.GetActive()); } diff --git a/samples/html/help/help.cpp b/samples/html/help/help.cpp index 0cde485388..1c344c68f8 100644 --- a/samples/html/help/help.cpp +++ b/samples/html/help/help.cpp @@ -163,14 +163,14 @@ ret = help.AddBook("helpfiles/testing.hhp"); #endif if (! ret) - wxMessageBox("Failed adding book helpfiles/testing.hhp"); + wxMessageBox("Failed adding book helpfiles/testing.hhp"); #ifdef __WXMAC__ ret = help.AddBook(":helpfiles:another.hhp"); #else ret = help.AddBook("helpfiles/another.hhp"); #endif if (! ret) - wxMessageBox("Failed adding book helpfiles/another.hhp"); + wxMessageBox("Failed adding book helpfiles/another.hhp"); } diff --git a/samples/html/printing/printing.cpp b/samples/html/printing/printing.cpp index 4ccb47d74a..fe6db85c75 100644 --- a/samples/html/printing/printing.cpp +++ b/samples/html/printing/printing.cpp @@ -44,9 +44,10 @@ class MyApp : public wxApp class MyFrame : public wxFrame { public: - // ctor(s) + // ctor and dtor MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size); + virtual ~MyFrame(); // event handlers (these functions should _not_ be virtual) void OnQuit(wxCommandEvent& event); @@ -185,12 +186,18 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)
", wxPAGE_ALL); } +// frame destructor +MyFrame::~MyFrame() +{ + delete m_Prn; + m_Prn = (wxHtmlEasyPrinting *) NULL; +} + // event handlers void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - delete m_Prn; // TRUE is to force the frame to close Close(TRUE); } @@ -234,7 +241,7 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event)) { m_Name = dialog.GetPath(); m_Html -> LoadPage(m_Name); - m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)
", wxPAGE_ALL); + m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)
", wxPAGE_ALL); } } diff --git a/samples/image/image.cpp b/samples/image/image.cpp index 60dac7ff8d..d08a07585d 100644 --- a/samples/image/image.cpp +++ b/samples/image/image.cpp @@ -317,7 +317,8 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, #if wxUSE_GIF image.Destroy(); - if ( !image.LoadFile( dir + wxString("horse.gif")) ) + if ( !image.LoadFile( dir + wxString("horse.gif"))) + //if ( !image.LoadFile( wxString("\\slidbar.gif"), wxBITMAP_TYPE_GIF, -2) ) wxLogError(wxT("Can't load GIF image")); else my_horse_gif = new wxBitmap( image ); @@ -430,6 +431,7 @@ MyCanvas::~MyCanvas() delete my_horse_ico32; delete my_horse_ico16; delete my_horse_ico; + delete my_horse_cur; delete my_smile_xbm; delete my_square; delete my_anti; diff --git a/samples/ipc/client.cpp b/samples/ipc/client.cpp index a964af465d..a7255b2e44 100644 --- a/samples/ipc/client.cpp +++ b/samples/ipc/client.cpp @@ -60,7 +60,7 @@ char ipc_buffer[4000]; wxListBox *the_list = NULL; MyConnection *the_connection = NULL; -MyClient *my_client ; +MyClient *my_client; // ============================================================================ // implementation @@ -121,11 +121,17 @@ int MyApp::OnExit() if (the_connection) { the_connection->Disconnect(); + delete the_connection; + the_connection = NULL; } // will delete the connection too + // Update: Seems it didn't delete the_connection, because there's a leak. + // Deletion is now explicitly done a few lines up. delete my_client; + + return 0; } @@ -207,11 +213,6 @@ MyConnection::MyConnection() { } -MyConnection::~MyConnection() -{ - the_connection = NULL; -} - bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format) { if (the_list) diff --git a/samples/ipc/client.h b/samples/ipc/client.h index 8dcdc7dbe4..aae6609c41 100644 --- a/samples/ipc/client.h +++ b/samples/ipc/client.h @@ -38,7 +38,6 @@ class MyConnection: public wxConnection { public: MyConnection(); - ~MyConnection(); bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format); bool OnDisconnect(); diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index a073793928..189314b3a8 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -94,7 +94,7 @@ bool MyApp::OnInit(void) } BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) - EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent) + EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent) END_EVENT_TABLE() // Define a constructor for my canvas diff --git a/samples/joytest/joytest.h b/samples/joytest/joytest.h index 18a8a75e3c..9a08f6f5e3 100644 --- a/samples/joytest/joytest.h +++ b/samples/joytest/joytest.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // Define a new application diff --git a/samples/layout/layout.cpp b/samples/layout/layout.cpp index 7eb0a1fad8..c3bfb5e58d 100644 --- a/samples/layout/layout.cpp +++ b/samples/layout/layout.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". diff --git a/samples/layout/layout.h b/samples/layout/layout.h index dae135e135..eba0332e16 100644 --- a/samples/layout/layout.h +++ b/samples/layout/layout.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // Define a new application diff --git a/samples/memcheck/memcheck.cpp b/samples/memcheck/memcheck.cpp index 54712a16f4..750a8f1f69 100644 --- a/samples/memcheck/memcheck.cpp +++ b/samples/memcheck/memcheck.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/mfc/mfctest.cpp b/samples/mfc/mfctest.cpp index d50d963470..7121cc136c 100644 --- a/samples/mfc/mfctest.cpp +++ b/samples/mfc/mfctest.cpp @@ -134,9 +134,9 @@ IMPLEMENT_APP(MyApp) // CMainWindow::CMainWindow() { - LoadAccelTable( "MainAccelTable" ); - Create( NULL, "Hello Foundation Application", - WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" ); + LoadAccelTable( "MainAccelTable" ); + Create( NULL, "Hello Foundation Application", + WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" ); } // OnPaint: @@ -148,16 +148,16 @@ CMainWindow::CMainWindow() // void CMainWindow::OnPaint() { - CString s = "Hello, Windows!"; - CPaintDC dc( this ); - CRect rect; - - GetClientRect( rect ); - dc.SetTextAlign( TA_BASELINE | TA_CENTER ); - dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) ); - dc.SetBkMode(TRANSPARENT); - dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ), - s, s.GetLength() ); + CString s = "Hello, Windows!"; + CPaintDC dc( this ); + CRect rect; + + GetClientRect( rect ); + dc.SetTextAlign( TA_BASELINE | TA_CENTER ); + dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) ); + dc.SetBkMode(TRANSPARENT); + dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ), + s, s.GetLength() ); } // OnAbout: @@ -170,8 +170,8 @@ void CMainWindow::OnPaint() // void CMainWindow::OnAbout() { - CDialog about( "AboutBox", this ); - about.DoModal(); + CDialog about( "AboutBox", this ); + about.DoModal(); } void CMainWindow::OnTest() @@ -190,11 +190,11 @@ void CMainWindow::OnTest() // receive no arguments and are void of return type, e.g., "void OnAbout()". // BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd ) - //{{AFX_MSG_MAP( CMainWindow ) - ON_WM_PAINT() - ON_COMMAND( IDM_ABOUT, OnAbout ) - ON_COMMAND( IDM_TEST, OnTest ) - //}}AFX_MSG_MAP + //{{AFX_MSG_MAP( CMainWindow ) + ON_WM_PAINT() + ON_COMMAND( IDM_ABOUT, OnAbout ) + ON_COMMAND( IDM_TEST, OnTest ) + //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// @@ -209,16 +209,16 @@ END_MESSAGE_MAP() // BOOL CTheApp::InitInstance() { - TRACE( "HELLO WORLD\n" ); + TRACE( "HELLO WORLD\n" ); - SetDialogBkColor(); // hook gray dialogs (was default in MFC V1) + SetDialogBkColor(); // hook gray dialogs (was default in MFC V1) wxEntry((WXHINSTANCE) m_hInstance, (WXHINSTANCE) m_hPrevInstance, m_lpCmdLine, m_nCmdShow, FALSE); /* - m_pMainWnd = new CMainWindow(); - m_pMainWnd->ShowWindow( m_nCmdShow ); - m_pMainWnd->UpdateWindow(); + m_pMainWnd = new CMainWindow(); + m_pMainWnd->ShowWindow( m_nCmdShow ); + m_pMainWnd->UpdateWindow(); */ if (wxTheApp && wxTheApp->GetTopWindow()) @@ -226,7 +226,7 @@ BOOL CTheApp::InitInstance() m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND()); } - return TRUE; + return TRUE; } int CTheApp::ExitInstance() diff --git a/samples/mfc/mfctest.h b/samples/mfc/mfctest.h index 038a08cad2..f95a27c03c 100644 --- a/samples/mfc/mfctest.h +++ b/samples/mfc/mfctest.h @@ -25,15 +25,15 @@ class CMainWindow : public CFrameWnd { public: - CMainWindow(); + CMainWindow(); - //{{AFX_MSG( CMainWindow ) - afx_msg void OnPaint(); - afx_msg void OnAbout(); - afx_msg void OnTest(); - //}}AFX_MSG + //{{AFX_MSG( CMainWindow ) + afx_msg void OnPaint(); + afx_msg void OnAbout(); + afx_msg void OnTest(); + //}}AFX_MSG - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; // A dummy CWnd pointing to a wxWindow's HWND @@ -52,7 +52,7 @@ class CDummyWindow: public CWnd class CTheApp : public CWinApp { public: - BOOL InitInstance(); + BOOL InitInstance(); int ExitInstance(); // Override this to provide wxWindows message loop diff --git a/samples/minifram/minifram.h b/samples/minifram/minifram.h index d71035f3d5..ea3c215c51 100644 --- a/samples/minifram/minifram.h +++ b/samples/minifram/minifram.h @@ -6,7 +6,7 @@ // Created: 23/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #include "wx/minifram.h" diff --git a/samples/nativdlg/nativdlg.cpp b/samples/nativdlg/nativdlg.cpp index 6d16c488af..764f619784 100644 --- a/samples/nativdlg/nativdlg.cpp +++ b/samples/nativdlg/nativdlg.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -76,8 +76,8 @@ bool MyApp::OnInit(void) } BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit) - EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1) + EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit) + EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1) END_EVENT_TABLE() // Define my frame constructor @@ -89,7 +89,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c void MyFrame::OnQuit(wxCommandEvent& event) { - Close(TRUE); + Close(TRUE); } void MyFrame::OnTest1(wxCommandEvent& event) @@ -109,8 +109,8 @@ void MyFrame::OnTest1(wxCommandEvent& event) } BEGIN_EVENT_TABLE(MyDialog, wxDialog) - EVT_BUTTON(wxID_OK, MyDialog::OnOk) - EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel) + EVT_BUTTON(wxID_OK, MyDialog::OnOk) + EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel) END_EVENT_TABLE() diff --git a/samples/nativdlg/nativdlg.h b/samples/nativdlg/nativdlg.h index 5bc20575c2..f82f2e1b4b 100644 --- a/samples/nativdlg/nativdlg.h +++ b/samples/nativdlg/nativdlg.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index 28c51cd7f1..c93a563918 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -30,10 +30,11 @@ #ifndef WX_PRECOMP #include "wx/wx.h" - #include "wx/colordlg.h" - #include "wx/fontdlg.h" #endif +#include "wx/colordlg.h" +#include "wx/fontdlg.h" + #include "wx/grid.h" #include "wx/generic/gridctrl.h" @@ -599,8 +600,8 @@ void GridFrame::DeleteSelectedRows( wxCommandEvent& WXUNUSED(ev) ) for ( int n = 0; n < grid->GetNumberRows(); ) if ( grid->IsInSelection( n , 0 ) ) grid->DeleteRows( n, 1 ); - else - n++; + else + n++; grid->EndBatch(); } } @@ -614,8 +615,8 @@ void GridFrame::DeleteSelectedCols( wxCommandEvent& WXUNUSED(ev) ) for ( int n = 0; n < grid->GetNumberCols(); ) if ( grid->IsInSelection( 0 , n ) ) grid->DeleteCols( n, 1 ); - else - n++; + else + n++; grid->EndBatch(); } } @@ -823,14 +824,13 @@ void GridFrame::OnEditorShown( wxGridEvent& ev ) if ( (ev.GetCol() == 4) && (ev.GetRow() == 0) && - (wxMessageBox(_T("Are you sure you wish to edit this cell"), - _T("Checking"),wxYES_NO) == wxNO ) ) { + (wxMessageBox(_T("Are you sure you wish to edit this cell"), + _T("Checking"),wxYES_NO) == wxNO ) ) { - ev.Veto(); - return; + ev.Veto(); + return; } - - + wxLogMessage( wxT("Cell editor shown.") ); ev.Skip(); @@ -841,11 +841,11 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev ) if ( (ev.GetCol() == 4) && (ev.GetRow() == 0) && - (wxMessageBox(_T("Are you sure you wish to finish editing this cell"), - _T("Checking"),wxYES_NO) == wxNO ) ) { + (wxMessageBox(_T("Are you sure you wish to finish editing this cell"), + _T("Checking"),wxYES_NO) == wxNO ) ) { - ev.Veto(); - return; + ev.Veto(); + return; } wxLogMessage( wxT("Cell editor hidden.") ); diff --git a/samples/oleauto/oleauto.cpp b/samples/oleauto/oleauto.cpp index d50c7ecd4b..0eb9238629 100644 --- a/samples/oleauto/oleauto.cpp +++ b/samples/oleauto/oleauto.cpp @@ -201,26 +201,26 @@ void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event)) { wxMessageBox("Please ensure Excel is running, then press OK.\nThe active cell should then say 'wxWindows automation test!' in bold."); - wxAutomationObject excelObject, rangeObject; - if (!excelObject.GetInstance("Excel.Application")) - { + wxAutomationObject excelObject, rangeObject; + if (!excelObject.GetInstance("Excel.Application")) + { if (!excelObject.CreateInstance("Excel.Application")) { - wxMessageBox("Could not create Excel object."); - return; + wxMessageBox("Could not create Excel object."); + return; } - } - if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!")) - { - wxMessageBox("Could not set active cell value."); - return; - } + } + if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!")) + { + wxMessageBox("Could not set active cell value."); + return; + } #ifdef HAVE_BOOL - if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant((bool) TRUE)) ) - { - wxMessageBox("Could not put Bold property to active cell."); - return; - } + if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant((bool) TRUE)) ) + { + wxMessageBox("Could not put Bold property to active cell."); + return; + } #endif } diff --git a/samples/opengl/cube/cube.cpp b/samples/opengl/cube/cube.cpp index a617a4c756..02bf45444a 100644 --- a/samples/opengl/cube/cube.cpp +++ b/samples/opengl/cube/cube.cpp @@ -279,8 +279,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event) wxGLCanvas::OnSize(event); // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...) - int w, h; - GetClientSize(&w, &h); + int w, h; + GetClientSize(&w, &h); #ifndef __WXMOTIF__ if (GetContext()) #endif @@ -385,7 +385,7 @@ void TestGLCanvas::OnKeyDown( wxKeyEvent& event ) Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime ); #if defined(__WXMAC__) && !defined(__DARWIN__) - m_LastRedraw = currTime; // wxStopWatch() doesn't work on Mac... + m_LastRedraw = currTime; // wxStopWatch() doesn't work on Mac... #else m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct; #endif diff --git a/samples/opengl/cube/cube.h b/samples/opengl/cube/cube.h index be348b5427..c01b89e1c3 100644 --- a/samples/opengl/cube/cube.h +++ b/samples/opengl/cube/cube.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_CUBE_H_ diff --git a/samples/opengl/isosurf/isosurf.cpp b/samples/opengl/isosurf/isosurf.cpp index fbb0a5e752..895c3d44e3 100644 --- a/samples/opengl/isosurf/isosurf.cpp +++ b/samples/opengl/isosurf/isosurf.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -91,8 +91,8 @@ static void read_surface( char *filename ) numverts = 0; while (!feof(f) && numverts 0) { - int cnt = read_short(f); - fseek(f, cnt*2+2, SEEK_CUR); - nbytes -= cnt*2+2; + int cnt = read_short(f); + fseek(f, cnt*2+2, SEEK_CUR); + nbytes -= cnt*2+2; } } face->material -= 1; @@ -380,13 +380,13 @@ void lw_object_show(const lwObject *lw_object) prev_index_cnt = face->index_cnt; switch (face->index_cnt) { case 3: - glBegin(GL_TRIANGLES); - break; + glBegin(GL_TRIANGLES); + break; case 4: - glBegin(GL_QUADS); - break; + glBegin(GL_QUADS); + break; default: - glBegin(GL_POLYGON); + glBegin(GL_POLYGON); } } @@ -394,8 +394,8 @@ void lw_object_show(const lwObject *lw_object) if (prev_material != face->material) { prev_material = face->material; glColor3f(lw_object->material[face->material].r, - lw_object->material[face->material].g, - lw_object->material[face->material].b); + lw_object->material[face->material].g, + lw_object->material[face->material].b); } /* update normal if necessary */ diff --git a/samples/opengl/penguin/penguin.cpp b/samples/opengl/penguin/penguin.cpp index 1b09d9530c..12a70d4de1 100644 --- a/samples/opengl/penguin/penguin.cpp +++ b/samples/opengl/penguin/penguin.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -159,8 +159,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event) wxGLCanvas::OnSize(event); // set GL viewport (not called by wxGLCanvas::OnSize on all platforms...) - int w, h; - GetClientSize(&w, &h); + int w, h; + GetClientSize(&w, &h); #ifndef __WXMOTIF__ if (GetContext()) #endif @@ -203,17 +203,17 @@ void TestGLCanvas::OnMouse( wxMouseEvent& event ) /* drag in progress, simulate trackball */ float spin_quat[4]; trackball(spin_quat, - (2.0*info.beginx - sz.x) / sz.x, - ( sz.y - 2.0*info.beginy) / sz.y, - ( 2.0*event.GetX() - sz.x) / sz.x, - ( sz.y - 2.0*event.GetY()) / sz.y); - + (2.0*info.beginx - sz.x) / sz.x, + ( sz.y - 2.0*info.beginy) / sz.y, + ( 2.0*event.GetX() - sz.x) / sz.x, + ( sz.y - 2.0*event.GetY()) / sz.y); + add_quats( spin_quat, info.quat, info.quat ); - + /* orientation has changed, redraw mesh */ - Refresh(FALSE); + Refresh(FALSE); } - + info.beginx = event.GetX(); info.beginy = event.GetY(); } diff --git a/samples/opengl/penguin/penguin.h b/samples/opengl/penguin/penguin.h index 5c71de8ed7..a8e8550e65 100644 --- a/samples/opengl/penguin/penguin.h +++ b/samples/opengl/penguin/penguin.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Robert Roebling -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_PENGUIN_H_ diff --git a/samples/png/pngdemo.cpp b/samples/png/pngdemo.cpp index 0d88f11699..186d3c90ac 100644 --- a/samples/png/pngdemo.cpp +++ b/samples/png/pngdemo.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -87,6 +87,16 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, cons canvas = (MyCanvas *) NULL; } +// frame destructor +MyFrame::~MyFrame() +{ + if (g_TestBitmap) + { + delete g_TestBitmap; + g_TestBitmap = (wxBitmap *) NULL; + } +} + void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); @@ -128,16 +138,17 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event)) { - // Show file selector. - wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL, + // Show file selector. + wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL, (const wxChar *) NULL, wxT("png"), wxT("PNG files (*.png)|*.png")); - if (f == "") - return; + if (f == "") + return; if ( g_TestBitmap ) delete g_TestBitmap; + g_TestBitmap = new wxBitmap(f, wxBITMAP_TYPE_PNG); if (!g_TestBitmap->Ok()) { diff --git a/samples/png/pngdemo.h b/samples/png/pngdemo.h index e250aa69d2..c664e1a145 100644 --- a/samples/png/pngdemo.h +++ b/samples/png/pngdemo.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -31,6 +31,7 @@ class MyFrame: public wxFrame public: MyCanvas *canvas; MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size); + virtual ~MyFrame(); void OnActivate(bool) {} void OnLoadFile(wxCommandEvent& event); diff --git a/samples/proplist/proplist.cpp b/samples/proplist/proplist.cpp index af8c22b74e..b64a165092 100644 --- a/samples/proplist/proplist.cpp +++ b/samples/proplist/proplist.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -152,214 +152,219 @@ void MyApp::RegisterValidators(void) void MyApp::PropertyListTest(bool useDialog) { - if (m_childWindow) - return; - - wxPropertySheet *sheet = new wxPropertySheet; - - sheet->AddProperty(new wxProperty("fred", 1.0, "real")); - sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); - sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50))); - sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); - sheet->AddProperty(new wxProperty("julian", "one", "string")); - sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); - wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL); - sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); - - wxStringList *strings2 = new wxStringList(wxT("earth"), wxT("fire"), wxT("wind"), wxT("water"), NULL); - sheet->AddProperty(new wxProperty("string list", strings2, "stringlist")); - - wxPropertyListView *view = - new wxPropertyListView(NULL, - wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | - wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES); - - wxDialog *propDialog = NULL; - wxPropertyListFrame *propFrame = NULL; - if (useDialog) - { - propDialog = new PropListDialog(view, NULL, "Property Sheet Test", - wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS); - m_childWindow = propDialog; - } - else - { - propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500)); - m_childWindow = propFrame; - } - - view->AddRegistry(&myListValidatorRegistry); - - if (useDialog) - { - view->ShowView(sheet, (wxPanel *)propDialog); - propDialog->Centre(wxBOTH); - propDialog->Show(TRUE); - } - else - { - propFrame->Initialize(); - view->ShowView(sheet, propFrame->GetPropertyPanel()); - - propFrame->Centre(wxBOTH); - propFrame->Show(TRUE); - } + if (m_childWindow) + return; + + wxPropertySheet *sheet = new wxPropertySheet; + + sheet->AddProperty(new wxProperty("fred", 1.0, "real")); + sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); + sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerListValidator(-50, 50))); + sheet->AddProperty(new wxProperty("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0))); + sheet->AddProperty(new wxProperty("julian", "one", "string")); + sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp"))); + wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL); + sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringListValidator(strings))); + + wxStringList *strings2 = new wxStringList(wxT("earth"), wxT("fire"), wxT("wind"), wxT("water"), NULL); + sheet->AddProperty(new wxProperty("string list", strings2, "stringlist")); + + wxPropertyListView *view = new wxPropertyListView + ( + NULL, + wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS + |wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES + ); + + wxDialog *propDialog = NULL; + wxPropertyListFrame *propFrame = NULL; + if (useDialog) + { + propDialog = new PropListDialog(view, NULL, "Property Sheet Test", + wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS); + m_childWindow = propDialog; + } + else + { + propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500)); + m_childWindow = propFrame; + } + + view->AddRegistry(&myListValidatorRegistry); + + if (useDialog) + { + view->ShowView(sheet, (wxPanel *)propDialog); + propDialog->Centre(wxBOTH); + propDialog->Show(TRUE); + } + else + { + propFrame->Initialize(); + view->ShowView(sheet, propFrame->GetPropertyPanel()); + + propFrame->Centre(wxBOTH); + propFrame->Show(TRUE); + } } void MyApp::PropertyFormTest(bool useDialog) { - if (m_childWindow) - return; - - wxPropertySheet *sheet = new wxPropertySheet; - - sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0))); - sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); - sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); - sheet->AddProperty(new wxProperty("julian", "one", "string")); - wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL); - sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); - - wxPropertyFormView *view = new wxPropertyFormView(NULL); - - wxDialog *propDialog = NULL; - wxPropertyFormFrame *propFrame = NULL; - if (useDialog) - { - propDialog = new PropFormDialog(view, NULL, "Property Form Test", - wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); - m_childWindow = propDialog; - } - else - { - propFrame = new PropFormFrame(view, NULL, "Property Form Test", wxPoint(-1, - -1), wxSize(380, 250)); - propFrame->Initialize(); - m_childWindow = propFrame; - } - - // BCC32 does not like ?: - wxWindow *panel ; - if ( propDialog ) - { - panel = propDialog ; - } - else - { - panel = propFrame->GetPropertyPanel() ; - } - - wxLayoutConstraints* c; + if (m_childWindow) + return; + + wxPropertySheet *sheet = new wxPropertySheet; + + sheet->AddProperty(new wxProperty("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0))); + sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool")); + sheet->AddProperty(new wxProperty("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50))); + sheet->AddProperty(new wxProperty("julian", "one", "string")); + wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL); + sheet->AddProperty(new wxProperty("constrained", "one", "string", new wxStringFormValidator(strings))); + + wxPropertyFormView *view = new wxPropertyFormView(NULL); + + wxDialog *propDialog = NULL; + wxPropertyFormFrame *propFrame = NULL; + + if (useDialog) + { + propDialog = new PropFormDialog(view, NULL, "Property Form Test", + wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL); + m_childWindow = propDialog; + } + else + { + propFrame = new PropFormFrame(view, NULL, "Property Form Test", + wxPoint(-1, -1), wxSize(380, 250)); + propFrame->Initialize(); + m_childWindow = propFrame; + } + + // BCC32 does not like ?: + wxWindow *panel ; + if ( propDialog ) + { + panel = propDialog; + } + else + { + panel = propFrame->GetPropertyPanel() ; + } + + wxLayoutConstraints* c; #if 0 - if (!propDialog) - { - c = new wxLayoutConstraints; - c->left.SameAs(m_childWindow, wxLeft, 4); - c->right.SameAs(m_childWindow, wxRight, 4); - c->top.SameAs(m_childWindow, wxTop, 4); - c->bottom.SameAs(m_childWindow, wxBottom, 40); + if (!propDialog) + { + c = new wxLayoutConstraints; + c->left.SameAs(m_childWindow, wxLeft, 4); + c->right.SameAs(m_childWindow, wxRight, 4); + c->top.SameAs(m_childWindow, wxTop, 4); + c->bottom.SameAs(m_childWindow, wxBottom, 40); - panel->SetConstraints(c); - } + panel->SetConstraints(c); + } #endif - // Add items to the panel - wxButton *okButton = new wxButton(panel, wxID_OK, "OK", wxPoint(-1, -1), - wxSize(80, 26), 0, wxDefaultValidator, "ok"); - wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", wxPoint(-1, -1), - wxSize(80, 26), 0, wxDefaultValidator, "cancel"); - wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, "Update", wxPoint(-1, -1), - wxSize(80, 26), 0, wxDefaultValidator, "update"); - wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, "Revert", wxPoint(-1, -1), - wxSize(80, 26), 0, wxDefaultValidator, "revert"); - - c = new wxLayoutConstraints; - c->right.SameAs(panel, wxRight, 4); - c->bottom.SameAs(panel, wxBottom, 4); - c->height.AsIs(); - c->width.AsIs(); - revertButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->right.SameAs(revertButton, wxLeft, 4); - c->bottom.SameAs(panel, wxBottom, 4); - c->height.AsIs(); - c->width.AsIs(); - updateButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->right.SameAs(updateButton, wxLeft, 4); - c->bottom.SameAs(panel, wxBottom, 4); - c->height.AsIs(); - c->width.AsIs(); - cancelButton->SetConstraints(c); - - c = new wxLayoutConstraints; - c->right.SameAs(cancelButton, wxLeft, 4); - c->bottom.SameAs(panel, wxBottom, 4); - c->height.AsIs(); - c->width.AsIs(); - okButton->SetConstraints(c); - - // The name of this text item matches the "fred" property - wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize( + // Add items to the panel + wxButton *okButton = new wxButton(panel, wxID_OK, "OK", wxPoint(-1, -1), + wxSize(80, 26), 0, wxDefaultValidator, "ok"); + wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", wxPoint(-1, -1), + wxSize(80, 26), 0, wxDefaultValidator, "cancel"); + wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, "Update", wxPoint(-1, -1), + wxSize(80, 26), 0, wxDefaultValidator, "update"); + wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, "Revert", wxPoint(-1, -1), + wxSize(80, 26), 0, wxDefaultValidator, "revert"); + + c = new wxLayoutConstraints; + c->right.SameAs(panel, wxRight, 4); + c->bottom.SameAs(panel, wxBottom, 4); + c->height.AsIs(); + c->width.AsIs(); + revertButton->SetConstraints(c); + + c = new wxLayoutConstraints; + c->right.SameAs(revertButton, wxLeft, 4); + c->bottom.SameAs(panel, wxBottom, 4); + c->height.AsIs(); + c->width.AsIs(); + updateButton->SetConstraints(c); + + c = new wxLayoutConstraints; + c->right.SameAs(updateButton, wxLeft, 4); + c->bottom.SameAs(panel, wxBottom, 4); + c->height.AsIs(); + c->width.AsIs(); + cancelButton->SetConstraints(c); + + c = new wxLayoutConstraints; + c->right.SameAs(cancelButton, wxLeft, 4); + c->bottom.SameAs(panel, wxBottom, 4); + c->height.AsIs(); + c->width.AsIs(); + okButton->SetConstraints(c); + + // The name of this text item matches the "fred" property + wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize( 200, -1), 0, wxDefaultValidator, "fred"); - - c = new wxLayoutConstraints; - c->left.SameAs(panel, wxLeft, 4); - c->top.SameAs(panel, wxTop, 4); - c->height.AsIs(); - c->width.AsIs(); - text->SetConstraints(c); - - wxCheckBox *checkBox = new wxCheckBox(panel, -1, "Yes or no", wxPoint(-1, -1), - wxSize(-1, -1), 0, wxDefaultValidator, "tough choice"); - - c = new wxLayoutConstraints; - c->left.SameAs(text, wxRight, 20); - c->top.SameAs(panel, wxTop, 4); - c->height.AsIs(); - c->width.AsIs(); - checkBox->SetConstraints(c); - + + c = new wxLayoutConstraints; + c->left.SameAs(panel, wxLeft, 4); + c->top.SameAs(panel, wxTop, 4); + c->height.AsIs(); + c->width.AsIs(); + text->SetConstraints(c); + + wxCheckBox *checkBox = new wxCheckBox(panel, -1, "Yes or no", wxPoint(-1, -1), + wxSize(-1, -1), 0, wxDefaultValidator, "tough choice"); + + c = new wxLayoutConstraints; + c->left.SameAs(text, wxRight, 20); + c->top.SameAs(panel, wxTop, 4); + c->height.AsIs(); + c->width.AsIs(); + checkBox->SetConstraints(c); + wxSlider *slider = new wxSlider(panel, -1, -50, 50, 150, wxPoint(-1, -1), wxSize(200,10), 0, wxDefaultValidator, "ian"); - c = new wxLayoutConstraints; - c->left.SameAs(panel, wxLeft, 4); - c->top.SameAs(text, wxBottom, 10); - c->height.AsIs(); - c->width.AsIs(); - slider->SetConstraints(c); - - wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1), wxSize(200, 100), - 0, NULL, 0, wxDefaultValidator, "constrained"); - - c = new wxLayoutConstraints; - c->left.SameAs(panel, wxLeft, 4); - c->top.SameAs(slider, wxBottom, 10); - c->height.AsIs(); - c->width.AsIs(); - listBox->SetConstraints(c); - - view->AddRegistry(&myFormValidatorRegistry); - - panel->SetAutoLayout(TRUE); - - view->ShowView(sheet, panel); - view->AssociateNames(); - view->TransferToDialog(); - - if (useDialog) { - propDialog->Layout(); - propDialog->Centre(wxBOTH); - propDialog->Show(TRUE); - } else { - // panel->Layout(); - propFrame->Centre(wxBOTH); - propFrame->Show(TRUE); - } + c = new wxLayoutConstraints; + c->left.SameAs(panel, wxLeft, 4); + c->top.SameAs(text, wxBottom, 10); + c->height.AsIs(); + c->width.AsIs(); + slider->SetConstraints(c); + + wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1), + wxSize(200, 100), 0, NULL, 0, wxDefaultValidator, "constrained"); + + c = new wxLayoutConstraints; + c->left.SameAs(panel, wxLeft, 4); + c->top.SameAs(slider, wxBottom, 10); + c->height.AsIs(); + c->width.AsIs(); + listBox->SetConstraints(c); + + view->AddRegistry(&myFormValidatorRegistry); + + panel->SetAutoLayout(TRUE); + + view->ShowView(sheet, panel); + view->AssociateNames(); + view->TransferToDialog(); + + if (useDialog) { + propDialog->Layout(); + propDialog->Centre(wxBOTH); + propDialog->Show(TRUE); + } + else + { + // panel->Layout(); + propFrame->Centre(wxBOTH); + propFrame->Show(TRUE); + } } BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame) diff --git a/samples/proplist/proplist.h b/samples/proplist/proplist.h index deabd5c5fd..eb50e3f815 100644 --- a/samples/proplist/proplist.h +++ b/samples/proplist/proplist.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/resource/resource.cpp b/samples/resource/resource.cpp index ab0405be9b..807c387fa1 100644 --- a/samples/resource/resource.cpp +++ b/samples/resource/resource.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -120,7 +120,7 @@ MyApp::~MyApp() } BEGIN_EVENT_TABLE(MyPanel, wxPanel) - EVT_LEFT_DOWN( MyPanel::OnClick) + EVT_LEFT_DOWN( MyPanel::OnClick) END_EVENT_TABLE() MyPanel::MyPanel( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -138,9 +138,9 @@ void MyPanel::OnClick( wxMouseEvent &WXUNUSED(event2) ) BEGIN_EVENT_TABLE(MyFrame, wxFrame) - EVT_MENU(RESOURCE_ABOUT, MyFrame::OnAbout) - EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit) - EVT_MENU(RESOURCE_TESTDIALOG, MyFrame::OnTestDialog) + EVT_MENU(RESOURCE_ABOUT, MyFrame::OnAbout) + EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit) + EVT_MENU(RESOURCE_TESTDIALOG, MyFrame::OnTestDialog) END_EVENT_TABLE() // Define my frame constructor @@ -159,7 +159,7 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) ) { - Close(TRUE); + Close(TRUE); } void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) ) @@ -176,8 +176,8 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) ) } BEGIN_EVENT_TABLE(MyDialog, wxDialog) - // EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk) - EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel) + //EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk) + EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel) END_EVENT_TABLE() diff --git a/samples/resource/resource.h b/samples/resource/resource.h index 5975b871c7..5ffccc779d 100644 --- a/samples/resource/resource.h +++ b/samples/resource/resource.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ diff --git a/samples/samples.dsw b/samples/samples.dsw index ac23b0a0c6..69d3efb6e9 100644 --- a/samples/samples.dsw +++ b/samples/samples.dsw @@ -831,7 +831,7 @@ Package=<4> ############################################################################### -Project: "treectrl"=.\treectrl\treectrl.dsp - Package Owner=<4> +Project: "treetest"=.\treectrl\treetest.dsp - Package Owner=<4> Package=<5> {{{ diff --git a/samples/sashtest/sashtest.cpp b/samples/sashtest/sashtest.cpp index 5cfc8bda7c..f59fae02a0 100644 --- a/samples/sashtest/sashtest.cpp +++ b/samples/sashtest/sashtest.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -94,7 +94,7 @@ END_EVENT_TABLE() // Define my frame constructor MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, - const long style): + const long style): wxMDIParentFrame(parent, id, title, pos, size, style) { // Create some dummy layout windows @@ -273,7 +273,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event)) } BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) - EVT_MOUSE_EVENTS(MyCanvas::OnEvent) + EVT_MOUSE_EVENTS(MyCanvas::OnEvent) END_EVENT_TABLE() // Define a constructor for my canvas diff --git a/samples/sashtest/sashtest.h b/samples/sashtest/sashtest.h index 02ff483b54..11c644f8a9 100644 --- a/samples/sashtest/sashtest.h +++ b/samples/sashtest/sashtest.h @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #include "wx/toolbar.h" diff --git a/samples/scrollsub/scrollsub.cpp b/samples/scrollsub/scrollsub.cpp index c7ce613e4e..3d16d9e91d 100644 --- a/samples/scrollsub/scrollsub.cpp +++ b/samples/scrollsub/scrollsub.cpp @@ -306,12 +306,12 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) (0-scroll_x < size_x) && (0-scroll_y < size_y)) { // Has the region on screen been exposed? - if (IsExposed(0,0,100,25)) - { - wxLogMessage( wxT("Redraw first cell") ); + if (IsExposed(0,0,100,25)) + { + wxLogMessage( wxT("Redraw first cell") ); dc.DrawRectangle( 0, 0, 100, 25 ); - dc.DrawText( "First Cell", 5, 5 ); - } + dc.DrawText( "First Cell", 5, 5 ); + } } @@ -321,12 +321,12 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) ) (200-scroll_x < size_x) && (0-scroll_y < size_y)) { // Has the region on screen been exposed? - if (IsExposed(200,0,100,25)) - { - wxLogMessage( wxT("Redraw second cell") ); + if (IsExposed(200,0,100,25)) + { + wxLogMessage( wxT("Redraw second cell") ); dc.DrawRectangle( 200, 0, 100, 25 ); - dc.DrawText( "Second Cell", 205, 5 ); - } + dc.DrawText( "Second Cell", 205, 5 ); + } } } diff --git a/samples/statbar/statbar.cpp b/samples/statbar/statbar.cpp index 436c6dd44e..2b9924d343 100644 --- a/samples/statbar/statbar.cpp +++ b/samples/statbar/statbar.cpp @@ -413,7 +413,7 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnUpdateStatusBarToggle(wxUpdateUIEvent& event) { - event.Check(GetStatusBar() != 0); + event.Check(GetStatusBar() != 0); } void MyFrame::OnStatusBarToggle(wxCommandEvent& WXUNUSED(event)) diff --git a/samples/tab/tab.cpp b/samples/tab/tab.cpp index c581ac1760..055ebf099d 100644 --- a/samples/tab/tab.cpp +++ b/samples/tab/tab.cpp @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". diff --git a/samples/tab/tab.h b/samples/tab/tab.h index 0763ffe8b4..8fcadf7b99 100644 --- a/samples/tab/tab.h +++ b/samples/tab/tab.h @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // Define a new application diff --git a/samples/taskbar/tbtest.cpp b/samples/taskbar/tbtest.cpp index 2fcadd54c4..eab3c3f1ab 100644 --- a/samples/taskbar/tbtest.cpp +++ b/samples/taskbar/tbtest.cpp @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". diff --git a/samples/taskbar/tbtest.h b/samples/taskbar/tbtest.h index 454e66ef23..64e141f546 100644 --- a/samples/taskbar/tbtest.h +++ b/samples/taskbar/tbtest.h @@ -6,13 +6,13 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// class MyTaskBarIcon: public wxTaskBarIcon { public: - MyTaskBarIcon() {}; + MyTaskBarIcon() {}; virtual void OnMouseMove(wxEvent&); virtual void OnLButtonDown(wxEvent&); diff --git a/samples/treelay/treelay.cpp b/samples/treelay/treelay.cpp index 02e00da18c..41d2671a9c 100644 --- a/samples/treelay/treelay.cpp +++ b/samples/treelay/treelay.cpp @@ -24,7 +24,7 @@ #include "treelay.h" -wxTreeLayoutStored *myTree = NULL; +wxTreeLayoutStored *myTree = (wxTreeLayoutStored *) NULL; // A macro needed for some compilers (AIX) that need 'main' to be defined // in the application itself. @@ -85,6 +85,17 @@ bool MyApp::OnInit() return TRUE; } +int MyApp::OnExit() +{ + if (myTree) + { + delete myTree; + myTree = (wxTreeLayoutStored *) NULL; + } + + return 0; +} + void MyApp::TreeTest(wxTreeLayoutStored& tree, wxDC& dc) { tree.Initialize(200); diff --git a/samples/treelay/treelay.h b/samples/treelay/treelay.h index d920ecc1be..2b1a292368 100644 --- a/samples/treelay/treelay.h +++ b/samples/treelay/treelay.h @@ -12,8 +12,9 @@ // Define a new application class MyApp: public wxApp { - public: - bool OnInit(); +public: + virtual bool OnInit(); + virtual int OnExit(); void TreeTest(wxTreeLayoutStored& tree, wxDC& dc); }; diff --git a/samples/typetest/typetest.cpp b/samples/typetest/typetest.cpp index 98ee15d096..75e68a09bb 100644 --- a/samples/typetest/typetest.cpp +++ b/samples/typetest/typetest.cpp @@ -436,7 +436,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event)) case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break; case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break; default: textCtrl.WriteText( "Huh?\n" ); break; - } + } } textCtrl.WriteText( "\n" ); diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index b4a4ecc961..e79c7e7d89 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -457,7 +457,7 @@ void ComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event) { unsigned long n; event.Enable(m_textDelete->GetValue().ToULong(&n) && - (n < (unsigned)m_combobox->GetCount())); + (n < (unsigned)m_combobox->GetCount())); } } @@ -482,8 +482,8 @@ void ComboboxWidgetsPage::OnUpdateUIAddSeveral(wxUpdateUIEvent& event) void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event) { if (!m_combobox) - return; - + return; + wxString s = event.GetString(); wxASSERT_MSG( s == m_combobox->GetValue(), diff --git a/samples/wizard/wizard.cpp b/samples/wizard/wizard.cpp index f4586a11d8..50e1a1ce22 100644 --- a/samples/wizard/wizard.cpp +++ b/samples/wizard/wizard.cpp @@ -303,9 +303,9 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event)) { wxWizard *wizard = new wxWizard(this, -1, - "Absolutely Useless Wizard", - wxBITMAP(wiztest)); - + "Absolutely Useless Wizard", + wxBITMAP(wiztest)); + // a wizard page may be either an object of predefined class wxWizardPageSimple *page1 = new wxWizardPageSimple(wizard); wxStaticText *text = new wxStaticText(page1, -1, -- 2.47.2