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
This commit is contained in:
Vadim Zeitlin
2002-03-17 14:16:03 +00:00
parent 1c9f1f4d51
commit 2f6c54eb07
62 changed files with 616 additions and 552 deletions

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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..."));

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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);
}

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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());

View File

@@ -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 );

View File

@@ -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");
// 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 &dividers");
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");
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 &dividers");
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);
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);
// 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);
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);
}
SetTopWindow(frame);
return TRUE;
frame->grid->UpdateDimensions();
// Show the frame
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
// My frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
wxFrame(frame, -1, title, pos, size)
int MyApp::OnExit()
{
grid = (wxGrid*) NULL;
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)
{
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());
}

View File

@@ -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");
}

View File

@@ -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@)<hr>", 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@)<hr>", wxPAGE_ALL);
m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)<hr>", wxPAGE_ALL);
}
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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();

View File

@@ -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

View File

@@ -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

View File

@@ -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".

View File

@@ -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

View File

@@ -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__

View File

@@ -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;
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() );
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()

View File

@@ -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

View File

@@ -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"

View File

@@ -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()

View File

@@ -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__

View File

@@ -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.") );

View File

@@ -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
}

View File

@@ -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

View File

@@ -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_

View File

@@ -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<MAXVERTS) {
fscanf( f, "%f %f %f %f %f %f",
&verts[numverts][0], &verts[numverts][1], &verts[numverts][2],
&norms[numverts][0], &norms[numverts][1], &norms[numverts][2] );
&verts[numverts][0], &verts[numverts][1], &verts[numverts][2],
&norms[numverts][0], &norms[numverts][1], &norms[numverts][2] );
numverts++;
}
numverts--;
@@ -263,12 +263,12 @@ bool MyApp::OnInit(void)
int *gl_attrib = NULL;
#else
int gl_attrib[20] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1,
WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1,
WX_GL_DOUBLEBUFFER,
WX_GL_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1,
WX_GL_DOUBLEBUFFER,
# ifdef __WXMAC__
GL_NONE };
GL_NONE };
# else
None };
None };
# endif
#endif
@@ -366,13 +366,13 @@ 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
{
SetCurrent();
SetCurrent();
glViewport(0, 0, (GLint) w, (GLint) h);
}
}
@@ -381,39 +381,39 @@ void TestGLCanvas::OnChar(wxKeyEvent& event)
{
switch(event.KeyCode()) {
case WXK_ESCAPE:
exit(0);
exit(0);
case WXK_LEFT:
yrot -= 15.0;
break;
yrot -= 15.0;
break;
case WXK_RIGHT:
yrot += 15.0;
break;
yrot += 15.0;
break;
case WXK_UP:
xrot += 15.0;
break;
xrot += 15.0;
break;
case WXK_DOWN:
xrot -= 15.0;
break;
xrot -= 15.0;
break;
case 's': case 'S':
smooth = !smooth;
if (smooth) {
glShadeModel(GL_SMOOTH);
} else {
glShadeModel(GL_FLAT);
}
break;
smooth = !smooth;
if (smooth) {
glShadeModel(GL_SMOOTH);
} else {
glShadeModel(GL_FLAT);
}
break;
case 'l': case 'L':
lighting = !lighting;
if (lighting) {
glEnable(GL_LIGHTING);
} else {
glDisable(GL_LIGHTING);
}
break;
lighting = !lighting;
if (lighting) {
glEnable(GL_LIGHTING);
} else {
glDisable(GL_LIGHTING);
}
break;
default:
{
event.Skip();
return;
return;
}
}
@@ -427,17 +427,17 @@ void TestGLCanvas::OnMouseEvent(wxMouseEvent& event)
//printf("%f %f %d\n", event.GetX(), event.GetY(), (int)event.LeftIsDown());
if(event.LeftIsDown()) {
if(!dragging) {
dragging = 1;
} else {
yrot += (event.GetX() - last_x)*1.0;
xrot += (event.GetY() - last_y)*1.0;
Refresh(FALSE);
}
last_x = event.GetX();
last_y = event.GetY();
if(!dragging) {
dragging = 1;
} else {
yrot += (event.GetX() - last_x)*1.0;
xrot += (event.GetY() - last_y)*1.0;
Refresh(FALSE);
}
last_x = event.GetX();
last_y = event.GetY();
} else
dragging = 0;
dragging = 0;
}
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ISOSURF_H_

View File

@@ -45,9 +45,9 @@
#endif
#define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
(((wxUint32)(b))<<16)| \
(((wxUint32)(c))<< 8)| \
(((wxUint32)(d)) ))
(((wxUint32)(b))<<16)| \
(((wxUint32)(c))<< 8)| \
(((wxUint32)(d)) ))
#define ID_FORM MK_ID('F','O','R','M')
#define ID_LWOB MK_ID('L','W','O','B')
@@ -212,9 +212,9 @@ static void read_pols(FILE *f, int nbytes, lwObject *lwo)
det_cnt = read_short(f);
nbytes -= 2;
while (det_cnt-- > 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 */

View File

@@ -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();
}

View File

@@ -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_

View File

@@ -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())
{

View File

@@ -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);

View File

@@ -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;
if (m_childWindow)
return;
wxPropertySheet *sheet = new wxPropertySheet;
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)));
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"));
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);
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);
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;
}
if (useDialog)
{
view->ShowView(sheet, (wxPanel *)propDialog);
propDialog->Centre(wxBOTH);
propDialog->Show(TRUE);
}
else
{
propFrame->Initialize();
view->ShowView(sheet, propFrame->GetPropertyPanel());
view->AddRegistry(&myListValidatorRegistry);
propFrame->Centre(wxBOTH);
propFrame->Show(TRUE);
}
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;
if (m_childWindow)
return;
wxPropertySheet *sheet = new wxPropertySheet;
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)));
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);
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;
}
wxDialog *propDialog = NULL;
wxPropertyFormFrame *propFrame = NULL;
// BCC32 does not like ?:
wxWindow *panel ;
if ( propDialog )
{
panel = propDialog ;
}
else
{
panel = propFrame->GetPropertyPanel() ;
}
wxLayoutConstraints* c;
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");
// 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(panel, wxRight, 4);
c->bottom.SameAs(panel, wxBottom, 4);
c->height.AsIs();
c->width.AsIs();
revertButton->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(revertButton, wxLeft, 4);
c->bottom.SameAs(panel, wxBottom, 4);
c->height.AsIs();
c->width.AsIs();
updateButton->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);
c = new wxLayoutConstraints;
c->right.SameAs(updateButton, wxLeft, 4);
c->bottom.SameAs(panel, wxBottom, 4);
c->height.AsIs();
c->width.AsIs();
cancelButton->SetConstraints(c);
// The name of this text item matches the "fred" property
wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize(
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(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(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);
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");
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);
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);
view->AddRegistry(&myFormValidatorRegistry);
panel->SetAutoLayout(TRUE);
panel->SetAutoLayout(TRUE);
view->ShowView(sheet, panel);
view->AssociateNames();
view->TransferToDialog();
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);
}
if (useDialog) {
propDialog->Layout();
propDialog->Centre(wxBOTH);
propDialog->Show(TRUE);
}
else
{
// panel->Layout();
propFrame->Centre(wxBOTH);
propFrame->Show(TRUE);
}
}
BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)

View File

@@ -6,7 +6,7 @@
// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
// Licence: wxWindows license
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__

View File

@@ -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()

View File

@@ -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__

View File

@@ -831,7 +831,7 @@ Package=<4>
###############################################################################
Project: "treectrl"=.\treectrl\treectrl.dsp - Package Owner=<4>
Project: "treetest"=.\treectrl\treetest.dsp - Package Owner=<4>
Package=<5>
{{{

View File

@@ -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

View File

@@ -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"

View File

@@ -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 );
}
}
}

View File

@@ -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))

View File

@@ -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".

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c)
// Licence: wxWindows licence
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Define a new application

View File

@@ -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".

View File

@@ -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&);

View File

@@ -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);

View File

@@ -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);
};

View File

@@ -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" );

View File

@@ -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(),

View File

@@ -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,