]> SALOME platform Git repositories - modules/gui.git/blob - src/SUIT/SUIT_ViewManager.h
Salome HOME
Update comments
[modules/gui.git] / src / SUIT / SUIT_ViewManager.h
1 #ifndef SUIT_VIEWMANAGER_H
2 #define SUIT_VIEWMANAGER_H
3
4 #include "SUIT.h"
5 #include "SUIT_ViewWindow.h"
6 #include "SUIT_PopupClient.h"
7
8 #include <qobject.h>
9 #include <qptrvector.h>
10
11 class SUIT_Study;
12 class SUIT_Desktop;
13 class SUIT_ViewModel;
14
15 class QPopupMenu;
16
17 #ifdef WIN32
18 #pragma warning( disable:4251 )
19 #endif
20
21 class SUIT_EXPORT SUIT_ViewManager : public QObject, public SUIT_PopupClient
22 {
23   Q_OBJECT
24 public:
25   SUIT_ViewManager( SUIT_Study*,
26                     SUIT_Desktop*,
27                     SUIT_ViewModel* = 0 );
28   virtual ~SUIT_ViewManager();
29
30   virtual QString  popupClientType() const { return getType(); }
31   virtual void     contextMenuPopup( QPopupMenu* );
32   
33   void             setViewModel(SUIT_ViewModel* theViewModel);
34   SUIT_ViewModel*  getViewModel() { return myViewModel; }
35   
36   SUIT_Study*      study() const;
37
38   QString          getType() const; 
39   SUIT_ViewWindow* getActiveView() { return myActiveView; }
40   
41   int              getViewsCount() { return myViews.count(); }
42   QPtrVector<SUIT_ViewWindow> getViews() { return myViews; }  
43
44   QString          getTitle() const { return myTitle;}
45   void             setTitle(QString theTitle) { myTitle = theTitle; }
46
47   /*! Creates View, adds it into list of views and returns just created view window*/
48   SUIT_ViewWindow* createViewWindow();
49
50 public slots:
51   void             createView();
52   void             closeAllViews();
53   
54 signals:
55   void             lastViewClosed(SUIT_ViewManager*);
56   void             deleteView(SUIT_ViewWindow*);
57   void             viewCreated(SUIT_ViewWindow*);
58   void             mousePress(SUIT_ViewWindow*, QMouseEvent*);
59   void             mouseRelease(SUIT_ViewWindow*, QMouseEvent*);
60   void             mouseDoubleClick(SUIT_ViewWindow*, QMouseEvent*);
61   void             mouseMove(SUIT_ViewWindow*, QMouseEvent*);
62   void             wheel(SUIT_ViewWindow*, QWheelEvent*);
63   void             keyPress(SUIT_ViewWindow*, QKeyEvent*);
64   void             keyRelease(SUIT_ViewWindow*, QKeyEvent*);
65   void             activated(SUIT_ViewManager*);
66   
67 protected slots:
68   void             onWindowActivated(SUIT_ViewWindow*);
69   void             onDeleteView(SUIT_ViewWindow* theView);
70   void             onMousePressed(SUIT_ViewWindow* theView, QMouseEvent* theEvent);
71   void             onDeleteStudy();
72
73 private slots:
74   void             onContextMenuRequested( QContextMenuEvent* e );
75   
76 protected:
77   /*! Inserts the View into internal Views Vector.\n
78    *  Returns true if view has been added successfully
79    */
80   virtual bool     insertView(SUIT_ViewWindow* theView);
81   
82   /*! Removes the View from internal Views Vector.*/
83   virtual void     removeView(SUIT_ViewWindow* theView);
84   
85   /*! Used to set unique name for the view.*/
86   virtual void     setViewName(SUIT_ViewWindow* theView);
87
88 protected:
89   SUIT_Desktop*               myDesktop;
90   SUIT_ViewModel*             myViewModel;
91   QPtrVector<SUIT_ViewWindow> myViews;
92   SUIT_ViewWindow*            myActiveView;
93
94   QString                     myTitle;
95   SUIT_Study*                 myStudy;
96 };
97
98 #ifdef WIN32
99 #pragma warning( default:4251 )
100 #endif
101
102 #endif