Logo ROOT  
Reference Guide
TGView.cxx
Go to the documentation of this file.
1// @(#)root/gui:$Id$
2// Author: Fons Rademakers 30/6/2000
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, 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
13 This source is based on Xclass95, a Win95-looking GUI toolkit.
14 Copyright (C) 1996, 1997 David Barth, Ricky Ralston, Hector Peraza.
15
16 Xclass95 is free software; you can redistribute it and/or
17 modify it under the terms of the GNU Library General Public
18 License as published by the Free Software Foundation; either
19 version 2 of the License, or (at your option) any later version.
20
21**************************************************************************/
22
23
24/** \class TGView
25 \ingroup guiwidgets
26
27A TGView provides the infrastructure for text viewer and editor
28widgets. It provides a canvas (TGViewFrame) and (optionally) a
29vertical and horizontal scrollbar and methods for marking and
30scrolling.
31
32The TGView (and derivatives) will generate the following
33event messages:
34
35 - kC_TEXTVIEW, kTXT_ISMARKED, widget id, [true|false]
36 - kC_TEXTVIEW, kTXT_DATACHANGE, widget id, 0
37 - kC_TEXTVIEW, kTXT_CLICK2, widget id, position (y << 16) | x)
38 - kC_TEXTVIEW, kTXT_CLICK3, widget id, position (y << 16) | x)
39 - kC_TEXTVIEW, kTXT_F3, widget id, true
40 - kC_TEXTVIEW, kTXT_OPEN, widget id, 0
41 - kC_TEXTVIEW, kTXT_CLOSE, widget id, 0
42 - kC_TEXTVIEW, kTXT_SAVE, widget id, 0
43
44*/
45
46
47#include "TGView.h"
48#include "TGScrollBar.h"
49#include "TGResourcePool.h"
50#include "TMath.h"
51#include "KeySymbols.h"
52#include "RConfigure.h"
53#include "TVirtualX.h"
54
56
57////////////////////////////////////////////////////////////////////////////////
58/// Create a editor frame.
59
61 Pixel_t back) :
62 TGCompositeFrame(v, w, h, options | kOwnBackground, back)
63{
64 fView = v;
65
67
71
74
77 wattr.fBitGravity = 1; // NorthWestGravity
78 wattr.fWinGravity = 1;
79 gVirtualX->ChangeWindowAttributes(fId, &wattr);
80
81 // guibuiding settings
83}
84
85
87
88////////////////////////////////////////////////////////////////////////////////
89/// Create an editor view, containing an TGEditorFrame and (optionally)
90/// a horizontal and vertical scrollbar.
91
93 UInt_t xMargin, UInt_t yMargin, UInt_t options,
94 UInt_t sboptions, Pixel_t back)
95 : TGCompositeFrame(p, w, h, options, GetDefaultFrameBackground())
96{
97 fWidgetId = id;
98 fMsgWindow = p;
100
101 fXMargin = xMargin;
102 fYMargin = yMargin;
103 fScrollVal.fX = 1;
104 fScrollVal.fY = 1;
106
108
109 fCanvas = new TGViewFrame(this, 10, 10, kChildFrame | kOwnBackground, back);
111
112 if (!(sboptions & kNoHSB)) {
113 fHsb = new TGHScrollBar(this, 10, 10, kChildFrame);
114 AddFrame(fHsb);
115 fHsb->Associate(this);
116 } else {
117 fHsb = 0;
118 }
119
120 if (!(sboptions & kNoVSB)) {
121 fVsb = new TGVScrollBar(this, 10, 10, kChildFrame);
122 AddFrame(fVsb);
123 fVsb->Associate(this);
124 } else {
125 fVsb = 0;
126 }
127
130
131 // sets for guibuilding
132 if (fVsb) {
134 }
135 if (fHsb) {
137 }
138
140
141 // layout manager is not used
142 delete fLayoutManager;
143 fLayoutManager = 0;
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Delete view.
148
150{
151 if (!MustCleanup()) {
152 delete fCanvas;
153 delete fHsb;
154 delete fVsb;
155 }
156}
157
158////////////////////////////////////////////////////////////////////////////////
159/// Clear view.
160
162{
163 fScrolling = -1;
164
165 fMousePos.fX = fMousePos.fY = -1;
166 fVisible.fX = fVisible.fY = 0;
169
170 gVirtualX->ClearArea(fCanvas->GetId(), 0, 0,
172 Layout();
173}
174
175////////////////////////////////////////////////////////////////////////////////
176/// Scroll view in specified direction to make newTop the visible location.
177
178void TGView::SetVisibleStart(Int_t newTop, Int_t direction)
179{
180 if (direction == kHorizontal) {
181 if (newTop / fScrollVal.fX == fVisible.fX / fScrollVal.fX) {
182 return;
183 }
184 ScrollCanvas(newTop, kHorizontal);
185 } else {
186 if (newTop / fScrollVal.fY == fVisible.fY / fScrollVal.fY) {
187 return;
188 }
189 ScrollCanvas(newTop, kVertical);
190 }
191}
192
193////////////////////////////////////////////////////////////////////////////////
194/// Draw region.
195
197{
198 return;
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// update a part of view
203
205{
206 x = x < 0 ? 0 : x;
207 y = y < 0 ? 0 : y;
208
209 w = x + w > fCanvas->GetWidth() ? fCanvas->GetWidth() - x : w;
210 h = y + h > fCanvas->GetHeight() ? fCanvas->GetHeight() - y : h;
211
212 if (fExposedRegion.IsEmpty()) {
217 } else {
218 TGRectangle r(x, y, w, h);
220 }
221
222 fClient->NeedRedraw(this);
223}
224
225////////////////////////////////////////////////////////////////////////////////
226/// set some gc values
227
229{
232}
233
234////////////////////////////////////////////////////////////////////////////////
235/// handle button
236
238{
239 if (event->fType == kButtonPress) {
240 int amount, ch;
241
242 ch = fCanvas->GetHeight();
243
244 if (fScrollVal.fY == 1) {
245 amount = fScrollVal.fY * TMath::Max(ch/6, 1);
246 } else {
247 amount = fScrollVal.fY * 5;
248 }
249
250 if (event->fState & kKeyShiftMask) {
251 amount = fScrollVal.fY;
252 } else if (event->fState & kKeyControlMask) {
253 amount = ch - TMath::Max(ch / 20, 1);
254 }
255
256 if (event->fCode == kButton4) {
257 ScrollDown(amount);
258 return kTRUE;
259 } else if (event->fCode == kButton5) {
260 ScrollUp(amount);
261 return kTRUE;
262 }
263 }
264 return kFALSE;
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// redraw
269
271{
272 DrawBorder();
273
274 if (!fExposedRegion.IsEmpty()) {
278 }
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Handle expose events.
283
285{
286 if (event->fWindow == fCanvas->GetId()) {
287
288 TGPosition pos(event->fX, event->fY);
289 TGDimension dim(event->fWidth, event->fHeight);
290 TGRectangle rect(pos, dim);
291
292 if (fExposedRegion.IsEmpty()) {
294 } else {
295 if (((!rect.fX && !fExposedRegion.fY) ||
296 (!rect.fY && !fExposedRegion.fX)) &&
297 ((rect.fX >= (int)fExposedRegion.fW) ||
298 (rect.fY >= (int)fExposedRegion.fH))) {
300 } else {
302 }
303 }
304
305 fClient->NeedRedraw(this);
306 } else {
308 }
309
310 return kTRUE;
311}
312
313////////////////////////////////////////////////////////////////////////////////
314/// Process scrollbar messages.
315
317{
318 switch(GET_MSG(msg)) {
319 case kC_HSCROLL:
320 switch(GET_SUBMSG(msg)) {
321 case kSB_SLIDERTRACK:
322 case kSB_SLIDERPOS:
324 break;
325 }
326 break;
327
328 case kC_VSCROLL:
329 switch(GET_SUBMSG(msg)) {
330 case kSB_SLIDERTRACK:
331 case kSB_SLIDERPOS:
333 break;
334 }
335 break;
336
337 default:
338 break;
339 }
340 return kTRUE;
341}
342
343////////////////////////////////////////////////////////////////////////////////
344/// layout view
345
347{
348 Bool_t need_vsb, need_hsb;
349 Int_t cw, ch;
350
351 need_vsb = need_hsb = kFALSE;
352
353 // test whether we need scrollbars
354 cw = fWidth - (fBorderWidth << 1) - fXMargin - 1;
355 ch = fHeight - (fBorderWidth << 1) - fYMargin - 1;
356
357 fCanvas->SetWidth(cw);
358 fCanvas->SetHeight(ch);
359 ItemLayout();
360
361 if ((Int_t)fVirtualSize.fWidth > cw) {
362 if (fHsb) {
363 need_hsb = kTRUE;
364 if (fVsb) ch -= fVsb->GetDefaultWidth();
365 if (ch < 0) ch = 0;
366 fCanvas->SetHeight(ch);
367 ItemLayout();
368 }
369 }
370
371 if ((Int_t)fVirtualSize.fHeight > ch) {
372 if (fVsb) {
373 need_vsb = kTRUE;
374 if (fHsb) cw -= fHsb->GetDefaultHeight();
375 if (cw < 0) cw = 0;
376 fCanvas->SetWidth(cw);
377 ItemLayout();
378 }
379 }
380
381 // re-check again (putting the scrollbar could have changed things)
382
383 if ((Int_t)fVirtualSize.fWidth > cw) {
384 if (!need_hsb) {
385 need_hsb = kTRUE;
386 if (fVsb) ch -= fVsb->GetDefaultWidth();
387 if (ch < 0) ch = 0;
388 fCanvas->SetHeight(ch);
389 ItemLayout();
390 }
391 }
392
393 if (fHsb) {
394 if (need_hsb) {
396 cw, fHsb->GetDefaultHeight());
397 fHsb->MapRaised();
398 } else {
399 fHsb->UnmapWindow();
400 fHsb->SetPosition(0);
401 }
402 }
403
404 if (fVsb) {
405 if (need_vsb) {
407 fVsb->GetDefaultWidth(), ch);
408 fVsb->MapWindow();
409 } else {
410 fVsb->UnmapWindow();
411 fVsb->SetPosition(0);
412 }
413 }
415
416 if (fHsb) {
418 }
419
420 if (fVsb) {
422 }
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// Draw the border of the text edit widget.
427
429{
432 if (gClient->GetStyle() < 2) {
433 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, fWidth-2, 0);
434 gVirtualX->DrawLine(fId, GetShadowGC()(), 0, 0, 0, fHeight-2);
435 gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, fWidth-3, 1);
436 gVirtualX->DrawLine(fId, GetBlackGC()(), 1, 1, 1, fHeight-3);
437
438 gVirtualX->DrawLine(fId, GetHilightGC()(), 0, fHeight-1, fWidth-1, fHeight-1);
439 gVirtualX->DrawLine(fId, GetHilightGC()(), fWidth-1, fHeight-1, fWidth-1, 0);
440 gVirtualX->DrawLine(fId, GetBckgndGC()(), 1, fHeight-2, fWidth-2, fHeight-2);
441 gVirtualX->DrawLine(fId, GetBckgndGC()(), fWidth-2, 1, fWidth-2, fHeight-2);
442 break;
443 }
444 default:
446 break;
447 }
448}
449
450////////////////////////////////////////////////////////////////////////////////
451/// Scroll the canvas to pos.
452
454{
455 if (pos.fX < 0) pos.fX = 0;
456 if (pos.fY < 0) pos.fY = 0;
457 if (pos.fX != fHsb->GetPosition()) fHsb->SetPosition(pos.fX / fScrollVal.fX);
458 if (pos.fY != fVsb->GetPosition()) fVsb->SetPosition(pos.fY / fScrollVal.fY);
459}
460
461////////////////////////////////////////////////////////////////////////////////
462/// Scroll the canvas to new_top in the kVertical or kHorizontal direction.
463
464void TGView::ScrollCanvas(Int_t new_top, Int_t direction)
465{
466 Point_t points[4];
467 Int_t xsrc, ysrc, xdest, ydest;
468#ifndef R__HAS_COCOA
469 Int_t cpyheight = 0, cpywidth = 0;
470#endif
471
472 if (new_top < 0) {
473 return;
474 }
475
476 if (direction == kVertical) {
477 if (new_top == fVisible.fY) {
478 return;
479 }
480
481 points[0].fX = points[3].fX = 0;
482 points[1].fX = points[2].fX = fCanvas->GetWidth();
483 xsrc = xdest = 0;
484 if (new_top < fVisible.fY) {
485 ysrc = 0;
486 ydest = Int_t(fVisible.fY - new_top);
487#ifndef R__HAS_COCOA
488 cpyheight = ydest;
489#endif
490 if (ydest > (Int_t)fCanvas->GetHeight()) {
491 ydest = fCanvas->GetHeight();
492 }
493
494 points[1].fY = points[0].fY = 0;
495 points[3].fY = points[2].fY = ydest; // -1;
496 } else {
497 ydest = 0;
498 ysrc = Int_t(new_top - fVisible.fY);
499#ifndef R__HAS_COCOA
500 cpyheight= ysrc;
501#endif
502 if (ysrc > (Int_t)fCanvas->GetHeight()) {
503 ysrc = fCanvas->GetHeight();
504 }
505 points[1].fY = points[0].fY = fCanvas->GetHeight()-ysrc; // +1;
506 points[3].fY = points[2].fY = fCanvas->GetHeight();
507 }
508 fVisible.fY = new_top;
509
510 if (fVisible.fY < 0) {
511 fVisible.fY = 0;
512 }
513 } else {
514 if (new_top == fVisible.fX) {
515 return;
516 }
517
518 points[0].fY = points[1].fY = 0;
519 points[2].fY = points[3].fY = fCanvas->GetHeight();
520 ysrc = ydest = 0;
521
522 if (new_top < fVisible.fX) {
523 xsrc = 0;
524 xdest = Int_t(fVisible.fX - new_top);
525#ifndef R__HAS_COCOA
526 cpywidth = xdest;
527#endif
528 if (xdest < 0) {
529 xdest = fCanvas->GetWidth();
530 }
531 points[0].fX = points[3].fX = 0;
532 points[1].fX = points[2].fX = xdest ; // -1;
533 } else {
534 xdest = 0;
535 xsrc = Int_t(new_top - fVisible.fX);
536#ifndef R__HAS_COCOA
537 cpywidth = xsrc;
538#endif
539 if (xsrc > (Int_t)fCanvas->GetWidth()) {
540 xsrc = fCanvas->GetWidth();
541 }
542 points[0].fX = points[3].fX = fCanvas->GetWidth()-xsrc; // +1;
543 points[1].fX = points[2].fX = fCanvas->GetWidth();
544 }
545 fVisible.fX = new_top;
546 if (fVisible.fX < 0) {
547 fVisible.fX = 0;
548 }
549 }
550
552
553#ifdef R__HAS_COCOA
554 //With QuartzView it's quite tough to copy window's pixels to window.
555 //TODO: non-optimal solution.
556 DrawRegion(0, 0, GetWidth(), GetHeight());
557#else
558 // Copy the scrolled region to its new position
559 gVirtualX->CopyArea(fCanvas->GetId(), fCanvas->GetId(), fWhiteGC(),
560 xsrc, ysrc, fCanvas->GetWidth()-cpywidth,
561 fCanvas->GetHeight()-cpyheight, xdest, ydest);
562
563 UInt_t xdiff = points[2].fX - points[0].fX;
564 UInt_t ydiff = points[2].fY - points[0].fY;
565
566 // under windows we need to redraw larger area (why?)
567#ifdef WIN32
568 xdiff = xdiff << 1;
569 ydiff = ydiff << 1;
570#endif
571
572 DrawRegion(points[0].fX, points[0].fY, xdiff, ydiff);
573#endif
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Change background color of the canvas frame.
578
580{
585}
586
587////////////////////////////////////////////////////////////////////////////////
588/// Set background color of the canvas frame.
589
591{
595}
596
597////////////////////////////////////////////////////////////////////////////////
598/// Set backgound pixmap
599
601{
603}
@ kButtonPress
Definition: GuiTypes.h:60
const Mask_t kWABitGravity
Definition: GuiTypes.h:144
Handle_t Pixmap_t
Pixmap handle.
Definition: GuiTypes.h:30
const Mask_t kButtonMotionMask
Definition: GuiTypes.h:164
const Mask_t kFocusChangeMask
Definition: GuiTypes.h:169
const Mask_t kButtonPressMask
Definition: GuiTypes.h:161
const Mask_t kWAWinGravity
Definition: GuiTypes.h:145
const Mask_t kAnyModifier
Definition: GuiTypes.h:210
const Mask_t kKeyPressMask
Definition: GuiTypes.h:159
const Mask_t kKeyShiftMask
Definition: GuiTypes.h:195
@ kChildFrame
Definition: GuiTypes.h:379
@ kRaisedFrame
Definition: GuiTypes.h:384
@ kSunkenFrame
Definition: GuiTypes.h:383
@ kDoubleBorder
Definition: GuiTypes.h:385
@ kOwnBackground
Definition: GuiTypes.h:391
const Handle_t kNone
Definition: GuiTypes.h:88
const Mask_t kKeyControlMask
Definition: GuiTypes.h:197
const Mask_t kLeaveWindowMask
Definition: GuiTypes.h:168
const Mask_t kButtonReleaseMask
Definition: GuiTypes.h:162
const Mask_t kEnterWindowMask
Definition: GuiTypes.h:167
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
@ kButton4
Definition: GuiTypes.h:215
@ kButton5
Definition: GuiTypes.h:215
@ kAnyButton
Definition: GuiTypes.h:214
#define h(i)
Definition: RSha256.hxx:106
int Int_t
Definition: RtypesCore.h:45
long Longptr_t
Definition: RtypesCore.h:82
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
#define gClient
Definition: TGClient.h:157
@ kWidgetWantFocus
Definition: TGWidget.h:35
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t rect
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
#define gVirtualX
Definition: TVirtualX.h:338
Int_t GET_MSG(Long_t val)
@ kSB_SLIDERTRACK
@ kSB_SLIDERPOS
@ kC_VSCROLL
@ kC_HSCROLL
Int_t GET_SUBMSG(Long_t val)
const TGResourcePool * GetResourcePool() const
Definition: TGClient.h:124
void NeedRedraw(TGWindow *w, Bool_t force=kFALSE)
Set redraw flags.
Definition: TGClient.cxx:372
The base class for composite widgets (menu bars, list boxes, etc.).
Definition: TGFrame.h:287
TGLayoutManager * fLayoutManager
layout manager
Definition: TGFrame.h:291
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
Definition: TGFrame.cxx:1117
Int_t MustCleanup() const override
Definition: TGFrame.h:360
UInt_t fHeight
Definition: TGDimension.h:21
UInt_t fWidth
Definition: TGDimension.h:20
void AddInput(UInt_t emask)
Add events specified in the emask to the events the frame should handle.
Definition: TGFrame.cxx:339
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition: TGFrame.cxx:629
static const TGGC & GetBlackGC()
Get black graphics context.
Definition: TGFrame.cxx:735
UInt_t fOptions
frame options
Definition: TGFrame.h:94
Int_t fX
frame x position
Definition: TGFrame.h:85
UInt_t fHeight
frame height
Definition: TGFrame.h:88
virtual UInt_t GetDefaultWidth() const
Definition: TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition: TGFrame.h:191
virtual void DrawBorder()
Draw frame border.
Definition: TGFrame.cxx:421
Int_t fBorderWidth
frame border width
Definition: TGFrame.h:93
void SetBackgroundColor(Pixel_t back) override
Set background color (override from TGWindow base class).
Definition: TGFrame.cxx:312
void MapWindow() override
map window
Definition: TGFrame.h:204
static const TGGC & GetHilightGC()
Get highlight color graphics context.
Definition: TGFrame.cxx:755
Int_t fY
frame y position
Definition: TGFrame.h:86
void UnmapWindow() override
unmap window
Definition: TGFrame.h:206
static const TGGC & GetShadowGC()
Get shadow color graphics context.
Definition: TGFrame.cxx:765
UInt_t fWidth
frame width
Definition: TGFrame.h:87
UInt_t GetHeight() const
Definition: TGFrame.h:225
virtual void SetWidth(UInt_t w)
Definition: TGFrame.h:246
UInt_t GetWidth() const
Definition: TGFrame.h:224
virtual void SetHeight(UInt_t h)
Definition: TGFrame.h:247
static const TGGC & GetBckgndGC()
Get background color graphics context.
Definition: TGFrame.cxx:775
void MapRaised() override
map raised
Definition: TGFrame.h:205
void SetTileStipYOrigin(Int_t v)
Y offset for tile or stipple operations.
Definition: TGGC.cxx:400
void SetForeground(Pixel_t v)
Set foreground color.
Definition: TGGC.cxx:278
void SetTileStipXOrigin(Int_t v)
X offset for tile or stipple operations.
Definition: TGGC.cxx:389
void SetBackground(Pixel_t v)
Set background color.
Definition: TGGC.cxx:289
void SetGraphicsExposures(Bool_t v)
True if graphics exposure should be generated.
Definition: TGGC.cxx:433
The TGHScrollBar will generate the following event messages: kC_HSCROLL, kSB_SLIDERPOS,...
Definition: TGScrollBar.h:142
void SetRange(Int_t range, Int_t page_size) override
Set range of horizontal scrollbar.
void SetPosition(Int_t pos) override
Set logical slider position of horizontal scrollbar.
Long_t fX
x position
Definition: TGDimension.h:56
Long_t fY
y position
Definition: TGDimension.h:57
TGClient * fClient
Connection to display server.
Definition: TGObject.h:25
Handle_t GetId() const
Definition: TGObject.h:41
Handle_t fId
X11/Win32 Window identifier.
Definition: TGObject.h:24
Bool_t IsEmpty() const
Definition: TGDimension.h:124
void Empty()
Definition: TGDimension.h:123
UInt_t fH
height
Definition: TGDimension.h:94
UInt_t fW
width
Definition: TGDimension.h:93
Int_t fX
x position
Definition: TGDimension.h:91
void Merge(const TGRectangle &r)
Definition: TGDimension.cxx:49
Int_t fY
y position
Definition: TGDimension.h:92
Atom_t GetClipboard() const
virtual Int_t GetPosition() const
Definition: TGScrollBar.h:113
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
Move and/or resize the frame.
Definition: TGScrollBar.h:118
The TGVScrollBar will generate the following event messages: kC_VSCROLL, kSB_SLIDERPOS,...
Definition: TGScrollBar.h:165
void SetRange(Int_t range, Int_t page_size) override
Set range of vertical scrollbar.
void SetPosition(Int_t pos) override
Set logical slider position of vertical scrollbar.
TGViewFrame(const TGViewFrame &)=delete
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
Bool_t ProcessMessage(Longptr_t msg, Longptr_t parm1, Longptr_t parm2) override
Process scrollbar messages.
Definition: TGView.cxx:316
TGHScrollBar * fHsb
horizontal scrollbar
Definition: TGView.h:43
virtual ~TGView()
Delete view.
Definition: TGView.cxx:149
virtual Bool_t ItemLayout()
Definition: TGView.h:51
void SetBackgroundColor(Pixel_t) override
Set background color of the canvas frame.
Definition: TGView.cxx:590
@ kNoHSB
Definition: TGView.h:28
@ kNoVSB
Definition: TGView.h:28
void DrawBorder() override
Draw the border of the text edit widget.
Definition: TGView.cxx:428
TGDimension fVirtualSize
the current virtual window size
Definition: TGView.h:35
TGVScrollBar * fVsb
vertical scrollbar
Definition: TGView.h:44
TGLongPosition fMousePos
position of mouse
Definition: TGView.h:33
void ScrollUp(Int_t pixels)
Definition: TGView.h:78
Bool_t HandleButton(Event_t *event) override
handle button
Definition: TGView.cxx:237
TGLongPosition fVisible
position of visible region
Definition: TGView.h:32
void ScrollDown(Int_t pixels)
Definition: TGView.h:80
virtual void UpdateBackgroundStart()
set some gc values
Definition: TGView.cxx:228
void Layout() override
layout view
Definition: TGView.cxx:346
@ kHorizontal
Definition: TGView.h:29
@ kVertical
Definition: TGView.h:29
TGView(const TGView &)=delete
void ChangeBackground(Pixel_t) override
Change background color of the canvas frame.
Definition: TGView.cxx:579
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
friend class TGViewFrame
Definition: TGView.h:25
void DoRedraw() override
redraw
Definition: TGView.cxx:270
TGLongPosition fScrollVal
scroll value
Definition: TGView.h:34
TGViewFrame * fCanvas
frame containing the text
Definition: TGView.h:42
void SetBackgroundPixmap(Pixmap_t p) override
Set backgound pixmap.
Definition: TGView.cxx:600
void Clear(Option_t *="") override
Clear view.
Definition: TGView.cxx:161
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
TGGC fWhiteGC
graphics context used for scrolling generates GraphicsExposure events
Definition: TGView.h:46
virtual void ScrollToPosition(TGLongPosition newPos)
Scroll the canvas to pos.
Definition: TGView.cxx:453
UInt_t fYMargin
y margin
Definition: TGView.h:41
TGRectangle fExposedRegion
exposed area
Definition: TGView.h:36
Bool_t HandleExpose(Event_t *event) override
Handle expose events.
Definition: TGView.cxx:284
Int_t fWidgetId
the widget id (used for event processing)
Definition: TGWidget.h:46
virtual void Associate(const TGWindow *w)
Definition: TGWidget.h:72
Int_t fWidgetFlags
widget status flags (OR of EWidgetStatus)
Definition: TGWidget.h:47
const TGWindow * fMsgWindow
window which handles widget events
Definition: TGWidget.h:48
ROOT GUI Window base class.
Definition: TGWindow.h:23
virtual void SetBackgroundPixmap(Pixmap_t pixmap)
set background pixmap
Definition: TGWindow.cxx:248
virtual void SetEditDisabled(UInt_t on=kEditDisable)
Definition: TGWindow.h:106
virtual Bool_t HandleExpose(Event_t *event)
Definition: TGWindow.h:94
@ kEditDisableLayout
window layout cannot be edited
Definition: TGWindow.h:53
@ kEditDisableBtnEnable
window can handle mouse button events
Definition: TGWindow.h:57
@ kEditDisableGrab
window grab cannot be edited
Definition: TGWindow.h:52
@ kEditDisableKeyEnable
window can handle keyboard events
Definition: TGWindow.h:58
UInt_t fEditDisabled
flags used for "guibuilding"
Definition: TGWindow.h:32
SCoord_t fY
Definition: TPoint.h:36
SCoord_t fX
Definition: TPoint.h:35
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition: TMathBase.h:250
Event structure.
Definition: GuiTypes.h:174
Point structure (maps to the X11 XPoint structure)
Definition: GuiTypes.h:356
Attributes that can be used when creating or changing a window.
Definition: GuiTypes.h:93
Mask_t fMask
bit mask specifying which fields are valid
Definition: GuiTypes.h:110
Int_t fWinGravity
one of the window gravity values
Definition: GuiTypes.h:100
Int_t fBitGravity
one of bit gravity values
Definition: GuiTypes.h:99