OpendTect  6.3
uigraphicsviewbase.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Satyaki Maitra
8  Date: March 2009
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "uibasemod.h"
14 #include "uiobj.h"
15 
16 namespace OD { class Alignment; }
17 class uiGraphicsItem;
18 class uiGraphicsScene;
19 class uiGraphicsViewBody;
22 class MouseEventHandler;
23 class uiRect;
24 
25 
27 {
28 friend class uiGraphicsViewBody;
29 public:
30  uiGraphicsViewBase(uiParent*,const char*);
32 
33  void setScene(uiGraphicsScene&);
35  uiGraphicsScene& scene();
36  const uiGraphicsScene& scene() const;
37  void show();
38  enum ODDragMode { NoDrag, ScrollHandDrag, RubberBandDrag };
39  enum ScrollBarPolicy { ScrollBarAsNeeded, ScrollBarAlwaysOff,
40  ScrollBarAlwaysOn };
41 
42  void setScrollBarPolicy(bool hor,ScrollBarPolicy);
43  void setDragMode(ODDragMode);
44  ODDragMode dragMode() const;
45  bool isRubberBandingOn() const;
46 
47  void setMouseTracking(bool);
48  bool hasMouseTracking() const;
49 
50  void setMouseWheelReversal(bool);
51  bool getMouseWheelReversal() const;
52 
53  void setMidMouseButtonForDrag(bool);
54  bool hasMidMouseButtonForDrag() const;
55 
56  int width() const;
57  int height() const;
58  int viewWidth() const;
59  int viewHeight() const;
60 
61  void setViewSize(int width,int height);
62  void setViewWidth(int);
63  void setViewHeight(int);
64 
65  int getSceneBorder() const;
66  void setSceneBorder(int);
67 
68  void centreOn(uiPoint);
69  uiRect getSceneRect() const;
70  void setSceneRect(const uiRect&);
71  void setSceneAlignment(const OD::Alignment&);
72  void setScaleFactor(float,float);
73 
74  uiPoint getCursorPos() const;
75  void getScaleFactor(float&,float&) const;
76  uiPoint getScenePos(float,float) const;
77  const uiPoint& getStartPos() const;
78  const uiRect* getSelectedArea() const {return selectedarea_;}
79  void setViewArea(double x,double y,
80  double w,double h);
81  uiRect getViewArea() const;
82 
83  void setBackgroundColor(const Color&);
84  Color backgroundColor() const;
85  void setNoBackGround();
86  void rePaint();
87  void enableScrollZoom(bool yn=true);
88  void disableScrollZoom();
90  { return enabscrollzoom_; }
91  uiSize scrollBarSize(bool horizontal) const;
92 
93  const uiPoint mapFromScene(const Geom::Point2D<float>&) const;
94  const Geom::Point2D<float> mapToScene(const uiPoint&) const;
95 
96  bool isCtrlPressed() const {return isctrlpressed_;}
97  void setCtrlPressed( bool yn )
98  { isctrlpressed_ = yn; }
99 
100  bool print();
101 
102  MouseEventHandler& getNavigationMouseEventHandler();
107  MouseEventHandler& getMouseEventHandler();
108  KeyboardEventHandler& getKeyboardEventHandler();
109  GestureEventHandler& gestureEventHandler();
110 
111 
121 
122 
123  static const ObjectSet<uiGraphicsViewBase>& allInstances();
124 
125 protected:
126 
127  void translateText();
128 
129  uiGraphicsViewBody* body_;
130  uiGraphicsViewBody& mkbody(uiParent*,const char*);
131 
135 
138  void rubberBandCB(CallBacker*);
139 
140 };
CNotifier< uiGraphicsViewBase, uiSize > reSize
CallBacker is OLD size.
Definition: uigraphicsviewbase.h:112
Handles gesture event and triggers notifier with GestureEventInfo.
Definition: mouseevent.h:279
#define mExpClass(module)
Definition: commondefs.h:157
ODDragMode
Definition: uigraphicsviewbase.h:38
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
Notifier< uiGraphicsViewBase > scrollBarUsed
Definition: uigraphicsviewbase.h:118
Definition: uigraphicsviewbase.h:38
Definition: uigeom.h:40
bool enabscrollzoom_
Definition: uigraphicsviewbase.h:137
Notifier< uiGraphicsViewBase > reDrawNeeded
Definition: uigraphicsviewbase.h:114
Definition: uigraphicsviewbase.h:26
Notifier< uiGraphicsViewBase > preDraw
Definition: uigraphicsviewbase.h:117
uiGraphicsScene * scene_
Definition: uigraphicsviewbase.h:133
The base class for most UI elements.
Definition: uiobj.h:35
uiRect * selectedarea_
Definition: uigraphicsviewbase.h:132
Definition: uiparent.h:24
Notifier< uiGraphicsViewBase > reDrawn
In practice, this happens only after reSize.
Definition: uigraphicsviewbase.h:115
Definition: uigeom.h:23
Notifier< uiObject > pointerLeft
Definition: uigraphicsviewbase.h:120
bool isctrlpressed_
Definition: uigraphicsviewbase.h:136
Set of pointers to objects.
Definition: commontypes.h:28
Definition: draw.h:21
int sceneborder_
Definition: uigraphicsviewbase.h:134
Notifier< uiGraphicsViewBase > rubberBandUsed
Definition: uigraphicsviewbase.h:113
uiGraphicsViewBody * body_
Definition: uigraphicsviewbase.h:129
Definition: mouseevent.h:166
ScrollBarPolicy
Definition: uigraphicsviewbase.h:39
Notifier< uiObject > pointerEntered
Definition: uigraphicsviewbase.h:119
Handles KeyboardEvent.
Definition: keyboardevent.h:44
OpendTect.
Definition: commontypes.h:25
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:24
const uiRect * getSelectedArea() const
Definition: uigraphicsviewbase.h:78
bool scrollZoomEnabled()
Definition: uigraphicsviewbase.h:89
bool isCtrlPressed() const
Definition: uigraphicsviewbase.h:96
void setCtrlPressed(bool yn)
Definition: uigraphicsviewbase.h:97
Definition: uigraphicsscene.h:35

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2017