TToggle


class description - source file - inheritance tree

class TToggle : public TNamed


    public:
TToggle TToggle() TToggle TToggle(const TToggle&) void ~TToggle() static TClass* Class() virtual Long_t GetOffValue() virtual Long_t GetOnValue() virtual Bool_t GetState() virtual Int_t GetValue() virtual TClass* IsA() const virtual Bool_t IsInitialized() virtual void SetOffValue(Long_t lof) virtual void SetOnValue(Long_t lon) virtual void SetState(Bool_t state) virtual void SetToggledObject(TObject* obj, TMethod* anymethod) virtual void SetToggledVariable(Int_t& var) virtual void SetValue(Long_t val) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b) virtual void Toggle()

Data Members

    private:
Bool_t fState Object's state - "a local copy" Long_t fOnValue Value recognized as switched ON (Def=1) Long_t fOffValue Value recognized as switched OFF(Def=0) Long_t fValue Local copy of a value returned by called function protected:
Bool_t fInitialized True if either SetToggledObject or SetToggledVariable called - enables Toggle() method. TObject* fObject The object this Toggle belongs to TMethodCall* fGetter Method to Get a value of fObject; TMethodCall* fSetter Method to Set a value of fObject; Int_t* fTglVariable Alternatively: pointer to an integer value to be Toggled instead of TObjectl

Class Description

                                                                      
 TToggle                                                              
                                                                      
 This class defines toggling facility for both - object's method or   
 variables.                                                           
 Assume that user provides an object with a two-state field , and     
 methods to Get/Set value of this field. This object enables to switch
 values via this method when the only thing you know about the field  
 is the name of the method (or method itself) which sets the field.   
 This facility is required in context Pop-Up menu, when the only      
 information about how to toggle a field is a name of methhod which   
 sets it.                                                             
 This Object may be also used for toggling an integer variable ,      
 which may be important while building universal objects...           
 When user provides a "set-method" of name SetXXX this object tries   
 automaticaly find a matching "get-method" by lookin for a method     
 with name GetXXX, IsXXX or HasXXX for given object.                  
                                                                      


TToggle()
 TToggle default constructor. You have to initialize it before using
 by making a call to SetToggledVariable() or SetToggledObject().

void SetToggledVariable(Int_t &var)
 Initializes object for use with a variable - you pass it via reference
 so it will be modified by Toggle.

Bool_t GetState()
 Returns the state of Toggle according to its current value and
 fOnValue ; Returns true if they match.

void SetState(Bool_t state)
 Sets the value of toggle to fOnValue or fOffValue according to passed
 argument.

void SetValue(Long_t val)
 Sets the value of toggle and modifies its state according to whether
 the value is equal to fOnValue.

void Toggle()
 Toggles the Values and State of this object and connected data!

void SetToggledObject(TObject *obj, TMethod *anymethod)
 Initializes it to toggle an object's datamember using this object's
 method.



Inline Functions


             Bool_t IsInitialized()
               void SetOnValue(Long_t lon)
             Long_t GetOnValue()
               void SetOffValue(Long_t lof)
             Long_t GetOffValue()
              Int_t GetValue()
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)
            TToggle TToggle(const TToggle&)
               void ~TToggle()


Author: Piotr Golonka 30/07/97
Last update: root/meta:$Name: $:$Id: TToggle.cxx,v 1.3 2002/02/21 15:40:08 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.