Salome HOME
Second integration of PV3D viewer:
[modules/gui.git] / src / Qtx / QtxWorkstackAction.h
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 // File:      QtxWorkstackAction.h
24 // Author:    Sergey TELKOV
25 //
26 #ifndef QTXWORKSTACKACTION_H
27 #define QTXWORKSTACKACTION_H
28
29 #include "QtxActionSet.h"
30 #include <QDialog>
31
32 class QtxWorkstack;
33 class QRadioButton;
34 class QStackedLayout;
35 class QListWidget;
36 class QComboBox;
37 class QLabel;
38 class QToolButton;
39
40 #ifdef WIN32
41 #pragma warning( disable:4251 )
42 #endif
43
44 class QTX_EXPORT QtxWorkstackAction : public QtxActionSet
45 {
46   Q_OBJECT
47
48 public:
49   //! Actions (menu items) ID
50   enum { SplitVertical   = 0x0001,   //!< "Split window vertically" operation
51          SplitHorizontal = 0x0002,   //!< "Split window horizontally" operation
52          Windows         = 0x0010,   //!< A list of child windows menu items
53          Split           = SplitVertical | SplitHorizontal,
54          Standard        = Split | Windows };
55
56   QtxWorkstackAction( QtxWorkstack*, QObject* = 0 );
57   virtual ~QtxWorkstackAction();
58
59   QtxWorkstack* workstack() const;
60   QAction*      getArrangeViewsAction();
61
62   int           menuActions() const;
63   void          setMenuActions( const int );
64
65   QIcon         icon( const int ) const;
66   QString       text( const int ) const;
67   int           accel( const int ) const;
68   QString       statusTip( const int ) const;
69
70   void          setIcon( const int, const QIcon& );
71   void          setText( const int, const QString& );
72   void          setStatusTip( const int, const QString& );
73
74   void          perform( const int );
75
76 private slots:
77   void          onAboutToShow();
78   void          onTriggered( int );
79
80 protected:
81   virtual void  addedTo( QWidget* );
82   virtual void  removedFrom( QWidget* );
83
84 private:
85   void          updateContent();
86   void          updateWindows();
87   void          splitVertical();
88   void          splitHorizontal();
89   void          activateItem( const int );
90
91 private:
92   QtxWorkstack* myWorkstack;       //!< parent workstack
93   bool          myWindowsFlag;     //!< "show child windows items" flag
94   QAction*      myArrangeViewsAction;
95 };
96
97 enum QtxSplitDlgMode{ ArrangeViews, CreateSubViews };
98
99 class QTX_EXPORT QtxSplitDlg : public QDialog
100 {
101   Q_OBJECT
102
103   enum ViewMode{ XYZ, XY, XZ, YZ };
104
105 public:
106   QtxSplitDlg( QWidget* = 0, QtxWorkstack* = NULL, QtxSplitDlgMode = ArrangeViews );
107   ~QtxSplitDlg();
108   int getSplitMode();
109   QList<int> getViewsMode();
110
111 private :
112   QToolButton* createSplitButton( int, int );
113   void initialize();
114   void valid();
115
116   QStackedLayout* myStackedSplitLayout;
117   QRadioButton* myButton2Views;
118   QRadioButton* myButton3Views;
119   QRadioButton* myButton4Views;
120   QPushButton* myButtonApply;
121   QPushButton* myButtonPrevious;
122   QPushButton* myButtonNext;
123   QList<QLabel*> myLabels;
124   QList<QComboBox*> myComboBox;
125   QListWidget* myViewsList;
126
127   QtxWorkstack* myWorkstack;
128   QtxSplitDlgMode myDlgMode;
129
130   int myViewsNB;
131   int mySplitMode;
132   int myNBSelectedViews;
133   bool myIsCloseViews;
134   QMap<QComboBox*, ViewMode> myMapComboBoxMode;
135   QMap<ViewMode, bool> myMapModeIsBusy;
136
137 private slots:
138
139   void onChangeIcons();
140   void onSplitChanged(int);
141   void onComboBoxChanged(int);
142   void onPreviousViews();
143   void onNextViews();
144   void onSynchronize();
145   void onCloseViews();
146   void onStackViews();
147   void onApply();
148 };
149
150 #ifdef WIN32
151 #pragma warning( default:4251 )
152 #endif
153
154 #endif