library: libGui #include "TGListBox.h"

# TGListBox

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

## class TGListBox : public TGCompositeFrame, public TGWidget

| Inheritance Chart:

`TObject`

<-

`TGObject`

<-

`TGWindow`

`TQObject`

<-

`TGFrame`

<-

`TGCompositeFrame`

`TGWidget`

<-

`TGListBox`

        protected:

          virtual void InitListBox()
                  void SetContainer(TGFrame* f)

        public:

                              TGListBox(const TGWindow* p, Int_t id = -1, UInt_t options = kSunkenFrame|kDoubleBorder, Pixel_t back = GetWhitePixel())
                              TGListBox(const TGListBox&)
                      virtual ~TGListBox()
                 virtual void AddEntry(TGString* s, Int_t id)
                 virtual void AddEntry(const char* s, Int_t id)
                 virtual void AddEntry(TGLBEntry* lbe, TGLayoutHints* lhints)
                 virtual void AddEntrySort(TGString* s, Int_t id)
                 virtual void AddEntrySort(const char* s, Int_t id)
                 virtual void AddEntrySort(TGLBEntry* lbe, TGLayoutHints* lhints)
               static TClass* Class()
                 virtual void DrawBorder()
                     TGFrame* GetContainer() const
          virtual TGDimension GetDefaultSize() const
               virtual Bool_t GetMultipleSelections() const
                virtual Int_t GetNumberOfEntries() const
                 TGScrollBar* GetScrollBar() const
                virtual Int_t GetSelected() const
                 virtual void GetSelectedEntries(TList* selected)
           virtual TGLBEntry* GetSelectedEntry() const
               virtual Bool_t GetSelection(Int_t id)
                  TGViewPort* GetViewPort() const
                 virtual void InsertEntry(TGString* s, Int_t id, Int_t afterID)
                 virtual void InsertEntry(const char* s, Int_t id, Int_t afterID)
                 virtual void InsertEntry(TGLBEntry* lbe, TGLayoutHints* lhints, Int_t afterID)
                 virtual void IntegralHeight(Bool_t mode)
              virtual TClass* IsA() const
                 virtual void Layout()
                 virtual void MoveResize(Int_t x, Int_t y, UInt_t w, UInt_t h)
               virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
                 virtual void RemoveEntries(Int_t from_ID, Int_t to_ID)
                 virtual void RemoveEntry(Int_t id)
                 virtual void Resize(UInt_t w, UInt_t h)
                 virtual void Resize(TGDimension size)
                 virtual void SavePrimitive(ofstream& out, Option_t* option)
           virtual TGLBEntry* Select(Int_t id, Bool_t sel = kTRUE)
                 virtual void Selected(Int_t widgetId, Int_t id)
                 virtual void Selected(Int_t id)
                 virtual void Selected(const char* txt)
                 virtual void SelectionChanged()
                 virtual void SetMultipleSelections(Bool_t multi)
                 virtual void SetTopEntry(Int_t id)
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)

### Data Members

        protected:

                  UInt_t fItemVsize       maximum height of single entry
                  Bool_t fIntegralHeight  true if height should be multiple of fItemVsize
          TGLBContainer* fLbc             listbox container
             TGViewPort* fVport           listbox viewport (see TGCanvas.h)
           TGVScrollBar* fVScrollbar      vertical scrollbar

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

TGListBox(const TGWindow *p, Int_t id, UInt_t options, ULong_t back) : TGCompositeFrame(p, 10, 10, options, back)

     Create a listbox.

~TGListBox()

     Delete a listbox widget.

void InitListBox()

     initiate the internal classes of a list box

void DrawBorder()

     Draw borders of the list box widget.

void AddEntry(TGString *s, Int_t id)

     Add entry with specified string and id to listbox. The id will be
     used in the event processing routine when the item is selected.
     The string will be adopted by the listbox.

void AddEntry(const char *s, Int_t id)

     Add entry with specified string and id to listbox. The id will be
     used in the event processing routine when the item is selected.

void AddEntry(TGLBEntry *lbe, TGLayoutHints *lhints)

     Add specified TGLBEntry and TGLayoutHints to listbox. The
     entry and layout will be adopted and later deleted by the listbox.

void AddEntrySort(TGString *s, Int_t id)

     Add entry with specified string and id to listbox sorted by increasing id.
     This sorting works proberly only if EntrySort functions are used to add
     entries without mixing them with other add or insert functions.  The id will be
     used in the event processing routine when the item is selected.
     The string will be adopted by the listbox.

void AddEntrySort(const char *s, Int_t id)

     Add entry with specified string and id to listbox sorted by increasing id.
     This sorting works proberly only if EntrySort functions are used to add
     entries without mixing them with other add or insert functions. The id will be
     used in the event processing routine when the item is selected.

void AddEntrySort(TGLBEntry *lbe, TGLayoutHints *lhints)

     Add specified TGLBEntry and TGLayoutHints to listbox sorted by increasing id.
     This sorting works proberly only if EntrySort functions are used to add
     entries without mixing them with other add or insert functions. The
     entry and layout will be adopted and later deleted by the listbox.

void InsertEntry(TGString *s, Int_t id, Int_t afterID)

     Insert entry with specified string and id behind the entry with afterID.
     The string will be adopted and later deleted by the listbox.

void InsertEntry(const char *s, Int_t id, Int_t afterID)

     Insert entry with specified string and id behind the entry with afterID.

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

     Insert the specified TGLBEntry and layout hints behind afterID.
     The entry and layout will be adopted and later deleted by the listbox.

void SetTopEntry(Int_t id)

     Scroll the entry with id to the top of the listbox.

void Resize(UInt_t w, UInt_t h)

     Resize the listbox widget. If fIntegralHeight is true make the height
     an integral number of the maximum height of a single entry.

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

     Move and resize the listbox widget.

TGDimension GetDefaultSize() const

     Return default size of listbox widget.

void Layout()

     Layout the listbox components.

Int_t GetSelected() const

     Return id of selected listbox item.

void GetSelectedEntries(TList *selected)

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

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)

     Process messages generated by the listbox container and forward
     messages to the listbox message handling window.

void Selected(Int_t widgetId, Int_t id)

     Emit signal with list box id and entry id.

void SavePrimitive(ofstream &out, Option_t *option)

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

### Inline Functions

                    void SetContainer(TGFrame* f)
                    void RemoveEntry(Int_t id)
                    void RemoveEntries(Int_t from_ID, Int_t to_ID)
                    void SetMultipleSelections(Bool_t multi)
                  Bool_t GetMultipleSelections() const
                   Int_t GetNumberOfEntries() const
                TGFrame* GetContainer() const
             TGViewPort* GetViewPort() const
            TGScrollBar* GetScrollBar() const
                    void Resize(TGDimension size)
                    void IntegralHeight(Bool_t mode)
              TGLBEntry* Select(Int_t id, Bool_t sel = kTRUE)
                  Bool_t GetSelection(Int_t id)
              TGLBEntry* GetSelectedEntry() const
                    void Selected(Int_t id)
                    void Selected(const char* txt)
                    void SelectionChanged()
                 TClass* Class()
                 TClass* IsA() const
                    void ShowMembers(TMemberInspector& insp, char* parent)
                    void Streamer(TBuffer& b)
                    void StreamerNVirtual(TBuffer& b)
               TGListBox TGListBox(const TGListBox&)

Author: Fons Rademakers 12/01/98
Last update: root/gui:$Name: $:$Id: TGListBox.cxx,v 1.23 2004/07/07 15:02:25 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *