The class which encapsulates data and functionality required for posting component-specific events to perform arbitrary operations in the main GUI thread.
More...
#include <SALOME_Event.h>
Inherited by CloseEvent, InitEvent, TActionEvent, TActionIdEvent, TActivateModuleEvent, TActivateView, TActivateViewManagerAndView, TAddGlobalPrefEvent, TAddPrefEvent, TAddPrefParamEvent, TCloneView, TCloseView, TCreateActionEvent, TCreateActionGroupEvent, TCreateEmptyObjectEvent, TCreateMenuEvent, TCreateObjectEvent, TCreateSepEvent, TCreateToolEvent, TCreateView, TCreateViewWg, TDefMenuGroupEvent, TDeleteCurve, TdisableSelectorEvent, TDisplayCurve, TDumpViewEvent, TEnableSelectorEvent, TEraseCurve, TEvent, TFindViews, TFitRangeByCurves, TFitRangeCurrent, TGetActiveComponentEvent, TGetActivePyModuleEvent, TGetActiveStudyIdEvent, TGetActiveStudyNameEvent, TGetActiveView, TGetBoolSettingEvent, TGetByteArraySettingEvent, TGetChildrenEvent, TGetColorEvent, TGetColorSettingEvent, TGetComponentNameEvent, TGetConstantEvent, TGetDblSettingEvent, TGetDesktopEvent, TGetExistingDirectoryEvent, TGetFileNameEvent, TGetIntSettingEvent, TGetMainFrameEvent, TGetMainMenuBarEvent, TGetNameEvent, TGetObjectBrowserEvent, TGetObjectPositionEvent, TGetOpenFileNamesEvent, TGetPlot2dTitle, TGetPopupMenuEvent, TGetRefEvent, TGetRendererEvent, TGetRenderWindowEvent, TGetRenderWindowInteractorEvent, TGetSelectedEvent, TGetSelectionEvent, TGetSettingEvent, TGetStrSettingEvent, TGetStudyIdEvent, TGetToolTipEvent, TGetViewParameters, TGetViews, TGetViewTitle, TGetViewType, TGetViewWidget, TGetVisibilityStateEvent, TGroupAllViews, THasDesktopEvent, THasSettingEvent, TIsInViewerEvent, TIsModifiedEvent, TIsViewClosable, TIsViewVisible, TLoadIconEvent, TMemFun1ArgEvent< TObject, TRes, TArg, TStoreArg >, TMemFun2ArgEvent< TObject, TRes, TArg, TArg1, TStoreArg, TStoreArg1 >, TMemFunEvent< TObject, TRes >, TMoveView, TNeighbourViews, TParametersEvent, TPlot2dFitRange, TPrefPropEvent, TPutInfoEvent, TRemoveChildEvent, TRemoveObjectEvent, TSetColorEvent, TSetIconEvent, TSetNameEvent, TSetPlot2dTitle, TSetRefEvent, TSetSelectionEvent, TSetToolTipEvent, TSetViewSize, TSetViewTitle, TSplitView, TVoidMemFun1ArgEvent< TObject, TArg, TStoreArg >, TVoidMemFun2ArgEvent< TObject, TArg, TArg1, TStoreArg, TStoreArg1 >, and TVoidMemFunEvent< TObject >.
|
| SALOME_Event () |
| Constructor. More...
|
|
virtual | ~SALOME_Event () |
| Destructor. More...
|
|
void | ExecutePostedEvent () |
| This method should be called by the main GUI thread in order to execute the code specific for this event and finally to inform the calling thread that the event has been processed waking it up with help of the semaphore . More...
|
|
virtual void | Execute ()=0 |
| This method should be redefined in the successor classes to do real work. More...
|
|
void | process () |
| Post the event and wait for its completion. process() should be called from a secondary thread only. More...
|
|
|
void | processed () |
| Use this method to signal that this event has been processed. More...
|
|
SALOME_Event objects can be posted by any thread belonging to the GUI process.
It is necessary to derive a custom event class from SALOME_Event and re-implement virtual Execute() method. This method should actually perform the desirable operation. To pass all the required data to Execute() and store a return value, arbitrary data fields can be added to the custom event class. There is no need to protect such fields with a mutex, for only one thread working with a SALOME_Event object is active at any moment.
Usage:
- Create SALOME_Event. Components can derive their own event class from SALOME_Event in order to pass custom data to the event handler.
- Call process() method to post the event. After process() execution it is possible to examine fields of your custom event object.
- Perform delete operator on the event to wake up the desktop (you can also set <autoRelease> parameter to
true
to automatically wake up desktop after process().
The method processed() is used by the desktop to signal that event processing has been completed.
To make all this work, it is necessary to call static method GetSessionThread() during the application initialization, i.e. from main() function. It is important to call this method from the primary application thread.
Caveats:
SALOME_Event::SALOME_Event |
( |
| ) |
|
SALOME_Event::~SALOME_Event |
( |
| ) |
|
|
virtual |
void SALOME_Event::Execute |
( |
| ) |
|
|
pure virtual |
Implemented in TGetObjectPositionEvent, TGetVisibilityStateEvent, TPlot2dFitRange, TFitRangeCurrent, TFitRangeByCurves, TSetPlot2dTitle, TGetPlot2dTitle, TDeleteCurve, TEraseCurve, TDisplayCurve, TGetChildrenEvent, TRemoveObjectEvent, TRemoveChildEvent, TGetColorEvent, TGetRefEvent, TGetToolTipEvent, TGetNameEvent, TSetColorEvent, TSetRefEvent, TSetToolTipEvent, TSetIconEvent, TSetNameEvent, TCreateObjectEvent, TCreateEmptyObjectEvent, TNeighbourViews, TMoveView, TSplitView, TGroupAllViews, TIsViewClosable, TIsViewVisible, TCloneView, TCloseView, TCreateViewWg, TCreateView, TGetViewWidget, TActivateViewManagerAndView, TActivateView, TFindViews, TGetViewTitle, TSetViewSize, TSetViewTitle, TGetViewType, TGetActiveView, TGetViews, TDumpViewEvent, TPrefPropEvent, TAddPrefParamEvent, TAddPrefEvent, TAddGlobalPrefEvent, TActionIdEvent, TActionEvent, TCreateActionGroupEvent, TCreateActionEvent, TCreateSepEvent, TCreateMenuEvent, TCreateToolEvent, TDefMenuGroupEvent, TLoadIconEvent, TGetExistingDirectoryEvent, TGetOpenFileNamesEvent, TGetFileNameEvent, TParametersEvent, THasSettingEvent, TGetByteArraySettingEvent, TGetColorSettingEvent, TGetStrSettingEvent, TGetBoolSettingEvent, TGetDblSettingEvent, TGetIntSettingEvent, TGetConstantEvent, TGetSettingEvent, TGetViewParameters, TIsModifiedEvent, TActivateModuleEvent, TGetActivePyModuleEvent, TGetActiveComponentEvent, TPutInfoEvent, TIsInViewerEvent, TdisableSelectorEvent, TEnableSelectorEvent, TSetSelectionEvent, TGetSelectionEvent, TGetStudyIdEvent, TGetObjectBrowserEvent, TGetPopupMenuEvent, TGetMainMenuBarEvent, TGetMainFrameEvent, TGetDesktopEvent, TGetRenderWindowInteractorEvent, TGetSelectedEvent, TGetRenderWindowEvent, TGetComponentNameEvent, TGetActiveStudyNameEvent, TGetRendererEvent, TGetActiveStudyIdEvent, TVoidMemFun2ArgEvent< TObject, TArg, TArg1, TStoreArg, TStoreArg1 >, CloseEvent, TMemFun2ArgEvent< TObject, TRes, TArg, TArg1, TStoreArg, TStoreArg1 >, THasDesktopEvent, TVoidMemFun1ArgEvent< TObject, TArg, TStoreArg >, TMemFun1ArgEvent< TObject, TRes, TArg, TStoreArg >, TVoidMemFunEvent< TObject >, TMemFunEvent< TObject, TRes >, InitEvent, and TEvent.
void SALOME_Event::ExecutePostedEvent |
( |
| ) |
|
void SALOME_Event::GetSessionThread |
( |
| ) |
|
|
staticprotected |
This function sets up the main application thread. It should be called during the application initialization, i.e. main() function.
References myThread.
bool SALOME_Event::IsSessionThread |
( |
| ) |
|
|
static |
- Returns
true
if this method is called from the main application thread
References myThread.
void SALOME_Event::process |
( |
| ) |
|
void SALOME_Event::processed |
( |
| ) |
|
|
protected |
QSemaphore* SALOME_Event::mySemaphore |
|
private |
The documentation for this class was generated from the following files: