#ifndef ROOT_TGView
#define ROOT_TGView
#ifndef ROOT_TGFrame
#include "TGFrame.h"
#endif
#ifndef ROOT_TGWidget
#include "TGWidget.h"
#endif
#ifndef ROOT_TTimer
#include "TTimer.h"
#endif
class TGViewFrame;
class TGHScrollBar;
class TGVScrollBar;
class TGView : public TGCompositeFrame, public TGWidget {
friend class TGViewFrame;
public:
enum { kNoHSB = BIT(0), kNoVSB = BIT(1) };
enum { kHorizontal = 0, kVertical = 1 };
protected:
TGLongPosition fVisible;
TGLongPosition fMousePos;
TGLongPosition fScrollVal;
TGDimension fVirtualSize;
TGRectangle fExposedRegion;
Int_t fScrolling;
Atom_t fClipboard;
UInt_t fXMargin;
UInt_t fYMargin;
TGViewFrame *fCanvas;
TGHScrollBar *fHsb;
TGVScrollBar *fVsb;
TGGC fWhiteGC;
virtual void DoRedraw();
virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
virtual Bool_t ItemLayout() { return kFALSE; }
private:
TGView(const TGView&);
TGView& operator=(const TGView&);
public:
TGView(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1, Int_t id = -1,
UInt_t xMargin = 0, UInt_t yMargin = 0,
UInt_t options = kSunkenFrame | kDoubleBorder,
UInt_t sboptions = 0,
Pixel_t back = GetWhitePixel());
virtual ~TGView();
TGViewFrame *GetCanvas() const { return fCanvas; }
virtual void Clear(Option_t * = "");
virtual void SetVisibleStart(Int_t newTop, Int_t direction);
virtual void ScrollCanvas(Int_t newTop, Int_t direction);
virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
virtual void DrawBorder();
virtual void Layout();
virtual void SetLayoutManager(TGLayoutManager*) { }
virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height);
virtual void ScrollToPosition(TGLongPosition newPos);
void ScrollUp(Int_t pixels)
{ ScrollToPosition(TGLongPosition(fVisible.fX, fVisible.fY + pixels)); }
void ScrollDown(Int_t pixels)
{ ScrollToPosition(TGLongPosition(fVisible.fX, fVisible.fY - pixels)); }
void ScrollLeft(Int_t pixels)
{ ScrollToPosition(TGLongPosition(fVisible.fX + pixels, fVisible.fY)); }
void ScrollRight(Int_t pixels)
{ ScrollToPosition(TGLongPosition(fVisible.fX - pixels, fVisible.fY)); }
virtual TGDimension GetDefaultSize() const { return TGDimension(fWidth, fHeight); }
TGDimension GetVirtualSize() const { return fVirtualSize; }
TGLongPosition GetScrollValue() const { return fScrollVal; }
TGLongPosition GetScrollPosition() const { return fVisible; }
TGLongPosition ToVirtual(TGLongPosition coord) const { return coord + fVisible; }
TGLongPosition ToPhysical(TGLongPosition coord) const { return coord - fVisible; }
virtual Bool_t HandleButton(Event_t *event);
virtual Bool_t HandleExpose(Event_t *event);
virtual void ChangeBackground(Pixel_t);
virtual void SetBackgroundColor(Pixel_t);
virtual void SetBackgroundPixmap(Pixmap_t p);
virtual void UpdateBackgroundStart();
const TGGC &GetViewWhiteGC() { return fWhiteGC; }
ClassDef(TGView,0)
};
class TGViewFrame : public TGCompositeFrame {
private:
TGView *fView;
TGViewFrame(const TGViewFrame&);
TGViewFrame& operator=(const TGViewFrame&);
public:
TGViewFrame(TGView *v, UInt_t w, UInt_t h, UInt_t options = 0,
Pixel_t back = GetWhitePixel());
Bool_t HandleSelectionRequest(Event_t *event)
{ return fView->HandleSelectionRequest(event); }
Bool_t HandleSelectionClear(Event_t *event)
{ return fView->HandleSelectionClear(event); }
Bool_t HandleSelection(Event_t *event)
{ return fView->HandleSelection(event); }
Bool_t HandleButton(Event_t *event)
{ return fView->HandleButton(event); }
Bool_t HandleExpose(Event_t *event)
{ return fView->HandleExpose(event); }
Bool_t HandleCrossing(Event_t *event)
{ return fView->HandleCrossing(event); }
Bool_t HandleMotion(Event_t *event)
{ return fView->HandleMotion(event); }
Bool_t HandleKey(Event_t *event)
{ return fView->HandleKey(event); }
Bool_t HandleDoubleClick(Event_t *event)
{ return fView->HandleDoubleClick(event); }
ClassDef(TGViewFrame,0)
};
#endif