library: libGui #include "TGListBox.h"

# TGLBContainer

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

## class TGLBContainer : public TGContainer

| Inheritance Chart:
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGCompositeFrame`
| <- | `TGContainer`
| <- | `TGLBContainer` |

        public:

                                TGLBContainer(const TGWindow* p = 0, UInt_t w = 1, UInt_t h = 1, UInt_t options = kSunkenFrame, Pixel_t back = GetDefaultFrameBackground())
                                TGLBContainer(const TGLBContainer&)
                        virtual ~TGLBContainer()
                   virtual void AddEntry(TGLBEntry* lbe, TGLayoutHints* lhints)
                   virtual void AddEntrySort(TGLBEntry* lbe, TGLayoutHints* lhints)
                   virtual void Associate(const TGWindow* w)
                 static TClass* Class()
                 virtual Bool_t GetMultipleSelections() const
                  virtual Int_t GetPos(Int_t id)
                  virtual Int_t GetSelected() const
                   virtual void GetSelectedEntries(TList* selected)
             virtual TGLBEntry* GetSelectedEntry() const
                 virtual Bool_t GetSelection(Int_t id)
          virtual TGVScrollBar* GetVScrollbar() const
                 virtual Bool_t HandleButton(Event_t* event)
                 virtual Bool_t HandleMotion(Event_t* event)
                   virtual void InsertEntry(TGLBEntry* lbe, TGLayoutHints* lhints, Int_t afterID)
                virtual TClass* IsA() const
                   virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
                   virtual void RemoveEntry(Int_t id)
             virtual TGLBEntry* Select(Int_t id, Bool_t sel)
             virtual TGLBEntry* Select(Int_t id)
                   virtual void SetListBox(TGListBox* lb)
                   virtual void SetMultipleSelections(Bool_t multi)
                   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:

          TGLBEntry* fLastActive    last active listbox entry in single selection listbox
          TGListBox* fListBox       list box which contains this container
              Bool_t fMultiSelect   true if multi selection is switched on
               Int_t fChangeStatus  defines the changes (select or unselect) while the mouse

## Class Description

     TGListBox, TGLBContainer, TGLBEntry and TGTextLBEntry

     A listbox is a box, possibly with scrollbar, containing entries.
     Currently entries are simple text strings (TGTextLBEntry).
     A TGListBox looks a lot like a TGCanvas. It has a TGViewPort
     containing a TGLBContainer which contains the entries and it also
     has a vertical scrollbar which becomes visible if there are more
     items than fit in the visible part of the container.

     The TGListBox is user callable. The other classes are service
     classes of the listbox.

     Selecting an item in the listbox will generate the event:
     kC_COMMAND, kCM_LISTBOX, listbox id, item id.

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

     Create a listbox container.

~TGLBContainer()

     Delete the listbox container.

void AddEntry(TGLBEntry *lbe, TGLayoutHints *lhints)

     Add listbox entry with hints to container. To show entry call
     MapSubwindows() and Layout().

void InsertEntry(TGLBEntry *lbe, TGLayoutHints *lhints, Int_t afterID)

     Insert listbox entry after specified entry with id afterID. If afterID = -1
     then add entry at head of list. To show entry call MapSubwindows() and
     Layout().

void AddEntrySort(TGLBEntry *lbe, TGLayoutHints *lhints)

     Insert listbox entry before the list box entry with a higher id.
     To show entry call MapSubwindows() and Layout().

void RemoveEntry(Int_t id)

     Remove the entry with specified id from the listbox container.
     To update the listbox call Layout().

void RemoveEntries(Int_t from_ID, Int_t to_ID)

     Remove entries from from_ID to to_ID (including).
     To update the listbox call Layout().

TGLBEntry* Select(Int_t id)

     Select the entry with the specified id.
     Returns the selected TGLBEntry.

TGLBEntry* Select(Int_t id, Bool_t sel)

     Select / deselect the entry with the specified id.
     Returns the selected TGLBEntry.

Int_t GetSelected() const

     Returns id of selected entry. In case of no selected entry or
     if multi selection is switched on returns -1.

Bool_t GetSelection(Int_t id)

     Returns kTrue if entry id is selected.

void GetSelectedEntries(TList *selected)

     Adds all selected entries (TGLBEntry) of the list box into
     the list selected.

void SetMultipleSelections(Bool_t multi)

     enables and disables multible selections of entries

TGVScrollBar* GetVScrollbar() const

     return a pointer to vertical scroll bar

void SetVsbPosition(Int_t newPos)

     set new hor. position

Bool_t HandleButton(Event_t *event)

     Handle mouse button event in the listbox container.

Bool_t HandleMotion(Event_t *event)

     Handle mouse motion event in listbox container.

Int_t GetPos(Int_t id)

     Returns the position in the list box of the entry id.
     The first position has position no 0. Returns -1 if entry id
     is not in the list of entries.

### Inline Functions

                     void Associate(const TGWindow* w)
                     void SetListBox(TGListBox* lb)
               TGLBEntry* GetSelectedEntry() const
                   Bool_t GetMultipleSelections() const
                  TClass* Class()
                  TClass* IsA() const
                     void ShowMembers(TMemberInspector& insp, char* parent)
                     void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)
            TGLBContainer TGLBContainer(const TGLBContainer&)

Author: Fons Rademakers 12/01/98
Last update: root/gui:$Name: $:$Id: TGListBox.cxx,v 1.44 2005/04/28 08:30:57 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *