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

FXProgressDialog.h

Go to the documentation of this file.
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,2006 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.14 2006/01/22 17:58:07 fox Exp $                  *
00023 ********************************************************************************/
00024 #ifndef FXPROGRESSDIALOG_H
00025 #define FXPROGRESSDIALOG_H
00026 
00027 #ifndef FXDIALOGBOX_H
00028 #include "FXDialogBox.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 enum {
00035   PROGRESSDIALOG_NOCANCEL = 0,                        /// Default is no cancel button
00036   PROGRESSDIALOG_CANCEL   = 0x01000000,               /// Enable the cancel button
00037   PROGRESSDIALOG_NORMAL   = (DECOR_TITLE|DECOR_BORDER)
00038   };
00039 
00040 
00041 class FXHorizontalSeparator;
00042 class FXProgressBar;
00043 class FXButton;
00044 class FXLabel;
00045 
00046 /**
00047 * A Progress Dialog is a simple dialog which is used to
00048 * keep a user informed of the progress of a lengthy operation
00049 * in a program and that the program is in fact still working.
00050 */
00051 class FXAPI FXProgressDialog : public FXDialogBox {
00052   FXDECLARE(FXProgressDialog)
00053 protected:
00054   FXProgressBar         *progress;    // Progress bar
00055   FXLabel               *message;     // Message
00056   FXHorizontalSeparator *separator;   // Separator
00057   FXButton              *cancel;      // Cancel button
00058   FXbool                 cancelled;   // User hit cancel
00059 protected:
00060   FXProgressDialog();
00061 private:
00062   FXProgressDialog(const FXProgressDialog&);
00063   FXProgressDialog &operator=(const FXProgressDialog&);
00064 public:
00065   long onCmdSetValue(FXObject*,FXSelector,void*);
00066   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00067   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00068   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00069   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00070   long onCmdCancel(FXObject*,FXSelector,void*);
00071 public:
00072 
00073   /// Construct input dialog box with given caption, icon, and prompt text
00074   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);
00075 
00076   /// Change the progress message
00077   void setMessage(const FXString& msg);
00078 
00079   /// Get progress message
00080   FXString getMessage() const;
00081 
00082   /// Change style of the progress bar widget
00083   void setBarStyle(FXuint style);
00084 
00085   /// Get style of the progress bar widget
00086   FXuint getBarStyle() const;
00087 
00088   /// Change the amount of progress
00089   void setProgress(FXuint value);
00090 
00091   /// Get current progress
00092   FXuint getProgress() const;
00093 
00094   /// Set total amount of progress
00095   void setTotal(FXuint value);
00096 
00097   /// Return total amount of progrss
00098   FXuint getTotal() const;
00099 
00100   /// Increment progress by given amount
00101   void increment(FXuint value);
00102 
00103   /// Has operation been cancelled?
00104   FXbool isCancelled() const { return cancelled; }
00105 
00106   /// Change cancelled flag
00107   void setCancelled(FXbool flg){ cancelled=flg; }
00108 
00109   /// Destroy
00110   virtual ~FXProgressDialog();
00111   };
00112 
00113 }
00114 
00115 #endif

Copyright © 1997-2005 Jeroen van der Zijp