Salome HOME
dceef6963b1e55cc7ec2b7483fafa7f91aa2251f
[modules/gui.git] / src / Qtx / QtxWorkspaceAction.h
1 // Copyright (C) 2007-2023  CEA/DEN, EDF R&D, 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:      QtxWorkspaceAction.h
24 // Author:    Sergey TELKOV
25 //
26 #ifndef QTXWORKSPACEACTION_H
27 #define QTXWORKSPACEACTION_H
28
29 #include "QtxActionSet.h"
30
31 class QtxWorkspace;
32
33 #ifdef WIN32
34 #pragma warning( disable:4251 )
35 #endif
36
37 class QTX_EXPORT QtxWorkspaceAction : public QtxActionSet
38 {
39   Q_OBJECT
40
41 public:
42   //! Actions (menu items) ID
43   enum { Cascade    = 0x0001,   //!< "Cascade child windows" operation
44          Tile       = 0x0002,   //!< "Tile child windows" operation
45          VTile      = 0x0004,   //!< "Tile child windows vertically" operation
46          HTile      = 0x0008,   //!< "Tile child windows horizontally" operation
47          Windows    = 0x0010,   //!< A list of child windows menu items
48          Standard   = Cascade | Tile | Windows,
49          Operations = Cascade | Tile | VTile | HTile,
50          All        = Standard | HTile | VTile };
51
52 public:
53   QtxWorkspaceAction( QtxWorkspace*, QObject* = 0 );
54   virtual ~QtxWorkspaceAction();
55
56   QtxWorkspace* workspace() const;
57
58   int           menuActions() const;
59   void          setMenuActions( const int );
60
61   QIcon         icon( const int ) const;
62   QString       text( const int ) const;
63   int           accel( const int ) const;
64   QString       statusTip( const int ) const;
65
66   void          setAccel( const int, const int );
67   void          setIcon( const int, const QIcon& );
68   void          setText( const int, const QString& );
69   void          setStatusTip( const int, const QString& );
70
71   void          perform( const int );
72
73 public slots:
74   void          tile();
75   void          cascade();
76   void          tileVertical();
77   void          tileHorizontal();
78
79 private slots:
80   void          onAboutToShow();
81   void          onTriggered( int );
82
83 protected:
84   virtual void  addedTo( QWidget* );
85   virtual void  removedFrom( QWidget* );
86
87 private:
88   void          updateContent();
89   void          updateWindows();
90   void          activateItem( const int );
91
92 private:
93   QtxWorkspace* myWorkspace;       //!< parent workspace
94   bool          myWindowsFlag;     //!< "show child windows items" flag
95 };
96
97 #ifdef WIN32
98 #pragma warning( default:4251 )
99 #endif
100
101 #endif