1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #ifndef SUIT_VIEWMANAGER_H
23 #define SUIT_VIEWMANAGER_H
27 #include "SUIT_PopupClient.h"
42 class SUIT_ViewWindow;
45 #pragma warning( disable:4251 )
48 class SUIT_EXPORT SUIT_ViewManager : public QObject, public SUIT_PopupClient
52 SUIT_ViewManager( SUIT_Study*,
54 SUIT_ViewModel* = 0 );
55 virtual ~SUIT_ViewManager();
57 virtual QString popupClientType() const { return getType(); }
58 virtual void contextMenuPopup( QMenu* );
60 void setViewModel(SUIT_ViewModel* theViewModel);
61 SUIT_ViewModel* getViewModel() { return myViewModel; }
63 SUIT_Study* study() const;
65 QString getType() const;
66 SUIT_ViewWindow* getActiveView() { return myActiveView; }
68 int getViewsCount() { return myViews.count(); }
69 QVector<SUIT_ViewWindow*> getViews() const;
71 QString getTitle() const { return myTitle; }
72 virtual void setTitle( const QString& );
74 QPixmap getIcon() const { return myIcon; }
75 virtual void setIcon( const QPixmap& );
77 SUIT_ViewWindow* createViewWindow();
79 bool isVisible() const;
80 virtual void setShown( const bool );
81 virtual void setDestructiveClose( const bool );
90 void lastViewClosed(SUIT_ViewManager*);
91 void deleteView(SUIT_ViewWindow*);
92 void viewCreated(SUIT_ViewWindow*);
93 void mousePress(SUIT_ViewWindow*, QMouseEvent*);
94 void mouseRelease(SUIT_ViewWindow*, QMouseEvent*);
95 void mouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
96 void mouseMove(SUIT_ViewWindow*, QMouseEvent*);
97 void wheel(SUIT_ViewWindow*, QWheelEvent*);
98 void keyPress(SUIT_ViewWindow*, QKeyEvent*);
99 void keyRelease(SUIT_ViewWindow*, QKeyEvent*);
100 void activated(SUIT_ViewManager*);
103 void onWindowActivated(SUIT_ViewWindow*);
104 void onClosingView( SUIT_ViewWindow* );
105 void onMousePressed(SUIT_ViewWindow*, QMouseEvent* );
106 void onDeleteStudy();
109 void onContextMenuRequested( QContextMenuEvent* e );
112 /*! Inserts the View into internal Views Vector.\n
113 * Returns true if view has been added successfully
115 virtual bool insertView(SUIT_ViewWindow* theView);
117 /*! Removes the View from internal Views Vector.*/
118 virtual void removeView(SUIT_ViewWindow* theView);
120 /*! Close the specified View.*/
121 virtual void closeView(SUIT_ViewWindow* theView);
123 /*! Used to set unique name for the view.*/
124 virtual void setViewName(SUIT_ViewWindow* theView );
125 QString prepareTitle( const QString&, const int, const int );
127 static int useNewId( const QString& );
130 typedef QPointer<SUIT_ViewWindow> ViewWindow;
133 SUIT_Desktop* myDesktop;
134 SUIT_ViewModel* myViewModel;
135 QVector<ViewWindow> myViews;
136 SUIT_ViewWindow* myActiveView;
143 static QMap<QString, int> _ViewMgrId;
147 #pragma warning( default:4251 )