library: libGui #include "TGCanvas.h"

# TGCanvas

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

## class TGCanvas : public TGFrame

| Inheritance Chart:

`TObject`

<-

`TGObject`

<-

`TGWindow`

`TQObject`

<-

`TGFrame`

<-

`TGCanvas`

<-

`TGListView` |

`TRootEmbeddedCanvas` |

        public:

                              TGCanvas(const TGWindow* p, UInt_t w, UInt_t h, UInt_t options = kSunkenFrame|kDoubleBorder, Pixel_t back = GetDefaultFrameBackground())
                              TGCanvas(const TGCanvas&)
                      virtual ~TGCanvas()
                 virtual void AddFrame(TGFrame* f, TGLayoutHints* l = 0)
               static TClass* Class()
                 virtual void DrawBorder()
                     TGFrame* GetContainer() const
          virtual TGDimension GetDefaultSize() const
                virtual Int_t GetHsbPosition() const
                TGHScrollBar* GetHScrollbar() const
                        Int_t GetScrolling() const
                  TGViewPort* GetViewPort() const
                virtual Int_t GetVsbPosition() const
                TGVScrollBar* GetVScrollbar() const
              virtual TClass* IsA() const
                 virtual void Layout()
                 virtual void MapSubwindows()
               virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
                 virtual void SavePrimitive(ofstream& out, Option_t* option)
                 virtual void SetContainer(TGFrame* f)
                 virtual void SetHsbPosition(Int_t newPos)
                         void SetScrolling(Int_t scrolling)
                 virtual void SetVsbPosition(Int_t newPos)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

            TGViewPort* fVport       viewport through which we look at contents
          TGHScrollBar* fHScrollbar  horizontal scrollbar
          TGVScrollBar* fVScrollbar  vertical scrollbar
                  Int_t fScrolling   flag which scrolling modes are allowed

        public:

          static const enum TGCanvas:: kCanvasNoScroll
          static const enum TGCanvas:: kCanvasScrollHorizontal
          static const enum TGCanvas:: kCanvasScrollVertical
          static const enum TGCanvas:: kCanvasScrollBoth

## Class Description

     TGCanvas and TGViewPort and TGContainer

     A TGCanvas is a frame containing two scrollbars (a horizontal and
     a vertical) and a viewport. The viewport acts as the window through
     which we look at the contents of the container frame.

     A TGContainer frame manages a content area. It can display and
     control a hierarchy of multi-column items, and provides the ability
     to add new items at any time. By default it doesn't map subwindows
     which are items of the container. In this case subwindow must
     provide DrawCopy method, see for example TGLVEntry class.
     It is also possible to use option which allow to map subwindows.
     This option has much slower drawing speed in case of more than 1000
     items placed in container. To activate this option the fMapSubwindows
     data member must be set to kTRUE (for example TTVLVContainer class)

       The TGContainer class can handle the keys:

        o  F7, Ctnrl-F - activate search dialog
        o  F3, Ctnrl-G - continue search
        o  End - go to the last item in container
        o  Home - go to the first item in container
        o  PageUp,PageDown,arrow keys - navigate inside container
        o  Return/Enter - equivalent to double click of the mouse button
        o  Contrl-A - select/activate all items.
        o  Space - invert selection.

TGCanvas(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options, ULong_t back) : TGFrame(p, w, h, options, back)

     Create a canvas object.

~TGCanvas()

     Delete canvas.

void MapSubwindows()

     Map all canvas sub windows.

void AddFrame(TGFrame *f, TGLayoutHints *l)

     Adding a frame to a canvas is actually adding the frame to the
     viewport container. The viewport container must be at least a
     TGCompositeFrame for this method to succeed.

void DrawBorder()

     Draw canvas border.

void Layout()

     Create layout for canvas. Depending on the size of the container
     we need to add the scrollbars.

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)

     Handle message generated by the canvas scrollbars.

Int_t GetHsbPosition() const

     Get position of horizontal scrollbar.

Int_t GetVsbPosition() const

     Get position of vertical scrollbar.

void SetHsbPosition(Int_t newPos)

     Set position of horizontal scrollbar.

void SetVsbPosition(Int_t newPos)

     Set position of vertical scrollbar.

void SetScrolling(Int_t scrolling)

     Set scrolling policy. Use values defined by the enum: kCanvasNoScroll,
     kCanvasScrollHorizontal, kCanvasScrollVertical, kCanvasScrollBoth.

void SavePrimitive(ofstream &out, Option_t *option)

     Save a canvas widget as a C++ statement(s) on output stream out.

### Inline Functions

                 TGFrame* GetContainer() const
              TGViewPort* GetViewPort() const
            TGHScrollBar* GetHScrollbar() const
            TGVScrollBar* GetVScrollbar() const
                     void SetContainer(TGFrame* f)
                    Int_t GetScrolling() const
              TGDimension GetDefaultSize() const
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
                 TGCanvas TGCanvas(const TGCanvas&)

Author: Fons Rademakers 11/01/98
Last update: root/gui:$Name: $:$Id: TGCanvas.cxx,v 1.25 2004/02/18 20:13:42 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *