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

FXProgressBar.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * P r o g r e s s B a r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXProgressBar.h,v 1.22 2006/01/22 17:58:07 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXPROGRESSBAR_H
25 #define FXPROGRESSBAR_H
26 
27 #ifndef FXFRAME_H
28 #include "FXFrame.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Progress bar styles
35 enum {
36  PROGRESSBAR_HORIZONTAL = 0, /// Horizontal display
37  PROGRESSBAR_VERTICAL = 0x00008000, /// Vertical display
38  PROGRESSBAR_PERCENTAGE = 0x00010000, /// Show percentage done
39  PROGRESSBAR_DIAL = 0x00020000, /// Show as a dial instead of bar
41  };
42 
43 
44 /// Progress bar widget
45 class FXAPI FXProgressBar : public FXFrame {
47 protected:
48  FXuint progress; // Integer percentage number
49  FXuint total; // Amount for completion
50  FXint barsize; // Bar size
51  FXFont* font;
52  FXColor barBGColor;
53  FXColor barColor;
54  FXColor textNumColor;
55  FXColor textAltColor;
56 protected:
57  FXProgressBar(){}
58  void drawInterior(FXDCWindow& dc);
59 private:
61  FXProgressBar &operator=(const FXProgressBar&);
62 public:
63  long onPaint(FXObject*,FXSelector,void*);
64  long onCmdSetValue(FXObject*,FXSelector,void*);
65  long onCmdSetIntValue(FXObject*,FXSelector,void*);
66  long onCmdGetIntValue(FXObject*,FXSelector,void*);
67 public:
68 
69  /// Construct progress bar
71 
72  /// Create server-side resources
73  virtual void create();
74 
75  /// Detach server-side resources
76  virtual void detach();
77 
78  /// Return default width
79  virtual FXint getDefaultWidth();
80 
81  /// Return default height
82  virtual FXint getDefaultHeight();
83 
84  /// Change the amount of progress
85  void setProgress(FXuint value);
86 
87  /// Get current progress
88  FXuint getProgress() const { return progress; }
89 
90  /// Set total amount of progress
91  void setTotal(FXuint value);
92 
93  /// Return total amount of progrss
94  FXuint getTotal() const { return total; }
95 
96  /// Increment progress by given amount
97  void increment(FXuint value);
98 
99  /// Hide progress percentage
100  void hideNumber();
101 
102  /// Show progress percentage
103  void showNumber();
104 
105  /// Change progress bar width
106  void setBarSize(FXint size);
107 
108  /// Return progress bar width
109  FXint getBarSize() const { return barsize; }
110 
111  /// Change backgroundcolor
112  void setBarBGColor(FXColor clr);
113 
114  /// Return background color
115  FXColor getBarBGColor() const { return barBGColor; }
116 
117  /// Change bar color
118  void setBarColor(FXColor clr);
119 
120  /// Return bar color
121  FXColor getBarColor() const { return barColor; }
122 
123  /// Change text color
124  void setTextColor(FXColor clr);
125 
126  /// Return text color
127  FXColor getTextColor() const { return textNumColor; }
128 
129  /// Change alternate text color shown when bar under text
130  void setTextAltColor(FXColor clr);
131 
132  /// Return alternate text color
133  FXColor getTextAltColor() const { return textAltColor; }
134 
135  /// Set the text font
136  void setFont(FXFont *fnt);
137 
138  /// Get the text font
139  FXFont* getFont() const { return font; }
140 
141  /// Change progress bar style
142  void setBarStyle(FXuint style);
143 
144  /// Return current progress bar style
145  FXuint getBarStyle() const;
146 
147  /// Save progress bar to a stream
148  virtual void save(FXStream& store) const;
149 
150  /// Load progress bar from a stream
151  virtual void load(FXStream& store);
152 
153  /// Destructor
154  virtual ~FXProgressBar();
155  };
156 
157 }
158 
159 #endif
The Frame widget provides borders around some contents.
Definition: FXFrame.h:73
unsigned int FXuint
Definition: fxdefs.h:396
Definition: FXFrame.h:56
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
Definition: FXProgressBar.h:43
Sunken border.
Definition: FXWindow.h:76
Base composite.
Definition: FXComposite.h:35
#define NULL
Definition: fxdefs.h:41
FXuint FXColor
Definition: fxdefs.h:454
Horizontal display.
Definition: FXProgressBar.h:39
Show as a dial instead of bar.
Definition: FXProgressBar.h:42
int FXint
Definition: fxdefs.h:397
Progress bar widget.
Definition: FXProgressBar.h:53
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Window Device Context.
Definition: FXDCWindow.h:52
Thick border.
Definition: FXWindow.h:78
Show percentage done.
Definition: FXProgressBar.h:41
Font class.
Definition: FXFont.h:142
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
Vertical display.
Definition: FXProgressBar.h:40

Copyright © 1997-2005 Jeroen van der Zijp