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