File: grwidget.h

package info (click to toggle)
gr-framework 0.73.14%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,600 kB
  • sloc: ansic: 87,413; cpp: 45,348; objc: 3,057; javascript: 2,647; makefile: 1,129; python: 1,000; sh: 991; yacc: 855; pascal: 554; fortran: 228
file content (62 lines) | stat: -rw-r--r-- 1,242 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _GRWIDGET_H_
#define _GRWIDGET_H_

#include <QWidget>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
#include <QRubberBand>
#include <QPoint>

#ifdef _WIN32
#ifdef COMPILING_DLL
#define DLL __declspec(dllexport)
#else
#define DLL __declspec(dllimport)
#endif
#else
#define DLL
#endif


// ##################### Base GRWidget #########################################

class DLL GRWidget : public QWidget
{
public:
  GRWidget(QWidget *parent = 0);

protected:
  void paintEvent(QPaintEvent *event);
  virtual void clear_background(QPainter &painter);
  virtual void draw() = 0;

private:
  void init_gks();
};


// ##################### Interactive GRWidget ##################################

class DLL InteractiveGRWidget : public GRWidget
{
public:
  InteractiveGRWidget(QWidget *parent = 0);

protected:
  void paintEvent(QPaintEvent *event);
  void mouseMoveEvent(QMouseEvent *event);
  void mousePressEvent(QMouseEvent *event);
  void mouseReleaseEvent(QMouseEvent *event);
  void wheelEvent(QWheelEvent *event);
  void keyPressEvent(QKeyEvent *event);

private:
  void set_xform(void);
  QRubberBand *rubberBand;
  QPoint drag_start;
  QRect zoom_rect;
};

#undef DLL
#endif /* ifndef GRWIDGET_H_INCLUDED */