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

FXProgressBar.h
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,2024 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXPROGRESSBAR_H
22 #define FXPROGRESSBAR_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  PROGRESSBAR_HORIZONTAL = 0,
34  PROGRESSBAR_VERTICAL = 0x00008000,
35  PROGRESSBAR_PERCENTAGE = 0x00010000,
36  PROGRESSBAR_DIAL = 0x00020000,
37  PROGRESSBAR_NORMAL = FRAME_SUNKEN|FRAME_THICK
38  };
39 
40 
42 class FXAPI FXProgressBar : public FXFrame {
43  FXDECLARE(FXProgressBar)
44 protected:
45  FXuint progress; // Integer percentage number
46  FXuint total; // Amount for completion
47  FXint barsize; // Bar size
48  FXFont* font; // Text font
49  FXColor barBGColor; // Bar background color
50  FXColor barColor; // Filled bar color
51  FXColor textNumColor; // Text color inside bar background
52  FXColor textAltColor; // Text color inside filled bar
53 protected:
54  FXProgressBar(){}
55  void drawInterior(FXDCWindow& dc);
56 private:
58  FXProgressBar &operator=(const FXProgressBar&);
59 public:
60  long onPaint(FXObject*,FXSelector,void*);
61  long onCmdSetValue(FXObject*,FXSelector,void*);
62  long onCmdSetIntValue(FXObject*,FXSelector,void*);
63  long onCmdGetIntValue(FXObject*,FXSelector,void*);
64  long onCmdSetLongValue(FXObject*,FXSelector,void*);
65  long onCmdGetLongValue(FXObject*,FXSelector,void*);
66  long onCmdSetIntRange(FXObject*,FXSelector,void*);
67  long onCmdGetIntRange(FXObject*,FXSelector,void*);
68 public:
69 
71  FXProgressBar(FXComposite* p,FXObject* target=nullptr,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);
72 
74  virtual void create();
75 
77  virtual void detach();
78 
80  virtual FXint getDefaultWidth();
81 
83  virtual FXint getDefaultHeight();
84 
86  void setProgress(FXuint value);
87 
89  FXuint getProgress() const { return progress; }
90 
92  void setTotal(FXuint value);
93 
95  FXuint getTotal() const { return total; }
96 
98  void increment(FXuint value);
99 
101  void hideNumber();
102 
104  void showNumber();
105 
107  void setBarSize(FXint size);
108 
110  FXint getBarSize() const { return barsize; }
111 
113  void setBarBGColor(FXColor clr);
114 
116  FXColor getBarBGColor() const { return barBGColor; }
117 
119  void setBarColor(FXColor clr);
120 
122  FXColor getBarColor() const { return barColor; }
123 
125  void setTextColor(FXColor clr);
126 
128  FXColor getTextColor() const { return textNumColor; }
129 
131  void setTextAltColor(FXColor clr);
132 
134  FXColor getTextAltColor() const { return textAltColor; }
135 
137  void setFont(FXFont *fnt);
138 
140  FXFont* getFont() const { return font; }
141 
143  void setBarStyle(FXuint style);
144 
146  FXuint getBarStyle() const;
147 
149  virtual void save(FXStream& store) const;
150 
152  virtual void load(FXStream& store);
153 
155  virtual ~FXProgressBar();
156  };
157 
158 }
159 
160 #endif
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
FXuint getTotal() const
Return total amount of progrss.
Definition: FXProgressBar.h:95
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
FXint getBarSize() const
Return progress bar width.
Definition: FXProgressBar.h:110
FXFont * getFont() const
Get the text font.
Definition: FXProgressBar.h:140
Definition: FX4Splitter.h:28
Progress bar widget.
Definition: FXProgressBar.h:42
FXColor getTextAltColor() const
Return alternate text color.
Definition: FXProgressBar.h:134
FXuint getProgress() const
Get current progress.
Definition: FXProgressBar.h:89
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
Window Device Context.
Definition: FXDCWindow.h:48
FXColor getTextColor() const
Return text color.
Definition: FXProgressBar.h:128
Font class.
Definition: FXFont.h:137
FXColor getBarBGColor() const
Return background color.
Definition: FXProgressBar.h:116
FXColor getBarColor() const
Return bar color.
Definition: FXProgressBar.h:122

Copyright © 1997-2022 Jeroen van der Zijp