TGButtonGroup


class description - source file - inheritance tree

class TGButtonGroup : public TGGroupFrame


    protected:
void Init() public:
TGButtonGroup TGButtonGroup(TGWindow* parent = 0, const TString& title, UInt_t options = kChildFrame|kVerticalFrame, GContext_t norm = fgDefaultGC(), FontStruct_t font = fgDefaultFontStruct, ULong_t back = fgDefaultFrameBackground) TGButtonGroup TGButtonGroup(TGWindow* parent, UInt_t r, UInt_t c, Int_t s = 0, Int_t h = 0, const TString& title, GContext_t norm = fgDefaultGC(), FontStruct_t font = fgDefaultFontStruct, ULong_t back = fgDefaultFrameBackground) TGButtonGroup TGButtonGroup(TGButtonGroup&) virtual void ~TGButtonGroup() void ButtonClicked() void ButtonPressed() void ButtonReleased() static TClass* Class() void Clicked(Int_t id) virtual void DrawBorder() TGButton* Find(Int_t id) const TGButton* GetButton(Int_t id) const Int_t GetCount() const Int_t GetId(TGButton* button) const void Hide() Int_t Insert(TGButton* button, int id = -1) virtual TClass* IsA() const Bool_t IsBorderDrawn() const Bool_t IsExclusive() const Bool_t IsRadioButtonExclusive() const void Pressed(Int_t id) void ReleaseButtons() void Released(Int_t id) void Remove(TGButton* button) void SetBorderDrawn(Bool_t enable = kTRUE) void SetButton(Int_t id, Bool_t down = kTRUE) void SetExclusive(Bool_t flag = kTRUE) void SetLayoutHints(TGLayoutHints* l, TGButton* button = 0) void SetRadioButtonExclusive(Bool_t flag = kTRUE) void SetTitle(const char* title) void Show() virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members

protected:
Bool_t fExclGroup kTRUE if group is exclusive Bool_t fRadioExcl kTRUE if radio buttons are exclusive Bool_t fDrawBorder kTRUE if border and title are drawn TMap* fMapOfButtons map of button/id pairs in this group


See also

TGHButtonGroup, TGVButtonGroup

Class Description

                                                                      
 The TGButtonGroup widget organizes TGButton widgets in a group.      
                                                                      
 A button group widget makes it easier to deal with groups of buttons.
 A button in a button group is associated with a unique identifer.    
 The button group emits a Clicked() signal with this identifier when  
 the button is clicked. Thus, a button group is an ideal solution     
 when you have several similar buttons and want to connect all their  
 Clicked() signals, for example, to one slot.                         
                                                                      
 An exclusive button group switches off all toggle buttons except     
 the one that was clicked. A button group is by default non-exclusive.
 All radio buttons that are inserted, will be mutually exclusive even 
 if the button group is non-exclusive.                                
                                                                      
                                                                      
 There are two ways of using a button group:                          
                                                                      
    The button group is a parent widget of a number of buttons,       
    i.e. the button group is the parent argument in the button        
    constructor. The buttons are assigned identifiers 1, 2, 3 etc.    
/   in the order they are created or you can specify button id in     
    the button constructor. A TGButtonGroup can display a frame and   
    a title because it inherits from TGGroupFrame.                    
                                                                      
 Example:                                                             
                                                                      
    // vertical frame without border and title                        
    TGVButtonGroup *bg = new TGVButtonGroup(main_frame);              
                                                                      
    // create text button with id=1                                   
    TGTextButton *button1 = new TGTextButton(bg,"some text");         
                                                                      
    // create another text button with id=2                           
    TGTextButton *button2 = new TGTextButton(bg,"another text");      
                                                                      
    // map all buttons                                                
    bg->Show();                                                       
                                                                      
                                                                      
  ButtonGroup Signals:                                                
                                                                      
    Pressed(Int_t id)  -->  is emitted when a button in the group is  
                            pressed down. The id argument is the      
                            button's identifier.                      
    Released(Int_t id) -->  is emitted when a button in the group is  
                            released. The id argument is the button's 
                            identifier.                               
    Clicked(Int_t id)  -->  is emitted when a button in the group is  
                            clicked. The id argument is the button's  
                            identifier.                               
                                                                      
                                                                      
 The TGHButtonGroup widget organizes TGButton widgets in a group      
 with one horizontal row. TGHButtonGroup is a convenience class that  
 offers a thin layer on top of TGButtonGroup. It inherits from        
 TGButtonGroup.                                                       
                                                                      
 The TGVButtonGroup widget organizes TGButton widgets in a group      
 with one vertical column. TGVButtonGroup is a convenience class that 
 offers a thin layer on top of TGButtonGroup. It inherits from        
 TGButtonGroup.                                                       
                                                                      


TGButtonGroup(TGWindow *parent, const TString &title, UInt_t options, GContext_t norm, FontStruct_t font, ULong_t back) : TGGroupFrame(parent, new TGString(title), options, norm, font, back)
 Constructor. Layout 1 row or 1 column.

TGButtonGroup(TGWindow *parent, UInt_t r, UInt_t c, Int_t s, Int_t h, const TString &title, GContext_t norm , FontStruct_t font , ULong_t back) : TGGroupFrame(parent, new TGString(title), 0, norm, font, back)
 Constructor. Layout defined by TGMatrixLayout:
    r = number of rows
    c = number of columns
    s = interval between frames
    h = layout hints

void Init()
 Default init.

~TGButtonGroup()
 Destructor, we do not delete the buttons.

void SetBorderDrawn(Bool_t enable)
 Makes border to be visible/invisible.

void SetExclusive(Bool_t enable)
 Sets the button group to be exclusive if enable is kTRUE,
 or to be non-exclusive if enable is kFALSE.
 An exclusive button group switches off all other toggle buttons when
 one is switched on. This is ideal for groups of radio-buttons
 A non-exclusive group allow many buttons to be switched on at the same
 time. The default setting is kFALSE.

void SetRadioButtonExclusive(Bool_t enable)
 If enable is kTRUE, this button group will treat radio buttons as
 mutually exclusive, and other buttons according to IsExclusive().
 This function is called automatically whenever a TGRadioButton
 is inserted, so you should normally never have to call it.

void SetButton(Int_t id, Bool_t down)
 Sets the button with id to be on/down, and if this is an
 exclusive group, all other button in the group to be off/up.

Int_t Insert(TGButton *button, Int_t id)
 Inserts a button with the identifier id into the button group.
 Returns the button identifier.

 It is not necessary to manually insert buttons that have this button
 group as their parent widget. An exception is when you want custom
 identifiers instead of the default 1, 2, 3 etc.

 The button is assigned the identifier id or an automatically
 generated identifier.  It works as follows: If id > 0, this
 identifier is assigned.  If id == -1 (default), the identifier is
 equal to the number of buttons in the group+1.  If id is any other
 negative integer, for instance -2, a unique identifier (negative
 integer <= -2) is generated.

 Inserting several buttons with id = -1 assigns the identifiers 1,
 2, 3, etc.

void Remove(TGButton *button)
 Removes a button from the button group.

TGButton* Find(Int_t id) const
 Finds and returns a pointer to the button with the specified
 identifier id. Returns null if the button was not found.

Int_t GetId(TGButton *button) const
 Finds and returns the id of the button.
 Returns -1 if the button is not a member of this group.

void ButtonPressed()
 This slot is activated when one of the buttons in the group emits the
 Pressed() signal.

void ButtonReleased()
 This slot is activated when one of the buttons in the group emits the
 Released() signal.

void ButtonClicked()
 This slot is activated when one of the buttons in the group emits the
 Clicked() signal.

void ReleaseButtons()
 This slot is activated when one of the buttons in the
 exclusive group emits the Pressed() signal.

void Show()
 Show group of buttons.

void Hide()
 Hide group of buttons.

void SetTitle(const char* title)
 Set or change title.

void SetLayoutHints(TGLayoutHints *l, TGButton *button)
 Set layout hints.



Inline Functions


                 void Pressed(Int_t id)
                 void Released(Int_t id)
                 void Clicked(Int_t id)
               Bool_t IsExclusive() const
               Bool_t IsRadioButtonExclusive() const
               Bool_t IsBorderDrawn() const
            TGButton* GetButton(Int_t id) const
                Int_t GetCount() const
                 void DrawBorder()
              TClass* Class()
              TClass* IsA() const
                 void ShowMembers(TMemberInspector& insp, char* parent)
                 void Streamer(TBuffer& b)
                 void StreamerNVirtual(TBuffer& b)
        TGButtonGroup TGButtonGroup(TGButtonGroup&)


Author: Valeriy Onuchin & Fons Rademakers 16/10/2000
Last update: root/gui:$Name: $:$Id: TGButtonGroup.cxx,v 1.4 2000/10/22 19:28:58 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.