fw4spl
IProgressDialog.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWGUI_DIALOG_IPROGRESSDIALOG_HPP__
8 #define __FWGUI_DIALOG_IPROGRESSDIALOG_HPP__
9 
10 #include "fwGui/config.hpp"
11 #include "fwGui/GuiBaseObject.hpp"
12 
13 #include <fwData/location/ILocation.hpp>
14 
15 #include <boost/signals2.hpp>
16 
17 #include <functional>
18 #include <string>
19 
20 namespace fwGui
21 {
22 namespace dialog
23 {
30 class FWGUI_CLASS_API IProgressDialog : public ::fwGui::GuiBaseObject,
31  public ::boost::signals2::trackable
32 {
33 
34 public:
35 
37 
38  typedef std::string FactoryRegistryKeyType;
39  typedef boost::function< void () > CancelCallbackType;
40 
42  FWGUI_API static const FactoryRegistryKeyType REGISTRY_KEY;
43 
44  FWGUI_API virtual ~IProgressDialog();
45  FWGUI_API IProgressDialog();
46 
48  FWGUI_API virtual void setTitle(const std::string& title) = 0;
49 
51  FWGUI_API virtual void setMessage(const std::string& msg) = 0;
52 
54  FWGUI_API virtual void operator()(float percent, std::string msg) = 0;
55 
56  FWGUI_API virtual void setCancelCallback(CancelCallbackType callback);
57 
58  //------------------------------------------------------------------------------
59 
60  virtual void setCancelRaiseException(bool raise)
61  {
62  m_raise = raise;
63  }
64 
65  //------------------------------------------------------------------------------
66 
67  virtual bool getCanceled()
68  {
69  return m_canceled;
70  }
71 
72  //------------------------------------------------------------------------------
73 
74  virtual void hideCancelButton()
75  {
76  }
77 
78  //------------------------------------------------------------------------------
79 
80  virtual void setProcessUserEvents(bool process)
81  {
82  m_processUserEvents = process;
83  }
84 
85 protected:
86 
87  FWGUI_API virtual void cancelPressed();
88 
89  CancelCallbackType m_cancelCallback;
90  bool m_canceled;
91  bool m_raise;
93  int m_value;
94  bool m_processUserEvents;
95 
96 protected:
97  //------------------------------------------------------------------------------
98 
99  static sptr progressDialogFactory()
100  {
101  ::fwGui::GuiBaseObject::sptr guiObj = ::fwGui::factory::New(
103  ::fwGui::dialog::IProgressDialog::sptr progressDlg = ::fwGui::dialog::IProgressDialog::dynamicCast(guiObj);
104  return progressDlg;
105  }
106 
107 };
108 
109 } //namespace dialog
110 } // namespace fwGui
111 
112 #endif /*__FWGUI_DIALOG_IPROGRESSDIALOG_HPP__*/
113 
The namespace fwGui contains the base interface for IHM services.
Definition: SJobBar.hpp:23
static FWGUI_API const FactoryRegistryKeyType REGISTRY_KEY
this unique key should be used for all factory for specific LocationDialog(qt,wx,...)
#define fwCoreClassDefinitionsWithFactoryMacro(_classinfo_, _parameters_, _factory_)
Generate common construction methods for classes with one factory.
Base class for all fwGui&#39;s classes.
int m_value
progress bar&#39;s current value: [0-100]
Defines the generic Progress dialog for IHM.