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

Copyright © 1997-2004 Jeroen van der Zijp