X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUIT%2FSUIT_ViewManager.h;h=8a351ae437113f6ff738e3407d965305f718c5fd;hb=81f45cc1076110965c403b903c5b44147c613049;hp=e0ca57fb261dc9d1ef85b71533a1721daf0eddaa;hpb=232b55569765049c7d1cceb5096a45f8584c9369;p=modules%2Fgui.git diff --git a/src/SUIT/SUIT_ViewManager.h b/src/SUIT/SUIT_ViewManager.h index e0ca57fb2..8a351ae43 100755 --- a/src/SUIT/SUIT_ViewManager.h +++ b/src/SUIT/SUIT_ViewManager.h @@ -1,36 +1,46 @@ -// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D -// +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 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 +// 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 +// +// 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 +// 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.salome-platform.org/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + #ifndef SUIT_VIEWMANAGER_H #define SUIT_VIEWMANAGER_H #include "SUIT.h" -#include "SUIT_ViewWindow.h" + #include "SUIT_PopupClient.h" -#include -#include +#include +#include +#include +#include + +class QMenu; +class QMouseEvent; +class QWheelEvent; +class QKeyEvent; class SUIT_Study; class SUIT_Desktop; class SUIT_ViewModel; - -class QPopupMenu; +class SUIT_ViewWindow; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -46,32 +56,42 @@ public: virtual ~SUIT_ViewManager(); virtual QString popupClientType() const { return getType(); } - virtual void contextMenuPopup( QPopupMenu* ); - + virtual void contextMenuPopup( QMenu* ); + void setViewModel(SUIT_ViewModel* theViewModel); SUIT_ViewModel* getViewModel() { return myViewModel; } - + SUIT_Study* study() const; - QString getType() const; + QString getType() const; SUIT_ViewWindow* getActiveView() { return myActiveView; } - + int getViewsCount() { return myViews.count(); } - QPtrVector getViews() { return myViews; } + QVector getViews() const; + + QString getTitle() const { return myTitle; } + virtual void setTitle( const QString& ); - QString getTitle() const { return myTitle;} - void setTitle(QString theTitle) { myTitle = theTitle; } + QPixmap getIcon() const { return myIcon; } + virtual void setIcon( const QPixmap& ); SUIT_ViewWindow* createViewWindow(); + bool isVisible() const; virtual void setShown( const bool ); + virtual void setDestructiveClose( const bool ); + + int getId() const; + + int getGlobalId() const; public slots: void createView(); void closeAllViews(); - + signals: void lastViewClosed(SUIT_ViewManager*); + void tryCloseView(SUIT_ViewWindow*); void deleteView(SUIT_ViewWindow*); void viewCreated(SUIT_ViewWindow*); void mousePress(SUIT_ViewWindow*, QMouseEvent*); @@ -82,36 +102,49 @@ signals: void keyPress(SUIT_ViewWindow*, QKeyEvent*); void keyRelease(SUIT_ViewWindow*, QKeyEvent*); void activated(SUIT_ViewManager*); - + protected slots: void onWindowActivated(SUIT_ViewWindow*); - void onDeleteView(SUIT_ViewWindow* theView); - void onMousePressed(SUIT_ViewWindow* theView, QMouseEvent* theEvent); + void onClosingView( SUIT_ViewWindow* ); + void onMousePressed(SUIT_ViewWindow*, QMouseEvent* ); void onDeleteStudy(); private slots: void onContextMenuRequested( QContextMenuEvent* e ); - + protected: /*! Inserts the View into internal Views Vector.\n * Returns true if view has been added successfully */ virtual bool insertView(SUIT_ViewWindow* theView); - + /*! Removes the View from internal Views Vector.*/ virtual void removeView(SUIT_ViewWindow* theView); - + + /*! Close the specified View.*/ + virtual void closeView(SUIT_ViewWindow* theView); + /*! Used to set unique name for the view.*/ - virtual void setViewName(SUIT_ViewWindow* theView); + virtual void setViewName(SUIT_ViewWindow* theView ); + QString prepareTitle( const QString&, const int, const int ); + + static int useNewId( const QString& ); + +protected: + typedef QPointer ViewWindow; protected: SUIT_Desktop* myDesktop; SUIT_ViewModel* myViewModel; - QPtrVector myViews; + QVector myViews; SUIT_ViewWindow* myActiveView; + int myId; + QPixmap myIcon; QString myTitle; SUIT_Study* myStudy; + + static QMap _ViewMgrId; }; #ifdef WIN32