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

FXProgressBar.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                      P r o g r e s s B a r   W i d g e t                      *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,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: FXProgressBar.h,v 1.15 2002/01/18 22:42:54 jeroen Exp $                  *
00023 ********************************************************************************/
00024 #ifndef FXPROGRESSBAR_H
00025 #define FXPROGRESSBAR_H
00026 
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030 
00031 
00032 
00033 /// Progress bar styles
00034 enum {
00035   PROGRESSBAR_HORIZONTAL = 0,             /// Horizontal display
00036   PROGRESSBAR_VERTICAL   = 0x00008000,    /// Vertical display
00037   PROGRESSBAR_PERCENTAGE = 0x00010000,    /// Show percentage done
00038   PROGRESSBAR_DIAL       = 0x00020000,    /// Show as a dial instead of bar
00039   PROGRESSBAR_NORMAL     = FRAME_SUNKEN|FRAME_THICK
00040   };
00041 
00042 
00043 /// Progress bar widget
00044 class FXAPI FXProgressBar : public FXFrame {
00045   FXDECLARE(FXProgressBar)
00046 protected:
00047   FXuint   progress;                      // Integer percentage number
00048   FXuint   total;                         // Amount for completion
00049   FXint    barsize;                       // Bar size
00050   FXFont*  font;
00051   FXColor  barBGColor;
00052   FXColor  barColor;
00053   FXColor  textNumColor;
00054   FXColor  textAltColor;
00055 protected:
00056   FXProgressBar(){}
00057 private:
00058   FXProgressBar(const FXProgressBar&);
00059   FXProgressBar &operator=(const FXProgressBar&);
00060 public:
00061   long onPaint(FXObject*,FXSelector,void*);
00062   long onCmdSetValue(FXObject*,FXSelector,void*);
00063   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00064   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00065 public:
00066 
00067   /// Construct progress bar
00068   FXProgressBar(FXComposite* p,FXObject* target=NULL,FXSelector sel=0,FXuint opts=PROGRESSBAR_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00069 
00070   /// Create server-side resources
00071   virtual void create();
00072 
00073   /// Detach server-side resources
00074   virtual void detach();
00075 
00076   /// Return default width
00077   virtual FXint getDefaultWidth();
00078 
00079   /// Return default height
00080   virtual FXint getDefaultHeight();
00081 
00082   /// Change the amount of progress
00083   void setProgress(FXuint value);
00084 
00085   /// Get current progress
00086   FXuint getProgress() const { return progress; }
00087 
00088   /// Set total amount of progress
00089   void setTotal(FXuint value);
00090 
00091   /// Return total amount of progrss
00092   FXuint getTotal() const { return total; }
00093 
00094   /// Increment progress by given amount
00095   void increment(FXuint value);
00096 
00097   /// Hide progress percentage
00098   void hideNumber();
00099 
00100   /// Show progress percentage
00101   void showNumber();
00102 
00103   /// Change progress bar width
00104   void setBarSize(FXint size);
00105 
00106   /// Return progress bar width
00107   FXint getBarSize() const { return barsize; }
00108 
00109   /// Change backgroundcolor
00110   void setBarBGColor(FXColor clr);
00111 
00112   /// Return background color
00113   FXColor getBarBGColor() const { return barBGColor; }
00114 
00115   /// Change bar color
00116   void setBarColor(FXColor clr);
00117 
00118   /// Return bar color
00119   FXColor getBarColor() const { return barColor; }
00120 
00121   /// Change text color
00122   void setTextColor(FXColor clr);
00123 
00124   /// Return text color
00125   FXColor getTextColor() const { return textNumColor; }
00126 
00127   /// Change alternate text color shown when bar under text
00128   void setTextAltColor(FXColor clr);
00129 
00130   /// Return alternate text color
00131   FXColor getTextAltColor() const { return textAltColor; }
00132 
00133   /// Set the text font
00134   void setFont(FXFont *fnt);
00135 
00136   /// Get the text font
00137   FXFont* getFont() const { return font; }
00138 
00139   /// Change progress bar style
00140   void setBarStyle(FXuint style);
00141 
00142   /// Return current progress bar style
00143   FXuint getBarStyle() const;
00144 
00145   /// Save progress bar to a stream
00146   virtual void save(FXStream& store) const;
00147 
00148   /// Load progress bar from a stream
00149   virtual void load(FXStream& store);
00150 
00151   /// Destructor
00152   virtual ~FXProgressBar();
00153   };
00154 
00155 #endif