]> git.saurik.com Git - wxWidgets.git/commitdiff
renamed wizard sample
authorRon Lee <ron@debian.org>
Tue, 14 Mar 2000 18:50:24 +0000 (18:50 +0000)
committerRon Lee <ron@debian.org>
Tue, 14 Mar 2000 18:50:24 +0000 (18:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

17 files changed:
samples/wizard/Makefile.in
samples/wizard/makefile.b32
samples/wizard/makefile.bcc
samples/wizard/makefile.dos
samples/wizard/makefile.g95
samples/wizard/makefile.sc [new file with mode: 0644]
samples/wizard/makefile.sl [new file with mode: 0644]
samples/wizard/makefile.twn [new file with mode: 0644]
samples/wizard/makefile.unx [new file with mode: 0644]
samples/wizard/makefile.vc
samples/wizard/makefile.wat
samples/wizard/wizard.cpp [new file with mode: 0644]
samples/wizard/wizard.def [new file with mode: 0644]
samples/wizard/wizard.rc [new file with mode: 0644]
samples/wizard/wiztest.cpp [deleted file]
samples/wizard/wiztest.def [deleted file]
samples/wizard/wiztest.rc [deleted file]

index 4728a4ea537188599535f19bba58fdae664c807c..a593751f88f2a1bf31cec41ee250e8a98c1ea54d 100644 (file)
@@ -1,13 +1,5 @@
-#
-# File:                makefile.unx
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-# Copyright:   (c) 1998 Julian Smart
-#
-# "%W% %G%"
-#
-# Makefile for wiztest example (UNIX).
+# Purpose: makefile for wizard example (UNIX).
+# Created: 2000-03-15
 
 top_srcdir = @top_srcdir@/..
 top_builddir = ../..
@@ -15,7 +7,7 @@ program_dir = samples/wizard
 
 PROGRAM=wizard
 
-OBJECTS=wiztest.o
+OBJECTS=$(PROGRAM).o
 
 include ../../src/makeprog.env
 
index 3ed880a545d33bebc5d90ccbfe68808bb57596cd..c0b9a7225f0f6bdf6d99d45d11140195bd006a7a 100644 (file)
@@ -1,15 +1,9 @@
-#
-# File:                makefile.b32
-# Author:      Julian Smart
-# Created:     1999
-# Updated:     
-# Copyright:
-#
-# Makefile : Builds sample for 32-bit BC++
+# Purpose: makefile for wizard example (BC++ 32bit)
+# Created: 2000-03-15
 
 WXDIR = $(WXWIN)
 
-TARGET=wiztest
+TARGET=wizard
 OBJECTS = $(TARGET).obj
 
 !include $(WXDIR)\src\makeprog.b32
index 91ea98579a6a08adf1911bf646a75f4b73640bc3..1775c2f54d74fdce9204d8cabfd3f189c2073fe3 100644 (file)
@@ -1,10 +1,5 @@
-#
-# File:                makefile.bcc
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Builds a BC++ 16-bit sample
+# Purpose: makefile for wizard example (BC++ 16bit)
+# Created: 2000-03-15
 
 !if "$(WXWIN)" == ""
 !error You must define the WXWIN variable in autoexec.bat, e.g. WXWIN=c:\wx
@@ -12,7 +7,7 @@
 
 WXDIR = $(WXWIN)
 
-TARGET=wiztest
+TARGET=wizard
 OBJECTS=$(TARGET).obj
 
 !include $(WXDIR)\src\makeprog.bcc
index cfbe67b487384eb1f9eabd62fe29463bcf5bce89..ea02a5a74662d5691a1daa18ddeff51026a9ca9d 100644 (file)
@@ -1,16 +1,9 @@
-#
-# File:                makefile.dos
-# Author:      Julian Smart
-# Created:     1998
-# Updated:     
-#
-# Makefile : Builds 16-bit sample, VC++ 1.5
-# Use FINAL=1 argument to nmake to build final version with no debugging
-# info
+# Purpose: makefile for wizard example (VC++ 1.5x)
+# Created: 2000-03-15
 
 WXDIR = $(WXWIN)
 
-TARGET=wiztest
+TARGET=wizard
 OBJECTS=$(TARGET).obj
 
 !include $(WXDIR)\src\makeprog.msc
index 0d481d3f70e6b387b13adbc3cb453f3d23e78dac..2cee3f0c2f728213cf7d3b01e7e3d31ab86e6905 100644 (file)
@@ -1,16 +1,10 @@
-#
-# File:         makefile.g95
-# Author:       Julian Smart
-# Created:      1999
-# Updated:
-# Copyright:    (c) Julian Smart, 1999
-#
-# Makefile for wxWindows sample (Cygwin/Mingw32).
+# Purpose: makefile for wizard example (Cygwin/Mingw32)
+# Created: #03.01.00
 
 WXDIR = ../..
 
 TARGET=wizard
 OBJECTS = $(TARGET).o
 
-include $(WXDIR)/src/makeprog.g95
+include $(WXDIR)\src\makeprog.g95
 
diff --git a/samples/wizard/makefile.sc b/samples/wizard/makefile.sc
new file mode 100644 (file)
index 0000000..3a0045e
--- /dev/null
@@ -0,0 +1,37 @@
+# Purpose: makefile for wizard example (Symantec C++)
+# Created: 2000-03-15
+
+WXDIR = $(WXWIN)
+WXLIB = $(WXDIR)\lib\wx.lib
+INCDIR = $(WXDIR)\include
+INCLUDE=$(INCDIR)
+TARGET=wizard
+
+include $(WXDIR)\src\makesc.env
+
+wizard.exe: wizard.obj $(DEFFILE) wizard.res
+       *$(CC) $(LDFLAGS) -o$@ $** $(LIBS)
+    *$(RC) -k wizard.res
+
+sc32.def:
+     echo EXETYPE NT > sc32.def
+     echo SUBSYSTEM WINDOWS >> sc32.def
+
+sc16.def:
+     echo NAME $(TARGET) > sc16.def
+     echo EXETYPE WINDOWS >> sc16.def
+     echo STUB         'WINSTUB.EXE' >> sc16.def
+     echo CODE         PRELOAD MOVEABLE DISCARDABLE >> sc16.def
+     echo DATA         PRELOAD MOVEABLE MULTIPLE >> sc16.def
+     echo HEAPSIZE     1024 >> sc16.def
+     echo STACKSIZE    8192 >> sc16.def
+
+clean:
+    -del *.obj
+       -del *.exe
+       -del *.res
+       -del *.map
+       -del *.rws
+    -del sc32.def
+    -del sc16.def
+
diff --git a/samples/wizard/makefile.sl b/samples/wizard/makefile.sl
new file mode 100644 (file)
index 0000000..19615d2
--- /dev/null
@@ -0,0 +1,14 @@
+# Purpose: makefile for wizard example (Salford C++)
+# Created: 2000-03-15
+
+PROGRAM = wizard
+OBJECTS = $(PROGRAM).obj
+
+include ..\..\src\makeprog.sl
+
+all:        wx $(TARGET)
+
+wx:
+    cd $(WXDIR)\src\msw ^ mk32 -f makefile.sl all
+    cd $(WXDIR)\samples\wizard
+
diff --git a/samples/wizard/makefile.twn b/samples/wizard/makefile.twn
new file mode 100644 (file)
index 0000000..5ffd8e0
--- /dev/null
@@ -0,0 +1,35 @@
+# Purpose: makefile for wizard example (TWIN)
+# Created: 2000-03-15
+
+WXDIR = ../..
+
+# All common UNIX compiler flags and options are now in
+# this central makefile.
+include $(WXDIR)/src/maketwin.env
+
+OBJECTS = $(OBJDIR)/wizard.$(OBJSUFF) $(OBJDIR)/wizard.$(OBJSUFF)
+
+all:    $(OBJDIR) wizard$(GUISUFFIX)$(EXESUFF)
+
+wx:
+
+$(OBJDIR):
+       mkdir $(OBJDIR)
+
+wizard$(GUISUFFIX)$(EXESUFF):  $(OBJECTS) $(WXLIB)
+       $(CC) $(LDFLAGS) -o wizard$(GUISUFFIX)$(EXESUFF) $(OBJECTS) $(LDLIBS)
+
+$(OBJDIR)/wizard.$(OBJSUFF):   wizard.$(SRCSUFF)
+       $(CC) -c $(CPPFLAGS) -o $@ wizard.$(SRCSUFF)
+
+wizard.c:  wizard.rc
+       $(RESCOMP) $(RCINPUTSWITCH) wizard.rc $(RCOUTPUTSWITCH) wizard.c $(RESFLAGS)
+
+$(OBJDIR)/wizard.$(OBJSUFF):   wizard.c
+       $(CC) -c $(CPPFLAGS) -o $@ wizard.c
+
+#$(OBJDIR)/wizard.o:  wizard.rc
+#      $(RESCOMP) $(RCINPUTSWITCH) wizard.rc $(RCOUTPUTSWITCH) $(OBJDIR)/wizard.o $(RESFLAGS)
+
+clean:
+       rm -f $(OBJECTS) wizard$(GUISUFFIX).exe core *.rsc *.res
diff --git a/samples/wizard/makefile.unx b/samples/wizard/makefile.unx
new file mode 100644 (file)
index 0000000..f0e1aba
--- /dev/null
@@ -0,0 +1,23 @@
+# Purpose: makefile for wizard example (Unix)
+# Created: 2000-03-15
+
+CC = gcc
+
+PROGRAM = wizard
+
+OBJECTS = $(PROGRAM).o
+
+# implementation
+
+.SUFFIXES:     .o .cpp
+
+.cpp.o :
+       $(CC) -c `wx-config --cflags` -o $@ $<
+
+all:    $(PROGRAM)
+
+$(PROGRAM):    $(OBJECTS)
+       $(CC) -o $(PROGRAM) $(OBJECTS) `wx-config --libs`
+
+clean:
+       rm -f *.o $(PROGRAM)
index 42445bdbb43789e974e34a5e7d9519954633c717..0476d7c58934e94cba3de10cab55caa3d3bc2260 100644 (file)
@@ -1,17 +1,10 @@
-#
-# 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.
+# Purpose: makefile for wizard example (VC++ 32bit)
+# Created: 2000-03-15
 
 # Set WXDIR for your system
 WXDIR = $(WXWIN)
 
-PROGRAM=wiztest
+PROGRAM=wizard
 OBJECTS = $(PROGRAM).obj
 
 !include $(WXDIR)\src\makeprog.vc
index 53d054297fc360cce771449138136ae744b8d056..b281b5eb48a03af2e27bf87663a487034862ae56 100644 (file)
@@ -1,13 +1,9 @@
-#
-# Makefile for WATCOM
-#
-# Created by Julian Smart, January 1999
-# 
-#
+# Purpose: makefile for wizard example (Watcom)
+# Created: 2000-03-15
 
 WXDIR = $(%WXWIN)
 
-PROGRAM = wiztest
+PROGRAM = wizard
 OBJECTS = $(PROGRAM).obj
 
 !include $(WXDIR)\src\makeprog.wat
diff --git a/samples/wizard/wizard.cpp b/samples/wizard/wizard.cpp
new file mode 100644 (file)
index 0000000..52cd493
--- /dev/null
@@ -0,0 +1,355 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wizard.cpp
+// Purpose:     wxWindows sample demonstrating wxWizard control
+// Author:      Vadim Zeitlin
+// Modified by:
+// Created:     15.08.99
+// RCS-ID:      $Id$
+// Copyright:   (c) Vadim Zeitlin
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#ifdef __GNUG__
+    #pragma implementation "wizard.cpp"
+    #pragma interface "wizard.cpp"
+#endif
+
+// For compilers that support precompilation, includes "wx/wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+// for all others, include the necessary headers (this file is usually all you
+// need because it includes almost all "standard" wxWindows headers
+#ifndef WX_PRECOMP
+    #include "wx/wx.h"
+#endif
+
+#include "wx/wizard.h"
+
+#ifndef __WXMSW__
+    #include "wiztest.xpm"
+#endif
+
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// ids for menu items
+enum
+{
+    Wizard_Quit = 100,
+    Wizard_Run,
+    Wizard_About = 1000
+};
+
+// ----------------------------------------------------------------------------
+// ressources
+// ----------------------------------------------------------------------------
+
+#ifdef __WXMSW__
+    #define BMP_WIZARD_1 wxBitmap("wiztest.bmp", wxBITMAP_TYPE_BMP)
+    #define BMP_WIZARD_2 wxBitmap("wiztest2.bmp", wxBITMAP_TYPE_BMP)
+#else
+    #define BMP_WIZARD_1 wxBitmap(wizimage)
+    #define BMP_WIZARD_2 wxBitmap(wizimage)
+#endif
+
+// ----------------------------------------------------------------------------
+// private classes
+// ----------------------------------------------------------------------------
+
+// Define a new application type, each program should derive a class from wxApp
+class MyApp : public wxApp
+{
+public:
+    // override base class virtuals
+    virtual bool OnInit();
+};
+
+class MyFrame : public wxFrame
+{
+public:
+    // ctor(s)
+    MyFrame(const wxString& title);
+
+    // event handlers (these functions should _not_ be virtual)
+    void OnQuit(wxCommandEvent& event);
+    void OnAbout(wxCommandEvent& event);
+    void OnRunWizard(wxCommandEvent& event);
+    void OnWizardCancel(wxWizardEvent& event);
+
+private:
+    // any class wishing to process wxWindows events must use this macro
+    DECLARE_EVENT_TABLE()
+};
+
+// ----------------------------------------------------------------------------
+// some pages for our wizard
+// ----------------------------------------------------------------------------
+
+// this shows how to simply control the validity of the user input by just
+// overriding TransferDataFromWindow() - of course, in a real program, the
+// check wouldn't be so trivial and the data will be probably saved somewhere
+// too
+//
+// it also shows how to use a different bitmap for one of the pages
+class wxValidationPage : public wxWizardPageSimple
+{
+public:
+    wxValidationPage(wxWizard *parent) : wxWizardPageSimple(parent)
+    {
+        m_bitmap = BMP_WIZARD_2;
+
+        m_checkbox = new wxCheckBox(this, -1, "&Check me");
+    }
+
+    virtual bool TransferDataFromWindow()
+    {
+        if ( !m_checkbox->GetValue() )
+        {
+            wxMessageBox("Check the checkbox first!", "No way",
+                         wxICON_WARNING | wxOK, this);
+
+            return FALSE;
+        }
+
+        return TRUE;
+    }
+
+private:
+    wxCheckBox *m_checkbox;
+};
+
+// This is a more complicated example of validity checking: using events we may
+// allow to return to the previous page, but not to proceed. It also
+// demonstrates how to intercept [Cancel] button press.
+class wxRadioboxPage : public wxWizardPageSimple
+{
+public:
+    // directions in which we allow the user to proceed from this page
+    enum
+    {
+        Forward, Backward, Both, Neither
+    };
+
+    wxRadioboxPage(wxWizard *parent) : wxWizardPageSimple(parent)
+    {
+        // should correspond to the enum above
+        //        static wxString choices[] = { "forward", "backward", "both", "neither" };
+        // The above syntax can cause an internal compiler error with gcc.
+        wxString choices[4];
+        choices[0] = "forward";
+        choices[1] = "backward";
+        choices[2] = "both";
+        choices[3] = "neither";
+
+        m_radio = new wxRadioBox(this, -1, "Allow to proceed:",
+                                 wxPoint(5, 5), wxDefaultSize,
+                                 WXSIZEOF(choices), choices,
+                                 1, wxRA_SPECIFY_COLS);
+        m_radio->SetSelection(Both);
+    }
+
+    // wizard event handlers
+    void OnWizardCancel(wxWizardEvent& event)
+    {
+        if ( wxMessageBox("Do you really want to cancel?", "Question",
+                          wxICON_QUESTION | wxYES_NO, this) != wxYES )
+        {
+            // not confirmed
+            event.Veto();
+        }
+    }
+
+    void OnWizardPageChanging(wxWizardEvent& event)
+    {
+        int sel = m_radio->GetSelection();
+
+        if ( sel == Both )
+            return;
+
+        if ( event.GetDirection() && sel == Forward )
+            return;
+
+        if ( !event.GetDirection() && sel == Backward )
+            return;
+
+        wxMessageBox("You can't go there", "Not allowed",
+                     wxICON_WARNING | wxOK, this);
+
+        event.Veto();
+    }
+
+private:
+    wxRadioBox *m_radio;
+
+    DECLARE_EVENT_TABLE()
+};
+
+// this shows how to dynamically (i.e. during run-time) arrange the page order
+class wxCheckboxPage : public wxWizardPage
+{
+public:
+    wxCheckboxPage(wxWizard *parent,
+                   wxWizardPage *prev,
+                   wxWizardPage *next)
+        : wxWizardPage(parent)
+    {
+        m_prev = prev;
+        m_next = next;
+
+        (void)new wxStaticText(this, -1, "Try checking the box below and\n"
+                                         "then going back and clearing it");
+
+        m_checkbox = new wxCheckBox(this, -1, "&Skip the next page",
+                                    wxPoint(5, 30));
+    }
+
+    // implement wxWizardPage functions
+    virtual wxWizardPage *GetPrev() const { return m_prev; }
+    virtual wxWizardPage *GetNext() const
+    {
+        return m_checkbox->GetValue() ? m_next->GetNext() : m_next;
+    }
+
+private:
+    wxWizardPage *m_prev,
+                 *m_next;
+
+    wxCheckBox *m_checkbox;
+};
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// event tables and such
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(MyFrame, wxFrame)
+    EVT_MENU(Wizard_Quit,  MyFrame::OnQuit)
+    EVT_MENU(Wizard_About, MyFrame::OnAbout)
+    EVT_MENU(Wizard_Run,   MyFrame::OnRunWizard)
+
+    EVT_WIZARD_CANCEL(-1, MyFrame::OnWizardCancel)
+END_EVENT_TABLE()
+
+BEGIN_EVENT_TABLE(wxRadioboxPage, wxWizardPageSimple)
+    EVT_WIZARD_PAGE_CHANGING(-1, wxRadioboxPage::OnWizardPageChanging)
+    EVT_WIZARD_CANCEL(-1, wxRadioboxPage::OnWizardCancel)
+END_EVENT_TABLE()
+
+IMPLEMENT_APP(MyApp)
+
+// ----------------------------------------------------------------------------
+// the application class
+// ----------------------------------------------------------------------------
+
+// `Main program' equivalent: the program execution "starts" here
+bool MyApp::OnInit()
+{
+    MyFrame *frame = new MyFrame("wxWizard Sample");
+
+    // and show it (the frames, unlike simple controls, are not shown when
+    // created initially)
+    frame->Show(TRUE);
+
+    // we're done
+    return TRUE;
+}
+
+// ----------------------------------------------------------------------------
+// MyFrame
+// ----------------------------------------------------------------------------
+
+MyFrame::MyFrame(const wxString& title)
+       : wxFrame((wxFrame *)NULL, -1, title,
+                  wxDefaultPosition, wxSize(250, 150))  // small frame
+{
+    wxMenu *menuFile = new wxMenu;
+    menuFile->Append(Wizard_Run, "&Run wizard...\tCtrl-R");
+    menuFile->AppendSeparator();
+    menuFile->Append(Wizard_Quit, "E&xit\tAlt-X", "Quit this program");
+
+    wxMenu *helpMenu = new wxMenu;
+    helpMenu->Append(Wizard_About, "&About...\tF1", "Show about dialog");
+
+    // now append the freshly created menu to the menu bar...
+    wxMenuBar *menuBar = new wxMenuBar();
+    menuBar->Append(menuFile, "&File");
+    menuBar->Append(helpMenu, "&Help");
+
+    // ... and attach this menu bar to the frame
+    SetMenuBar(menuBar);
+
+    // also create status bar which we use in OnWizardCancel
+    CreateStatusBar();
+}
+
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
+{
+    // TRUE is to force the frame to close
+    Close(TRUE);
+}
+
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
+{
+    wxMessageBox("Demo of wxWizard class\n"
+                 "© 1999, 2000 Vadim Zeitlin",
+                 "About wxWizard sample", wxOK | wxICON_INFORMATION, this);
+}
+
+void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event))
+{
+    wxWizard *wizard = wxWizard::Create(this, -1,
+                                        "Absolutely Useless Wizard",
+                                        BMP_WIZARD_1);
+
+    // a wizard page may be either an object of predefined class
+    wxWizardPageSimple *page1 = new wxWizardPageSimple(wizard);
+    (void)new wxStaticText(page1, -1,
+                           "This wizard doesn't help you to do anything at "
+                           "all.\n"
+                           "\n"
+                           "The next pages will present you with more useless "
+                           "controls.");
+
+    // ... or a derived class
+    wxRadioboxPage *page3 = new wxRadioboxPage(wizard);
+    wxValidationPage *page4 = new wxValidationPage(wizard);
+
+    // set the page order using a convenience function - could also use
+    // SetNext/Prev directly as below
+    wxWizardPageSimple::Chain(page3, page4);
+
+    // this page is not a wxWizardPageSimple, so we use SetNext/Prev to insert
+    // it into the chain of pages
+    wxCheckboxPage *page2 = new wxCheckboxPage(wizard, page1, page3);
+    page1->SetNext(page2);
+    page3->SetPrev(page2);
+
+    if ( wizard->RunWizard(page1) )
+    {
+        wxMessageBox("The wizard successfully completed", "That's all",
+                     wxICON_INFORMATION | wxOK);
+    }
+
+    wizard->Destroy();
+}
+
+void MyFrame::OnWizardCancel(wxWizardEvent& WXUNUSED(event))
+{
+    wxLogStatus(this, "The wizard was cancelled.");
+}
diff --git a/samples/wizard/wizard.def b/samples/wizard/wizard.def
new file mode 100644 (file)
index 0000000..0b81618
--- /dev/null
@@ -0,0 +1,7 @@
+NAME         Wizard
+DESCRIPTION  'wxWizard sample application'
+EXETYPE      WINDOWS
+CODE         PRELOAD MOVEABLE DISCARDABLE
+DATA         PRELOAD MOVEABLE MULTIPLE
+HEAPSIZE     4048
+STACKSIZE    16000
diff --git a/samples/wizard/wizard.rc b/samples/wizard/wizard.rc
new file mode 100644 (file)
index 0000000..ba869e6
--- /dev/null
@@ -0,0 +1,5 @@
+#include "wx/msw/wx.rc"
+
+#define MINIMAL_QUIT   1
+#define MINIMAL_ABOUT  102
+
diff --git a/samples/wizard/wiztest.cpp b/samples/wizard/wiztest.cpp
deleted file mode 100644 (file)
index d6f249d..0000000
+++ /dev/null
@@ -1,355 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        wiztest.cpp
-// Purpose:     wxWindows sample demonstrating wxWizard control
-// Author:      Vadim Zeitlin
-// Modified by:
-// Created:     15.08.99
-// RCS-ID:      $Id$
-// Copyright:   (c) Vadim Zeitlin
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-#ifdef __GNUG__
-    #pragma implementation "wiztest.cpp"
-    #pragma interface "wiztest.cpp"
-#endif
-
-// For compilers that support precompilation, includes "wx/wx.h".
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-    #pragma hdrstop
-#endif
-
-// for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWindows headers
-#ifndef WX_PRECOMP
-    #include "wx/wx.h"
-#endif
-
-#include "wx/wizard.h"
-
-#ifndef __WXMSW__
-    #include "wiztest.xpm"
-#endif
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// ids for menu items
-enum
-{
-    Wizard_Quit = 100,
-    Wizard_Run,
-    Wizard_About = 1000
-};
-
-// ----------------------------------------------------------------------------
-// ressources
-// ----------------------------------------------------------------------------
-
-#ifdef __WXMSW__
-    #define BMP_WIZARD_1 wxBitmap("wiztest.bmp", wxBITMAP_TYPE_BMP)
-    #define BMP_WIZARD_2 wxBitmap("wiztest2.bmp", wxBITMAP_TYPE_BMP)
-#else
-    #define BMP_WIZARD_1 wxBitmap(wizimage)
-    #define BMP_WIZARD_2 wxBitmap(wizimage)
-#endif
-
-// ----------------------------------------------------------------------------
-// private classes
-// ----------------------------------------------------------------------------
-
-// Define a new application type, each program should derive a class from wxApp
-class MyApp : public wxApp
-{
-public:
-    // override base class virtuals
-    virtual bool OnInit();
-};
-
-class MyFrame : public wxFrame
-{
-public:
-    // ctor(s)
-    MyFrame(const wxString& title);
-
-    // event handlers (these functions should _not_ be virtual)
-    void OnQuit(wxCommandEvent& event);
-    void OnAbout(wxCommandEvent& event);
-    void OnRunWizard(wxCommandEvent& event);
-    void OnWizardCancel(wxWizardEvent& event);
-
-private:
-    // any class wishing to process wxWindows events must use this macro
-    DECLARE_EVENT_TABLE()
-};
-
-// ----------------------------------------------------------------------------
-// some pages for our wizard
-// ----------------------------------------------------------------------------
-
-// this shows how to simply control the validity of the user input by just
-// overriding TransferDataFromWindow() - of course, in a real program, the
-// check wouldn't be so trivial and the data will be probably saved somewhere
-// too
-//
-// it also shows how to use a different bitmap for one of the pages
-class wxValidationPage : public wxWizardPageSimple
-{
-public:
-    wxValidationPage(wxWizard *parent) : wxWizardPageSimple(parent)
-    {
-        m_bitmap = BMP_WIZARD_2;
-
-        m_checkbox = new wxCheckBox(this, -1, "&Check me");
-    }
-
-    virtual bool TransferDataFromWindow()
-    {
-        if ( !m_checkbox->GetValue() )
-        {
-            wxMessageBox("Check the checkbox first!", "No way",
-                         wxICON_WARNING | wxOK, this);
-
-            return FALSE;
-        }
-
-        return TRUE;
-    }
-
-private:
-    wxCheckBox *m_checkbox;
-};
-
-// This is a more complicated example of validity checking: using events we may
-// allow to return to the previous page, but not to proceed. It also
-// demonstrates how to intercept [Cancel] button press.
-class wxRadioboxPage : public wxWizardPageSimple
-{
-public:
-    // directions in which we allow the user to proceed from this page
-    enum
-    {
-        Forward, Backward, Both, Neither
-    };
-
-    wxRadioboxPage(wxWizard *parent) : wxWizardPageSimple(parent)
-    {
-        // should correspond to the enum above
-        //        static wxString choices[] = { "forward", "backward", "both", "neither" };
-        // The above syntax can cause an internal compiler error with gcc.
-        wxString choices[4];
-        choices[0] = "forward";
-        choices[1] = "backward";
-        choices[2] = "both";
-        choices[3] = "neither";
-
-        m_radio = new wxRadioBox(this, -1, "Allow to proceed:",
-                                 wxPoint(5, 5), wxDefaultSize,
-                                 WXSIZEOF(choices), choices,
-                                 1, wxRA_SPECIFY_COLS);
-        m_radio->SetSelection(Both);
-    }
-
-    // wizard event handlers
-    void OnWizardCancel(wxWizardEvent& event)
-    {
-        if ( wxMessageBox("Do you really want to cancel?", "Question",
-                          wxICON_QUESTION | wxYES_NO, this) != wxYES )
-        {
-            // not confirmed
-            event.Veto();
-        }
-    }
-
-    void OnWizardPageChanging(wxWizardEvent& event)
-    {
-        int sel = m_radio->GetSelection();
-
-        if ( sel == Both )
-            return;
-
-        if ( event.GetDirection() && sel == Forward )
-            return;
-
-        if ( !event.GetDirection() && sel == Backward )
-            return;
-
-        wxMessageBox("You can't go there", "Not allowed",
-                     wxICON_WARNING | wxOK, this);
-
-        event.Veto();
-    }
-
-private:
-    wxRadioBox *m_radio;
-
-    DECLARE_EVENT_TABLE()
-};
-
-// this shows how to dynamically (i.e. during run-time) arrange the page order
-class wxCheckboxPage : public wxWizardPage
-{
-public:
-    wxCheckboxPage(wxWizard *parent,
-                   wxWizardPage *prev,
-                   wxWizardPage *next)
-        : wxWizardPage(parent)
-    {
-        m_prev = prev;
-        m_next = next;
-
-        (void)new wxStaticText(this, -1, "Try checking the box below and\n"
-                                         "then going back and clearing it");
-
-        m_checkbox = new wxCheckBox(this, -1, "&Skip the next page",
-                                    wxPoint(5, 30));
-    }
-
-    // implement wxWizardPage functions
-    virtual wxWizardPage *GetPrev() const { return m_prev; }
-    virtual wxWizardPage *GetNext() const
-    {
-        return m_checkbox->GetValue() ? m_next->GetNext() : m_next;
-    }
-
-private:
-    wxWizardPage *m_prev,
-                 *m_next;
-
-    wxCheckBox *m_checkbox;
-};
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// event tables and such
-// ----------------------------------------------------------------------------
-
-BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(Wizard_Quit,  MyFrame::OnQuit)
-    EVT_MENU(Wizard_About, MyFrame::OnAbout)
-    EVT_MENU(Wizard_Run,   MyFrame::OnRunWizard)
-
-    EVT_WIZARD_CANCEL(-1, MyFrame::OnWizardCancel)
-END_EVENT_TABLE()
-
-BEGIN_EVENT_TABLE(wxRadioboxPage, wxWizardPageSimple)
-    EVT_WIZARD_PAGE_CHANGING(-1, wxRadioboxPage::OnWizardPageChanging)
-    EVT_WIZARD_CANCEL(-1, wxRadioboxPage::OnWizardCancel)
-END_EVENT_TABLE()
-
-IMPLEMENT_APP(MyApp)
-
-// ----------------------------------------------------------------------------
-// the application class
-// ----------------------------------------------------------------------------
-
-// `Main program' equivalent: the program execution "starts" here
-bool MyApp::OnInit()
-{
-    MyFrame *frame = new MyFrame("wxWizard Sample");
-
-    // and show it (the frames, unlike simple controls, are not shown when
-    // created initially)
-    frame->Show(TRUE);
-
-    // we're done
-    return TRUE;
-}
-
-// ----------------------------------------------------------------------------
-// MyFrame
-// ----------------------------------------------------------------------------
-
-MyFrame::MyFrame(const wxString& title)
-       : wxFrame((wxFrame *)NULL, -1, title,
-                  wxDefaultPosition, wxSize(250, 150))  // small frame
-{
-    wxMenu *menuFile = new wxMenu;
-    menuFile->Append(Wizard_Run, "&Run wizard...\tCtrl-R");
-    menuFile->AppendSeparator();
-    menuFile->Append(Wizard_Quit, "E&xit\tAlt-X", "Quit this program");
-
-    wxMenu *helpMenu = new wxMenu;
-    helpMenu->Append(Wizard_About, "&About...\tF1", "Show about dialog");
-
-    // now append the freshly created menu to the menu bar...
-    wxMenuBar *menuBar = new wxMenuBar();
-    menuBar->Append(menuFile, "&File");
-    menuBar->Append(helpMenu, "&Help");
-
-    // ... and attach this menu bar to the frame
-    SetMenuBar(menuBar);
-
-    // also create status bar which we use in OnWizardCancel
-    CreateStatusBar();
-}
-
-void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
-{
-    // TRUE is to force the frame to close
-    Close(TRUE);
-}
-
-void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
-{
-    wxMessageBox("Demo of wxWizard class\n"
-                 "© 1999, 2000 Vadim Zeitlin",
-                 "About wxWizard sample", wxOK | wxICON_INFORMATION, this);
-}
-
-void MyFrame::OnRunWizard(wxCommandEvent& WXUNUSED(event))
-{
-    wxWizard *wizard = wxWizard::Create(this, -1,
-                                        "Absolutely Useless Wizard",
-                                        BMP_WIZARD_1);
-
-    // a wizard page may be either an object of predefined class
-    wxWizardPageSimple *page1 = new wxWizardPageSimple(wizard);
-    (void)new wxStaticText(page1, -1,
-                           "This wizard doesn't help you to do anything at "
-                           "all.\n"
-                           "\n"
-                           "The next pages will present you with more useless "
-                           "controls.");
-
-    // ... or a derived class
-    wxRadioboxPage *page3 = new wxRadioboxPage(wizard);
-    wxValidationPage *page4 = new wxValidationPage(wizard);
-
-    // set the page order using a convenience function - could also use
-    // SetNext/Prev directly as below
-    wxWizardPageSimple::Chain(page3, page4);
-
-    // this page is not a wxWizardPageSimple, so we use SetNext/Prev to insert
-    // it into the chain of pages
-    wxCheckboxPage *page2 = new wxCheckboxPage(wizard, page1, page3);
-    page1->SetNext(page2);
-    page3->SetPrev(page2);
-
-    if ( wizard->RunWizard(page1) )
-    {
-        wxMessageBox("The wizard successfully completed", "That's all",
-                     wxICON_INFORMATION | wxOK);
-    }
-
-    wizard->Destroy();
-}
-
-void MyFrame::OnWizardCancel(wxWizardEvent& WXUNUSED(event))
-{
-    wxLogStatus(this, "The wizard was cancelled.");
-}
diff --git a/samples/wizard/wiztest.def b/samples/wizard/wiztest.def
deleted file mode 100644 (file)
index f843fd9..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-NAME         Wiztest
-DESCRIPTION  'Wiztest wxWindows application'
-EXETYPE      WINDOWS
-CODE         PRELOAD MOVEABLE DISCARDABLE
-DATA         PRELOAD MOVEABLE MULTIPLE
-HEAPSIZE     4048
-STACKSIZE    16000
diff --git a/samples/wizard/wiztest.rc b/samples/wizard/wiztest.rc
deleted file mode 100644 (file)
index ba869e6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "wx/msw/wx.rc"
-
-#define MINIMAL_QUIT   1
-#define MINIMAL_ABOUT  102
-