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

FXProgressBar.h

Go to the documentation of this file.
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,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: FXProgressBar.h,v 1.28 2009/01/06 13:07:26 fox Exp $                     *
00022 ********************************************************************************/
00023 #ifndef FXPROGRESSBAR_H
00024 #define FXPROGRESSBAR_H
00025 
00026 #ifndef FXFRAME_H
00027 #include "FXFrame.h"
00028 #endif
00029 
00030 namespace FX {
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   void drawInterior(FXDCWindow& dc);
00058 private:
00059   FXProgressBar(const FXProgressBar&);
00060   FXProgressBar &operator=(const FXProgressBar&);
00061 public:
00062   long onPaint(FXObject*,FXSelector,void*);
00063   long onCmdSetValue(FXObject*,FXSelector,void*);
00064   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00065   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00066   long onCmdSetLongValue(FXObject*,FXSelector,void*);
00067   long onCmdGetLongValue(FXObject*,FXSelector,void*);
00068   long onCmdSetIntRange(FXObject*,FXSelector,void*);
00069   long onCmdGetIntRange(FXObject*,FXSelector,void*);
00070 public:
00071 
00072   /// Construct progress bar
00073   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);
00074 
00075   /// Create server-side resources
00076   virtual void create();
00077 
00078   /// Detach server-side resources
00079   virtual void detach();
00080 
00081   /// Return default width
00082   virtual FXint getDefaultWidth();
00083 
00084   /// Return default height
00085   virtual FXint getDefaultHeight();
00086 
00087   /// Change the amount of progress
00088   void setProgress(FXuint value);
00089 
00090   /// Get current progress
00091   FXuint getProgress() const { return progress; }
00092 
00093   /// Set total amount of progress
00094   void setTotal(FXuint value);
00095 
00096   /// Return total amount of progrss
00097   FXuint getTotal() const { return total; }
00098 
00099   /// Increment progress by given amount
00100   void increment(FXuint value);
00101 
00102   /// Hide progress percentage
00103   void hideNumber();
00104 
00105   /// Show progress percentage
00106   void showNumber();
00107 
00108   /// Change progress bar width
00109   void setBarSize(FXint size);
00110 
00111   /// Return progress bar width
00112   FXint getBarSize() const { return barsize; }
00113 
00114   /// Change backgroundcolor
00115   void setBarBGColor(FXColor clr);
00116 
00117   /// Return background color
00118   FXColor getBarBGColor() const { return barBGColor; }
00119 
00120   /// Change bar color
00121   void setBarColor(FXColor clr);
00122 
00123   /// Return bar color
00124   FXColor getBarColor() const { return barColor; }
00125 
00126   /// Change text color
00127   void setTextColor(FXColor clr);
00128 
00129   /// Return text color
00130   FXColor getTextColor() const { return textNumColor; }
00131 
00132   /// Change alternate text color shown when bar under text
00133   void setTextAltColor(FXColor clr);
00134 
00135   /// Return alternate text color
00136   FXColor getTextAltColor() const { return textAltColor; }
00137 
00138   /// Set the text font
00139   void setFont(FXFont *fnt);
00140 
00141   /// Get the text font
00142   FXFont* getFont() const { return font; }
00143 
00144   /// Change progress bar style
00145   void setBarStyle(FXuint style);
00146 
00147   /// Return current progress bar style
00148   FXuint getBarStyle() const;
00149 
00150   /// Save progress bar to a stream
00151   virtual void save(FXStream& store) const;
00152 
00153   /// Load progress bar from a stream
00154   virtual void load(FXStream& store);
00155 
00156   /// Destructor
00157   virtual ~FXProgressBar();
00158   };
00159 
00160 }
00161 
00162 #endif

Copyright © 1997-2009 Jeroen van der Zijp