00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGView
00013 #define ROOT_TGView
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef ROOT_TGFrame
00036 #include "TGFrame.h"
00037 #endif
00038 #ifndef ROOT_TGWidget
00039 #include "TGWidget.h"
00040 #endif
00041 #ifndef ROOT_TTimer
00042 #include "TTimer.h"
00043 #endif
00044
00045 class TGViewFrame;
00046 class TGHScrollBar;
00047 class TGVScrollBar;
00048
00049 class TGView : public TGCompositeFrame, public TGWidget {
00050
00051 friend class TGViewFrame;
00052
00053 public:
00054 enum { kNoHSB = BIT(0), kNoVSB = BIT(1) };
00055 enum { kHorizontal = 0, kVertical = 1 };
00056
00057 protected:
00058 TGLongPosition fVisible;
00059 TGLongPosition fMousePos;
00060 TGLongPosition fScrollVal;
00061 TGDimension fVirtualSize;
00062 TGRectangle fExposedRegion;
00063
00064 Int_t fScrolling;
00065 Atom_t fClipboard;
00066 UInt_t fXMargin;
00067 UInt_t fYMargin;
00068 TGViewFrame *fCanvas;
00069 TGHScrollBar *fHsb;
00070 TGVScrollBar *fVsb;
00071
00072 TGGC fWhiteGC;
00073
00074
00075 virtual void DoRedraw();
00076 virtual void UpdateRegion(Int_t x, Int_t y, UInt_t w, UInt_t h);
00077 virtual Bool_t ItemLayout() { return kFALSE; }
00078
00079 private:
00080 TGView(const TGView&);
00081 TGView& operator=(const TGView&);
00082
00083 public:
00084 TGView(const TGWindow *p = 0, UInt_t w = 1, UInt_t h = 1, Int_t id = -1,
00085 UInt_t xMargin = 0, UInt_t yMargin = 0,
00086 UInt_t options = kSunkenFrame | kDoubleBorder,
00087 UInt_t sboptions = 0,
00088 Pixel_t back = GetWhitePixel());
00089
00090 virtual ~TGView();
00091
00092 TGViewFrame *GetCanvas() const { return fCanvas; }
00093
00094 virtual void Clear(Option_t * = "");
00095 virtual void SetVisibleStart(Int_t newTop, Int_t direction);
00096 virtual void ScrollCanvas(Int_t newTop, Int_t direction);
00097 virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
00098 virtual void DrawBorder();
00099 virtual void Layout();
00100 virtual void SetLayoutManager(TGLayoutManager*) { }
00101 virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height);
00102
00103 virtual void ScrollToPosition(TGLongPosition newPos);
00104 void ScrollUp(Int_t pixels)
00105 { ScrollToPosition(TGLongPosition(fVisible.fX, fVisible.fY + pixels)); }
00106 void ScrollDown(Int_t pixels)
00107 { ScrollToPosition(TGLongPosition(fVisible.fX, fVisible.fY - pixels)); }
00108 void ScrollLeft(Int_t pixels)
00109 { ScrollToPosition(TGLongPosition(fVisible.fX + pixels, fVisible.fY)); }
00110 void ScrollRight(Int_t pixels)
00111 { ScrollToPosition(TGLongPosition(fVisible.fX - pixels, fVisible.fY)); }
00112
00113 virtual TGDimension GetDefaultSize() const { return TGDimension(fWidth, fHeight); }
00114 TGDimension GetVirtualSize() const { return fVirtualSize; }
00115 TGLongPosition GetScrollValue() const { return fScrollVal; }
00116 TGLongPosition GetScrollPosition() const { return fVisible; }
00117
00118 TGLongPosition ToVirtual(TGLongPosition coord) const { return coord + fVisible; }
00119 TGLongPosition ToPhysical(TGLongPosition coord) const { return coord - fVisible; }
00120
00121 virtual Bool_t HandleButton(Event_t *event);
00122 virtual Bool_t HandleExpose(Event_t *event);
00123
00124 virtual void ChangeBackground(Pixel_t);
00125 virtual void SetBackgroundColor(Pixel_t);
00126 virtual void SetBackgroundPixmap(Pixmap_t p);
00127 virtual void UpdateBackgroundStart();
00128
00129 const TGGC &GetViewWhiteGC() { return fWhiteGC; }
00130
00131 ClassDef(TGView,0)
00132 };
00133
00134
00135 class TGViewFrame : public TGCompositeFrame {
00136 private:
00137 TGView *fView;
00138
00139 TGViewFrame(const TGViewFrame&);
00140 TGViewFrame& operator=(const TGViewFrame&);
00141
00142 public:
00143 TGViewFrame(TGView *v, UInt_t w, UInt_t h, UInt_t options = 0,
00144 Pixel_t back = GetWhitePixel());
00145
00146 Bool_t HandleSelectionRequest(Event_t *event)
00147 { return fView->HandleSelectionRequest(event); }
00148 Bool_t HandleSelectionClear(Event_t *event)
00149 { return fView->HandleSelectionClear(event); }
00150 Bool_t HandleSelection(Event_t *event)
00151 { return fView->HandleSelection(event); }
00152 Bool_t HandleButton(Event_t *event)
00153 { return fView->HandleButton(event); }
00154 Bool_t HandleExpose(Event_t *event)
00155 { return fView->HandleExpose(event); }
00156 Bool_t HandleCrossing(Event_t *event)
00157 { return fView->HandleCrossing(event); }
00158 Bool_t HandleMotion(Event_t *event)
00159 { return fView->HandleMotion(event); }
00160 Bool_t HandleKey(Event_t *event)
00161 { return fView->HandleKey(event); }
00162 Bool_t HandleDoubleClick(Event_t *event)
00163 { return fView->HandleDoubleClick(event); }
00164
00165 ClassDef(TGViewFrame,0)
00166 };
00167
00168
00169
00170 #endif