fw4spl
SQuit.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
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 #include "gui/action/SQuit.hpp"
8 
9 #include <fwCore/base.hpp>
10 
11 #include <fwGui/Application.hpp>
12 #include <fwGui/Cursor.hpp>
13 
14 #include <fwServices/macros.hpp>
15 
16 namespace gui
17 {
18 namespace action
19 {
20 
21 fwServicesRegisterMacro( ::fwGui::IActionSrv, ::gui::action::SQuit );
22 
23 //-----------------------------------------------------------------------------
24 
25 SQuit::SQuit() noexcept
26 {
27 }
28 
29 //-----------------------------------------------------------------------------
30 
31 SQuit::~SQuit() noexcept
32 {
33 }
34 
35 //-----------------------------------------------------------------------------
36 
38 {
40  this->initialize();
41 }
42 
43 //-----------------------------------------------------------------------------
44 
46 {
48  this->actionServiceStarting();
49 }
50 
51 //-----------------------------------------------------------------------------
52 
54 {
56  this->actionServiceStopping();
57 }
58 
59 //-----------------------------------------------------------------------------
60 
61 void SQuit::info(std::ostream& _sstream )
62 {
63  _sstream << "Quit Action" << std::endl;
64 }
65 
66 //-----------------------------------------------------------------------------
67 
69 {
70  ::fwGui::Cursor cursor;
71  cursor.setCursor(::fwGui::ICursor::BUSY);
72  ::fwGui::Application::New()->exit(0);
73  cursor.setDefaultCursor();
74 }
75 
76 //-----------------------------------------------------------------------------
77 
78 }
79 }
virtual FWGUI_API void setCursor(::fwGui::ICursor::CursorType cursor) override
Set the cursor.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
Definition: IActionSrv.cpp:160
This action tries to close the window and reset root object.
Definition: SQuit.hpp:24
#define SLM_TRACE_FUNC()
Trace contextual function signature.
Definition: spyLog.hpp:329
The namespace gui contains the basic services to build the application IHM.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
Definition: IActionSrv.cpp:153
virtual GUI_API void info(std::ostream &_sstream) override
Write information in a stream.
Definition: SQuit.cpp:61
Defines the service interface managing the menu items.
Definition: IActionSrv.hpp:24
GUI_API void configuring() override
This method is used to configure the service parameters: specifies which services must be started or ...
Definition: SQuit.cpp:37
FWGUI_API void initialize()
Initialize the action.
Definition: IActionSrv.cpp:69
virtual GUI_API void starting() override
Initialize the service activity.
Definition: SQuit.cpp:45
Defines the generic cursor for IHM. Use the Delegate design pattern.
virtual GUI_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
Definition: SQuit.cpp:53
GUI_API SQuit() noexcept
Constructor. Do nothing.
virtual GUI_API void updating() override
This method tries to close the window and reset root object.
Definition: SQuit.cpp:68
virtual GUI_API ~SQuit() noexcept
Destructor. Do nothing.
Definition: SQuit.cpp:31
virtual FWGUI_API void setDefaultCursor() override
Set the default cursor.