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 :
49class ALBA_EXPORT albaOp : public albaObserver, public albaObject, public albaServiceClient
50{
51public:
53 {
54 ID_HELP = MINID,
56 };
57
59
61 albaOp(const wxString &label);
62 virtual ~albaOp();
63 void SetListener(albaObserver *Listener) { m_Listener = Listener; };
64
66 int GetType();
67
68 virtual void OnEvent(albaEventBase *alba_event);
69 virtual albaOp* Copy();
70
72 virtual void OpRun();
73
75 virtual void SetParameters(void *param) {};
76
78 virtual albaString GetParameters() { albaString parameters; return parameters; };
79
81 virtual void OpDo();
82
84 virtual void OpUndo();
85
87 virtual albaGUI *GetGui() { return m_Gui; };
88
90 virtual void SetInput(albaVME* vme) { m_Input = vme; };
91 virtual albaVME *GetInput() { return m_Input; };
92
94 virtual albaVME *GetOutput() { return m_Output; };
95 virtual void SetOutput(albaVME *output) { m_Output = output; };
96
98 bool Accept(albaVME* vme);
99
100 void EnableAccept(bool enable = true) { m_EnableAccept = enable; }
101
103 virtual bool CanUndo();
104
106 bool IsInputPreserving() { return m_InputPreserving; };
107
109 void ShowGui();
110
112 void HideGui();
113
115 virtual bool OkEnabled();
116
118 virtual void ForceStopWithOk();
119
121 virtual void ForceStopWithCancel();
122
123 wxString m_Label;
124 int m_Id;
126
127 //SIL 22/04/04
129 bool IsCompatible(long state);
130 wxMenuItem *m_MenuItem;
131 wxString m_OpMenuPath;
132
133 //MARCO 7/05/04
134 virtual const char **GetActions() { return NULL; };
135
138 albaDeviceButtonsPadMouse *GetMouse() { return m_Mouse; };
139
142 void TestModeOn() { m_TestMode = true; };
143
145 void TestModeOff() { m_TestMode = false; };
146
148 bool GetTestMode() { return m_TestMode; };
149
151 void SetCanundo(bool can_undo = true) { m_Canundo = can_undo; };
152
154 bool GetCanundo() { return m_Canundo; };
155
157 void SetSetting(albaGUISettings *setting) { m_SettingPanel = setting; };
158
160 albaGUISettings *GetSetting() { return m_SettingPanel; };
161
163 virtual char ** GetIcon();
164
165protected:
166
168 virtual bool InternalAccept(albaVME* vme);
169
171 virtual void OpStop(int result);
172
185};
186#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:50
albaGUIHolder * m_Guih
Definition: albaOp.h:176
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:160
virtual void ForceStopWithCancel()
Stop operation with CANCEL condition.
albaVME * m_Input
Pointer to the Input VME.
Definition: albaOp.h:173
virtual albaString GetParameters()
Return parameters used by operation.
Definition: albaOp.h:78
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:183
long m_Compatibility
Definition: albaOp.h:128
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:53
@ MINID
Definition: albaOp.h:55
wxString m_OpMenuPath
Definition: albaOp.h:131
void SetMouse(albaDeviceButtonsPadMouse *mouse)
Initialize the mouse device.
void TestModeOff()
Used to turn off m_TestMode flag.
Definition: albaOp.h:145
bool m_EnableAccept
Definition: albaOp.h:184
wxMenuItem * m_MenuItem
Definition: albaOp.h:130
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:134
virtual void OpUndo()
Makes the undo for the operation.
void TestModeOn()
Turn On m_TestMode flag.
Definition: albaOp.h:142
bool m_Canundo
Flag to establish if the operation define the UnDo method or not.
Definition: albaOp.h:177
void SetCanundo(bool can_undo=true)
Set the Canundo flag for the operation when is plugged.
Definition: albaOp.h:151
virtual void SetOutput(albaVME *output)
Definition: albaOp.h:95
virtual bool CanUndo()
Return true if the operation is undoable.
bool GetTestMode()
Get TestMode.
Definition: albaOp.h:148
virtual ~albaOp()
albaDeviceButtonsPadMouse * GetMouse()
Definition: albaOp.h:138
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:106
virtual void OpRun()
Builds operation's interface.
int m_Id
Index of the operation referring to the operation list.
Definition: albaOp.h:124
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:75
virtual albaVME * GetInput()
Definition: albaOp.h:91
virtual albaVME * GetOutput()
Return the albaVME result of the operation.
Definition: albaOp.h:94
albaGUI * m_Gui
Pointer to the operation's GUI.
Definition: albaOp.h:175
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:123
bool m_InputPreserving
Flag to say if the operation change the input data (m_InputPreserving = false) or not.
Definition: albaOp.h:179
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:154
virtual void SetInput(albaVME *vme)
Set/Get the input vme for the operation.
Definition: albaOp.h:90
albaOp(const wxString &label)
albaGUISettings * m_SettingPanel
Definition: albaOp.h:182
virtual albaGUI * GetGui()
Return the operation's interface.
Definition: albaOp.h:87
albaOp * m_Next
Pointer to the next operation in the operation's list.
Definition: albaOp.h:125
bool IsCompatible(long state)
albaDeviceButtonsPadMouse * m_Mouse
Definition: albaOp.h:181
albaObserver * m_Listener
Definition: albaOp.h:180
void SetSetting(albaGUISettings *setting)
Set the reference to the operation's setting panel.
Definition: albaOp.h:157
void SetListener(albaObserver *Listener)
Definition: albaOp.h:63
void EnableAccept(bool enable=true)
Definition: albaOp.h:100
albaVME * m_Output
Pointer to the Output VME.
Definition: albaOp.h:174
int m_OpType
Store the type of the operation: OPTYPE_OP, OPTYPE_IMPORTER, OPTYPE_EXPORTER.
Definition: albaOp.h:178
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