Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:48

0001 // @(#)root/gui:$Id$
0002 // Author: Valeriy Onuchin & Fons Rademakers   16/10/2000
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGButtonGroup
0013 #define ROOT_TGButtonGroup
0014 
0015 
0016 #include "TGFrame.h"
0017 
0018 class TGButton;
0019 class TMap;
0020 
0021 class TGButtonGroup : public TGGroupFrame {
0022 
0023 friend class TGButton;
0024 
0025 private:
0026    TGButtonGroup(const TGButtonGroup&) = delete;
0027    TGButtonGroup& operator=(const TGButtonGroup&) = delete;
0028 
0029 protected:
0030    Bool_t  fState;           ///< kTRUE if group is enabled
0031    Bool_t  fExclGroup;       ///< kTRUE if group is exclusive
0032    Bool_t  fRadioExcl;       ///< kTRUE if radio buttons are exclusive
0033    Bool_t  fDrawBorder;      ///< kTRUE if border and title are drawn
0034    TMap   *fMapOfButtons;    ///< map of button/id pairs in this group
0035 
0036    void Init();
0037    void DoRedraw() override;
0038 
0039 public:
0040    TGButtonGroup(const TGWindow *parent = nullptr,
0041                  const TString &title = "",
0042                  UInt_t options = kChildFrame | kVerticalFrame,
0043                  GContext_t norm = GetDefaultGC()(),
0044                  FontStruct_t font = GetDefaultFontStruct(),
0045                  Pixel_t back = GetDefaultFrameBackground());
0046 
0047    TGButtonGroup(const TGWindow *parent,
0048                  UInt_t r, UInt_t c, Int_t s = 0, Int_t h = 0 ,
0049                  const TString &title = "",
0050                  GContext_t norm = GetDefaultGC()(),
0051                  FontStruct_t font = GetDefaultFontStruct(),
0052                  Pixel_t back = GetDefaultFrameBackground());
0053 
0054    ~TGButtonGroup() override;
0055 
0056    virtual void Pressed(Int_t id)  { Emit("Pressed(Int_t)",id); }   //*SIGNAL*
0057    virtual void Released(Int_t id) { Emit("Released(Int_t)",id);}   //*SIGNAL*
0058    virtual void Clicked(Int_t id)  { Emit("Clicked(Int_t)",id); }   //*SIGNAL*
0059 
0060    virtual void ButtonPressed();
0061    virtual void ButtonReleased();
0062    virtual void ButtonClicked();
0063    virtual void ReleaseButtons();
0064 
0065    Bool_t IsEnabled() const { return fState; }
0066    Bool_t IsExclusive() const { return fExclGroup; }
0067    Bool_t IsRadioButtonExclusive() const  { return fRadioExcl; }
0068    Bool_t IsBorderDrawn() const { return fDrawBorder; }
0069    Int_t  GetCount() const;
0070    Int_t  GetId(TGButton *button) const;
0071 
0072    virtual void SetExclusive(Bool_t flag = kTRUE);
0073    virtual void SetRadioButtonExclusive(Bool_t flag = kTRUE);
0074    virtual void SetState(Bool_t state = kTRUE);
0075    virtual void SetBorderDrawn(Bool_t enable = kTRUE);
0076    virtual void SetButton(Int_t id, Bool_t down = kTRUE);
0077    void         SetTitle(TGString *title) override;
0078    void         SetTitle(const char *title) override;
0079 
0080    virtual Int_t     Insert(TGButton *button, int id = -1);
0081    virtual void      Remove(TGButton *button);
0082    virtual TGButton *Find(Int_t id) const;
0083    virtual TGButton *GetButton(Int_t id) const { return Find(id); }
0084    virtual void      Show();
0085    virtual void      Hide();
0086    void              DrawBorder() override;
0087    virtual void      SetLayoutHints(TGLayoutHints *l, TGButton *button = nullptr);
0088    void              SavePrimitive(std::ostream &out, Option_t *option = "") override;
0089 
0090    ClassDefOverride(TGButtonGroup,0)  // Organizes TGButtons in a group
0091 };
0092 
0093 
0094 class TGVButtonGroup : public TGButtonGroup {
0095 
0096 public:
0097    TGVButtonGroup(const TGWindow *parent,
0098                   const TString &title = "",
0099                   GContext_t norm = GetDefaultGC()(),
0100                   FontStruct_t font = GetDefaultFontStruct(),
0101                   Pixel_t back = GetDefaultFrameBackground()) :
0102       TGButtonGroup(parent, title, kChildFrame | kVerticalFrame,
0103                     norm, font, back) {}
0104 
0105    ~TGVButtonGroup() override {}
0106    void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0107 
0108    ClassDefOverride(TGVButtonGroup,0)  // A button group with one vertical column
0109 };
0110 
0111 
0112 class TGHButtonGroup : public TGButtonGroup {
0113 
0114 public:
0115    TGHButtonGroup(const TGWindow *parent,
0116                   const TString &title = "",
0117                   GContext_t norm = GetDefaultGC()(),
0118                   FontStruct_t font = GetDefaultFontStruct(),
0119                   Pixel_t back = GetDefaultFrameBackground()) :
0120       TGButtonGroup(parent, title, kChildFrame | kHorizontalFrame,
0121                     norm, font, back) { }
0122 
0123    ~TGHButtonGroup() override {}
0124    void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0125 
0126    ClassDefOverride(TGHButtonGroup,0)  // A button group with one horizontal row
0127 };
0128 
0129 #endif