VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtContextTreeWidget.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2009 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtContextTreeWidget.h,v $ $Revision: 1.12 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #ifndef DtContextTreeWidget_H_
14 #define DtContextTreeWidget_H_
15 
16 #include <vrvCoreQt/vrvCoreQt.h>
17 #include <vrvUtil/signalslib.h>
18 
19 #include <QtGui/QTreeWidget>
20 
21 class QMenu;
22 class QMouseEvent;
23 class QPoint;
24 class QPushButton;
25 class QIcon;
26 
27 namespace makVrv
28 {
33  {
34  Q_OBJECT
35 
36  public:
38  {
39  public:
41  : myButton(0)
42  , myReceiver(0)
43  , mySlot(0)
44  {
45  }
46 
49  const char* mySlot;
50  QString myTitle;
51  };
52 
53  typedef std::vector<ContextMenuItem> DtContextMenuItems;
54 
55  public:
56  DtContextTreeWidget(QWidget* parent = 0);
57 
58  virtual ~DtContextTreeWidget();
59 
60  public:
61  // \brief Will add a context menu item for the specified button when creating the
66  virtual void addContextItem(QPushButton* b, QObject* receiver, const char* slot);
67  virtual void addContextItem(QPushButton* b, const QString& title, QObject* receiver, const char* slot);
68 
71  virtual void addContextItem(const QString& item, QObject* receiver, const char* slot,
72  const QIcon& icon = QIcon());
73 
75  virtual void addContextSeparator();
76 
79  const DtContextMenuItems& menuItems() const;
80  virtual void setMenuItems(const DtContextMenuItems&);
81 
84  virtual void removeMenuItem(const QString&);
85 
87  virtual void removeSeparator(int at = 1);
88 
89  bool rightClick() const
90  {
91  return myRightClick;
92  }
93 
94  public:
97  boost::signal<void (DtContextTreeWidget*, QMenu*)> signal_contextMenuAboutToBeShown;
98 
99  protected slots:
100  virtual void onButtonDestroyed();
101 
102  protected:
105  virtual void processContextMenu(const QPoint&);
106 
108  virtual void mousePressEvent(QMouseEvent* mouseEvent);
109 
111  virtual void mouseReleaseEvent(QMouseEvent* mouseEvent);
112 
114  virtual void deleteIfOwned(const ContextMenuItem&);
115 
116  protected:
119  };
120 }
121 
122 #endif

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)