library: libGui #include "TGView.h"

# TGView

class description - source file - inheritance tree (.pdf)

## class TGView : public TGCompositeFrame, public TGWidget

| Inheritance Chart:

`TObject`

<-

`TGObject`

<-

`TGWindow`

`TQObject`

<-

`TGFrame`

<-

`TGCompositeFrame`

`TGWidget`

<-

`TGView`

<-

`TGTextView`

<-

`TGTextEdit` |

        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())
                              TGView(const TGView&)
                      virtual ~TGView()
               static TClass* Class()
                 virtual void Clear(Option_t* = "")
                 virtual void DrawBorder()
                 virtual void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)
          virtual TGDimension GetDefaultSize() const
               virtual Bool_t HandleButton(Event_t* event)
               virtual Bool_t HandleCrossing(Event_t* event)
               virtual Bool_t HandleExpose(Event_t* event)
               virtual Bool_t HandleMotion(Event_t* event)
               virtual Bool_t HandleTimer(TTimer* t)
                 virtual void HLayout()
              virtual TClass* IsA() const
                       Bool_t IsMarked() const
                       Bool_t IsSaved()
                 virtual void Layout()
                 virtual void Mark(Long_t xPos, Long_t yPos)
                 virtual void Marked(Bool_t mark)
               virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
               virtual Long_t ReturnHeighestColHeight()
               virtual Long_t ReturnLineCount()
               virtual Long_t ReturnLineLength(Long_t line)
               virtual Long_t ReturnLongestLineWidth()
                 virtual void ScrollCanvas(Int_t newTop, Int_t direction)
                 virtual void SetHsbPosition(Long_t newPos)
                 virtual void SetSBRange(Int_t direction)
                 virtual void SetVisibleStart(Int_t newTop, Int_t direction)
                 virtual void SetVsbPosition(Long_t newPos)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
               virtual Long_t ToObjXCoord(Long_t xCoord, Long_t line)
               virtual Long_t ToObjYCoord(Long_t yCoord)
               virtual Long_t ToScrXCoord(Long_t xCoord, Long_t line)
               virtual Long_t ToScrYCoord(Long_t yCoord)
                 virtual void UnMark()
                 virtual void VLayout()

### Data Members

        protected:

          TGLongPosition fMarkedStart  start position of marked text
          TGLongPosition fMarkedEnd    end position of marked text
          TGLongPosition fVisible      position of visible region
          TGLongPosition fMousePos     position of mouse
          TGLongPosition fScrollVal    position of scrollbar
                  Bool_t fIsMarked     true if text is marked/selected
                  Bool_t fIsMarking    true if in marking mode
                  Bool_t fIsSaved      true is content is saved
                   Int_t fScrolling    scrolling direction
                  Atom_t fClipboard    clipboard property
                  UInt_t fXMargin      x margin
                  UInt_t fYMargin      y margin
            TGViewFrame* fCanvas       frame containing the text
           TGHScrollBar* fHsb          horizontal scrollbar
           TGVScrollBar* fVsb          vertical scrollbar
             TViewTimer* fScrollTimer  scrollbar timer
                    TGGC fWhiteGC      graphics context used for scrolling

        public:

          static const enum TGView:: kNoHSB
          static const enum TGView:: kNoVSB
          static const enum TGView:: kHorizontal
          static const enum TGView:: kVertical

## Class Description

     TGView

     A TGView provides the infrastructure for text viewer and editor
     widgets. It provides a canvas (TGViewFrame) and (optionally) a
     vertical and horizontal scrollbar and methods for marking and
     scrolling.

     The TGView (and derivatives) will generate the following
     event messages:
     kC_TEXTVIEW, kTXT_ISMARKED, widget id, [true|false]
     kC_TEXTVIEW, kTXT_DATACHANGE, widget id, 0
     kC_TEXTVIEW, kTXT_CLICK2, widget id, position (y << 16) | x)
     kC_TEXTVIEW, kTXT_CLICK3, widget id, position (y << 16) | x)
     kC_TEXTVIEW, kTXT_F3, widget id, true
     kC_TEXTVIEW, kTXT_OPEN, widget id, 0
     kC_TEXTVIEW, kTXT_CLOSE, widget id, 0
     kC_TEXTVIEW, kTXT_SAVE, widget id, 0

TGView(const TGWindow *p, UInt_t w, UInt_t h, Int_t id, UInt_t xMargin, UInt_t yMargin, UInt_t options, UInt_t sboptions, ULong_t back) : TGCompositeFrame(p, w, h, options, GetDefaultFrameBackground())

     Create an editor view, containing an TGEditorFrame and (optionally)
     a horizontal and vertical scrollbar.

~TGView()

     Delete view.

void Clear(Option_t *)

     Clear view.

void SetVisibleStart(Int_t newTop, Int_t direction)

     Scroll view in specified direction to make newTop the visible location.

Bool_t HandleExpose(Event_t *event)

     Handle expose events.

Bool_t HandleCrossing(Event_t *event)

     Handle mouse crossing event.

Bool_t HandleTimer(TTimer *)

     Handle scroll timer.

Bool_t HandleButton(Event_t *event)

     Handle mouse button event in text editor.

Bool_t HandleMotion(Event_t *event)

     Handle mouse motion event in the text editor widget.

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)

     Process scrollbar messages.

void Layout()

     Layout the components of view.

void HLayout()

     Horizontal layout of widgets (canvas, scrollbar).

void VLayout()

     Vertical layout of widgets (canvas, scrollbar).

void SetSBRange(Int_t direction)

     Set the range for the kVertical or kHorizontal scrollbar.

void SetHsbPosition(Long_t newPos)

     Set position of horizontal scrollbar.

void SetVsbPosition(Long_t newPos)

     Set position of vertical scrollbar.

void DrawBorder()

     Draw the border of the text edit widget.

void ScrollCanvas(Int_t new_top, Int_t direction)

     Scroll the canvas to new_top in the kVertical or kHorizontal direction.

### Inline Functions

            TGDimension GetDefaultSize() const
                 Long_t ToObjXCoord(Long_t xCoord, Long_t line)
                 Long_t ToObjYCoord(Long_t yCoord)
                 Long_t ToScrXCoord(Long_t xCoord, Long_t line)
                 Long_t ToScrYCoord(Long_t yCoord)
                   void Mark(Long_t xPos, Long_t yPos)
                   void UnMark()
                   void DrawRegion(Int_t x, Int_t y, UInt_t width, UInt_t height)
                 Long_t ReturnLineLength(Long_t line)
                 Long_t ReturnLineCount()
                 Long_t ReturnHeighestColHeight()
                 Long_t ReturnLongestLineWidth()
                 Bool_t IsMarked() const
                 Bool_t IsSaved()
                   void Marked(Bool_t mark)
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
                 TGView TGView(const TGView&)

Author: Fons Rademakers 30/6/2000
Last update: root/gui:$Name: $:$Id: TGView.cxx,v 1.12 2004/10/22 07:31:58 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *