//*CMZ :  1.03/09 07/12/97  23.44.40  by  Fons Rademakers
//*-- Author :    Piotr Golonka   31/07/97

//*KEEP,CopyRight,T=C.
/*************************************************************************
 * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
 * Authors: Rene Brun and Fons Rademakers.                               *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/AA_LICENSE.                      *
 * For the list of contributors see $ROOTSYS/AA_CREDITS.                 *
 *************************************************************************/
//*KEND.

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TToggleGroup                                                         //
//                                                                      //
// This class defines check-box facility for TToggle objects            //
// It is used in context menu "selectors" for picking up a value.       //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


//*KEEP,TClass.
#include "TClass.h"
//*KEEP,TMethod.
#include "TMethod.h"
//*KEEP,TToggleGroup,T=C++.
#include "TToggleGroup.h"
//*KEND.

ClassImp(TToggleGroup)

//______________________________________________________________________________
 TToggleGroup::TToggleGroup()
{
   fSelected = 0;
   fToggles  = new TOrdCollection();
}

//______________________________________________________________________________
 TToggleGroup::~TToggleGroup()
{
   // Deletes togglegroup but does not disposes toggled objects!

      delete fToggles;
}

//______________________________________________________________________________
 Int_t TToggleGroup::Add(TToggle *t, Bool_t select)
{
   if (t) {
      fToggles->AddLast(t);
      if (select)
         Select(t);
       return IndexOf(t);
   } else
       return (-1);
}

//______________________________________________________________________________
 Int_t TToggleGroup::InsertAt(TToggle *t, Int_t pos,Bool_t select)
{
   if (t) {
      fToggles->AddAt(t,pos);
      if (select)
         Select(t);
      return IndexOf(t);
   } else
      return (-1);
}

//______________________________________________________________________________
 void TToggleGroup::Select(Int_t idx)
{
   TToggle *sel = At(idx);
   if (sel)
      Select(sel);
}

//______________________________________________________________________________
 void TToggleGroup::Select(TToggle *t)
{
   TIter next(fToggles);
   TToggle *i = 0;

   // Untoggle toggled , and toggle this one if it's present on a list!

   while ((i = (TToggle*)next()))
      if ( i->GetState() || (i==t) )
         i->Toggle();
}

//______________________________________________________________________________
 void TToggleGroup::DeleteAll()
{
   // Disposes of all objects and clears array

    fToggles->Delete();
}


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.