Salome HOME
Updated copyright comment
[modules/gui.git] / src / Qtx / QtxMenu.h
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File:      QtxMenu.h
21 // Author:    Sergey TELKOV
22 //
23 #ifndef QTXMENU_H
24 #define QTXMENU_H
25
26 #include "Qtx.h"
27
28 #include <QMenu>
29
30 class QWidgetAction;
31
32 class QTX_EXPORT QtxMenu : public QMenu
33 {
34   Q_OBJECT
35
36   class Title;
37
38 public:
39   //! Popup menu title mode
40   typedef enum { 
41     TitleAuto,        //!< auto mode
42     TitleOn,          //!< always on (display title)
43     TitleOff          //!< always off (do not display title)
44   } TitleMode;
45
46 public:
47   QtxMenu( QWidget* = 0 );
48   virtual ~QtxMenu();
49
50   QIcon                  titleIcon() const;
51   QString                titleText() const;
52
53   TitleMode              titleMode() const;
54   Qt::Alignment          titleAlignment() const;
55
56   virtual void           setTitleIcon( const QIcon& );
57   virtual void           setTitleText( const QString& );
58
59   virtual void           setTitleMode( const TitleMode );
60   virtual void           setTitleAlignment( const Qt::Alignment );
61
62   virtual void           addGroup( const QString& );
63   virtual void           addGroup( const QIcon&, const QString& );
64
65 public slots:
66   virtual void           setVisible( bool );
67
68 private:
69   void                   updateTitle();
70   void                   insertTitle();
71   void                   removeTitle();
72
73 private:
74   TitleMode              myMode;
75   Title*                 myTitle;
76   QWidgetAction*         myAction;
77 };
78
79 #endif // QTXMENU_H