* Constructor
*/
//===========================================================
-SALOME_Event::SALOME_Event( int salomeEventType, bool wait, bool autoRelease ):
- myType( salomeEventType ),
- myWait( wait ),
- myAutoRelease( autoRelease )
+SALOME_Event::SALOME_Event():
+ myWait( true ),
+ myAutoRelease( false )
{
if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this<<", myWait = "<<myWait );
if ( myWait ) {
class SALOME_Event
{
public:
- SALOME_Event( int salomeEventType = -1, bool wait = true, bool autoRelease = false );
+ SALOME_Event();
virtual ~SALOME_Event();
- int getType() const { return myType; }
-
- virtual bool Execute() { return false; }
+ // To do real work
+ virtual void Execute() = 0;
void process();
void processed();
void release();
private:
- int myType;
bool myWait;
bool myAutoRelease;
QSemaphore* mySemaphore;
myAction(theAction),
myResult(theResult)
{}
- virtual bool Execute(){
+ virtual void Execute(){
myResult = (myObject->*myAction)();
- return true;
}
private:
TObject* myObject;
myObject(theObject),
myAction(theAction)
{}
- virtual bool Execute(){
+ virtual void Execute(){
(myObject->*myAction)();
- return true;
}
private:
TObject* myObject;
myResult(theResult),
myArg(theArg)
{}
- virtual bool Execute(){
+ virtual void Execute(){
myResult = (myObject->*myAction)(myArg);
- return true;
}
private:
TObject* myObject;
myAction(theAction),
myArg(theArg)
{}
- virtual bool Execute(){
+ virtual void Execute(){
(myObject->*myAction)(myArg);
- return true;
}
private:
TObject* myObject;
myArg(theArg),
myArg1(theArg1)
{}
- virtual bool Execute(){
+ virtual void Execute(){
myResult = (myObject->*myAction)(myArg,myArg1);
- return true;
}
private:
TObject* myObject;
myArg(theArg),
myArg1(theArg1)
{}
- virtual bool Execute(){
+ virtual void Execute(){
(myObject->*myAction)(myArg,myArg1);
- return true;
}
private:
TObject* myObject;
theEvent->release();
}
+
#endif
}
else if ( e->type() == SALOME_EVENT ) {
SALOME_Event* aSE = (SALOME_Event*)((QCustomEvent*)e)->data();
- MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 1 : o = " << o << ", e = " << aSE);
-
processEvent( aSE );
- MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 2" );
-
// Signal the calling thread that the event has been processed
aSE->processed();
- MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 3" );
-
((QCustomEvent*)e)->setData( 0 );
delete aSE;
return TRUE;
{
if ( !theEvent )
return;
-
- if(theEvent->Execute())
- return;
-
- // san - temporary code - to be removed together with VISU_Event and test operations in VISU_I...
- for ( ComponentMap::iterator it = myComponents.begin(); it != myComponents.end(); it++ ) {
- if ( it.data()->CanProcessEvent( theEvent ) && it.data()->ProcessEvent( theEvent ) )
- break;
- }
- // san - temporary code - to be removed together with VISU_Event and test operations in VISU_I...
+ theEvent->Execute();
}
/*!
return true;
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::CanProcessEvent(SALOME_Event* se)
-{
- return false;
-}
-
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-bool SALOMEGUI::ProcessEvent(SALOME_Event* se)
-{
- return false;
-}
-
//=============================================================================
/*!
*
virtual ~SALOMEGUI();
virtual bool OnGUIEvent (int theCommandID, QAD_Desktop* parent);
- virtual bool CanProcessEvent (SALOME_Event* se);
- virtual bool ProcessEvent (SALOME_Event* se);
virtual bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
virtual bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
virtual bool OnMouseMove (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);