Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[modules/gui.git] / src / SUIT / SUIT_PopupClient.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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 #ifndef SUIT_POPUPCLIENT_H
20 #define SUIT_POPUPCLIENT_H
21
22 #include "SUIT.h"
23
24 #include <qobject.h>
25
26 class QPopupMenu;
27 class QContextMenuEvent;
28
29 /*!\class SUIT_PopupClient
30  * Descr: Base class for instances which creates popup menu on QContextMenuEvent
31  */
32 class SUIT_EXPORT SUIT_PopupClient
33 {
34 public:
35
36   class Signal;
37
38   SUIT_PopupClient();
39   ~SUIT_PopupClient();
40
41   bool            connectPopupRequest( QObject* reciever, const char* slot );
42   bool            disconnectPopupRequest( QObject* reciever, const char* slot );
43
44   virtual QString popupClientType() const = 0;
45   virtual void    contextMenuPopup( QPopupMenu* ) {}
46
47 protected:
48   void    contextMenuRequest( QContextMenuEvent* e );
49
50 private:
51   Signal* mySignal;
52 };
53
54 /*! Class: SUIT_PopupClient::Signal [internal] \n
55  *  Descr: invoke signal which is connected to reciever in SUIT_PopupClient
56  */
57 class SUIT_PopupClient::Signal : public QObject
58 {
59   Q_OBJECT
60
61 public:
62   Signal();
63   virtual ~Signal();
64
65   void    sendSignal( SUIT_PopupClient*, QContextMenuEvent* );
66
67 signals:
68   void contextMenuRequest( SUIT_PopupClient*, QContextMenuEvent* );
69 };
70
71 #endif