diff --git a/samples/wxtest/.cvsignore b/samples/wxtest/.cvsignore new file mode 100644 index 0000000000..20e7cd6387 --- /dev/null +++ b/samples/wxtest/.cvsignore @@ -0,0 +1,6 @@ +scrollM5.mcp +scrollM*Data +*Classic?Debug* +*Classic?Release* +*Carbon?Debug* +*Carbon?Release* diff --git a/samples/wxtest/makefile.g95 b/samples/wxtest/makefile.g95 new file mode 100644 index 0000000000..b916c18c5b --- /dev/null +++ b/samples/wxtest/makefile.g95 @@ -0,0 +1,16 @@ +# +# File: makefile.g95 +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: (c) Julian Smart, 1999 +# +# Makefile for wxWindows sample (Cygwin/Mingw32). + +WXDIR = ../.. + +TARGET=test +OBJECTS = $(TARGET).o test_wdr.o + +include $(WXDIR)/src/makeprog.g95 + diff --git a/samples/wxtest/makefile.vc b/samples/wxtest/makefile.vc new file mode 100644 index 0000000000..ee684846d3 --- /dev/null +++ b/samples/wxtest/makefile.vc @@ -0,0 +1,18 @@ +# +# File: makefile.vc +# Author: Julian Smart +# Created: 1999 +# Updated: +# Copyright: (c) Julian Smart +# +# Makefile : Builds sample (VC++, WIN32) +# Use FINAL=1 argument to nmake to build final version with no debug info. + +# Set WXDIR for your system +WXDIR = $(WXWIN) + +PROGRAM=test +OBJECTS = $(PROGRAM).obj test_wdr.o + +!include $(WXDIR)\src\makeprog.vc + diff --git a/samples/wxtest/mondrian.ico b/samples/wxtest/mondrian.ico new file mode 100644 index 0000000000..8b0e58c0d7 Binary files /dev/null and b/samples/wxtest/mondrian.ico differ diff --git a/samples/wxtest/test.cpp b/samples/wxtest/test.cpp new file mode 100644 index 0000000000..91f09a013f --- /dev/null +++ b/samples/wxtest/test.cpp @@ -0,0 +1,143 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: test.cpp +// Author: XX +// Created: XX/XX/XX +// Copyright: +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ + #pragma implementation "test.cpp" +#endif + +// For compilers that support precompilation +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// Include private headers +#include "test.h" + +// WDR: class implementations + +//---------------------------------------------------------------------------- +// MyDialog +//---------------------------------------------------------------------------- + +// WDR: event table for MyDialog + +BEGIN_EVENT_TABLE(MyDialog,wxDialog) +END_EVENT_TABLE() + +MyDialog::MyDialog( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &position, const wxSize& size, long style ) : + wxDialog( parent, id, title, position, size, style|wxRESIZE_BORDER ) +{ + MyDialogFunc( this, TRUE ); + + CentreOnParent(); +} + +bool MyDialog::Validate() +{ + return TRUE; +} + +bool MyDialog::TransferDataToWindow() +{ + return TRUE; +} + +bool MyDialog::TransferDataFromWindow() +{ + return TRUE; +} + +// WDR: handler implementations for MyDialog + + +//------------------------------------------------------------------------------ +// MyFrame +//------------------------------------------------------------------------------ + +// WDR: event table for MyFrame + +BEGIN_EVENT_TABLE(MyFrame,wxFrame) + EVT_MENU(ID_ABOUT, MyFrame::OnAbout) + EVT_MENU(ID_QUIT, MyFrame::OnQuit) + EVT_CLOSE(MyFrame::OnCloseWindow) + EVT_MENU( ID_TEST, MyFrame::OnTest ) +END_EVENT_TABLE() + +MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint &position, const wxSize& size, long style ) : + wxFrame( parent, id, title, position, size, style ) +{ + CreateMyMenuBar(); + + CreateStatusBar(1); + SetStatusText( "Welcome!" ); + + // insert main window here +} + +void MyFrame::CreateMyMenuBar() +{ +#ifdef __WXMAC__ + wxApp::s_macAboutMenuItemId = ID_ABOUT; +#endif + + SetMenuBar( MyMenuBarFunc() ); +} + +// WDR: handler implementations for MyFrame + +void MyFrame::OnTest( wxCommandEvent &event ) +{ + MyDialog dialog( this, -1, "Test" ); + dialog.ShowModal(); +} + +void MyFrame::OnAbout( wxCommandEvent &event ) +{ + wxMessageDialog dialog( this, "Welcome to SuperApp 1.0\n(C)opyright Joe Hacker", + "About SuperApp", wxOK|wxICON_INFORMATION ); + dialog.ShowModal(); +} + +void MyFrame::OnQuit( wxCommandEvent &event ) +{ + Close( TRUE ); +} + +void MyFrame::OnCloseWindow( wxCloseEvent &event ) +{ + // if ! saved changes -> return + + Destroy(); +} + +//------------------------------------------------------------------------------ +// MyApp +//------------------------------------------------------------------------------ + +IMPLEMENT_APP(MyApp) + +MyApp::MyApp() +{ +} + +bool MyApp::OnInit() +{ + MyFrame *frame = new MyFrame( NULL, -1, "SuperApp", wxPoint(20,20), wxSize(500,340) ); + frame->Show( TRUE ); + + return TRUE; +} + +int MyApp::OnExit() +{ + return 0; +} + diff --git a/samples/wxtest/test.h b/samples/wxtest/test.h new file mode 100644 index 0000000000..09e2f3d63c --- /dev/null +++ b/samples/wxtest/test.h @@ -0,0 +1,97 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: test.h +// Author: XX +// Created: XX/XX/XX +// Copyright: +///////////////////////////////////////////////////////////////////////////// + +#ifndef __test_H__ +#define __test_H__ + +#ifdef __GNUG__ + #pragma interface "test.cpp" +#endif + +// Include wxWindows' headers + +#ifndef WX_PRECOMP + #include +#endif + +#include "test_wdr.h" + +// WDR: class declarations + +//---------------------------------------------------------------------------- +// MyDialog +//---------------------------------------------------------------------------- + +class MyDialog: public wxDialog +{ +public: + // constructors and destructors + MyDialog( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE ); + + // WDR: method declarations for MyDialog + virtual bool Validate(); + virtual bool TransferDataToWindow(); + virtual bool TransferDataFromWindow(); + +private: + // WDR: member variable declarations for MyDialog + +private: + // WDR: handler declarations for MyDialog + +private: + DECLARE_EVENT_TABLE() +}; + +//---------------------------------------------------------------------------- +// MyFrame +//---------------------------------------------------------------------------- + +class MyFrame: public wxFrame +{ +public: + // constructors and destructors + MyFrame( wxWindow *parent, wxWindowID id, const wxString &title, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_FRAME_STYLE ); + +private: + // WDR: method declarations for MyFrame + void CreateMyMenuBar(); + +private: + // WDR: member variable declarations for MyFrame + +private: + // WDR: handler declarations for MyFrame + void OnTest( wxCommandEvent &event ); + void OnAbout( wxCommandEvent &event ); + void OnQuit( wxCommandEvent &event ); + void OnCloseWindow( wxCloseEvent &event ); + +private: + DECLARE_EVENT_TABLE() +}; + +//---------------------------------------------------------------------------- +// MyApp +//---------------------------------------------------------------------------- + +class MyApp: public wxApp +{ +public: + MyApp(); + + virtual bool OnInit(); + virtual int OnExit(); +}; + +#endif diff --git a/samples/wxtest/test.rc b/samples/wxtest/test.rc new file mode 100644 index 0000000000..82bdf07561 --- /dev/null +++ b/samples/wxtest/test.rc @@ -0,0 +1,2 @@ +#include "wx/msw/wx.rc" + diff --git a/samples/wxtest/test_wdr.cpp b/samples/wxtest/test_wdr.cpp new file mode 100644 index 0000000000..c6ec0d7ed6 --- /dev/null +++ b/samples/wxtest/test_wdr.cpp @@ -0,0 +1,73 @@ +//------------------------------------------------------------------------------ +// Source code generated by wxDesigner from file: test.wdr +// Do not modify this file, all changes will be lost! +//------------------------------------------------------------------------------ + +#ifdef __GNUG__ + #pragma implementation "test_wdr.cpp" +#endif + +// For compilers that support precompilation +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +// Include private header +#include "test_wdr.h" + + +// Implement window functions + +wxSizer *MyDialogFunc( wxWindow *parent, bool call_fit, bool set_sizer ) +{ + wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); + + wxStaticBox *item2 = new wxStaticBox( parent, -1, "Text" ); + wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); + + wxBoxSizer *item3 = new wxBoxSizer( wxHORIZONTAL ); + + wxTextCtrl *item4 = new wxTextCtrl( parent, ID_TEXTCTRL, "", wxDefaultPosition, wxSize(80,-1), 0 ); + item3->Add( item4, 0, wxALIGN_CENTRE|wxALL, 5 ); + + item1->Add( item3, 0, wxALIGN_CENTRE|wxALL, 5 ); + + item0->Add( item1, 0, wxALIGN_CENTRE|wxALL, 5 ); + + if (set_sizer) + { + parent->SetAutoLayout( TRUE ); + parent->SetSizer( item0 ); + if (call_fit) + { + item0->Fit( parent ); + item0->SetSizeHints( parent ); + } + } + + return item0; +} + +// Implement menubar functions + +wxMenuBar *MyMenuBarFunc() +{ + wxMenuBar *item0 = new wxMenuBar; + + wxMenu* item1 = new wxMenu; + item1->Append( ID_ABOUT, "About...\tF1", "" ); + item1->Append( ID_TEST, "Test...\tF2", "" ); + item1->Append( ID_QUIT, "Quit\tCtrl-Q", "" ); + item0->Append( item1, "File" ); + + return item0; +} + +// Implement toolbar functions + +// Implement bitmap functions + + +// End of generated file diff --git a/samples/wxtest/test_wdr.h b/samples/wxtest/test_wdr.h new file mode 100644 index 0000000000..352fe7a4ef --- /dev/null +++ b/samples/wxtest/test_wdr.h @@ -0,0 +1,48 @@ +//------------------------------------------------------------------------------ +// Header generated by wxDesigner from file: test.wdr +// Do not modify this file, all changes will be lost! +//------------------------------------------------------------------------------ + +#ifndef __WDR_test_H__ +#define __WDR_test_H__ + +#ifdef __GNUG__ + #pragma interface "test_wdr.cpp" +#endif + +// Include wxWindows' headers + +#ifndef WX_PRECOMP + #include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Declare window functions + +#define ID_TEXTCTRL 10000 +wxSizer *MyDialogFunc( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); + +// Declare menubar functions + +#define ID_MENU 10001 +#define ID_ABOUT 10002 +#define ID_TEST 10003 +#define ID_QUIT 10004 +wxMenuBar *MyMenuBarFunc(); + +// Declare toolbar functions + +// Declare bitmap functions + +#endif + +// End of generated file