Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:31

0001 #ifndef Fireworks_Core_FWDisplayProperties_h
0002 #define Fireworks_Core_FWDisplayProperties_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Core
0006 // Class  :     FWDisplayProperties
0007 //
0008 /**\class FWDisplayProperties FWDisplayProperties.h Fireworks/Core/interface/FWDisplayProperties.h
0009 
0010    Description: <one line class summary>
0011 
0012    Usage:
0013     <usage>
0014 
0015  */
0016 //
0017 // Original Author:
0018 //         Created:  Thu Jan  3 14:22:36 EST 2008
0019 //
0020 
0021 // system include files
0022 #include "Rtypes.h"
0023 
0024 // user include files
0025 
0026 // forward declarations
0027 
0028 class FWDisplayProperties {
0029 public:
0030   static const FWDisplayProperties defaultProperties;
0031   /** Note that I removed the default values to make sure that properties do
0032        not get copied around via the not so uncommon paradigm:
0033        
0034        FWDisplayProperties new(old.color(), old.isVisible());
0035        
0036        or similar which has the drawback of not carring over transparency 
0037        information.
0038        
0039        In general it's a good idea to have a copy and modify approach when
0040        changing updating only one value.
0041      */
0042   FWDisplayProperties(Color_t iColor, bool isVisible, Char_t transparency);
0043   //virtual ~FWDisplayProperties();
0044 
0045   // ---------- const member functions ---------------------
0046 
0047   Color_t color() const { return m_color; }
0048 
0049   Char_t transparency() const { return m_transparency; }
0050 
0051   bool isVisible() const { return m_isVisible; }
0052 
0053   bool operator==(const FWDisplayProperties& iRHS) const {
0054     return m_color == iRHS.m_color && m_isVisible == iRHS.m_isVisible && m_transparency == iRHS.m_transparency;
0055   }
0056   bool operator!=(const FWDisplayProperties& iRHS) const { return not(*this == iRHS); }
0057 
0058   // ---------- static member functions --------------------
0059 
0060   // ---------- member functions ---------------------------
0061 
0062   void setColor(Color_t iColor) { m_color = iColor; }
0063 
0064   /** Notice that transparency in root is in the range [0, 100] */
0065   void setTransparency(Char_t transparency) {
0066     transparency = transparency < 0 ? 0 : transparency;
0067     transparency = transparency > 100 ? 100 : transparency;
0068     m_transparency = transparency;
0069   }
0070 
0071   void setIsVisible(bool iSet) { m_isVisible = iSet; }
0072 
0073 private:
0074   //FWDisplayProperties(const FWDisplayProperties&); // stop default
0075 
0076   //const FWDisplayProperties& operator=(const FWDisplayProperties&); // stop default
0077 
0078   // ---------- member data --------------------------------
0079 
0080   Color_t m_color;
0081   bool m_isVisible;
0082   Char_t m_transparency;
0083 };
0084 
0085 #endif