From 744b46218e117391c29374c9f05266cd557f43bb Mon Sep 17 00:00:00 2001 From: smh Date: Wed, 31 Mar 2004 12:08:33 +0000 Subject: [PATCH] Base class for all component GUI added: SALOMEGUI --- src/SALOMEGUI/Makefile.in | 3 + src/SALOMEGUI/SALOMEGUI.cxx | 251 +++++++++++++++++++++--------------- src/SALOMEGUI/SALOMEGUI.h | 80 ++++++++++++ 3 files changed, 232 insertions(+), 102 deletions(-) create mode 100644 src/SALOMEGUI/SALOMEGUI.h diff --git a/src/SALOMEGUI/Makefile.in b/src/SALOMEGUI/Makefile.in index fd3a043f3..3f7bc1c78 100644 --- a/src/SALOMEGUI/Makefile.in +++ b/src/SALOMEGUI/Makefile.in @@ -92,6 +92,7 @@ EXPORT_HEADERS = \ Handle_SALOME_NumberFilter.hxx \ SALOME_DataMapOfIOMapOfInteger.hxx \ Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger.hxx \ + SALOMEGUI.h \ SALOMEGUI_LoadStudiesDlg.h \ SALOMEGUI_TableDlg.h \ SALOMEGUI_NameDlg.h \ @@ -149,6 +150,7 @@ LIB_SRC = \ QAD_StudyFrame.cxx \ QAD_Tools.cxx \ QAD_ViewFrame.cxx \ + SALOMEGUI.cxx \ SALOMEGUI_Application.cxx \ SALOMEGUI_Desktop.cxx \ SALOMEGUI_ImportOperation.cxx \ @@ -181,6 +183,7 @@ LIB_SRC = \ SALOMEGUI_CloseDlg.cxx \ SALOMEGUI_ActivateComponentDlg.cxx LIB_MOC = \ + SALOMEGUI.h \ SALOMEGUI_Application.h \ SALOMEGUI_Desktop.h \ QAD_Application.h \ diff --git a/src/SALOMEGUI/SALOMEGUI.cxx b/src/SALOMEGUI/SALOMEGUI.cxx index 69a3b241b..7f6efa6a2 100644 --- a/src/SALOMEGUI/SALOMEGUI.cxx +++ b/src/SALOMEGUI/SALOMEGUI.cxx @@ -22,109 +22,156 @@ // // // File : SALOMEGUI.cxx -// Author : Nicolas REJNERI +// Author : Sergey ANIKIN // Module : SALOME // $Header$ -using namespace std; -#include -#include CORBA_SERVER_HEADER(SALOMEDS) - -#include "QAD.h" -#include "QAD_MessageBox.h" -#include "QAD_Application.h" -#include "SALOMEGUI_Application.h" - -#include -#include - -#include "SALOME_NamingService.hxx" - -int main(int argc, char* argv[]) -{ - QApplication a( argc, argv ); - - // Setting up the CORBA environment - // Initializing omniORB - SALOME_NamingService * name_service; - CORBA::ORB_var orb; - - // orb = CORBA::ORB_init(argc, argv, "omniORB4"); - orb = CORBA::ORB_init(argc, argv, "omniORB3"); - - // Get the reference the server. - name_service = new SALOME_NamingService(orb); - - QAD_ASSERT ( QObject::connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) ) ); - - /* Initialize the desktop and 'SALOMEGUI' application */ - SALOMEGUI_Application* app = - new SALOMEGUI_Application ( "MDTV-Standard", "HDF","hdf" ); - - if ( !SALOMEGUI_Application::addToDesktop ( app, name_service ) ) - { - QAD_MessageBox::error1 ( 0, - QObject::tr("ERR_ERROR"), - QObject::tr("ERR_APP_INITFAILED"), - QObject::tr("BUT_OK") ); - return -1; - } - - QPalette pal; - QColorGroup cg; - cg.setColor( QColorGroup::Foreground, Qt::black ); - cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Light, Qt::white ); - cg.setColor( QColorGroup::Midlight, QColor( 223, 223, 223) ); - cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); - cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Text, Qt::black ); - cg.setColor( QColorGroup::BrightText, Qt::white ); - cg.setColor( QColorGroup::ButtonText, Qt::black ); - cg.setColor( QColorGroup::Base, Qt::white ); - cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Shadow, Qt::black ); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, Qt::white ); - pal.setActive( cg ); - cg.setColor( QColorGroup::Foreground, Qt::black ); - cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Light, Qt::white ); - cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) ); - cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); - cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Text, Qt::black ); - cg.setColor( QColorGroup::BrightText, Qt::white ); - cg.setColor( QColorGroup::ButtonText, Qt::black ); - cg.setColor( QColorGroup::Base, Qt::white ); - cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Shadow, Qt::black ); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, Qt::white ); - pal.setInactive( cg ); - cg.setColor( QColorGroup::Foreground, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Button, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Light, Qt::white ); - cg.setColor( QColorGroup::Midlight, QColor( 220, 220, 220) ); - cg.setColor( QColorGroup::Dark, QColor( 96, 96, 96) ); - cg.setColor( QColorGroup::Mid, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Text, Qt::black ); - cg.setColor( QColorGroup::BrightText, Qt::white ); - cg.setColor( QColorGroup::ButtonText, QColor( 128, 128, 128) ); - cg.setColor( QColorGroup::Base, Qt::white ); - cg.setColor( QColorGroup::Background, QColor( 192, 192, 192) ); - cg.setColor( QColorGroup::Shadow, Qt::black ); - cg.setColor( QColorGroup::Highlight, QColor( 0, 0, 128) ); - cg.setColor( QColorGroup::HighlightedText, Qt::white ); - pal.setDisabled( cg ); - qApp->setPalette( pal ); - - /* Run 'SALOMEGUI' application */ - QAD_Application::run(); - a.exec(); - - delete name_service; - orb->destroy(); - - return 0; +#include "SALOMEGUI.h" + +//============================================================================= +/*! + * + */ +//============================================================================= +SALOMEGUI::SALOMEGUI( const QString& name, QObject* parent ) +: QObject( parent ), + myName( name ) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +SALOMEGUI::~SALOMEGUI() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::CanProcessEvent(SALOME_Event* se) +{ + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::ProcessEvent(SALOME_Event* se) +{ + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) +{ + return true; } + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::SetSettings( QAD_Desktop* parent ) +{ + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::CustomPopup( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, + const QString & theParent, const QString & theObject ) +{ + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SALOMEGUI::DefinePopup( QString & theContext, QString & theParent, QString & theObject ) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +bool SALOMEGUI::ActiveStudyChanged( QAD_Desktop* parent ) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SALOMEGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)& theIO ) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SALOMEGUI::SupportedViewType(int* buffer, int bufferSize) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SALOMEGUI::Deactivate() +{ + emit SignalCloseAllDialogs(); +} + diff --git a/src/SALOMEGUI/SALOMEGUI.h b/src/SALOMEGUI/SALOMEGUI.h new file mode 100644 index 000000000..f23d5cd8f --- /dev/null +++ b/src/SALOMEGUI/SALOMEGUI.h @@ -0,0 +1,80 @@ +// SALOME SALOMEGUI : implementation of desktop and GUI kernel +// +// 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 : SALOMEGUI.hxx +// Author : Sergey ANIKIN +// Module : SALOME +// $Header$ + +#ifndef SALOMEGUI_HeaderFile +#define SALOMEGUI_HeaderFile + +#include + +#include +#include + +class QAD_Desktop; +class QAD_StudyFrame; +class SALOME_Event; + +class Handle_SALOME_InteractiveObject; + +class QKeyEvent; +class QMouseEvent; +class QPopupMenu; +class QString; + + +class Standard_EXPORT SALOMEGUI : public QObject +{ + Q_OBJECT + +public: + SALOMEGUI( const QString& name, QObject* parent = 0 ); + 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); + virtual bool SetSettings ( QAD_Desktop* parent ); + virtual bool CustomPopup ( QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, + const QString & theParent, const QString & theObject ); + virtual void DefinePopup ( QString & theContext, QString & theParent, QString & theObject ); + virtual bool ActiveStudyChanged( QAD_Desktop* parent ); + virtual void BuildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ); + virtual void SupportedViewType (int* buffer, int bufferSize); + virtual void Deactivate (); + +signals: + void SignalDeactivateActiveDialog(); + void SignalCloseAllDialogs (); + +private: + QString myName; +}; + +#endif -- 2.39.2