Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXWizard.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                           W i z a r d   W i d g e t                           *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2002 by Jeroen van der Zijp.   All Rights Reserved.             *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXWizard.h,v 1.3 2002/06/19 19:06:56 fox Exp $                           *
00023 ********************************************************************************/
00024 #ifndef FXWIZARD_H
00025 #define FXWIZARD_H
00026 
00027 #ifndef FXDIALOGBOX_H
00028 #include "FXDialogBox.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXImage;
00035 class FXIcon;
00036 class FXImageFrame;
00037 class FXButton;
00038 class FXSwitcher;
00039 
00040 
00041 /**
00042 * A Wizard widget guides the user through a number of panels
00043 * in a predefined sequence; each step must be completed before
00044 * moving on to the next step.
00045 * For example, a Wizard may be used to install software components,
00046 * and ask various questions at each step in the installation.
00047 */
00048 class FXAPI FXWizard : public FXDialogBox {
00049   FXDECLARE(FXWizard)
00050 protected:
00051   FXImageFrame *sidebar;        // Sidebar comprising image
00052   FXButton     *advance;        // Advance to next stage
00053   FXButton     *retreat;        // Retreat to last stage
00054   FXButton     *finish;         // Finish panel
00055   FXButton     *cancel;         // Cancel button
00056   FXSwitcher   *panels;         // Sub panels
00057   FXIcon       *finishicon;
00058   FXIcon       *nexticon;
00059   FXIcon       *backicon;
00060 protected:
00061   FXWizard(){}
00062   void construct();
00063 private:
00064   FXWizard(const FXWizard&);
00065   FXWizard &operator=(const FXWizard&);
00066 public:
00067   long onUpdFinish(FXObject*,FXSelector,void*);
00068   long onCmdNext(FXObject*,FXSelector,void*);
00069   long onUpdNext(FXObject*,FXSelector,void*);
00070   long onCmdBack(FXObject*,FXSelector,void*);
00071   long onUpdBack(FXObject*,FXSelector,void*);
00072 public:
00073   enum {
00074     ID_NEXT=FXDialogBox::ID_LAST,
00075     ID_BACK,
00076     ID_LAST
00077     };
00078 public:
00079 
00080   /// Construct free-floating Wizard
00081   FXWizard(FXApp* a,const FXString& name,FXImage *image,FXuint opts=DECOR_TITLE|DECOR_BORDER|DECOR_RESIZE,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=10,FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=10,FXint vs=10);
00082 
00083   /// Construct Wizard which will always float over the owner window
00084   FXWizard(FXWindow* owner,const FXString& name,FXImage *image,FXuint opts=DECOR_TITLE|DECOR_BORDER|DECOR_RESIZE,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=10,FXint pr=10,FXint pt=10,FXint pb=10,FXint hs=10,FXint vs=10);
00085 
00086   /// Return a pointer to the "Advance" button
00087   FXButton *advanceButton() const { return advance; }
00088 
00089   /// Return a pointer to the "Retreat" button
00090   FXButton *retreatButton() const { return retreat; }
00091 
00092   /// Return a pointer to the "Finish" button
00093   FXButton *finishButton() const { return finish; }
00094 
00095   /// Return a pointer to the "Cancel" button
00096   FXButton *cancelButton() const { return cancel; }
00097 
00098   /// Return the container used as parent for the subpanels
00099   FXSwitcher *getContainer() const { return panels; }
00100 
00101   /// Change the image being displayed
00102   void setImage(FXImage* img);
00103 
00104   /// Return the current image
00105   FXImage* getImage() const;
00106 
00107   /// Return number of panels
00108   FXint getNumPanels() const;
00109 
00110   /// Bring the child window at index to the top
00111   void setCurrentPanel(FXint index);
00112 
00113   /// Return the index of the child window currently on top
00114   FXint getCurrentPanel() const;
00115 
00116   /// Save to stream
00117   virtual void save(FXStream& store) const;
00118 
00119   /// Load from stream
00120   virtual void load(FXStream& store);
00121 
00122   // Destroy
00123   virtual ~FXWizard();
00124   };
00125 
00126 }
00127 
00128 #endif