1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "SUIT_PopupClient.h"
23 /*! constructor. initialize mySignal.*/
24 SUIT_PopupClient::SUIT_PopupClient()
29 /*! destructor. delete mySignal*/
30 SUIT_PopupClient::~SUIT_PopupClient()
36 Connect popup request.
38 bool SUIT_PopupClient::connectPopupRequest( QObject* reciever, const char* slot )
40 if ( !reciever || !slot )
43 mySignal = new Signal();
44 return QObject::connect( mySignal, SIGNAL( contextMenuRequest( SUIT_PopupClient*, QContextMenuEvent* ) ),
49 Disconnect popup request.
51 bool SUIT_PopupClient::disconnectPopupRequest( QObject* reciever, const char* slot )
53 if ( !reciever || !slot || !mySignal )
55 return QObject::disconnect( mySignal, SIGNAL( contextMenuRequest( SUIT_PopupClient*, QContextMenuEvent* ) ),
60 Send signal on context menu request.
62 void SUIT_PopupClient::contextMenuRequest( QContextMenuEvent* e )
65 mySignal->sendSignal( this, e );
69 * \class SUIT_PopupClient::Signal
70 * Descr: invoke signal which is connected to reciever in SUIT_PopupClient
74 SUIT_PopupClient::Signal::Signal()
79 /*! destructor. do nothing*/
80 SUIT_PopupClient::Signal::~Signal()
83 /*! Send signal to \a client on context menu request \a e.
85 void SUIT_PopupClient::Signal::sendSignal( SUIT_PopupClient* client, QContextMenuEvent* e )
87 emit contextMenuRequest( client, e );