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

FXProgressDialog.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                      P r o g r e s s   D i a l o g   B o x                    *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2001,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: FXProgressDialog.h,v 1.6 2002/01/18 22:42:54 jeroen Exp $                *
00023 ********************************************************************************/
00024 #ifndef FXPROGRESSDIALOG_H
00025 #define FXPROGRESSDIALOG_H
00026 
00027 #ifndef FXDIALOGBOX_H
00028 #include "FXDialogBox.h"
00029 #endif
00030 
00031 
00032 
00033 enum {
00034   PROGRESSDIALOG_NOCANCEL = 0,                        /// Default is no cancel button
00035   PROGRESSDIALOG_CANCEL   = 0x01000000,               /// Enable the cancel button
00036   PROGRESSDIALOG_NORMAL   = (DECOR_TITLE|DECOR_BORDER)
00037   };
00038 
00039 
00040 class FXHorizontalSeparator;
00041 class FXProgressBar;
00042 class FXButton;
00043 class FXLabel;
00044 
00045 /**
00046 * A Progress Dialog is a simple dialog which is used to
00047 * keep a user informed of the progress of a lengthy operation
00048 * in a program and that the program is in fact still working.
00049 */
00050 class FXAPI FXProgressDialog : public FXDialogBox {
00051   FXDECLARE(FXProgressDialog)
00052 protected:
00053   FXProgressBar         *progress;    // Progress bar
00054   FXLabel               *message;     // Message
00055   FXHorizontalSeparator *separator;   // Separator
00056   FXButton              *cancel;      // Cancel button
00057   FXbool                 cancelled;   // User hit cancel
00058 protected:
00059   FXProgressDialog(){}
00060 private:
00061   FXProgressDialog(const FXProgressDialog&);
00062   FXProgressDialog &operator=(const FXProgressDialog&);
00063 public:
00064   long onCmdSetValue(FXObject*,FXSelector,void*);
00065   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00066   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00067   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00068   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00069   long onCmdCancel(FXObject*,FXSelector,void*);
00070 public:
00071 
00072   /// Construct input dialog box with given caption, icon, and prompt text
00073   FXProgressDialog(FXWindow* owner,const FXString& caption,const FXString& label,FXuint opts=PROGRESSDIALOG_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00074 
00075   /// Change the progress message
00076   void setMessage(const FXString& msg);
00077 
00078   /// Get progress message
00079   FXString getMessage() const;
00080 
00081   /// Change the amount of progress
00082   void setProgress(FXuint value);
00083 
00084   /// Get current progress
00085   FXuint getProgress() const;
00086 
00087   /// Set total amount of progress
00088   void setTotal(FXuint value);
00089 
00090   /// Return total amount of progrss
00091   FXuint getTotal() const;
00092 
00093   /// Increment progress by given amount
00094   void increment(FXuint value);
00095 
00096   /// Has operation been cancelled?
00097   FXbool isCancelled() const { return cancelled; }
00098 
00099   /// Destroy
00100   virtual ~FXProgressDialog();
00101   };
00102 
00103 
00104 
00105 #endif