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
21
22////////////////////////////////////////////////////////////////////////////////
23/// Constructor.
24
29
30////////////////////////////////////////////////////////////////////////////////
31/// Copy constructor
32
34{
35 fToggles = (TOrdCollection*)rhs.fToggles->Clone();
36}
37
38////////////////////////////////////////////////////////////////////////////////
39/// Assignment operator.
40
42{
43 if (this != &rhs) {
44 delete fToggles;
45 fToggles = (TOrdCollection*)rhs.fToggles->Clone();
46 }
47 return *this;
48}
49
50
51////////////////////////////////////////////////////////////////////////////////
52/// Deletes togglegroup but does not disposes toggled objects!
53
58
59////////////////////////////////////////////////////////////////////////////////
60/// Add a new toggle.
61
63{
64 if (t) {
65 fToggles->AddLast(t);
66 if (select)
67 Select(t);
68 return IndexOf(t);
69 } else
70 return (-1);
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Add a new toggle at a specific position.
75
77{
78 if (t) {
79 fToggles->AddAt(t,pos);
80 if (select)
81 Select(t);
82 return IndexOf(t);
83 } else
84 return (-1);
85}
86
87////////////////////////////////////////////////////////////////////////////////
88/// Select a toggle.
89
91{
92 TToggle *sel = At(idx);
93 if (sel)
94 Select(sel);
95}
96
97////////////////////////////////////////////////////////////////////////////////
98/// Selector a toggle.
99
101{
102 TIter next(fToggles);
103 TToggle *i = nullptr;
104
105 // Untoggle toggled , and toggle this one if it's present on a list!
106
107 while ((i = (TToggle*)next()))
108 if ( i->GetState() || (i==t) )
109 i->Toggle();
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Disposes of all objects and clears array
114
116{
117 fToggles->Delete();
118}
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
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:111
virtual Bool_t GetState()
Returns the state of Toggle according to its current value and fOnValue, returns true if they match.
Definition TToggle.cxx:68