Back to index

salome-gui  6.5.0
StandardApp_Module.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2011-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 // Author : Guillaume Boulant (EDF) 
00020 
00021 #ifndef _STANDARDAPP_MODULE_HXX_
00022 #define _STANDARDAPP_MODULE_HXX_
00023 
00024 #include <SUIT_ResourceMgr.h>
00025 #include <SalomeApp_Module.h>
00026 
00027 #include <SALOMEconfig.h>
00028 #include CORBA_SERVER_HEADER(SALOME_Component)
00029 
00030 #include <QString>
00031 
00059 class StandardApp_Module: public SalomeApp_Module
00060 {
00061   Q_OBJECT
00062 
00063 public:
00064 
00065   // ================================================================
00066   // This part defines the standard interface of the SalomeApp_Module
00067   // ================================================================
00068 
00069   StandardApp_Module();
00070   void    initialize( CAM_Application* );
00071   QString engineIOR() const;
00072   virtual void  windows( QMap<int, int>& theMap ) const;
00073 
00074 public slots:
00075   bool    deactivateModule( SUIT_Study* );
00076   bool    activateModule( SUIT_Study* );
00077 
00078   // ================================================================
00079   // This part defines the specific interface of this class
00080   // ================================================================
00081 
00082 public:
00083   /* Creates an action with standard default values */
00084   int createStandardAction(const QString& label,
00085                         QObject * slotobject,
00086                            const char* slotmember,
00087                            const QString& iconName=QString(),
00088                            const QString& tooltip=QString(),
00089                            const int identifier=ACTIONID_UNDEFINED);
00090 
00091   void addActionInToolbar(int actionId);
00092   void addActionInMenubar(int actionId);
00093   void addActionInPopupMenu(int actionId,const QString& rule="client='ObjectBrowser'");
00094 
00095 protected:
00096   /* Implement this to create additionnal widget (e.g. docked widget) */
00097   virtual void createModuleWidgets();
00098   /* Implement this to define the actions for this gui */
00099   virtual void createModuleActions();
00100 
00101   /* Use this to create a root entry in the study for this module */
00102   void createStudyComponent(SUIT_Study*);
00103   /* Implement this to say if study component entry should be created
00104      at activation step */
00105   virtual bool createStudyComponentAtActivation();
00106 
00107   /* The engine is the SALOME component associated to the study */
00108   virtual Engines::EngineComponent_ptr getEngine() const = 0;
00109   // Note that the function getEngine() is virtual pure and must be
00110   // implemented in the specific inherited classes. Note also that the
00111   // const flag is required because getEngine is used by functions
00112   // with const flags (see for ex: engineIOR()).
00113   virtual QString studyIconName();
00114 
00115   QIcon createIcon(const QString& iconName);
00116   int newActionId();
00117 
00118   enum DockLayoutType {
00119     DOCKLAYOUT_BOTTOM_HLARGE, // Bottom is Horizontal Large
00120     DOCKLAYOUT_LEFT_VLARGE,   // Left is Vertical Large
00121   };
00122   virtual void setDockLayout(DockLayoutType layoutType);
00123   virtual void unsetDockLayout();
00124   
00125   SUIT_ResourceMgr* _resourceMgr;
00126   int _defaultMenuId;
00127   int _defaultToolbarId;
00128 
00129   static int ACTIONID_DEFAULT_INIT_VALUE;
00130   static int ACTIONID_UNDEFINED;
00131 
00132 private:
00133   int _actionId_internalCount;
00134   Qt::DockWidgetArea _areaAtBottomLeftCorner;
00135   Qt::DockWidgetArea _areaAtBottomRightCorner;
00136 
00137   // =========================================================
00138   // This part defines slots for test purposes
00139   // =========================================================
00140 
00141 protected slots:
00142   void OnTest();
00143 };
00144 
00145 #endif