ALBA
albaOp.h
Go to the documentation of this file.
1/*=========================================================================
2 Program: ALBA (Agile Library for Biomedical Applications)
3 Module: albaOp
4 Authors: Silvano Imboden
5
6 Copyright (c) BIC
7 All rights reserved. See Copyright.txt or
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12=========================================================================*/
13#ifndef __albaOp_H__
14#define __albaOp_H__
15//----------------------------------------------------------------------------
16// Include:
17//----------------------------------------------------------------------------
18#include "albaDefines.h" //important: albaDefines should always be included as first
19#include "albaEvent.h"
20#include "albaObserver.h"
21#include "albaObject.h"
22#include "albaServiceClient.h"
23#include "albaAbsLogicManager.h"
24
25//----------------------------------------------------------------------------
26// forward references :
27//----------------------------------------------------------------------------
28class albaVME;
29class albaGUI;
30class albaGUIHolder;
32class albaGUISettings;
33
34//----------------------------------------------------------------------------
35// constants :
36//----------------------------------------------------------------------------
38{
45};
46
47//----------------------------------------------------------------------------
48// albaOp :
49//----------------------------------------------------------------------------
50class ALBA_EXPORT albaOp : public albaObserver, public albaObject, public albaServiceClient
51{
52public:
54 {
55 ID_HELP = MINID,
57 };
58
60
62 albaOp(const wxString &label);
63 virtual ~albaOp();
64 void SetListener(albaObserver *Listener) { m_Listener = Listener; };
65
67 int GetType();
68
69 virtual void OnEvent(albaEventBase *alba_event);
70 virtual albaOp* Copy();
71
73 virtual void OpRun();
74
76 virtual void SetParameters(void *param) {};
77
79 virtual albaString GetParameters() { albaString parameters; return parameters; };
80
82 virtual void OpDo();
83
85 virtual void OpUndo();
86
88 virtual albaGUI *GetGui() { return m_Gui; };
89
91 virtual void SetInput(albaVME* vme) { m_Input = vme; };
92 virtual albaVME *GetInput() { return m_Input; };
93
95 virtual albaVME *GetOutput() { return m_Output; };
96 virtual void SetOutput(albaVME *output) { m_Output = output; };
97
99 bool Accept(albaVME* vme);
100
101 void EnableAccept(bool enable = true) { m_EnableAccept = enable; }
102
104 virtual bool CanUndo();
105
107 bool IsInputPreserving() { return m_InputPreserving; };
108
110 void ShowGui();
111
113 void HideGui();
114
116 virtual bool OkEnabled();
117
119 virtual void ForceStopWithOk();
120
122 virtual void ForceStopWithCancel();
123
124 wxString m_Label;
125 int m_Id;
127
128 //SIL 22/04/04
130 bool IsCompatible(long state);
131 wxMenuItem *m_MenuItem;
132 wxString m_OpMenuPath;
133
134 //MARCO 7/05/04
135 virtual const char **GetActions() { return NULL; };
136
139 albaDeviceButtonsPadMouse *GetMouse() { return m_Mouse; };
140
143 void TestModeOn() { m_TestMode = true; };
144
146 void TestModeOff() { m_TestMode = false; };
147
149 bool GetTestMode() { return m_TestMode; };
150
152 void SetCanundo(bool can_undo = true) { m_Canundo = can_undo; };
153
155 bool GetCanundo() { return m_Canundo; };
156
158 void SetSetting(albaGUISettings *setting) { m_SettingPanel = setting; };
159
161 albaGUISettings *GetSetting() { return m_SettingPanel; };
162
164 virtual char ** GetIcon();
165
166protected:
167
169 virtual bool InternalAccept(albaVME* vme);
170
172 virtual void OpStop(int result);
173
186};
187#endif
MINID
Definition: albaDecl.h:420
OPERATIONS_TYPE_ID
Definition: albaOp.h:38
@ OPTYPE_MAX
Definition: albaOp.h:44
@ OPTYPE_EXPORTER
Definition: albaOp.h:41
@ OPTYPE_STATECHANGER
Definition: albaOp.h:43
@ OPTYPE_EDIT
Definition: albaOp.h:42
@ OPTYPE_IMPORTER
Definition: albaOp.h:40
@ OPTYPE_OP
Definition: albaOp.h:39
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
class name: albaGUIHolder Secialized panel in which a developer can put a albaGUI.
Definition: albaGUIHolder.h:32
class name: albaGUISettings base class for more complex specified classes regarding the setting of ap...
albaGUI is a panel with function to easily create GUI.
Definition: albaGUI.h:110
Abstract superclass for all ALBA classes implementing RTTI APIs.
Definition: albaObject.h:38
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
Definition: albaOp.h:51
albaGUIHolder * m_Guih
Definition: albaOp.h:177
virtual bool InternalAccept(albaVME *vme)
Return true for the acceptable vme type.
albaGUISettings * GetSetting()
Get the reference to the operation's setting panel.
Definition: albaOp.h:161
virtual void ForceStopWithCancel()
Stop operation with CANCEL condition.
albaVME * m_Input
Pointer to the Input VME.
Definition: albaOp.h:174
virtual albaString GetParameters()
Return parameters used by operation.
Definition: albaOp.h:79
bool m_TestMode
Flag used with cppunitTest: put this flag at true when executing tests to avoid busy-info or splash s...
Definition: albaOp.h:184
long m_Compatibility
Definition: albaOp.h:129
virtual char ** GetIcon()
Return an xpm-icon that can be used to represent this operation.
virtual void OpDo()
Execute the operation.
ALBAOP_ID
Definition: albaOp.h:54
@ MINID
Definition: albaOp.h:56
wxString m_OpMenuPath
Definition: albaOp.h:132
void SetMouse(albaDeviceButtonsPadMouse *mouse)
Initialize the mouse device.
void TestModeOff()
Used to turn off m_TestMode flag.
Definition: albaOp.h:146
bool m_EnableAccept
Definition: albaOp.h:185
wxMenuItem * m_MenuItem
Definition: albaOp.h:131
virtual bool OkEnabled()
Return true if the OK button in operation's interface is enabled.
void HideGui()
Send the event to remove the interface from the side bar.
virtual const char ** GetActions()
Definition: albaOp.h:135
virtual void OpUndo()
Makes the undo for the operation.
void TestModeOn()
Turn On m_TestMode flag.
Definition: albaOp.h:143
bool m_Canundo
Flag to establish if the operation define the UnDo method or not.
Definition: albaOp.h:178
void SetCanundo(bool can_undo=true)
Set the Canundo flag for the operation when is plugged.
Definition: albaOp.h:152
virtual void SetOutput(albaVME *output)
Definition: albaOp.h:96
virtual bool CanUndo()
Return true if the operation is undoable.
bool GetTestMode()
Get TestMode.
Definition: albaOp.h:149
virtual ~albaOp()
albaDeviceButtonsPadMouse * GetMouse()
Definition: albaOp.h:139
bool Accept(albaVME *vme)
Return true for the acceptable vme type.
virtual void OpStop(int result)
This method is called at the end of the operation and result contain the wxOK or wxCANCEL.
bool IsInputPreserving()
Return true if the operation preserve the input vme.
Definition: albaOp.h:107
virtual void OpRun()
Builds operation's interface.
int m_Id
Index of the operation referring to the operation list.
Definition: albaOp.h:125
virtual void ForceStopWithOk()
Stop operation with OK condition.
virtual albaOp * Copy()
virtual void SetParameters(void *param)
Initialize operation's variables according to the parameter's list.
Definition: albaOp.h:76
virtual albaVME * GetInput()
Definition: albaOp.h:92
virtual albaVME * GetOutput()
Return the albaVME result of the operation.
Definition: albaOp.h:95
albaGUI * m_Gui
Pointer to the operation's GUI.
Definition: albaOp.h:176
virtual void OnEvent(albaEventBase *alba_event)
process the events sent by subjects
wxString m_Label
Label of the operation that will appear on the SideBar tab.
Definition: albaOp.h:124
bool m_InputPreserving
Flag to say if the operation change the input data (m_InputPreserving = false) or not.
Definition: albaOp.h:180
void ShowGui()
Puts the operation's interface into the gui holder and send the event to plug the interface on the si...
bool GetCanundo()
Return the Canundo flag for the operation.
Definition: albaOp.h:155
virtual void SetInput(albaVME *vme)
Set/Get the input vme for the operation.
Definition: albaOp.h:91
albaOp(const wxString &label)
albaGUISettings * m_SettingPanel
Definition: albaOp.h:183
virtual albaGUI * GetGui()
Return the operation's interface.
Definition: albaOp.h:88
albaOp * m_Next
Pointer to the next operation in the operation's list.
Definition: albaOp.h:126
bool IsCompatible(long state)
albaDeviceButtonsPadMouse * m_Mouse
Definition: albaOp.h:182
albaObserver * m_Listener
Definition: albaOp.h:181
void SetSetting(albaGUISettings *setting)
Set the reference to the operation's setting panel.
Definition: albaOp.h:158
void SetListener(albaObserver *Listener)
Definition: albaOp.h:64
void EnableAccept(bool enable=true)
Definition: albaOp.h:101
albaVME * m_Output
Pointer to the Output VME.
Definition: albaOp.h:175
int m_OpType
Store the type of the operation: OPTYPE_OP, OPTYPE_IMPORTER, OPTYPE_EXPORTER.
Definition: albaOp.h:179
int GetType()
Return the type of the operation: OPTYPE_OP, OPTYPE_IMPORTER, OPTYPE_EXPORTER, OPTYPE_EDIT or OPTYPE_...
albaTypeMacro(albaOp, albaObject)
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:150