libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GtkCRNProgress.h
Go to the documentation of this file.
1 /* Copyright 2010-2016 CoReNum, INSA-Lyon, ENS-Lyon
2  *
3  * This file is part of libgtkcrnmm.
4  *
5  * libgtkcrnmm is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libgtkcrnmm is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libgtkcrnmm. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * file: GtkCRNProgress.h
19  * \author Yann LEYDIER
20  */
21 
22 #ifndef GtkCRNProgress_HEADER
23 #define GtkCRNProgress_HEADER
24 
25 #include <libgtkcrnmm_config.h>
26 #include <CRNUtils/CRNProgress.h>
27 #include <gtkmm.h>
28 
29 namespace GtkCRN
30 {
34  class Progress : public crn::Progress
35  {
36  public:
38  Progress(const crn::String &name, size_t maxcount = 100);
40  Progress(const crn::String &name, sigc::slot<void> execute_at_end, size_t maxcount = 100);
42  virtual ~Progress() override = default;
43 
45  Gtk::ProgressBar& GetProgressBar() { return pb; }
47  const Gtk::ProgressBar& GetProgressBar() const { return pb; }
48 
50  sigc::signal<void> signal_end() { return progress_end; }
51  protected:
53  virtual void display(const crn::String &msg) override;
54 
55  private:
56  struct PM
57  {
58  PM(Progress *p, const crn::String &m):prog(p),msg(m) {}
59  Progress *prog;
60  crn::String msg;
61  };
62  static gboolean ts_display(PM *data);
63  Gtk::ProgressBar pb;
64  sigc::signal<void> progress_end;
65  bool has_ended;
66  };
67 
68 }
69 
70 #endif
71 
72 
73 
Gtk::ProgressBar & GetProgressBar()
Gets the Gtk progress bar.
Base class for a progress display.
Definition: CRNProgress.h:39
Progress object associated with a widget.
Progress(const crn::String &name, size_t maxcount=100)
Constructor.
A UTF32 character string class.
Definition: CRNString.h:61
virtual void display(const crn::String &msg) override
Displays current progress on Gtk progress bar (thread safe)
virtual ~Progress() override=default
Destructor.
const Gtk::ProgressBar & GetProgressBar() const
Gets the Gtk progress bar.
sigc::signal< void > signal_end()
Signal thrown when the progress reached 100%.