Salome HOME
*** empty log message ***
[modules/gui.git] / src / Qtx / QtxWorkstackAction.h
1 // File:      QtxWorkstackAction.h
2 // Author:    Sergey TELKOV
3
4 #ifndef QTXWORKSTACKACTION_H
5 #define QTXWORKSTACKACTION_H
6
7 #include "QtxAction.h"
8
9 class QtxWorkstack;
10
11 #ifdef WIN32
12 #pragma warning( disable:4251 )
13 #endif
14
15 class QTX_EXPORT QtxWorkstackAction : public QtxAction
16 {
17   Q_OBJECT
18
19 public:
20   enum { VSplit     = 0x0001,
21          HSplit     = 0x0002,
22          Windows    = 0x0010,
23          Split      = VSplit | HSplit,
24          Standard   = Split | Windows };
25
26 public:
27   QtxWorkstackAction( QtxWorkstack*, QObject* = 0, const char* = 0 );
28   virtual ~QtxWorkstackAction();
29
30   QtxWorkstack* workstack() const;
31
32   int           items() const;
33   void          setItems( const int );
34   bool          hasItems( const int ) const;
35
36   int           accel( const int ) const;
37   QIconSet      iconSet( const int ) const;
38   QString       menuText( const int ) const;
39   QString       statusTip( const int ) const;
40
41   void          setAccel( const int, const int );
42   void          setIconSet( const int, const QIconSet& );
43   void          setMenuText( const int, const QString& );
44   void          setStatusTip( const int, const QString& );
45
46   virtual bool  addTo( QWidget* );
47   virtual bool  addTo( QWidget*, const int );
48   virtual bool  removeFrom( QWidget* );
49
50   void          perform( const int );
51
52 private slots:
53   void          onAboutToShow();
54   void          onItemActivated( int );
55   void          onPopupDestroyed( QObject* );
56
57 private:
58   void          checkPopup( QPopupMenu* );
59   void          updatePopup( QPopupMenu* );
60
61   int           clearPopup( QPopupMenu* );
62   void          fillPopup( QPopupMenu*, const int );
63
64 private:
65   typedef QMap<QPopupMenu*, QIntList> MenuMap;
66   typedef QMap<int, QtxAction*>       ItemMap;
67
68 private:
69   MenuMap       myMenu;
70   ItemMap       myItem;
71   int           myFlags;
72   QtxWorkstack* myWorkstack;
73 };
74
75 #ifdef WIN32
76 #pragma warning( default:4251 )
77 #endif
78
79 #endif