Evita  0.16
evGUIProgress.h
Go to the documentation of this file.
1 /*
2  *
3  * EVITA: Efficient Visualization of Terascale Datasets
4  * Copyright (C) 2000-2016 Team Evita
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
19  * MA 02139, USA.
20  *
21  */
22 
23 
24 #ifndef __evGUIProgress_h
25 #define __evGUIProgress_h
26 
27 
28 #include <FL/Fl_Button.H>
29 #include <FL/Fl_Slider.H>
30 #include <FL/Fl_Output.H>
31 #include <FL/Fl_Box.H>
32 
33 #include "evGUIObject.h"
34 
35 
36 class evGUIProgressSlider : public Fl_Slider
37 {
38 public:
39  evGUIProgressSlider(const int x, const int y,
40  const int width, const int height,
41  const char *label = 0) :
42  Fl_Slider(x, y, width, height, label)
43  { }
45  { }
46 
47  int handle(int)
48  {
49  return(1);
50  }
51 };
52 
53 
54 class evGUIProgress : public evGUIObject, public Fl_Group
55 {
56 public:
57  evGUIProgress(const int x, const int y, const int width, const int height);
58  virtual ~evGUIProgress(void);
59 
60  virtual const evString GetClassName(void) const
61  {
62  return(evString("evGUIProgress"));
63  }
64 
65  void SetProgress(const unsigned int progress);
66  void SetProcess(const char *process);
67 
68 protected:
69 
70 private:
72  Fl_Output *ProcessText;
73  Fl_Box *LabelText;
74  Fl_Button *CancelButton;
76 
77  static void CancelCallback(Fl_Widget *widget, void *data);
78 };
79 
80 
81 inline void evGUIProgress::SetProgress(unsigned int progress)
82 {
83  unsigned int progress2 = QccMathMin(progress, (unsigned int)100);
84  this->Slider->value((double)progress2);
85  this->Label.Sprintf("%d%%", progress2);
86  this->LabelText->label(this->Label.GetString());
87  this->LabelText->redraw();
88 }
89 
90 
91 inline void evGUIProgress::SetProcess(const char *process)
92 {
93  this->ProcessText->value(process);
94 }
95 
96 #endif
evGUIProgressSlider(const int x, const int y, const int width, const int height, const char *label=0)
Definition: evGUIProgress.h:39
void SetProcess(const char *process)
Definition: evGUIProgress.h:91
evGUIProgressSlider * Slider
Definition: evGUIProgress.h:71
int handle(int)
Definition: evGUIProgress.h:47
virtual const evString GetClassName(void) const
Definition: evGUIProgress.h:60
Fl_Output * ProcessText
Definition: evGUIProgress.h:72
Definition: evGUIProgress.h:36
Fl_Button * CancelButton
Definition: evGUIProgress.h:74
Definition: evGUIObject.h:33
Fl_Box * LabelText
Definition: evGUIProgress.h:73
Definition: evGUIProgress.h:54
void SetProgress(const unsigned int progress)
Definition: evGUIProgress.h:81
Definition: evString.h:30
evString Label
Definition: evGUIProgress.h:75
~evGUIProgressSlider(void)
Definition: evGUIProgress.h:44