Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGView.h
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 30/6/2000
3
4/*************************************************************************
5 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TGView
13#define ROOT_TGView
14
15
16#include "TGFrame.h"
17#include "TGWidget.h"
18
19class TGViewFrame;
20class TGHScrollBar;
21class TGVScrollBar;
22
23class TGView : public TGCompositeFrame, public TGWidget {
24
25friend class TGViewFrame;
26
27public:
28 enum { kNoHSB = BIT(0), kNoVSB = BIT(1) };
29 enum { kHorizontal = 0, kVertical = 1 };
30
31protected:
32 TGLongPosition fVisible; ///< position of visible region
33 TGLongPosition fMousePos; ///< position of mouse
34 TGLongPosition fScrollVal; ///< scroll value
35 TGDimension fVirtualSize; ///< the current virtual window size
36 TGRectangle fExposedRegion;///< exposed area
37
38 Int_t fScrolling; ///< scrolling direction
39 Atom_t fClipboard; ///< clipboard property
40 UInt_t fXMargin; ///< x margin
41 UInt_t fYMargin; ///< y margin
42 TGViewFrame *fCanvas; ///< frame containing the text
43 TGHScrollBar *fHsb; ///< horizontal scrollbar
44 TGVScrollBar *fVsb; ///< vertical scrollbar
45
46 TGGC fWhiteGC; ///< graphics context used for scrolling
47 ///< generates GraphicsExposure events
48
49 virtual void DoRedraw();
50 virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
51 virtual Bool_t ItemLayout() { return kFALSE; }
52
53private:
54 TGView(const TGView&) = delete;
55 TGView& operator=(const TGView&) = delete;
56
57public:
58 TGView(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1, Int_t id = -1,
59 UInt_t xMargin = 0, UInt_t yMargin = 0,
61 UInt_t sboptions = 0,
62 Pixel_t back = GetWhitePixel());
63
64 virtual ~TGView();
65
66 TGViewFrame *GetCanvas() const { return fCanvas; }
67
68 virtual void Clear(Option_t * = "");
69 virtual void SetVisibleStart(Int_t newTop, Int_t direction);
70 virtual void ScrollCanvas(Int_t newTop, Int_t direction);
71 virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2);
72 virtual void DrawBorder();
73 virtual void Layout();
75 virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height);
76
77 virtual void ScrollToPosition(TGLongPosition newPos);
78 void ScrollUp(Int_t pixels)
80 void ScrollDown(Int_t pixels)
82 void ScrollLeft(Int_t pixels)
84 void ScrollRight(Int_t pixels)
86
87 virtual TGDimension GetDefaultSize() const { return TGDimension(fWidth, fHeight); }
91
92 TGLongPosition ToVirtual(TGLongPosition coord) const { return coord + fVisible; }
93 TGLongPosition ToPhysical(TGLongPosition coord) const { return coord - fVisible; }
94
97
98 virtual void ChangeBackground(Pixel_t);
99 virtual void SetBackgroundColor(Pixel_t);
100 virtual void SetBackgroundPixmap(Pixmap_t p);
101 virtual void UpdateBackgroundStart();
102
103 const TGGC &GetViewWhiteGC() { return fWhiteGC; }
104
105 ClassDef(TGView,0) // View widget base class
106};
107
108
110private:
111 TGView *fView; // pointer back to the view
112
113 TGViewFrame(const TGViewFrame&) = delete;
115
116public:
117 TGViewFrame(TGView *v, UInt_t w, UInt_t h, UInt_t options = 0,
118 Pixel_t back = GetWhitePixel());
119
123 { return fView->HandleSelectionClear(event); }
125 { return fView->HandleSelection(event); }
127 { return fView->HandleButton(event); }
129 { return fView->HandleExpose(event); }
131 { return fView->HandleCrossing(event); }
133 { return fView->HandleMotion(event); }
135 { return fView->HandleKey(event); }
137 { return fView->HandleDoubleClick(event); }
138
139 ClassDef(TGViewFrame,0) // Frame containing the actual text
140};
141
142
143
144#endif
Handle_t Pixmap_t
Pixmap handle.
Definition GuiTypes.h:30
@ kSunkenFrame
Definition GuiTypes.h:383
@ kDoubleBorder
Definition GuiTypes.h:385
Handle_t Atom_t
WM token.
Definition GuiTypes.h:37
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
#define h(i)
Definition RSha256.hxx:106
int Int_t
Definition RtypesCore.h:45
long Longptr_t
Definition RtypesCore.h:82
unsigned int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
#define BIT(n)
Definition Rtypes.h:85
include TDocParser_001 C image html pict1_TDocParser_001 png width
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual Bool_t HandleCrossing(Event_t *)
Definition TGFrame.h:326
virtual Bool_t HandleSelection(Event_t *)
Definition TGFrame.h:330
virtual Bool_t HandleDoubleClick(Event_t *)
Definition TGFrame.h:325
virtual Bool_t HandleMotion(Event_t *)
Definition TGFrame.h:327
virtual Bool_t HandleKey(Event_t *)
Definition TGFrame.h:328
virtual Bool_t HandleSelectionClear(Event_t *)
Definition TGFrame.h:170
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
UInt_t fHeight
frame height
Definition TGFrame.h:88
virtual Bool_t HandleSelectionRequest(Event_t *)
Definition TGFrame.h:169
UInt_t fWidth
frame width
Definition TGFrame.h:87
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
The TGHScrollBar will generate the following event messages: kC_HSCROLL, kSB_SLIDERPOS,...
Frame layout manager.
Definition TGLayout.h:135
Long_t fX
x position
Definition TGDimension.h:56
Long_t fY
y position
Definition TGDimension.h:57
The TGVScrollBar will generate the following event messages: kC_VSCROLL, kSB_SLIDERPOS,...
Bool_t HandleDoubleClick(Event_t *event)
Definition TGView.h:136
Bool_t HandleCrossing(Event_t *event)
Definition TGView.h:130
Bool_t HandleSelectionRequest(Event_t *event)
Definition TGView.h:120
Bool_t HandleSelection(Event_t *event)
Definition TGView.h:124
Bool_t HandleKey(Event_t *event)
Definition TGView.h:134
TGViewFrame & operator=(const TGViewFrame &)=delete
Bool_t HandleSelectionClear(Event_t *event)
Definition TGView.h:122
Bool_t HandleButton(Event_t *event)
Definition TGView.h:126
Bool_t HandleMotion(Event_t *event)
Definition TGView.h:132
TGViewFrame(const TGViewFrame &)=delete
Bool_t HandleExpose(Event_t *event)
Definition TGView.h:128
TGView * fView
Definition TGView.h:111
A TGView provides the infrastructure for text viewer and editor widgets.
Definition TGView.h:23
Atom_t fClipboard
clipboard property
Definition TGView.h:39
TGHScrollBar * fHsb
horizontal scrollbar
Definition TGView.h:43
virtual ~TGView()
Delete view.
Definition TGView.cxx:149
void ScrollLeft(Int_t pixels)
Definition TGView.h:82
virtual Bool_t ItemLayout()
Definition TGView.h:51
virtual Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2)
Process scrollbar messages.
Definition TGView.cxx:316
void ScrollRight(Int_t pixels)
Definition TGView.h:84
virtual Bool_t HandleButton(Event_t *event)
handle button
Definition TGView.cxx:237
@ kNoHSB
Definition TGView.h:28
@ kNoVSB
Definition TGView.h:28
TGDimension fVirtualSize
the current virtual window size
Definition TGView.h:35
TGVScrollBar * fVsb
vertical scrollbar
Definition TGView.h:44
const TGGC & GetViewWhiteGC()
Definition TGView.h:103
TGLongPosition ToPhysical(TGLongPosition coord) const
Definition TGView.h:93
virtual void Layout()
layout view
Definition TGView.cxx:346
TGLongPosition fMousePos
position of mouse
Definition TGView.h:33
void ScrollUp(Int_t pixels)
Definition TGView.h:78
TGLongPosition fVisible
position of visible region
Definition TGView.h:32
void ScrollDown(Int_t pixels)
Definition TGView.h:80
virtual TGDimension GetDefaultSize() const
std::cout << fWidth << "x" << fHeight << std::endl;
Definition TGView.h:87
virtual void UpdateBackgroundStart()
set some gc values
Definition TGView.cxx:228
TGLongPosition ToVirtual(TGLongPosition coord) const
Definition TGView.h:92
virtual void DrawBorder()
Draw the border of the text edit widget.
Definition TGView.cxx:428
@ kHorizontal
Definition TGView.h:29
@ kVertical
Definition TGView.h:29
TGView(const TGView &)=delete
TGViewFrame * GetCanvas() const
Definition TGView.h:66
UInt_t fXMargin
x margin
Definition TGView.h:40
virtual void SetVisibleStart(Int_t newTop, Int_t direction)
Scroll view in specified direction to make newTop the visible location.
Definition TGView.cxx:178
Int_t fScrolling
scrolling direction
Definition TGView.h:38
virtual void SetBackgroundColor(Pixel_t)
Set background color of the canvas frame.
Definition TGView.cxx:590
TGLongPosition GetScrollPosition() const
Definition TGView.h:90
TGLongPosition fScrollVal
scroll value
Definition TGView.h:34
virtual void SetLayoutManager(TGLayoutManager *)
Set the layout manager for the composite frame.
Definition TGView.h:74
TGViewFrame * fCanvas
frame containing the text
Definition TGView.h:42
virtual void ChangeBackground(Pixel_t)
Change background color of the canvas frame.
Definition TGView.cxx:579
virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
update a part of view
Definition TGView.cxx:204
virtual void ScrollCanvas(Int_t newTop, Int_t direction)
Scroll the canvas to new_top in the kVertical or kHorizontal direction.
Definition TGView.cxx:464
virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)
Draw region.
Definition TGView.cxx:196
virtual void DoRedraw()
redraw
Definition TGView.cxx:270
TGGC fWhiteGC
graphics context used for scrolling generates GraphicsExposure events
Definition TGView.h:46
virtual Bool_t HandleExpose(Event_t *event)
Handle expose events.
Definition TGView.cxx:284
virtual void ScrollToPosition(TGLongPosition newPos)
Scroll the canvas to pos.
Definition TGView.cxx:453
UInt_t fYMargin
y margin
Definition TGView.h:41
TGLongPosition GetScrollValue() const
Definition TGView.h:89
TGDimension GetVirtualSize() const
Definition TGView.h:88
TGView & operator=(const TGView &)=delete
virtual void Clear(Option_t *="")
Clear view.
Definition TGView.cxx:161
TGRectangle fExposedRegion
exposed area
Definition TGView.h:36
virtual void SetBackgroundPixmap(Pixmap_t p)
Set backgound pixmap.
Definition TGView.cxx:600
The widget base class.
Definition TGWidget.h:43
ROOT GUI Window base class.
Definition TGWindow.h:23
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
Event structure.
Definition GuiTypes.h:174