library: libGui #include "TGCanvas.h"

# TGContainer

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

## class TGContainer : public TGCompositeFrame

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGCompositeFrame`
| <- | `TGContainer` |
<- |
`TGLBContainer` |
`TGListTree` |
`TGLVContainer` | <- |
`TGFileContainer` |
`TTVLVContainer` |

        protected:

                virtual void ActivateItem(TGFrameElement* el)
                virtual void ClearViewPort()
                virtual void DoRedraw()
                virtual void End(Bool_t select = kFALSE)
               virtual void* FindItem(const TString& name, Bool_t direction = kTRUE, Bool_t caseSensitive = kTRUE, Bool_t beginWith = kFALSE)
          static const TGGC& GetLineGC() const
                virtual void Home(Bool_t select = kFALSE)
                virtual void LineDown(Bool_t select = kFALSE)
                virtual void LineLeft(Bool_t select = kFALSE)
                virtual void LineRight(Bool_t select = kFALSE)
                virtual void LineUp(Bool_t select = kFALSE)
                virtual void OnAutoScroll()
                virtual void PageDown(Bool_t select = kFALSE)
                virtual void PageUp(Bool_t select = kFALSE)
                virtual void RepeatSearch()
                virtual void Search()
                virtual void SearchPattern()

        public:

                                  TGContainer(const TGWindow* p = 0, UInt_t w = 1, UInt_t h = 1, UInt_t options = kSunkenFrame, Pixel_t back = GetDefaultFrameBackground())
                                  TGContainer(TGCanvas* p, UInt_t options = kSunkenFrame, Pixel_t back = GetDefaultFrameBackground())
                                  TGContainer(const TGContainer&)
                          virtual ~TGContainer()
                     virtual void AdjustPosition()
                     virtual void Associate(const TGWindow* w)
                   static TClass* Class()
                     virtual void Clicked(TGFrame* f, Int_t btn)
                     virtual void Clicked(TGFrame* f, Int_t btn, Int_t x, Int_t y)
                     virtual void CurrentChanged(Int_t x, Int_t y)
                     virtual void CurrentChanged(TGFrame* f)
                     virtual void DoubleClicked(TGFrame* f, Int_t btn)
                     virtual void DoubleClicked(TGFrame* f, Int_t btn, Int_t x, Int_t y)
                     virtual void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)
          virtual TGFrameElement* FindFrame(Int_t x, Int_t y, Bool_t exclude = kTRUE)
                        TGCanvas* GetCanvas() const
            virtual TGHScrollBar* GetHScrollbar() const
                 virtual TGFrame* GetLastActive() const
                  const TGWindow* GetMessageWindow() const
           virtual const TGFrame* GetNextSelected(void** current) const
                      TGDimension GetPageDimension() const
                       TGPosition GetPagePosition() const
            virtual TGVScrollBar* GetVScrollbar() const
                   virtual Bool_t HandleButton(Event_t* event)
                   virtual Bool_t HandleDoubleClick(Event_t* event)
                   virtual Bool_t HandleExpose(Event_t* event)
                   virtual Bool_t HandleKey(Event_t* event)
                   virtual Bool_t HandleMotion(Event_t* event)
                     virtual void InvertSelection()
                  virtual TClass* IsA() const
                     virtual void KeyPressed(TGFrame*, UInt_t keysym, UInt_t mask)
                     virtual void Layout()
                    virtual Int_t NumItems() const
                    virtual Int_t NumSelected() const
                     virtual void OnMouseOver(TGFrame*)
                     virtual void RemoveAll()
                     virtual void RemoveItem(TGFrame* item)
                     virtual void ReturnPressed(TGFrame*)
                     virtual void SavePrimitive(ofstream& out, Option_t* option)
                     virtual void SelectAll()
                     virtual void SetHsbPosition(Int_t newPos)
                     virtual void SetPageDimension(const TGDimension& dim)
                     virtual void SetPageDimension(UInt_t w, UInt_t h)
                     virtual void SetPagePosition(const TGPosition& pos)
                     virtual void SetPagePosition(Int_t x, Int_t y)
                     virtual void SetVsbPosition(Int_t newPos)
                     virtual void ShowMembers(TMemberInspector& insp, char* parent)
                     virtual void SpacePressed(TGFrame*)
                     virtual void Streamer(TBuffer& b)
                             void StreamerNVirtual(TBuffer& b)
                     virtual void UnSelectAll()

### Data Members

        protected:

              TGViewPort* fViewPort        container viewport
                TGCanvas* fCanvas          pointer to canvas
          const TGWindow* fMsgWindow       window handling container messages
          TGFrameElement* fLastActiveEl    last active item
                    Int_t fXp
                    Int_t fYp              previous pointer position
                    Int_t fX0
                    Int_t fY0              corner of rubber band box
                    Int_t fXf
                    Int_t fYf              other corner of rubber band box
                   Bool_t fDragging        true if in dragging mode
                    Int_t fTotal           total items
                    Int_t fSelected        number of selected items
                  TTimer* fScrollTimer     autoscroll timer
                   Bool_t fOnMouseOver     kTRUE when mouse pointer is over entry
            TGSearchType* fSearch          structure used by search dialog
                   Bool_t fLastDir         direction of last search
                   Bool_t fLastCase        case sensetivity of last search
                  TString fLastName        the name of object of last search
                  TTimer* fKeyTimer        keyboard timer
                  TString fKeyInput        keyboard input (buffer)
                   Bool_t fKeyTimerActive  kTRUE - keyboard timer is active
                   Bool_t fScrolling       kTRUE - when scrolling is ON
             static TGGC* fgLineGC

## 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.

TGContainer(const TGWindow *p, UInt_t w, UInt_t h, UInt_t options, ULong_t back) : TGCompositeFrame(p, w, h, options, back)

     Create a canvas container. This is the (large) frame that contains
     all the list items. It will be shown through a TGViewPort (which is
     created by the TGCanvas).

TGContainer(TGCanvas *p, UInt_t options, ULong_t back) : TGCompositeFrame(p->GetViewPort(), p->GetWidth(), p->GetHeight(), options, back)

     Create a canvas container. This is the (large) frame that contains
     all the list items. It will be shown through a TGViewPort (which is
     created by the TGCanvas).

~TGContainer()

     Delete canvas container.

void Layout()

     Layout container entries.

void CurrentChanged(Int_t x, Int_t y)

     Emit signal when current position changed.

void CurrentChanged(TGFrame* f)

     Emit signal when current selected frame changed.

void KeyPressed(TGFrame *frame, UInt_t keysym, UInt_t mask)

     Signal emitted when keyboard key pressed

     frame - activated frame
     keysym - defined in "KeySymbols.h"
     mask - modifier key mask, defined in "GuiTypes.h"

     const Mask_t kKeyShiftMask   = BIT(0);
     const Mask_t kKeyLockMask    = BIT(1);
     const Mask_t kKeyControlMask = BIT(2);
     const Mask_t kKeyMod1Mask    = BIT(3);   // typically the Alt key
     const Mask_t kButton1Mask    = BIT(8);
     const Mask_t kButton2Mask    = BIT(9);
     const Mask_t kButton3Mask    = BIT(10);
     const Mask_t kButton4Mask    = BIT(11);
     const Mask_t kButton5Mask    = BIT(12);
     const Mask_t kAnyModifier    = BIT(15);

void ReturnPressed(TGFrame* f)

     Signal emitted when Return/Enter key pressed.
     It's equivalent to "double click" of mouse button.

void SpacePressed(TGFrame* f)

     Signal emitted when space key pressed.
     Pressing space key inverts selection.

void OnMouseOver(TGFrame* f)

     Signal emitted when pointer is over entry.

void Clicked(TGFrame *entry, Int_t btn)

     Emit Clicked() signal.

void Clicked(TGFrame *entry, Int_t btn, Int_t x, Int_t y)

     Emit Clicked() signal.

void DoubleClicked(TGFrame *entry, Int_t btn)

     Emit DoubleClicked() signal.

void DoubleClicked(TGFrame *entry, Int_t btn, Int_t x, Int_t y)

     Emit DoubleClicked() signal.

void SelectAll()

     Select all items in the container.
     SelectAll() signal emitted.

void UnSelectAll()

     Unselect all items in the container.

void InvertSelection()

     Invert the selection, all selected items become unselected and
     vice versa.

void RemoveAll()

     Remove all items from the container.

void RemoveItem(TGFrame *item)

     Remove item from container.

const TGFrame* GetNextSelected(void **current)

     Return next selected item.

void ActivateItem(TGFrameElement* el)

     Activate item.

TGPosition GetPagePosition() const

     Returns page position.

TGDimension GetPageDimension() const

     Returns page dimension.

void SetPagePosition(const TGPosition& pos)

     Set page position.

void SetPagePosition(Int_t x, Int_t y)

     Set page position.

void SetPageDimension(const TGDimension& dim)

     Set page dimension.

void SetPageDimension(UInt_t w, UInt_t h)

     Set page dimension.

void DoRedraw()

     Redraw content of container in the viewport region.

void DrawRegion(Int_t x, Int_t y, UInt_t w, UInt_t h)

     Draw a region of container in viewport.

void ClearViewPort()

     Clear view port.

Bool_t HandleExpose(Event_t *event)

     Handle expose events. Do not use double buffer.

Bool_t HandleButton(Event_t *event)

     Handle mouse button event in container.

Bool_t HandleDoubleClick(Event_t *event)

     Handle double click mouse event.

Bool_t HandleMotion(Event_t *event)

     Handle mouse motion events.

Bool_t HandleKey(Event_t *event)

     The key press event handler converts a key press to some line editor
     action.

void Search()

     Invokes search dialog. Looks for item with the entered name.

void OnAutoScroll()

     Autoscroll while close to & beyond  The Wall

void SearchPattern()

     Search for entry which name begins with pattern.

void RepeatSearch()

     Repeats search.

TGFrameElement* FindFrame(Int_t x,Int_t y,Bool_t exclude)

     Find frame located int container at position x,y.

void* FindItem(const TString& name, Bool_t direction, Bool_t caseSensitive, Bool_t beginWith)

TGHScrollBar* GetHScrollbar() const

     returns pointer to hor. scroll bar

TGVScrollBar* GetVScrollbar() const

     returns pointer to vert. scroll bar

void SetVsbPosition(Int_t newPos)

     Set position of vertical scrollbar.

void SetHsbPosition(Int_t newPos)

     set new hor. position

void AdjustPosition()

     Move content to position of highlighted/activated frame.

void LineLeft(Bool_t select)

     Move current position one column left.

void LineRight(Bool_t select)

     Move current position one column right.

void LineUp(Bool_t select)

     Make current position first line in window by scrolling up.

void LineDown(Bool_t select)

     Move one line down.

void PageUp(Bool_t select)

     Move  position one page up.

void PageDown(Bool_t select)

     Move position one page down.

void Home(Bool_t select)

     Move to upper-left corner of container.

void End(Bool_t select)

     Move to the bottom-right corner of container.

const TGGC& GetLineGC()

void SavePrimitive(ofstream &out, Option_t *option)

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

### Inline Functions

                       void Associate(const TGWindow* w)
            const TGWindow* GetMessageWindow() const
                  TGCanvas* GetCanvas() const
                      Int_t NumSelected() const
                      Int_t NumItems() const
                   TGFrame* GetLastActive() const
                    TClass* Class()
                    TClass* IsA() const
                       void ShowMembers(TMemberInspector& insp, char* parent)
                       void Streamer(TBuffer& b)
                       void StreamerNVirtual(TBuffer& b)
                TGContainer TGContainer(const TGContainer&)

Author: Fons Rademakers 11/01/98
Last update: root/gui:$Name: $:$Id: TGCanvas.cxx,v 1.33 2005/01/20 15:37:28 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *