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,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXProgressDialog.h,v 1.25 2009/01/06 13:07:26 fox Exp $                  *
00022 ********************************************************************************/
00023 #ifndef FXPROGRESSDIALOG_H
00024 #define FXPROGRESSDIALOG_H
00025 
00026 #ifndef FXDIALOGBOX_H
00027 #include "FXDialogBox.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 enum {
00034   PROGRESSDIALOG_NOCANCEL = 0,                        /// Default is no cancel button
00035   PROGRESSDIALOG_CANCEL   = 0x02000000,               /// Enable the cancel button
00036   PROGRESSDIALOG_NORMAL   = (DECOR_TITLE|DECOR_BORDER)/// Normally with title and 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 * The PROGRESSDIALOG_CANCEL option enables the display of the
00050 * cancel button in the Progress Dialog.
00051 */
00052 class FXAPI FXProgressDialog : public FXDialogBox {
00053   FXDECLARE(FXProgressDialog)
00054 protected:
00055   FXProgressBar         *progress;    // Progress bar
00056   FXLabel               *message;     // Message
00057   FXHorizontalSeparator *separator;   // Separator
00058   FXButton              *cancel;      // Cancel button
00059   FXbool                 cancelled;   // User hit cancel
00060 protected:
00061   FXProgressDialog();
00062 private:
00063   FXProgressDialog(const FXProgressDialog&);
00064   FXProgressDialog &operator=(const FXProgressDialog&);
00065 public:
00066   long onCmdSetValue(FXObject*,FXSelector,void*);
00067   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00068   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00069   long onCmdSetLongValue(FXObject*,FXSelector,void*);
00070   long onCmdGetLongValue(FXObject*,FXSelector,void*);
00071   long onCmdSetIntRange(FXObject*,FXSelector,void*);
00072   long onCmdGetIntRange(FXObject*,FXSelector,void*);
00073   long onCmdSetStringValue(FXObject*,FXSelector,void*);
00074   long onCmdGetStringValue(FXObject*,FXSelector,void*);
00075   long onCmdCancel(FXObject*,FXSelector,void*);
00076 public:
00077 
00078   /// Construct input dialog box with given caption, icon, and prompt text
00079   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);
00080 
00081   /// Change the progress message
00082   void setMessage(const FXString& msg);
00083 
00084   /// Get progress message
00085   FXString getMessage() const;
00086 
00087   /// Change style of the progress bar widget
00088   void setBarStyle(FXuint style);
00089 
00090   /// Get style of the progress bar widget
00091   FXuint getBarStyle() const;
00092 
00093   /// Change the amount of progress
00094   void setProgress(FXuint value);
00095 
00096   /// Get current progress
00097   FXuint getProgress() const;
00098 
00099   /// Set total amount of progress
00100   void setTotal(FXuint value);
00101 
00102   /// Return total amount of progrss
00103   FXuint getTotal() const;
00104 
00105   /// Increment progress by given amount
00106   void increment(FXuint value);
00107 
00108   /// Has operation been cancelled?
00109   FXbool isCancelled() const { return cancelled; }
00110 
00111   /// Change cancelled flag
00112   void setCancelled(FXbool flg){ cancelled=flg; }
00113 
00114   /// Destroy
00115   virtual ~FXProgressDialog();
00116   };
00117 
00118 }
00119 
00120 #endif

Copyright © 1997-2009 Jeroen van der Zijp