Salome HOME
PR: merge from tag BR_CCRT2_mergeto_V2_1_0b1
[modules/kernel.git] / src / SALOMEGUI / SALOMEGUI.cxx
index 50e3b389f9dce06301a1b511f97aae582f70d0ed..81e91ae424d3a278bbf2bc83145472afd83975ba 100644 (file)
-using namespace std;
-//  File      : SALOMEGUI.cxx
-//  Created   : Thu Jun 14 12:00:40 2001
-//  Author    : Nicolas REJNERI
-//  Project   : SALOME
-//  Module    : SALOMEGUI
-//  Copyright : Open CASCADE
+//  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.cxx
+//  Author : Sergey ANIKIN
+//  Module : SALOME
 //  $Header$
 
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SALOMEDS)
-
-#include "QAD.h"
-#include "QAD_MessageBox.h"
-#include "QAD_Application.h"
-#include "SALOMEGUI_Application.h"
-
-#include <qmainwindow.h>
-#include <qapplication.h>
-
-#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, "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"
+#include "QAD_Desktop.h"
+
+using namespace std;
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+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::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::SetSettings( QAD_Desktop* parent, char* compName )
+{
+  return SetSettings( parent);
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+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 )
+{
+  //static QAD_Study* aPrevStudy = NULL;
+  //QAD_Study* aStudy = parent->getActiveStudy();
+  //if(!aPrevStudy)
+  //  aPrevStudy = aStudy;
+  //if(aStudy != aPrevStudy){
+  //  emit SignalCloseAllDialogs();
+  //  aPrevStudy = aStudy;
+  //}
+  emit SignalCloseAllDialogs();
+  return true;
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+void SALOMEGUI::BuildPresentation( const Handle(SALOME_InteractiveObject)&,
+                                   QAD_ViewFrame* )
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+void SALOMEGUI::SupportedViewType(int* /*buffer*/, int /*bufferSize*/ )
+{
+}
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+void SALOMEGUI::Deactivate()
+{
+  emit SignalCloseAllDialogs();
+}
+