Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TToggleGroup.cxx
Go to the documentation of this file.
1// @(#)root/meta:$Id$
2// Author: Piotr Golonka 31/07/97
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TToggleGroup
13
14This class defines check-box facility for TToggle objects
15It is used in context menu "selectors" for picking up a value.
16*/
17
18
19#include "TToggleGroup.h"
20
22
23////////////////////////////////////////////////////////////////////////////////
24/// Constructor.
25
27{
29}
30
31////////////////////////////////////////////////////////////////////////////////
32/// Copy constructor
33
34TToggleGroup::TToggleGroup(const TToggleGroup& rhs) : TNamed(rhs), fToggles(nullptr)
35{
37}
38
39////////////////////////////////////////////////////////////////////////////////
40/// Assignment operator.
41
43{
44 if (this != &rhs) {
45 delete fToggles;
47 }
48 return *this;
49}
50
51
52////////////////////////////////////////////////////////////////////////////////
53/// Deletes togglegroup but does not disposes toggled objects!
54
56{
57 delete fToggles;
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Add a new toggle.
62
64{
65 if (t) {
66 fToggles->AddLast(t);
67 if (select)
68 Select(t);
69 return IndexOf(t);
70 } else
71 return (-1);
72}
73
74////////////////////////////////////////////////////////////////////////////////
75/// Add a new toggle at a specific position.
76
78{
79 if (t) {
80 fToggles->AddAt(t,pos);
81 if (select)
82 Select(t);
83 return IndexOf(t);
84 } else
85 return (-1);
86}
87
88////////////////////////////////////////////////////////////////////////////////
89/// Select a toggle.
90
92{
93 TToggle *sel = At(idx);
94 if (sel)
95 Select(sel);
96}
97
98////////////////////////////////////////////////////////////////////////////////
99/// Selector a toggle.
100
102{
103 TIter next(fToggles);
104 TToggle *i = nullptr;
105
106 // Untoggle toggled , and toggle this one if it's present on a list!
107
108 while ((i = (TToggle*)next()))
109 if ( i->GetState() || (i==t) )
110 i->Toggle();
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// Disposes of all objects and clears array
115
117{
118 fToggles->Delete();
119}
#define ClassImp(name)
Definition Rtypes.h:382
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
TObject * Clone(const char *newname="") const override
Make a clone of an collection using the Streamer facility.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
Ordered collection.
void AddLast(TObject *obj) override
Add object at the end of the collection.
void AddAt(TObject *obj, Int_t idx) override
Insert object at position idx in the collection.
void Delete(Option_t *option="") override
Remove all objects from the collection AND delete all heap based objects.
This class defines check-box facility for TToggle objects It is used in context menu "selectors" for ...
TOrdCollection * fToggles
virtual Int_t InsertAt(TToggle *t, Int_t pos, Bool_t select=1)
Add a new toggle at a specific position.
virtual TToggle * At(Int_t idx)
virtual void Select(Int_t idx)
Select a toggle.
virtual Int_t Add(TToggle *t, Bool_t select=1)
Add a new toggle.
virtual Int_t IndexOf(TToggle *t)
virtual void DeleteAll()
Disposes of all objects and clears array.
TToggleGroup()
Constructor.
virtual ~TToggleGroup()
Deletes togglegroup but does not disposes toggled objects!
TToggleGroup & operator=(const TToggleGroup &)
Assignment operator.
This class defines toggling facility for both - object's method or variables.
Definition TToggle.h:47
virtual void Toggle()
Toggles the Values and State of this object and connected data!
Definition TToggle.cxx:112
virtual Bool_t GetState()
Returns the state of Toggle according to its current value and fOnValue, returns true if they match.
Definition TToggle.cxx:69