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

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