OpenStructure
overlay_base.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 // Copyright (C) 2003-2010 by the IPLT authors
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the Free
9 // Software Foundation; either version 3.0 of the License, or (at your option)
10 // any later version.
11 // This library is distributed in the hope that it will be useful, but WITHOUT
12 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 // details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with this library; if not, write to the Free Software Foundation, Inc.,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //------------------------------------------------------------------------------
20 
21 /*
22  Authors: Ansgar Philippsen, Andreas Schenk
23 */
24 
25 #ifndef IMG_GUI_OVERLAY_BASE_H
26 #define IMG_GUI_OVERLAY_BASE_H
27 
28 
29 #include <ost/base.hh>
30 
31 #include <ost/gui/module_config.hh>
32 #include "overlay_base_fw.hh"
33 
34 #include <QObject>
35 #include <QEvent>
36 #include <QPainter>
37 #include <QMenu>
38 #include <QMouseEvent>
39 #include <QKeyEvent>
40 namespace ost { namespace img { namespace gui {
41 
42 // fw decl
43 class DataViewerPanel;
44 
45 // overlay base class
46 class DLLEXPORT_OST_GUI Overlay: public QObject
47 {
48  Q_OBJECT;
49 
50 public:
52  Overlay(const String& name);
53 
55  void SetName (const String& name);
56 
58  String GetName() const;
59 
61 
66  virtual void OnDraw(QPainter& pnt, DataViewerPanel* dvp, bool is_active);
67 
69 
75  virtual bool OnMouseEvent(QMouseEvent* e, DataViewerPanel* dvp,
76  const QPoint& lastmouse);
77 
79 
82  virtual bool OnKeyEvent(QKeyEvent* e, DataViewerPanel* dvp);
83 
85  /*
86  this menu will be available in the viewer, under the name of
87  the overlay. if this method returns zero (the default), then
88  the viewer will ignore this menu
89  */
90  virtual QMenu* GetMenu();
91 
92  virtual void OnMenuEvent(QAction* e);
93 
94 public slots:
95  void OnMenuEventSlot(QAction* e);
96 
97 signals:
99  void InfoTextChanged(const QString& t);
100 
101 private:
102  String name_;
103 
104  Overlay(const Overlay&) {}
105  Overlay& operator=(const Overlay&) {return *this;}
106 };
107 
108 }}} //ns
109 
110 #endif
Overlay(const String &name)
initialization requires name
virtual QMenu * GetMenu()
return overlay specific pulldown menu
String GetName() const
retrieve name
virtual bool OnMouseEvent(QMouseEvent *e, DataViewerPanel *dvp, const QPoint &lastmouse)
mouse event handler
virtual bool OnKeyEvent(QKeyEvent *e, DataViewerPanel *dvp)
key event handler
virtual void OnMenuEvent(QAction *e)
void InfoTextChanged(const QString &t)
void SetName(const String &name)
set name
void OnMenuEventSlot(QAction *e)
virtual void OnDraw(QPainter &pnt, DataViewerPanel *dvp, bool is_active)
call when redrawing is necessary
#define DLLEXPORT_OST_GUI
std::string String
Definition: base.hh:54
Definition: base.dox:1