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:
@@ -2871,7 +2871,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
DbGridFrame::DbGridFrame(wxWindow *parent)
|
DbGridFrame::DbGridFrame(wxWindow *parent)
|
||||||
: wxFrame (parent, -1, wxT("Database Table"),
|
: wxFrame (parent, -1, wxT("Database Table"),
|
||||||
wxDefaultPosition, wxSize(400, 325))
|
wxDefaultPosition, wxSize(400, 325))
|
||||||
{
|
{
|
||||||
initialized = FALSE;
|
initialized = FALSE;
|
||||||
}
|
}
|
||||||
|
@@ -187,14 +187,14 @@ DECLARE_EVENT_TABLE()
|
|||||||
class DbGridFrame : public wxFrame
|
class DbGridFrame : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool initialized;
|
bool initialized;
|
||||||
|
|
||||||
DbGridFrame(wxWindow *parent);
|
DbGridFrame(wxWindow *parent);
|
||||||
|
|
||||||
void OnCloseWindow(wxCloseEvent& event);
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
bool Initialize();
|
bool Initialize();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -190,7 +190,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
|
|||||||
widgetPtrsSet = TRUE;
|
widgetPtrsSet = TRUE;
|
||||||
|
|
||||||
// Query the lookup table and display the result set
|
// 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)
|
if (!lookup)
|
||||||
{
|
{
|
||||||
wxMessageBox(wxT("Error allocating memory for 'Clookup'object."),wxT("Error..."));
|
wxMessageBox(wxT("Error allocating memory for 'Clookup'object."),wxT("Error..."));
|
||||||
@@ -295,7 +295,7 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
|
|||||||
widgetPtrsSet = TRUE;
|
widgetPtrsSet = TRUE;
|
||||||
|
|
||||||
// Query the lookup table and display the result set
|
// 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)
|
if (!lookup2)
|
||||||
{
|
{
|
||||||
wxMessageBox(wxT("Error allocating memory for 'Clookup2' object."),wxT("Error..."));
|
wxMessageBox(wxT("Error allocating memory for 'Clookup2' object."),wxT("Error..."));
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -163,8 +163,8 @@ wxSTD ostream& DoodleSegment::SaveObject(wxSTD ostream& stream)
|
|||||||
DoodleLine *line = (DoodleLine *)node->Data();
|
DoodleLine *line = (DoodleLine *)node->Data();
|
||||||
stream << line->x1 << " " <<
|
stream << line->x1 << " " <<
|
||||||
line->y1 << " " <<
|
line->y1 << " " <<
|
||||||
line->x2 << " " <<
|
line->x2 << " " <<
|
||||||
line->y2 << "\n";
|
line->y2 << "\n";
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,8 +184,8 @@ wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream)
|
|||||||
DoodleLine *line = (DoodleLine *)node->Data();
|
DoodleLine *line = (DoodleLine *)node->Data();
|
||||||
text_stream << line->x1 << " " <<
|
text_stream << line->x1 << " " <<
|
||||||
line->y1 << " " <<
|
line->y1 << " " <<
|
||||||
line->x2 << " " <<
|
line->x2 << " " <<
|
||||||
line->y2 << "\n";
|
line->y2 << "\n";
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,8 +204,8 @@ wxSTD istream& DoodleSegment::LoadObject(wxSTD istream& stream)
|
|||||||
DoodleLine *line = new DoodleLine;
|
DoodleLine *line = new DoodleLine;
|
||||||
stream >> line->x1 >>
|
stream >> line->x1 >>
|
||||||
line->y1 >>
|
line->y1 >>
|
||||||
line->x2 >>
|
line->x2 >>
|
||||||
line->y2;
|
line->y2;
|
||||||
lines.Append(line);
|
lines.Append(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,8 +224,8 @@ wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream)
|
|||||||
DoodleLine *line = new DoodleLine;
|
DoodleLine *line = new DoodleLine;
|
||||||
text_stream >> line->x1 >>
|
text_stream >> line->x1 >>
|
||||||
line->y1 >>
|
line->y1 >>
|
||||||
line->x2 >>
|
line->x2 >>
|
||||||
line->y2;
|
line->y2;
|
||||||
lines.Append(line);
|
lines.Append(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -394,9 +394,9 @@ bool MyApp::OnInit()
|
|||||||
{
|
{
|
||||||
wxString filename;
|
wxString filename;
|
||||||
filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i);
|
filename.Printf(wxT("%s%d.png"), (const wxChar*)rootName, i);
|
||||||
/* For some reason under wxX11, the 2nd LoadFile in this loop fails, with
|
/* 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
|
a BadMatch inside CreateFromImage (inside ConvertToBitmap). This happens even if you copy
|
||||||
the first file over the second file. */
|
the first file over the second file. */
|
||||||
if (image.LoadFile(filename, wxBITMAP_TYPE_PNG))
|
if (image.LoadFile(filename, wxBITMAP_TYPE_PNG))
|
||||||
{
|
{
|
||||||
DragShape* newShape = new DragShape(image.ConvertToBitmap());
|
DragShape* newShape = new DragShape(image.ConvertToBitmap());
|
||||||
|
@@ -195,13 +195,14 @@ void MyCanvas::OnPaint( wxPaintEvent &event )
|
|||||||
wxSize client_size = GetClientSize();
|
wxSize client_size = GetClientSize();
|
||||||
wxLogDebug( "size %d %d client_size %d %d", size.x, size.y, client_size.x, client_size.y );
|
wxLogDebug( "size %d %d client_size %d %d", size.x, size.y, client_size.x, client_size.y );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int i;
|
||||||
dc.SetPen( *wxWHITE_PEN );
|
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.DrawLine( i,i, i+100,i );
|
||||||
|
|
||||||
dc.SetPen( *wxWHITE_PEN );
|
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 );
|
dc.DrawLine( i-200,i, i-100,i );
|
||||||
|
|
||||||
wxRegion region( 110, 110, 80, 80 );
|
wxRegion region( 110, 110, 80, 80 );
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* File: grid.cpp
|
* File: grid.cpp
|
||||||
* Purpose: wxGrid test
|
* Purpose: wxGrid test
|
||||||
* Author: Julian Smart
|
* Author: Julian Smart
|
||||||
* Created: 1995
|
* Created: 1995
|
||||||
* Updated:
|
* Updated:
|
||||||
* Copyright: (c) 1995, AIAI, University of Edinburgh
|
* Copyright: (c) 1995, AIAI, University of Edinburgh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -25,8 +25,10 @@ static const char sccsid[] = "%W% %G%";
|
|||||||
|
|
||||||
// Define a new application type
|
// Define a new application type
|
||||||
class MyApp: public wxApp
|
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)
|
bool MyApp::OnInit(void)
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
cellBitmap1 = new wxBitmap("bitmap1");
|
cellBitmap1 = new wxBitmap("bitmap1");
|
||||||
cellBitmap2 = new wxBitmap("bitmap2");
|
cellBitmap2 = new wxBitmap("bitmap2");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxGrid Sample", wxPoint(50, 50), wxSize(450, 300));
|
MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "wxGrid Sample", wxPoint(50, 50), wxSize(450, 300));
|
||||||
|
|
||||||
// Give it an icon
|
// Give it an icon
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
frame->SetIcon(wxIcon("mondrian"));
|
frame->SetIcon(wxIcon("mondrian"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Make a menubar
|
// Make a menubar
|
||||||
wxMenu *file_menu = new wxMenu;
|
wxMenu *file_menu = new wxMenu;
|
||||||
file_menu->Append(GRID_QUIT, "E&xit");
|
file_menu->Append(GRID_QUIT, "E&xit");
|
||||||
|
|
||||||
wxMenu *settings_menu = new wxMenu;
|
wxMenu *settings_menu = new wxMenu;
|
||||||
settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable");
|
settings_menu->Append(GRID_TOGGLE_EDITABLE, "&Toggle editable");
|
||||||
settings_menu->Append(GRID_TOGGLE_EDITINPLACE, "&Toggle edit in place");
|
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_ROW_LABEL, "Toggle ro&w label");
|
||||||
settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label");
|
settings_menu->Append(GRID_TOGGLE_COL_LABEL, "Toggle co&l label");
|
||||||
settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle ÷rs");
|
settings_menu->Append(GRID_TOGGLE_DIVIDERS, "Toggle ÷rs");
|
||||||
settings_menu->AppendSeparator();
|
settings_menu->AppendSeparator();
|
||||||
settings_menu->Append(GRID_LEFT_CELL, "&Left cell alignment ");
|
settings_menu->Append(GRID_LEFT_CELL, "&Left cell alignment ");
|
||||||
settings_menu->Append(GRID_CENTRE_CELL, "&Centre cell alignment ");
|
settings_menu->Append(GRID_CENTRE_CELL, "&Centre cell alignment ");
|
||||||
settings_menu->Append(GRID_RIGHT_CELL, "&Right cell alignment ");
|
settings_menu->Append(GRID_RIGHT_CELL, "&Right cell alignment ");
|
||||||
settings_menu->AppendSeparator();
|
settings_menu->AppendSeparator();
|
||||||
settings_menu->Append(GRID_COLOUR_LABEL_BACKGROUND, "Choose a label &background colour");
|
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_COLOUR_LABEL_TEXT, "Choose a label fore&ground colour");
|
||||||
settings_menu->Append(GRID_NORMAL_LABEL_COLOURING, "&Normal label colouring");
|
settings_menu->Append(GRID_NORMAL_LABEL_COLOURING, "&Normal label colouring");
|
||||||
settings_menu->AppendSeparator();
|
settings_menu->AppendSeparator();
|
||||||
settings_menu->Append(GRID_COLOUR_CELL_BACKGROUND, "Choo&se a cell &background colour");
|
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_COLOUR_CELL_TEXT, "Choose &a cell foreground colour");
|
||||||
settings_menu->Append(GRID_NORMAL_CELL_COLOURING, "N&ormal cell colouring");
|
settings_menu->Append(GRID_NORMAL_CELL_COLOURING, "N&ormal cell colouring");
|
||||||
|
|
||||||
wxMenuBar *menu_bar = new wxMenuBar;
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
menu_bar->Append(file_menu, "&File");
|
menu_bar->Append(file_menu, "&File");
|
||||||
menu_bar->Append(settings_menu, "&Settings");
|
menu_bar->Append(settings_menu, "&Settings");
|
||||||
frame->SetMenuBar(menu_bar);
|
frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
// Make a grid
|
// Make a grid
|
||||||
frame->grid = new wxGrid(frame, 0, 0, 400, 400);
|
frame->grid = new wxGrid(frame, 0, 0, 400, 400);
|
||||||
|
|
||||||
frame->grid->CreateGrid(10, 8);
|
frame->grid->CreateGrid(10, 8);
|
||||||
frame->grid->SetColumnWidth(3, 200);
|
frame->grid->SetColumnWidth(3, 200);
|
||||||
frame->grid->SetRowHeight(4, 45);
|
frame->grid->SetRowHeight(4, 45);
|
||||||
frame->grid->SetCellValue("First cell", 0, 0);
|
frame->grid->SetCellValue("First cell", 0, 0);
|
||||||
frame->grid->SetCellValue("Another cell", 1, 1);
|
frame->grid->SetCellValue("Another cell", 1, 1);
|
||||||
frame->grid->SetCellValue("Yet another cell", 2, 2);
|
frame->grid->SetCellValue("Yet another cell", 2, 2);
|
||||||
frame->grid->SetCellTextFont(wxFont(10, wxROMAN, wxITALIC, wxNORMAL), 0, 0);
|
frame->grid->SetCellTextFont(wxFont(10, wxROMAN, wxITALIC, wxNORMAL), 0, 0);
|
||||||
frame->grid->SetCellTextColour(*wxRED, 1, 1);
|
frame->grid->SetCellTextColour(*wxRED, 1, 1);
|
||||||
frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2);
|
frame->grid->SetCellBackgroundColour(*wxCYAN, 2, 2);
|
||||||
if (cellBitmap1 && cellBitmap2)
|
if (cellBitmap1 && cellBitmap2)
|
||||||
{
|
{
|
||||||
frame->grid->SetCellAlignment(wxCENTRE, 5, 0);
|
frame->grid->SetCellAlignment(wxCENTRE, 5, 0);
|
||||||
frame->grid->SetCellAlignment(wxCENTRE, 6, 0);
|
frame->grid->SetCellAlignment(wxCENTRE, 6, 0);
|
||||||
frame->grid->SetCellBitmap(cellBitmap1, 5, 0);
|
frame->grid->SetCellBitmap(cellBitmap1, 5, 0);
|
||||||
frame->grid->SetCellBitmap(cellBitmap2, 6, 0);
|
frame->grid->SetCellBitmap(cellBitmap2, 6, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame->grid->UpdateDimensions();
|
|
||||||
|
|
||||||
// Show the frame
|
|
||||||
frame->Show(TRUE);
|
|
||||||
|
|
||||||
SetTopWindow(frame);
|
frame->grid->UpdateDimensions();
|
||||||
return TRUE;
|
|
||||||
|
// Show the frame
|
||||||
|
frame->Show(TRUE);
|
||||||
|
|
||||||
|
SetTopWindow(frame);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// My frame constructor
|
int MyApp::OnExit()
|
||||||
MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size):
|
|
||||||
wxFrame(frame, -1, title, pos, size)
|
|
||||||
{
|
{
|
||||||
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)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable)
|
EVT_MENU(GRID_TOGGLE_EDITABLE, MyFrame::ToggleEditable)
|
||||||
EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace)
|
EVT_MENU(GRID_TOGGLE_EDITINPLACE, MyFrame::ToggleEditInPlace)
|
||||||
EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel)
|
EVT_MENU(GRID_TOGGLE_ROW_LABEL, MyFrame::ToggleRowLabel)
|
||||||
EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel)
|
EVT_MENU(GRID_TOGGLE_COL_LABEL, MyFrame::ToggleColLabel)
|
||||||
EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers)
|
EVT_MENU(GRID_TOGGLE_DIVIDERS, MyFrame::ToggleDividers)
|
||||||
EVT_MENU(GRID_LEFT_CELL, MyFrame::LeftCell)
|
EVT_MENU(GRID_LEFT_CELL, MyFrame::LeftCell)
|
||||||
EVT_MENU(GRID_CENTRE_CELL, MyFrame::CentreCell)
|
EVT_MENU(GRID_CENTRE_CELL, MyFrame::CentreCell)
|
||||||
EVT_MENU(GRID_RIGHT_CELL, MyFrame::RightCell)
|
EVT_MENU(GRID_RIGHT_CELL, MyFrame::RightCell)
|
||||||
EVT_MENU(GRID_COLOUR_LABEL_BACKGROUND, MyFrame::ColourLabelBackground)
|
EVT_MENU(GRID_COLOUR_LABEL_BACKGROUND, MyFrame::ColourLabelBackground)
|
||||||
EVT_MENU(GRID_COLOUR_LABEL_TEXT, MyFrame::ColourLabelText)
|
EVT_MENU(GRID_COLOUR_LABEL_TEXT, MyFrame::ColourLabelText)
|
||||||
EVT_MENU(GRID_NORMAL_LABEL_COLOURING, MyFrame::NormalLabelColouring)
|
EVT_MENU(GRID_NORMAL_LABEL_COLOURING, MyFrame::NormalLabelColouring)
|
||||||
EVT_MENU(GRID_COLOUR_CELL_BACKGROUND, MyFrame::ColourCellBackground)
|
EVT_MENU(GRID_COLOUR_CELL_BACKGROUND, MyFrame::ColourCellBackground)
|
||||||
EVT_MENU(GRID_COLOUR_CELL_TEXT, MyFrame::ColourCellText)
|
EVT_MENU(GRID_COLOUR_CELL_TEXT, MyFrame::ColourCellText)
|
||||||
EVT_MENU(GRID_NORMAL_CELL_COLOURING, MyFrame::NormalCellColouring)
|
EVT_MENU(GRID_NORMAL_CELL_COLOURING, MyFrame::NormalCellColouring)
|
||||||
EVT_MENU(GRID_QUIT, MyFrame::Quit)
|
EVT_MENU(GRID_QUIT, MyFrame::Quit)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
void MyFrame::ToggleEditable(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ToggleEditable(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetEditable(!grid->GetEditable());
|
grid->SetEditable(!grid->GetEditable());
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ToggleEditInPlace(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ToggleEditInPlace(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetEditInPlace(!grid->GetEditInPlace());
|
grid->SetEditInPlace(!grid->GetEditInPlace());
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ToggleRowLabel(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ToggleRowLabel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (grid->GetLabelSize(wxVERTICAL) > 0)
|
if (grid->GetLabelSize(wxVERTICAL) > 0)
|
||||||
grid->SetLabelSize(wxVERTICAL, 0);
|
grid->SetLabelSize(wxVERTICAL, 0);
|
||||||
else
|
else
|
||||||
grid->SetLabelSize(wxVERTICAL, 40);
|
grid->SetLabelSize(wxVERTICAL, 40);
|
||||||
grid->Refresh();
|
|
||||||
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ToggleColLabel(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ToggleColLabel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (grid->GetLabelSize(wxHORIZONTAL) > 0)
|
if (grid->GetLabelSize(wxHORIZONTAL) > 0)
|
||||||
grid->SetLabelSize(wxHORIZONTAL, 0);
|
grid->SetLabelSize(wxHORIZONTAL, 0);
|
||||||
else
|
else
|
||||||
grid->SetLabelSize(wxHORIZONTAL, 20);
|
grid->SetLabelSize(wxHORIZONTAL, 20);
|
||||||
|
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ToggleDividers(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ToggleDividers(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
if (!grid->GetDividerPen().Ok())
|
if (!grid->GetDividerPen().Ok())
|
||||||
grid->SetDividerPen(wxPen(wxT("LIGHT GREY"), 1, wxSOLID));
|
grid->SetDividerPen(wxPen(wxT("LIGHT GREY"), 1, wxSOLID));
|
||||||
else
|
else
|
||||||
grid->SetDividerPen(wxNullPen);
|
grid->SetDividerPen(wxNullPen);
|
||||||
grid->Refresh();
|
|
||||||
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::LeftCell(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::LeftCell(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetCellAlignment(wxLEFT);
|
grid->SetCellAlignment(wxLEFT);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::CentreCell(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::CentreCell(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetCellAlignment(wxCENTRE);
|
grid->SetCellAlignment(wxCENTRE);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::RightCell(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::RightCell(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetCellAlignment(wxRIGHT);
|
grid->SetCellAlignment(wxRIGHT);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ColourLabelBackground(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ColourLabelBackground(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxColourData data;
|
wxColourData data;
|
||||||
data.SetChooseFull(TRUE);
|
data.SetChooseFull(TRUE);
|
||||||
wxColourDialog dialog(this, &data);
|
wxColourDialog dialog(this, &data);
|
||||||
if (dialog.ShowModal() != wxID_CANCEL)
|
if (dialog.ShowModal() != wxID_CANCEL)
|
||||||
{
|
{
|
||||||
wxColourData retData = dialog.GetColourData();
|
wxColourData retData = dialog.GetColourData();
|
||||||
wxColour col = retData.GetColour();
|
wxColour col = retData.GetColour();
|
||||||
grid->SetLabelBackgroundColour(col);
|
grid->SetLabelBackgroundColour(col);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ColourLabelText(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ColourLabelText(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxColourData data;
|
wxColourData data;
|
||||||
data.SetChooseFull(TRUE);
|
data.SetChooseFull(TRUE);
|
||||||
wxColourDialog dialog(this, &data);
|
wxColourDialog dialog(this, &data);
|
||||||
if (dialog.ShowModal() != wxID_CANCEL)
|
if (dialog.ShowModal() != wxID_CANCEL)
|
||||||
{
|
{
|
||||||
wxColourData retData = dialog.GetColourData();
|
wxColourData retData = dialog.GetColourData();
|
||||||
wxColour col = retData.GetColour();
|
wxColour col = retData.GetColour();
|
||||||
grid->SetLabelTextColour(col);
|
grid->SetLabelTextColour(col);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::NormalLabelColouring(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::NormalLabelColouring(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetLabelBackgroundColour(*wxLIGHT_GREY);
|
grid->SetLabelBackgroundColour(*wxLIGHT_GREY);
|
||||||
grid->SetLabelTextColour(*wxBLACK);
|
grid->SetLabelTextColour(*wxBLACK);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ColourCellBackground(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ColourCellBackground(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxColourData data;
|
wxColourData data;
|
||||||
data.SetChooseFull(TRUE);
|
data.SetChooseFull(TRUE);
|
||||||
wxColourDialog dialog(this, &data);
|
wxColourDialog dialog(this, &data);
|
||||||
if (dialog.ShowModal() != wxID_CANCEL)
|
if (dialog.ShowModal() != wxID_CANCEL)
|
||||||
{
|
{
|
||||||
wxColourData retData = dialog.GetColourData();
|
wxColourData retData = dialog.GetColourData();
|
||||||
wxColour col = retData.GetColour();
|
wxColour col = retData.GetColour();
|
||||||
grid->SetCellBackgroundColour(col);
|
grid->SetCellBackgroundColour(col);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::ColourCellText(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::ColourCellText(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxColourData data;
|
wxColourData data;
|
||||||
data.SetChooseFull(TRUE);
|
data.SetChooseFull(TRUE);
|
||||||
wxColourDialog dialog(this, &data);
|
wxColourDialog dialog(this, &data);
|
||||||
if (dialog.ShowModal() != wxID_CANCEL)
|
if (dialog.ShowModal() != wxID_CANCEL)
|
||||||
{
|
{
|
||||||
wxColourData retData = dialog.GetColourData();
|
wxColourData retData = dialog.GetColourData();
|
||||||
wxColour col = retData.GetColour();
|
wxColour col = retData.GetColour();
|
||||||
grid->SetCellTextColour(col);
|
grid->SetCellTextColour(col);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::NormalCellColouring(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::NormalCellColouring(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
grid->SetCellBackgroundColour(*wxWHITE);
|
grid->SetCellBackgroundColour(*wxWHITE);
|
||||||
grid->SetCellTextColour(*wxBLACK);
|
grid->SetCellTextColour(*wxBLACK);
|
||||||
grid->Refresh();
|
grid->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::Quit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::Quit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
this->Close(TRUE);
|
this->Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the grid's edit control always has the focus.
|
// Ensure that the grid's edit control always has the focus.
|
||||||
void MyFrame::OnActivate(wxActivateEvent& event)
|
void MyFrame::OnActivate(wxActivateEvent& event)
|
||||||
{
|
{
|
||||||
if (grid) grid->OnActivate(event.GetActive());
|
if (grid) grid->OnActivate(event.GetActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -163,14 +163,14 @@
|
|||||||
ret = help.AddBook("helpfiles/testing.hhp");
|
ret = help.AddBook("helpfiles/testing.hhp");
|
||||||
#endif
|
#endif
|
||||||
if (! ret)
|
if (! ret)
|
||||||
wxMessageBox("Failed adding book helpfiles/testing.hhp");
|
wxMessageBox("Failed adding book helpfiles/testing.hhp");
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
ret = help.AddBook(":helpfiles:another.hhp");
|
ret = help.AddBook(":helpfiles:another.hhp");
|
||||||
#else
|
#else
|
||||||
ret = help.AddBook("helpfiles/another.hhp");
|
ret = help.AddBook("helpfiles/another.hhp");
|
||||||
#endif
|
#endif
|
||||||
if (! ret)
|
if (! ret)
|
||||||
wxMessageBox("Failed adding book helpfiles/another.hhp");
|
wxMessageBox("Failed adding book helpfiles/another.hhp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,9 +44,10 @@ class MyApp : public wxApp
|
|||||||
class MyFrame : public wxFrame
|
class MyFrame : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// ctor(s)
|
// ctor and dtor
|
||||||
|
|
||||||
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||||
|
virtual ~MyFrame();
|
||||||
|
|
||||||
// event handlers (these functions should _not_ be virtual)
|
// event handlers (these functions should _not_ be virtual)
|
||||||
void OnQuit(wxCommandEvent& event);
|
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);
|
m_Prn -> SetHeader(m_Name + "(@PAGENUM@/@PAGESCNT@)<hr>", wxPAGE_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// frame destructor
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
delete m_Prn;
|
||||||
|
m_Prn = (wxHtmlEasyPrinting *) NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
delete m_Prn;
|
|
||||||
// TRUE is to force the frame to close
|
// TRUE is to force the frame to close
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
@@ -234,7 +241,7 @@ void MyFrame::OnOpen(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
m_Name = dialog.GetPath();
|
m_Name = dialog.GetPath();
|
||||||
m_Html -> LoadPage(m_Name);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -317,7 +317,8 @@ MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id,
|
|||||||
#if wxUSE_GIF
|
#if wxUSE_GIF
|
||||||
image.Destroy();
|
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"));
|
wxLogError(wxT("Can't load GIF image"));
|
||||||
else
|
else
|
||||||
my_horse_gif = new wxBitmap( image );
|
my_horse_gif = new wxBitmap( image );
|
||||||
@@ -430,6 +431,7 @@ MyCanvas::~MyCanvas()
|
|||||||
delete my_horse_ico32;
|
delete my_horse_ico32;
|
||||||
delete my_horse_ico16;
|
delete my_horse_ico16;
|
||||||
delete my_horse_ico;
|
delete my_horse_ico;
|
||||||
|
delete my_horse_cur;
|
||||||
delete my_smile_xbm;
|
delete my_smile_xbm;
|
||||||
delete my_square;
|
delete my_square;
|
||||||
delete my_anti;
|
delete my_anti;
|
||||||
|
@@ -60,7 +60,7 @@ char ipc_buffer[4000];
|
|||||||
wxListBox *the_list = NULL;
|
wxListBox *the_list = NULL;
|
||||||
|
|
||||||
MyConnection *the_connection = NULL;
|
MyConnection *the_connection = NULL;
|
||||||
MyClient *my_client ;
|
MyClient *my_client;
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -121,11 +121,17 @@ int MyApp::OnExit()
|
|||||||
if (the_connection)
|
if (the_connection)
|
||||||
{
|
{
|
||||||
the_connection->Disconnect();
|
the_connection->Disconnect();
|
||||||
|
delete the_connection;
|
||||||
|
the_connection = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// will delete the connection too
|
// 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;
|
delete my_client;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
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)
|
bool MyConnection::OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format)
|
||||||
{
|
{
|
||||||
if (the_list)
|
if (the_list)
|
||||||
|
@@ -38,7 +38,6 @@ class MyConnection: public wxConnection
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyConnection();
|
MyConnection();
|
||||||
~MyConnection();
|
|
||||||
|
|
||||||
bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
|
bool OnAdvise(const wxString& topic, const wxString& item, char *data, int size, wxIPCFormat format);
|
||||||
bool OnDisconnect();
|
bool OnDisconnect();
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
@@ -94,7 +94,7 @@ bool MyApp::OnInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||||
EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent)
|
EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define a constructor for my canvas
|
// Define a constructor for my canvas
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Define a new application
|
// Define a new application
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Define a new application
|
// Define a new application
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -134,9 +134,9 @@ IMPLEMENT_APP(MyApp)
|
|||||||
//
|
//
|
||||||
CMainWindow::CMainWindow()
|
CMainWindow::CMainWindow()
|
||||||
{
|
{
|
||||||
LoadAccelTable( "MainAccelTable" );
|
LoadAccelTable( "MainAccelTable" );
|
||||||
Create( NULL, "Hello Foundation Application",
|
Create( NULL, "Hello Foundation Application",
|
||||||
WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" );
|
WS_OVERLAPPEDWINDOW, rectDefault, NULL, "MainMenu" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnPaint:
|
// OnPaint:
|
||||||
@@ -148,16 +148,16 @@ CMainWindow::CMainWindow()
|
|||||||
//
|
//
|
||||||
void CMainWindow::OnPaint()
|
void CMainWindow::OnPaint()
|
||||||
{
|
{
|
||||||
CString s = "Hello, Windows!";
|
CString s = "Hello, Windows!";
|
||||||
CPaintDC dc( this );
|
CPaintDC dc( this );
|
||||||
CRect rect;
|
CRect rect;
|
||||||
|
|
||||||
GetClientRect( rect );
|
GetClientRect( rect );
|
||||||
dc.SetTextAlign( TA_BASELINE | TA_CENTER );
|
dc.SetTextAlign( TA_BASELINE | TA_CENTER );
|
||||||
dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) );
|
dc.SetTextColor( ::GetSysColor( COLOR_WINDOWTEXT ) );
|
||||||
dc.SetBkMode(TRANSPARENT);
|
dc.SetBkMode(TRANSPARENT);
|
||||||
dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ),
|
dc.TextOut( ( rect.right / 2 ), ( rect.bottom / 2 ),
|
||||||
s, s.GetLength() );
|
s, s.GetLength() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// OnAbout:
|
// OnAbout:
|
||||||
@@ -170,8 +170,8 @@ void CMainWindow::OnPaint()
|
|||||||
//
|
//
|
||||||
void CMainWindow::OnAbout()
|
void CMainWindow::OnAbout()
|
||||||
{
|
{
|
||||||
CDialog about( "AboutBox", this );
|
CDialog about( "AboutBox", this );
|
||||||
about.DoModal();
|
about.DoModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMainWindow::OnTest()
|
void CMainWindow::OnTest()
|
||||||
@@ -190,11 +190,11 @@ void CMainWindow::OnTest()
|
|||||||
// receive no arguments and are void of return type, e.g., "void OnAbout()".
|
// receive no arguments and are void of return type, e.g., "void OnAbout()".
|
||||||
//
|
//
|
||||||
BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd )
|
BEGIN_MESSAGE_MAP( CMainWindow, CFrameWnd )
|
||||||
//{{AFX_MSG_MAP( CMainWindow )
|
//{{AFX_MSG_MAP( CMainWindow )
|
||||||
ON_WM_PAINT()
|
ON_WM_PAINT()
|
||||||
ON_COMMAND( IDM_ABOUT, OnAbout )
|
ON_COMMAND( IDM_ABOUT, OnAbout )
|
||||||
ON_COMMAND( IDM_TEST, OnTest )
|
ON_COMMAND( IDM_TEST, OnTest )
|
||||||
//}}AFX_MSG_MAP
|
//}}AFX_MSG_MAP
|
||||||
END_MESSAGE_MAP()
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -209,16 +209,16 @@ END_MESSAGE_MAP()
|
|||||||
//
|
//
|
||||||
BOOL CTheApp::InitInstance()
|
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);
|
wxEntry((WXHINSTANCE) m_hInstance, (WXHINSTANCE) m_hPrevInstance, m_lpCmdLine, m_nCmdShow, FALSE);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
m_pMainWnd = new CMainWindow();
|
m_pMainWnd = new CMainWindow();
|
||||||
m_pMainWnd->ShowWindow( m_nCmdShow );
|
m_pMainWnd->ShowWindow( m_nCmdShow );
|
||||||
m_pMainWnd->UpdateWindow();
|
m_pMainWnd->UpdateWindow();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (wxTheApp && wxTheApp->GetTopWindow())
|
if (wxTheApp && wxTheApp->GetTopWindow())
|
||||||
@@ -226,7 +226,7 @@ BOOL CTheApp::InitInstance()
|
|||||||
m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND());
|
m_pMainWnd = new CDummyWindow((HWND) wxTheApp->GetTopWindow()->GetHWND());
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CTheApp::ExitInstance()
|
int CTheApp::ExitInstance()
|
||||||
|
@@ -25,15 +25,15 @@
|
|||||||
class CMainWindow : public CFrameWnd
|
class CMainWindow : public CFrameWnd
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CMainWindow();
|
CMainWindow();
|
||||||
|
|
||||||
//{{AFX_MSG( CMainWindow )
|
//{{AFX_MSG( CMainWindow )
|
||||||
afx_msg void OnPaint();
|
afx_msg void OnPaint();
|
||||||
afx_msg void OnAbout();
|
afx_msg void OnAbout();
|
||||||
afx_msg void OnTest();
|
afx_msg void OnTest();
|
||||||
//}}AFX_MSG
|
//}}AFX_MSG
|
||||||
|
|
||||||
DECLARE_MESSAGE_MAP()
|
DECLARE_MESSAGE_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
// A dummy CWnd pointing to a wxWindow's HWND
|
// A dummy CWnd pointing to a wxWindow's HWND
|
||||||
@@ -52,7 +52,7 @@ class CDummyWindow: public CWnd
|
|||||||
class CTheApp : public CWinApp
|
class CTheApp : public CWinApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BOOL InitInstance();
|
BOOL InitInstance();
|
||||||
int ExitInstance();
|
int ExitInstance();
|
||||||
|
|
||||||
// Override this to provide wxWindows message loop
|
// Override this to provide wxWindows message loop
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 23/07/98
|
// Created: 23/07/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Robert Roebling
|
// Copyright: (c) Julian Smart and Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/minifram.h"
|
#include "wx/minifram.h"
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -76,8 +76,8 @@ bool MyApp::OnInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
|
EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
|
||||||
EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1)
|
EVT_MENU(RESOURCE_TEST1, MyFrame::OnTest1)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define my frame constructor
|
// Define my frame constructor
|
||||||
@@ -89,7 +89,7 @@ MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, c
|
|||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& event)
|
void MyFrame::OnQuit(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnTest1(wxCommandEvent& event)
|
void MyFrame::OnTest1(wxCommandEvent& event)
|
||||||
@@ -109,8 +109,8 @@ void MyFrame::OnTest1(wxCommandEvent& event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||||
EVT_BUTTON(wxID_OK, MyDialog::OnOk)
|
EVT_BUTTON(wxID_OK, MyDialog::OnOk)
|
||||||
EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel)
|
EVT_BUTTON(wxID_CANCEL, MyDialog::OnCancel)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -30,10 +30,11 @@
|
|||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/wx.h"
|
#include "wx/wx.h"
|
||||||
#include "wx/colordlg.h"
|
|
||||||
#include "wx/fontdlg.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "wx/colordlg.h"
|
||||||
|
#include "wx/fontdlg.h"
|
||||||
|
|
||||||
#include "wx/grid.h"
|
#include "wx/grid.h"
|
||||||
#include "wx/generic/gridctrl.h"
|
#include "wx/generic/gridctrl.h"
|
||||||
|
|
||||||
@@ -599,8 +600,8 @@ void GridFrame::DeleteSelectedRows( wxCommandEvent& WXUNUSED(ev) )
|
|||||||
for ( int n = 0; n < grid->GetNumberRows(); )
|
for ( int n = 0; n < grid->GetNumberRows(); )
|
||||||
if ( grid->IsInSelection( n , 0 ) )
|
if ( grid->IsInSelection( n , 0 ) )
|
||||||
grid->DeleteRows( n, 1 );
|
grid->DeleteRows( n, 1 );
|
||||||
else
|
else
|
||||||
n++;
|
n++;
|
||||||
grid->EndBatch();
|
grid->EndBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -614,8 +615,8 @@ void GridFrame::DeleteSelectedCols( wxCommandEvent& WXUNUSED(ev) )
|
|||||||
for ( int n = 0; n < grid->GetNumberCols(); )
|
for ( int n = 0; n < grid->GetNumberCols(); )
|
||||||
if ( grid->IsInSelection( 0 , n ) )
|
if ( grid->IsInSelection( 0 , n ) )
|
||||||
grid->DeleteCols( n, 1 );
|
grid->DeleteCols( n, 1 );
|
||||||
else
|
else
|
||||||
n++;
|
n++;
|
||||||
grid->EndBatch();
|
grid->EndBatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -823,14 +824,13 @@ void GridFrame::OnEditorShown( wxGridEvent& ev )
|
|||||||
|
|
||||||
if ( (ev.GetCol() == 4) &&
|
if ( (ev.GetCol() == 4) &&
|
||||||
(ev.GetRow() == 0) &&
|
(ev.GetRow() == 0) &&
|
||||||
(wxMessageBox(_T("Are you sure you wish to edit this cell"),
|
(wxMessageBox(_T("Are you sure you wish to edit this cell"),
|
||||||
_T("Checking"),wxYES_NO) == wxNO ) ) {
|
_T("Checking"),wxYES_NO) == wxNO ) ) {
|
||||||
|
|
||||||
ev.Veto();
|
ev.Veto();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxLogMessage( wxT("Cell editor shown.") );
|
wxLogMessage( wxT("Cell editor shown.") );
|
||||||
|
|
||||||
ev.Skip();
|
ev.Skip();
|
||||||
@@ -841,11 +841,11 @@ void GridFrame::OnEditorHidden( wxGridEvent& ev )
|
|||||||
|
|
||||||
if ( (ev.GetCol() == 4) &&
|
if ( (ev.GetCol() == 4) &&
|
||||||
(ev.GetRow() == 0) &&
|
(ev.GetRow() == 0) &&
|
||||||
(wxMessageBox(_T("Are you sure you wish to finish editing this cell"),
|
(wxMessageBox(_T("Are you sure you wish to finish editing this cell"),
|
||||||
_T("Checking"),wxYES_NO) == wxNO ) ) {
|
_T("Checking"),wxYES_NO) == wxNO ) ) {
|
||||||
|
|
||||||
ev.Veto();
|
ev.Veto();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogMessage( wxT("Cell editor hidden.") );
|
wxLogMessage( wxT("Cell editor hidden.") );
|
||||||
|
@@ -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.");
|
wxMessageBox("Please ensure Excel is running, then press OK.\nThe active cell should then say 'wxWindows automation test!' in bold.");
|
||||||
|
|
||||||
wxAutomationObject excelObject, rangeObject;
|
wxAutomationObject excelObject, rangeObject;
|
||||||
if (!excelObject.GetInstance("Excel.Application"))
|
if (!excelObject.GetInstance("Excel.Application"))
|
||||||
{
|
{
|
||||||
if (!excelObject.CreateInstance("Excel.Application"))
|
if (!excelObject.CreateInstance("Excel.Application"))
|
||||||
{
|
{
|
||||||
wxMessageBox("Could not create Excel object.");
|
wxMessageBox("Could not create Excel object.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!"))
|
if (!excelObject.PutProperty("ActiveCell.Value", "wxWindows automation test!"))
|
||||||
{
|
{
|
||||||
wxMessageBox("Could not set active cell value.");
|
wxMessageBox("Could not set active cell value.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_BOOL
|
#ifdef HAVE_BOOL
|
||||||
if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant((bool) TRUE)) )
|
if (!excelObject.PutProperty("ActiveCell.Font.Bold", wxVariant((bool) TRUE)) )
|
||||||
{
|
{
|
||||||
wxMessageBox("Could not put Bold property to active cell.");
|
wxMessageBox("Could not put Bold property to active cell.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -279,8 +279,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
|||||||
wxGLCanvas::OnSize(event);
|
wxGLCanvas::OnSize(event);
|
||||||
|
|
||||||
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
#ifndef __WXMOTIF__
|
#ifndef __WXMOTIF__
|
||||||
if (GetContext())
|
if (GetContext())
|
||||||
#endif
|
#endif
|
||||||
@@ -385,7 +385,7 @@ void TestGLCanvas::OnKeyDown( wxKeyEvent& event )
|
|||||||
Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime );
|
Action( m_Key, m_LastTime-m_StartTime, currTime-m_StartTime );
|
||||||
|
|
||||||
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
#if defined(__WXMAC__) && !defined(__DARWIN__)
|
||||||
m_LastRedraw = currTime; // wxStopWatch() doesn't work on Mac...
|
m_LastRedraw = currTime; // wxStopWatch() doesn't work on Mac...
|
||||||
#else
|
#else
|
||||||
m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct;
|
m_LastRedraw = wxStopWatch(&m_secbase) - m_gsynct;
|
||||||
#endif
|
#endif
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_CUBE_H_
|
#ifndef _WX_CUBE_H_
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -91,8 +91,8 @@ static void read_surface( char *filename )
|
|||||||
numverts = 0;
|
numverts = 0;
|
||||||
while (!feof(f) && numverts<MAXVERTS) {
|
while (!feof(f) && numverts<MAXVERTS) {
|
||||||
fscanf( f, "%f %f %f %f %f %f",
|
fscanf( f, "%f %f %f %f %f %f",
|
||||||
&verts[numverts][0], &verts[numverts][1], &verts[numverts][2],
|
&verts[numverts][0], &verts[numverts][1], &verts[numverts][2],
|
||||||
&norms[numverts][0], &norms[numverts][1], &norms[numverts][2] );
|
&norms[numverts][0], &norms[numverts][1], &norms[numverts][2] );
|
||||||
numverts++;
|
numverts++;
|
||||||
}
|
}
|
||||||
numverts--;
|
numverts--;
|
||||||
@@ -263,12 +263,12 @@ bool MyApp::OnInit(void)
|
|||||||
int *gl_attrib = NULL;
|
int *gl_attrib = NULL;
|
||||||
#else
|
#else
|
||||||
int gl_attrib[20] = { WX_GL_RGBA, WX_GL_MIN_RED, 1, WX_GL_MIN_GREEN, 1,
|
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_MIN_BLUE, 1, WX_GL_DEPTH_SIZE, 1,
|
||||||
WX_GL_DOUBLEBUFFER,
|
WX_GL_DOUBLEBUFFER,
|
||||||
# ifdef __WXMAC__
|
# ifdef __WXMAC__
|
||||||
GL_NONE };
|
GL_NONE };
|
||||||
# else
|
# else
|
||||||
None };
|
None };
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -366,13 +366,13 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
|||||||
wxGLCanvas::OnSize(event);
|
wxGLCanvas::OnSize(event);
|
||||||
|
|
||||||
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
#ifndef __WXMOTIF__
|
#ifndef __WXMOTIF__
|
||||||
if (GetContext())
|
if (GetContext())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SetCurrent();
|
SetCurrent();
|
||||||
glViewport(0, 0, (GLint) w, (GLint) h);
|
glViewport(0, 0, (GLint) w, (GLint) h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -381,39 +381,39 @@ void TestGLCanvas::OnChar(wxKeyEvent& event)
|
|||||||
{
|
{
|
||||||
switch(event.KeyCode()) {
|
switch(event.KeyCode()) {
|
||||||
case WXK_ESCAPE:
|
case WXK_ESCAPE:
|
||||||
exit(0);
|
exit(0);
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
yrot -= 15.0;
|
yrot -= 15.0;
|
||||||
break;
|
break;
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
yrot += 15.0;
|
yrot += 15.0;
|
||||||
break;
|
break;
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
xrot += 15.0;
|
xrot += 15.0;
|
||||||
break;
|
break;
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
xrot -= 15.0;
|
xrot -= 15.0;
|
||||||
break;
|
break;
|
||||||
case 's': case 'S':
|
case 's': case 'S':
|
||||||
smooth = !smooth;
|
smooth = !smooth;
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
glShadeModel(GL_SMOOTH);
|
glShadeModel(GL_SMOOTH);
|
||||||
} else {
|
} else {
|
||||||
glShadeModel(GL_FLAT);
|
glShadeModel(GL_FLAT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l': case 'L':
|
case 'l': case 'L':
|
||||||
lighting = !lighting;
|
lighting = !lighting;
|
||||||
if (lighting) {
|
if (lighting) {
|
||||||
glEnable(GL_LIGHTING);
|
glEnable(GL_LIGHTING);
|
||||||
} else {
|
} else {
|
||||||
glDisable(GL_LIGHTING);
|
glDisable(GL_LIGHTING);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
event.Skip();
|
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());
|
//printf("%f %f %d\n", event.GetX(), event.GetY(), (int)event.LeftIsDown());
|
||||||
if(event.LeftIsDown()) {
|
if(event.LeftIsDown()) {
|
||||||
if(!dragging) {
|
if(!dragging) {
|
||||||
dragging = 1;
|
dragging = 1;
|
||||||
} else {
|
} else {
|
||||||
yrot += (event.GetX() - last_x)*1.0;
|
yrot += (event.GetX() - last_x)*1.0;
|
||||||
xrot += (event.GetY() - last_y)*1.0;
|
xrot += (event.GetY() - last_y)*1.0;
|
||||||
Refresh(FALSE);
|
Refresh(FALSE);
|
||||||
}
|
}
|
||||||
last_x = event.GetX();
|
last_x = event.GetX();
|
||||||
last_y = event.GetY();
|
last_y = event.GetY();
|
||||||
} else
|
} else
|
||||||
dragging = 0;
|
dragging = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
|
void TestGLCanvas::OnEraseBackground(wxEraseEvent& event)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_ISOSURF_H_
|
#ifndef _WX_ISOSURF_H_
|
||||||
|
@@ -45,9 +45,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
|
#define MK_ID(a,b,c,d) ((((wxUint32)(a))<<24)| \
|
||||||
(((wxUint32)(b))<<16)| \
|
(((wxUint32)(b))<<16)| \
|
||||||
(((wxUint32)(c))<< 8)| \
|
(((wxUint32)(c))<< 8)| \
|
||||||
(((wxUint32)(d)) ))
|
(((wxUint32)(d)) ))
|
||||||
|
|
||||||
#define ID_FORM MK_ID('F','O','R','M')
|
#define ID_FORM MK_ID('F','O','R','M')
|
||||||
#define ID_LWOB MK_ID('L','W','O','B')
|
#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);
|
det_cnt = read_short(f);
|
||||||
nbytes -= 2;
|
nbytes -= 2;
|
||||||
while (det_cnt-- > 0) {
|
while (det_cnt-- > 0) {
|
||||||
int cnt = read_short(f);
|
int cnt = read_short(f);
|
||||||
fseek(f, cnt*2+2, SEEK_CUR);
|
fseek(f, cnt*2+2, SEEK_CUR);
|
||||||
nbytes -= cnt*2+2;
|
nbytes -= cnt*2+2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
face->material -= 1;
|
face->material -= 1;
|
||||||
@@ -380,13 +380,13 @@ void lw_object_show(const lwObject *lw_object)
|
|||||||
prev_index_cnt = face->index_cnt;
|
prev_index_cnt = face->index_cnt;
|
||||||
switch (face->index_cnt) {
|
switch (face->index_cnt) {
|
||||||
case 3:
|
case 3:
|
||||||
glBegin(GL_TRIANGLES);
|
glBegin(GL_TRIANGLES);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
glBegin(GL_POLYGON);
|
glBegin(GL_POLYGON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,8 +394,8 @@ void lw_object_show(const lwObject *lw_object)
|
|||||||
if (prev_material != face->material) {
|
if (prev_material != face->material) {
|
||||||
prev_material = face->material;
|
prev_material = face->material;
|
||||||
glColor3f(lw_object->material[face->material].r,
|
glColor3f(lw_object->material[face->material].r,
|
||||||
lw_object->material[face->material].g,
|
lw_object->material[face->material].g,
|
||||||
lw_object->material[face->material].b);
|
lw_object->material[face->material].b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update normal if necessary */
|
/* update normal if necessary */
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Robert Roebling
|
// Copyright: (c) Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -159,8 +159,8 @@ void TestGLCanvas::OnSize(wxSizeEvent& event)
|
|||||||
wxGLCanvas::OnSize(event);
|
wxGLCanvas::OnSize(event);
|
||||||
|
|
||||||
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
#ifndef __WXMOTIF__
|
#ifndef __WXMOTIF__
|
||||||
if (GetContext())
|
if (GetContext())
|
||||||
#endif
|
#endif
|
||||||
@@ -203,17 +203,17 @@ void TestGLCanvas::OnMouse( wxMouseEvent& event )
|
|||||||
/* drag in progress, simulate trackball */
|
/* drag in progress, simulate trackball */
|
||||||
float spin_quat[4];
|
float spin_quat[4];
|
||||||
trackball(spin_quat,
|
trackball(spin_quat,
|
||||||
(2.0*info.beginx - sz.x) / sz.x,
|
(2.0*info.beginx - sz.x) / sz.x,
|
||||||
( sz.y - 2.0*info.beginy) / sz.y,
|
( sz.y - 2.0*info.beginy) / sz.y,
|
||||||
( 2.0*event.GetX() - sz.x) / sz.x,
|
( 2.0*event.GetX() - sz.x) / sz.x,
|
||||||
( sz.y - 2.0*event.GetY()) / sz.y);
|
( sz.y - 2.0*event.GetY()) / sz.y);
|
||||||
|
|
||||||
add_quats( spin_quat, info.quat, info.quat );
|
add_quats( spin_quat, info.quat, info.quat );
|
||||||
|
|
||||||
/* orientation has changed, redraw mesh */
|
/* orientation has changed, redraw mesh */
|
||||||
Refresh(FALSE);
|
Refresh(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
info.beginx = event.GetX();
|
info.beginx = event.GetX();
|
||||||
info.beginy = event.GetY();
|
info.beginy = event.GetY();
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Robert Roebling
|
// Copyright: (c) Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PENGUIN_H_
|
#ifndef _WX_PENGUIN_H_
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -87,6 +87,16 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, cons
|
|||||||
canvas = (MyCanvas *) NULL;
|
canvas = (MyCanvas *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// frame destructor
|
||||||
|
MyFrame::~MyFrame()
|
||||||
|
{
|
||||||
|
if (g_TestBitmap)
|
||||||
|
{
|
||||||
|
delete g_TestBitmap;
|
||||||
|
g_TestBitmap = (wxBitmap *) NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
@@ -128,16 +138,17 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
// Show file selector.
|
// Show file selector.
|
||||||
wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL,
|
wxString f = wxFileSelector(wxT("Open Image"), (const wxChar *) NULL,
|
||||||
(const wxChar *) NULL, wxT("png"),
|
(const wxChar *) NULL, wxT("png"),
|
||||||
wxT("PNG files (*.png)|*.png"));
|
wxT("PNG files (*.png)|*.png"));
|
||||||
|
|
||||||
if (f == "")
|
if (f == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( g_TestBitmap )
|
if ( g_TestBitmap )
|
||||||
delete g_TestBitmap;
|
delete g_TestBitmap;
|
||||||
|
|
||||||
g_TestBitmap = new wxBitmap(f, wxBITMAP_TYPE_PNG);
|
g_TestBitmap = new wxBitmap(f, wxBITMAP_TYPE_PNG);
|
||||||
if (!g_TestBitmap->Ok())
|
if (!g_TestBitmap->Ok())
|
||||||
{
|
{
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -31,6 +31,7 @@ class MyFrame: public wxFrame
|
|||||||
public:
|
public:
|
||||||
MyCanvas *canvas;
|
MyCanvas *canvas;
|
||||||
MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size);
|
MyFrame(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size);
|
||||||
|
virtual ~MyFrame();
|
||||||
|
|
||||||
void OnActivate(bool) {}
|
void OnActivate(bool) {}
|
||||||
void OnLoadFile(wxCommandEvent& event);
|
void OnLoadFile(wxCommandEvent& event);
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -152,214 +152,219 @@ void MyApp::RegisterValidators(void)
|
|||||||
|
|
||||||
void MyApp::PropertyListTest(bool useDialog)
|
void MyApp::PropertyListTest(bool useDialog)
|
||||||
{
|
{
|
||||||
if (m_childWindow)
|
if (m_childWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPropertySheet *sheet = new wxPropertySheet;
|
wxPropertySheet *sheet = new wxPropertySheet;
|
||||||
|
|
||||||
sheet->AddProperty(new wxProperty("fred", 1.0, "real"));
|
sheet->AddProperty(new wxProperty("fred", 1.0, "real"));
|
||||||
sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool"));
|
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("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("bill", 25.0, "real", new wxRealListValidator(0.0, 100.0)));
|
||||||
sheet->AddProperty(new wxProperty("julian", "one", "string"));
|
sheet->AddProperty(new wxProperty("julian", "one", "string"));
|
||||||
sheet->AddProperty(new wxProperty("bitmap", "none", "string", new wxFilenameListValidator("Select a bitmap file", "*.bmp")));
|
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);
|
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("constrained", "one", "string", new wxStringListValidator(strings)));
|
||||||
|
|
||||||
wxStringList *strings2 = new wxStringList(wxT("earth"), wxT("fire"), wxT("wind"), wxT("water"), NULL);
|
wxStringList *strings2 = new wxStringList(wxT("earth"), wxT("fire"), wxT("wind"), wxT("water"), NULL);
|
||||||
sheet->AddProperty(new wxProperty("string list", strings2, "stringlist"));
|
sheet->AddProperty(new wxProperty("string list", strings2, "stringlist"));
|
||||||
|
|
||||||
wxPropertyListView *view =
|
wxPropertyListView *view = new wxPropertyListView
|
||||||
new wxPropertyListView(NULL,
|
(
|
||||||
wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL |
|
NULL,
|
||||||
wxPROP_BUTTON_CHECK_CROSS|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES);
|
wxPROP_BUTTON_OK | wxPROP_BUTTON_CANCEL | wxPROP_BUTTON_CHECK_CROSS
|
||||||
|
|wxPROP_DYNAMIC_VALUE_FIELD|wxPROP_PULLDOWN|wxPROP_SHOWVALUES
|
||||||
|
);
|
||||||
|
|
||||||
wxDialog *propDialog = NULL;
|
wxDialog *propDialog = NULL;
|
||||||
wxPropertyListFrame *propFrame = NULL;
|
wxPropertyListFrame *propFrame = NULL;
|
||||||
if (useDialog)
|
if (useDialog)
|
||||||
{
|
{
|
||||||
propDialog = new PropListDialog(view, NULL, "Property Sheet Test",
|
propDialog = new PropListDialog(view, NULL, "Property Sheet Test",
|
||||||
wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
|
wxPoint(-1, -1), wxSize(400, 500), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODELESS);
|
||||||
m_childWindow = propDialog;
|
m_childWindow = propDialog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500));
|
propFrame = new PropListFrame(view, NULL, "Property Sheet Test", wxPoint(-1, -1), wxSize(400, 500));
|
||||||
m_childWindow = propFrame;
|
m_childWindow = propFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
view->AddRegistry(&myListValidatorRegistry);
|
|
||||||
|
|
||||||
if (useDialog)
|
view->AddRegistry(&myListValidatorRegistry);
|
||||||
{
|
|
||||||
view->ShowView(sheet, (wxPanel *)propDialog);
|
|
||||||
propDialog->Centre(wxBOTH);
|
|
||||||
propDialog->Show(TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
propFrame->Initialize();
|
|
||||||
view->ShowView(sheet, propFrame->GetPropertyPanel());
|
|
||||||
|
|
||||||
propFrame->Centre(wxBOTH);
|
if (useDialog)
|
||||||
propFrame->Show(TRUE);
|
{
|
||||||
}
|
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)
|
void MyApp::PropertyFormTest(bool useDialog)
|
||||||
{
|
{
|
||||||
if (m_childWindow)
|
if (m_childWindow)
|
||||||
return;
|
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("fred", 25.0, "real", new wxRealFormValidator(0.0, 100.0)));
|
||||||
sheet->AddProperty(new wxProperty("tough choice", (bool)TRUE, "bool"));
|
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("ian", (long)45, "integer", new wxIntegerFormValidator(-50, 50)));
|
||||||
sheet->AddProperty(new wxProperty("julian", "one", "string"));
|
sheet->AddProperty(new wxProperty("julian", "one", "string"));
|
||||||
wxStringList *strings = new wxStringList(wxT("one"), wxT("two"), wxT("three"), NULL);
|
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("constrained", "one", "string", new wxStringFormValidator(strings)));
|
||||||
|
|
||||||
wxPropertyFormView *view = new wxPropertyFormView(NULL);
|
wxPropertyFormView *view = new wxPropertyFormView(NULL);
|
||||||
|
|
||||||
wxDialog *propDialog = NULL;
|
wxDialog *propDialog = NULL;
|
||||||
wxPropertyFormFrame *propFrame = 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 ?:
|
if (useDialog)
|
||||||
wxWindow *panel ;
|
{
|
||||||
if ( propDialog )
|
propDialog = new PropFormDialog(view, NULL, "Property Form Test",
|
||||||
{
|
wxPoint(-1, -1), wxSize(380, 250), wxDEFAULT_DIALOG_STYLE|wxDIALOG_MODAL);
|
||||||
panel = propDialog ;
|
m_childWindow = propDialog;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
panel = propFrame->GetPropertyPanel() ;
|
propFrame = new PropFormFrame(view, NULL, "Property Form Test",
|
||||||
}
|
wxPoint(-1, -1), wxSize(380, 250));
|
||||||
|
propFrame->Initialize();
|
||||||
wxLayoutConstraints* c;
|
m_childWindow = propFrame;
|
||||||
|
}
|
||||||
|
|
||||||
|
// BCC32 does not like ?:
|
||||||
|
wxWindow *panel ;
|
||||||
|
if ( propDialog )
|
||||||
|
{
|
||||||
|
panel = propDialog;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
panel = propFrame->GetPropertyPanel() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxLayoutConstraints* c;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if (!propDialog)
|
if (!propDialog)
|
||||||
{
|
{
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->left.SameAs(m_childWindow, wxLeft, 4);
|
c->left.SameAs(m_childWindow, wxLeft, 4);
|
||||||
c->right.SameAs(m_childWindow, wxRight, 4);
|
c->right.SameAs(m_childWindow, wxRight, 4);
|
||||||
c->top.SameAs(m_childWindow, wxTop, 4);
|
c->top.SameAs(m_childWindow, wxTop, 4);
|
||||||
c->bottom.SameAs(m_childWindow, wxBottom, 40);
|
c->bottom.SameAs(m_childWindow, wxBottom, 40);
|
||||||
|
|
||||||
panel->SetConstraints(c);
|
panel->SetConstraints(c);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Add items to the panel
|
// Add items to the panel
|
||||||
wxButton *okButton = new wxButton(panel, wxID_OK, "OK", wxPoint(-1, -1),
|
wxButton *okButton = new wxButton(panel, wxID_OK, "OK", wxPoint(-1, -1),
|
||||||
wxSize(80, 26), 0, wxDefaultValidator, "ok");
|
wxSize(80, 26), 0, wxDefaultValidator, "ok");
|
||||||
wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", wxPoint(-1, -1),
|
wxButton *cancelButton = new wxButton(panel, wxID_CANCEL, "Cancel", wxPoint(-1, -1),
|
||||||
wxSize(80, 26), 0, wxDefaultValidator, "cancel");
|
wxSize(80, 26), 0, wxDefaultValidator, "cancel");
|
||||||
wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, "Update", wxPoint(-1, -1),
|
wxButton *updateButton = new wxButton(panel, wxID_PROP_UPDATE, "Update", wxPoint(-1, -1),
|
||||||
wxSize(80, 26), 0, wxDefaultValidator, "update");
|
wxSize(80, 26), 0, wxDefaultValidator, "update");
|
||||||
wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, "Revert", wxPoint(-1, -1),
|
wxButton *revertButton = new wxButton(panel, wxID_PROP_REVERT, "Revert", wxPoint(-1, -1),
|
||||||
wxSize(80, 26), 0, wxDefaultValidator, "revert");
|
wxSize(80, 26), 0, wxDefaultValidator, "revert");
|
||||||
|
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->right.SameAs(panel, wxRight, 4);
|
c->right.SameAs(panel, wxRight, 4);
|
||||||
c->bottom.SameAs(panel, wxBottom, 4);
|
c->bottom.SameAs(panel, wxBottom, 4);
|
||||||
c->height.AsIs();
|
c->height.AsIs();
|
||||||
c->width.AsIs();
|
c->width.AsIs();
|
||||||
revertButton->SetConstraints(c);
|
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 = new wxLayoutConstraints;
|
||||||
c->right.SameAs(updateButton, wxLeft, 4);
|
c->right.SameAs(revertButton, wxLeft, 4);
|
||||||
c->bottom.SameAs(panel, wxBottom, 4);
|
c->bottom.SameAs(panel, wxBottom, 4);
|
||||||
c->height.AsIs();
|
c->height.AsIs();
|
||||||
c->width.AsIs();
|
c->width.AsIs();
|
||||||
cancelButton->SetConstraints(c);
|
updateButton->SetConstraints(c);
|
||||||
|
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->right.SameAs(cancelButton, wxLeft, 4);
|
c->right.SameAs(updateButton, wxLeft, 4);
|
||||||
c->bottom.SameAs(panel, wxBottom, 4);
|
c->bottom.SameAs(panel, wxBottom, 4);
|
||||||
c->height.AsIs();
|
c->height.AsIs();
|
||||||
c->width.AsIs();
|
c->width.AsIs();
|
||||||
okButton->SetConstraints(c);
|
cancelButton->SetConstraints(c);
|
||||||
|
|
||||||
// The name of this text item matches the "fred" property
|
c = new wxLayoutConstraints;
|
||||||
wxTextCtrl *text = new wxTextCtrl(panel, -1, "Fred", wxPoint(-1, -1), wxSize(
|
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");
|
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),
|
c = new wxLayoutConstraints;
|
||||||
wxSize(-1, -1), 0, wxDefaultValidator, "tough choice");
|
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),
|
wxSlider *slider = new wxSlider(panel, -1, -50, 50, 150, wxPoint(-1, -1),
|
||||||
wxSize(200,10), 0, wxDefaultValidator, "ian");
|
wxSize(200,10), 0, wxDefaultValidator, "ian");
|
||||||
|
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->left.SameAs(panel, wxLeft, 4);
|
c->left.SameAs(panel, wxLeft, 4);
|
||||||
c->top.SameAs(text, wxBottom, 10);
|
c->top.SameAs(text, wxBottom, 10);
|
||||||
c->height.AsIs();
|
c->height.AsIs();
|
||||||
c->width.AsIs();
|
c->width.AsIs();
|
||||||
slider->SetConstraints(c);
|
slider->SetConstraints(c);
|
||||||
|
|
||||||
wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1), wxSize(200, 100),
|
wxListBox *listBox = new wxListBox(panel, -1, wxPoint(-1, -1),
|
||||||
0, NULL, 0, wxDefaultValidator, "constrained");
|
wxSize(200, 100), 0, NULL, 0, wxDefaultValidator, "constrained");
|
||||||
|
|
||||||
c = new wxLayoutConstraints;
|
c = new wxLayoutConstraints;
|
||||||
c->left.SameAs(panel, wxLeft, 4);
|
c->left.SameAs(panel, wxLeft, 4);
|
||||||
c->top.SameAs(slider, wxBottom, 10);
|
c->top.SameAs(slider, wxBottom, 10);
|
||||||
c->height.AsIs();
|
c->height.AsIs();
|
||||||
c->width.AsIs();
|
c->width.AsIs();
|
||||||
listBox->SetConstraints(c);
|
listBox->SetConstraints(c);
|
||||||
|
|
||||||
view->AddRegistry(&myFormValidatorRegistry);
|
view->AddRegistry(&myFormValidatorRegistry);
|
||||||
|
|
||||||
panel->SetAutoLayout(TRUE);
|
panel->SetAutoLayout(TRUE);
|
||||||
|
|
||||||
view->ShowView(sheet, panel);
|
view->ShowView(sheet, panel);
|
||||||
view->AssociateNames();
|
view->AssociateNames();
|
||||||
view->TransferToDialog();
|
view->TransferToDialog();
|
||||||
|
|
||||||
if (useDialog) {
|
if (useDialog) {
|
||||||
propDialog->Layout();
|
propDialog->Layout();
|
||||||
propDialog->Centre(wxBOTH);
|
propDialog->Centre(wxBOTH);
|
||||||
propDialog->Show(TRUE);
|
propDialog->Show(TRUE);
|
||||||
} else {
|
}
|
||||||
// panel->Layout();
|
else
|
||||||
propFrame->Centre(wxBOTH);
|
{
|
||||||
propFrame->Show(TRUE);
|
// panel->Layout();
|
||||||
}
|
propFrame->Centre(wxBOTH);
|
||||||
|
propFrame->Show(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)
|
BEGIN_EVENT_TABLE(PropListFrame, wxPropertyListFrame)
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -120,7 +120,7 @@ MyApp::~MyApp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
|
||||||
EVT_LEFT_DOWN( MyPanel::OnClick)
|
EVT_LEFT_DOWN( MyPanel::OnClick)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
MyPanel::MyPanel( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
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)
|
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||||
EVT_MENU(RESOURCE_ABOUT, MyFrame::OnAbout)
|
EVT_MENU(RESOURCE_ABOUT, MyFrame::OnAbout)
|
||||||
EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
|
EVT_MENU(RESOURCE_QUIT, MyFrame::OnQuit)
|
||||||
EVT_MENU(RESOURCE_TESTDIALOG, MyFrame::OnTestDialog)
|
EVT_MENU(RESOURCE_TESTDIALOG, MyFrame::OnTestDialog)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define my frame constructor
|
// Define my frame constructor
|
||||||
@@ -159,7 +159,7 @@ void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
|||||||
|
|
||||||
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnQuit( wxCommandEvent& WXUNUSED(event) )
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
|
||||||
@@ -176,8 +176,8 @@ void MyFrame::OnTestDialog(wxCommandEvent& WXUNUSED(event) )
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||||
// EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk)
|
//EVT_BUTTON(RESOURCE_OK, MyDialog::OnOk)
|
||||||
EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel)
|
EVT_BUTTON(ID_BUTTON109, MyDialog::OnCancel)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
@@ -831,7 +831,7 @@ Package=<4>
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
Project: "treectrl"=.\treectrl\treectrl.dsp - Package Owner=<4>
|
Project: "treetest"=.\treectrl\treetest.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
{{{
|
{{{
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx/wx.h".
|
// For compilers that support precompilation, includes "wx/wx.h".
|
||||||
@@ -94,7 +94,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
// Define my frame constructor
|
// Define my frame constructor
|
||||||
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
|
MyFrame::MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
|
||||||
const long style):
|
const long style):
|
||||||
wxMDIParentFrame(parent, id, title, pos, size, style)
|
wxMDIParentFrame(parent, id, title, pos, size, style)
|
||||||
{
|
{
|
||||||
// Create some dummy layout windows
|
// Create some dummy layout windows
|
||||||
@@ -273,7 +273,7 @@ void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
|
||||||
EVT_MOUSE_EVENTS(MyCanvas::OnEvent)
|
EVT_MOUSE_EVENTS(MyCanvas::OnEvent)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// Define a constructor for my canvas
|
// Define a constructor for my canvas
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/toolbar.h"
|
#include "wx/toolbar.h"
|
||||||
|
@@ -306,12 +306,12 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
(0-scroll_x < size_x) && (0-scroll_y < size_y))
|
(0-scroll_x < size_x) && (0-scroll_y < size_y))
|
||||||
{
|
{
|
||||||
// Has the region on screen been exposed?
|
// Has the region on screen been exposed?
|
||||||
if (IsExposed(0,0,100,25))
|
if (IsExposed(0,0,100,25))
|
||||||
{
|
{
|
||||||
wxLogMessage( wxT("Redraw first cell") );
|
wxLogMessage( wxT("Redraw first cell") );
|
||||||
dc.DrawRectangle( 0, 0, 100, 25 );
|
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))
|
(200-scroll_x < size_x) && (0-scroll_y < size_y))
|
||||||
{
|
{
|
||||||
// Has the region on screen been exposed?
|
// Has the region on screen been exposed?
|
||||||
if (IsExposed(200,0,100,25))
|
if (IsExposed(200,0,100,25))
|
||||||
{
|
{
|
||||||
wxLogMessage( wxT("Redraw second cell") );
|
wxLogMessage( wxT("Redraw second cell") );
|
||||||
dc.DrawRectangle( 200, 0, 100, 25 );
|
dc.DrawRectangle( 200, 0, 100, 25 );
|
||||||
dc.DrawText( "Second Cell", 205, 5 );
|
dc.DrawText( "Second Cell", 205, 5 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -413,7 +413,7 @@ void MyFrame::OnSetStatusFields(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnUpdateStatusBarToggle(wxUpdateUIEvent& event)
|
void MyFrame::OnUpdateStatusBarToggle(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
event.Check(GetStatusBar() != 0);
|
event.Check(GetStatusBar() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnStatusBarToggle(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnStatusBarToggle(wxCommandEvent& WXUNUSED(event))
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Define a new application
|
// Define a new application
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
@@ -6,13 +6,13 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class MyTaskBarIcon: public wxTaskBarIcon
|
class MyTaskBarIcon: public wxTaskBarIcon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyTaskBarIcon() {};
|
MyTaskBarIcon() {};
|
||||||
|
|
||||||
virtual void OnMouseMove(wxEvent&);
|
virtual void OnMouseMove(wxEvent&);
|
||||||
virtual void OnLButtonDown(wxEvent&);
|
virtual void OnLButtonDown(wxEvent&);
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "treelay.h"
|
#include "treelay.h"
|
||||||
|
|
||||||
wxTreeLayoutStored *myTree = NULL;
|
wxTreeLayoutStored *myTree = (wxTreeLayoutStored *) NULL;
|
||||||
|
|
||||||
// A macro needed for some compilers (AIX) that need 'main' to be defined
|
// A macro needed for some compilers (AIX) that need 'main' to be defined
|
||||||
// in the application itself.
|
// in the application itself.
|
||||||
@@ -85,6 +85,17 @@ bool MyApp::OnInit()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MyApp::OnExit()
|
||||||
|
{
|
||||||
|
if (myTree)
|
||||||
|
{
|
||||||
|
delete myTree;
|
||||||
|
myTree = (wxTreeLayoutStored *) NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void MyApp::TreeTest(wxTreeLayoutStored& tree, wxDC& dc)
|
void MyApp::TreeTest(wxTreeLayoutStored& tree, wxDC& dc)
|
||||||
{
|
{
|
||||||
tree.Initialize(200);
|
tree.Initialize(200);
|
||||||
|
@@ -12,8 +12,9 @@
|
|||||||
// Define a new application
|
// Define a new application
|
||||||
class MyApp: public wxApp
|
class MyApp: public wxApp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool OnInit();
|
virtual bool OnInit();
|
||||||
|
virtual int OnExit();
|
||||||
void TreeTest(wxTreeLayoutStored& tree, wxDC& dc);
|
void TreeTest(wxTreeLayoutStored& tree, wxDC& dc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -436,7 +436,7 @@ void MyApp::DoStreamDemo3(wxCommandEvent& WXUNUSED(event))
|
|||||||
case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
|
case wxSTREAM_READ_ERROR: textCtrl.WriteText( "wxSTREAM_READ_ERROR\n" ); break;
|
||||||
case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
|
case wxSTREAM_WRITE_ERROR: textCtrl.WriteText( "wxSTREAM_WRITE_ERROR\n" ); break;
|
||||||
default: textCtrl.WriteText( "Huh?\n" ); break;
|
default: textCtrl.WriteText( "Huh?\n" ); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
textCtrl.WriteText( "\n" );
|
textCtrl.WriteText( "\n" );
|
||||||
|
|
||||||
|
@@ -457,7 +457,7 @@ void ComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event)
|
|||||||
{
|
{
|
||||||
unsigned long n;
|
unsigned long n;
|
||||||
event.Enable(m_textDelete->GetValue().ToULong(&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)
|
void ComboboxWidgetsPage::OnComboText(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (!m_combobox)
|
if (!m_combobox)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString s = event.GetString();
|
wxString s = event.GetString();
|
||||||
|
|
||||||
wxASSERT_MSG( s == m_combobox->GetValue(),
|
wxASSERT_MSG( s == m_combobox->GetValue(),
|
||||||
|
@@ -303,9 +303,9 @@ void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxWizard *wizard = new wxWizard(this, -1,
|
wxWizard *wizard = new wxWizard(this, -1,
|
||||||
"Absolutely Useless Wizard",
|
"Absolutely Useless Wizard",
|
||||||
wxBITMAP(wiztest));
|
wxBITMAP(wiztest));
|
||||||
|
|
||||||
// a wizard page may be either an object of predefined class
|
// a wizard page may be either an object of predefined class
|
||||||
wxWizardPageSimple *page1 = new wxWizardPageSimple(wizard);
|
wxWizardPageSimple *page1 = new wxWizardPageSimple(wizard);
|
||||||
wxStaticText *text = new wxStaticText(page1, -1,
|
wxStaticText *text = new wxStaticText(page1, -1,
|
||||||
|
Reference in New Issue
Block a user