1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
33 #include <qvaluelist.h>
34 #include <qpopupmenu.h>
36 /****************************************************************************
38 ** Interface QAD_PopupServer: must be implemented by a class which is going
39 ** to be a popup server for clients i.e. be able to create a popup menu
41 *****************************************************************************/
42 class QAD_EXPORT QAD_PopupServer
46 virtual ~QAD_PopupServer();
49 virtual QPopupMenu* createPopup();
50 virtual void destroyPopup();
51 void enablePopup( bool );
54 virtual void onCreatePopup () = 0; /* addition of menu items goes here */
57 QPopupMenu* myPopup; /* resulting popup menu */
58 bool myEnablePopup; /* enable/disable popup creation */
61 /****************************************************************************
63 ** Class QAD_PopupClient: must be inherited by a class which is going
64 ** to be a popup client i.e. be able to show its server's popup menu
66 *****************************************************************************/
67 class QAD_EXPORT QAD_PopupClient
71 virtual ~QAD_PopupClient();
74 void setPopupServer ( QAD_PopupServer* );
75 QAD_PopupServer* getPopupServer () const;
78 QAD_PopupServer* myPopupServer;
81 /****************************************************************************
83 ** Class QAD_PopupClientServer: both client and server. Can be used as
84 ** a server only or as a client only ( if server is not set ).
86 *****************************************************************************/
87 class QAD_EXPORT QAD_PopupClientServer : public QAD_PopupClient,
88 public QAD_PopupServer
91 QAD_PopupClientServer( bool separateItems = true, bool smartSeparator = true );
92 ~QAD_PopupClientServer();
95 QPopupMenu* createPopup();
99 QValueList<int> myIDs; // ids of the items added by myself as a server
100 bool myOnlyServer; // true if I`m fully responsible for the menu
101 bool mySeparateItems; // to insert separator before my items
102 bool mySmartSeparator; // if true then separator is inserted after own items,
103 // not at the end of menu