]> SALOME platform Git repositories - modules/gui.git/blob - src/Qtx/QtxWorkstackAction.h
Salome HOME
aaa61b7863f9554e93faa927fc5444939ca80112
[modules/gui.git] / src / Qtx / QtxWorkstackAction.h
1 //  Copyright (C) 2007-2008  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.
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 // File:      QtxWorkstackAction.h
23 // Author:    Sergey TELKOV
24 //
25 #ifndef QTXWORKSTACKACTION_H
26 #define QTXWORKSTACKACTION_H
27
28 #include "QtxActionSet.h"
29
30 class QtxWorkstack;
31
32 #ifdef WIN32
33 #pragma warning( disable:4251 )
34 #endif
35
36 class QTX_EXPORT QtxWorkstackAction : public QtxActionSet
37 {
38   Q_OBJECT
39
40 public:
41   //! Actions (menu items) ID
42   enum { SplitVertical   = 0x0001,   //!< "Split window vertically" operation
43          SplitHorizontal = 0x0002,   //!< "Split window horizontally" operation
44          Windows         = 0x0010,   //!< A list of child windows menu items
45          Split           = SplitVertical | SplitHorizontal,
46          Standard        = Split | Windows };
47
48   QtxWorkstackAction( QtxWorkstack*, QObject* = 0 );
49   virtual ~QtxWorkstackAction();
50
51   QtxWorkstack* workstack() const;
52
53   int           menuActions() const;
54   void          setMenuActions( const int );
55
56   QIcon         icon( const int ) const;
57   QString       text( const int ) const;
58   int           accel( const int ) const;
59   QString       statusTip( const int ) const;
60
61   void          setAccel( const int, const int );
62   void          setIcon( const int, const QIcon& );
63   void          setText( const int, const QString& );
64   void          setStatusTip( const int, const QString& );
65
66   void          perform( const int );
67
68 private slots:
69   void          onAboutToShow();
70   void          onTriggered( int );
71
72 protected:
73   virtual void  addedTo( QWidget* );
74   virtual void  removedFrom( QWidget* );
75
76 private:
77   void          updateContent();
78   void          updateWindows();
79   void          splitVertical();
80   void          splitHorizontal();
81   void          activateItem( const int );
82
83 private:
84   QtxWorkstack* myWorkstack;       //!< parent workstack
85   bool          myWindowsFlag;     //!< "show child windows items" flag
86 };
87
88 #ifdef WIN32
89 #pragma warning( default:4251 )
90 #endif
91
92 #endif