From: smh Date: Thu, 1 Apr 2004 13:12:39 +0000 (+0000) Subject: SALOME_Event ideology changed X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3ca9bad62c0a05d2579099580e09dfc159bbe516;p=modules%2Fkernel.git SALOME_Event ideology changed --- diff --git a/src/Event/SALOME_Event.cxx b/src/Event/SALOME_Event.cxx index 36ec6ce99..f40251e3a 100644 --- a/src/Event/SALOME_Event.cxx +++ b/src/Event/SALOME_Event.cxx @@ -1,45 +1,115 @@ -// File: SALOME_Event.cxx -// Created: Tue Mar 30 15:06:32 2004 -// Author: Sergey ANIKIN -// - +// KERNEL SALOME_Event : Define event posting mechanism +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Event.cxx +// Author : Sergey ANIKIN +// Module : KERNEL +// $Header$ #include "SALOME_Event.hxx" #include "utilities.h" -//=========================================================================== -// ~SALOME_Semaphore -//=========================================================================== -SALOME_Semaphore::~SALOME_Semaphore() +#include +#include +#include + +//=========================================================== +/*! + * SALOME_Event::SALOME_Event + * Constructor + */ +//=========================================================== +SALOME_Event::SALOME_Event( int salomeEventType, bool wait ) +: myType( salomeEventType ), + myWait( wait ) +{ + MESSAGE( "SALOME_Event::SALOME_Event(): myType = "<available() ) { - MESSAGE( "SALOME_Event::SALOME_Event(): available = " << getSemaphore()->available() ); - getSemaphore()->operator--( 1 ); + MESSAGE( "SALOME_Event::processed(): myType = "<processed(); MESSAGE( "QAD_Desktop::eventFilter - SALOME_Event handling - 3" ); + + ((QCustomEvent*)e)->setData( 0 ); + delete aSE; return TRUE; } return QMainWindow::eventFilter( o, e ); } +/*! + Dispatches to the target component GUI +*/ +void QAD_Desktop::processEvent( SALOME_Event* theEvent ) +{ + if ( !theEvent ) + return; + + for ( ComponentMap::iterator it = myComponents.begin(); it != myComponents.end(); it++ ) { + if ( it.data()->CanProcessEvent( theEvent ) && it.data()->ProcessEvent( theEvent ) ) + break; + } +} + /*! Creates and initializes the standard file operations such as 'New/Open/Save/SaveAs/Close' and 'Help'. diff --git a/src/SALOMEGUI/QAD_Desktop.h b/src/SALOMEGUI/QAD_Desktop.h index 7cce46ea3..94a4a3fe1 100644 --- a/src/SALOMEGUI/QAD_Desktop.h +++ b/src/SALOMEGUI/QAD_Desktop.h @@ -59,11 +59,9 @@ #include #include -// Open CASCADE Includes -#include - class QAD_XmlHandler; class SALOMEGUI; +class SALOME_Event; class QAD_EXPORT QAD_Desktop : public QMainWindow { @@ -319,6 +317,9 @@ protected: QMap mapComponentName; +private: + void processEvent( SALOME_Event* ); + private: typedef QMap ComponentMap; diff --git a/src/SALOMEGUI/SALOMEGUI_Swig.cxx b/src/SALOMEGUI/SALOMEGUI_Swig.cxx index 9bf557876..015d16722 100644 --- a/src/SALOMEGUI/SALOMEGUI_Swig.cxx +++ b/src/SALOMEGUI/SALOMEGUI_Swig.cxx @@ -135,6 +135,13 @@ const char* SALOMEGUI_Swig::getComponentUserName( const char* ComponentName ) { return QAD_Application::getDesktop()->getComponentUserName( ComponentName ); } +/*! + Loads component GUI library if not yet loaded +*/ +void SALOMEGUI_Swig::loadComponentGUI( const char* ComponentName ) +{ + QAD_Application::getDesktop()->getComponentGUI( QAD_Application::getDesktop()->getComponentUserName( ComponentName ) ); +} /*! Returns the number of selected objects. diff --git a/src/SALOMEGUI/SALOMEGUI_Swig.hxx b/src/SALOMEGUI/SALOMEGUI_Swig.hxx index 0af5330a1..8718063fe 100644 --- a/src/SALOMEGUI/SALOMEGUI_Swig.hxx +++ b/src/SALOMEGUI/SALOMEGUI_Swig.hxx @@ -72,6 +72,7 @@ public: /* component name */ const char* getComponentName( const char* ComponentUserName ); const char* getComponentUserName( const char* ComponentName ); + void loadComponentGUI( const char* ComponentName ); protected: int _studyId; diff --git a/src/SALOMEGUI/SALOMEGUI_Swig.i b/src/SALOMEGUI/SALOMEGUI_Swig.i index d5c5a5007..f0237824e 100644 --- a/src/SALOMEGUI/SALOMEGUI_Swig.i +++ b/src/SALOMEGUI/SALOMEGUI_Swig.i @@ -82,4 +82,6 @@ class SALOMEGUI_Swig /* component name */ const char* getComponentName( const char* ComponentUserName ); const char* getComponentUserName( const char* ComponentName ); + + void loadComponentGUI( const char* ComponentName ); };