00001 // @(#)root/qt:$Id: TQtBrush.h 36066 2010-10-04 19:41:50Z brun $ 00002 // Author: Valeri Fine 21/01/2002 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * Copyright (C) 2002 by Valeri Fine. * 00007 * All rights reserved. * 00008 * * 00009 * For the licensing terms see $ROOTSYS/LICENSE. * 00010 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00011 *************************************************************************/ 00012 00013 #ifndef ROOT_TQtBrush 00014 #define ROOT_TQtBrush 00015 00016 #ifndef __CINT__ 00017 # include <qbrush.h> 00018 # include <qcolor.h> 00019 # include <qpixmap.h> 00020 #else 00021 class QColor; 00022 class QBrush; 00023 class QPixmap; 00024 #endif 00025 00026 #include "Rtypes.h" 00027 #include "Gtypes.h" 00028 00029 class TAttFill; 00030 class TPoint; 00031 00032 // 00033 // TQtBrush creates the QBrush Qt object based on the ROOT "fill" attributes 00034 // 00035 class TQtBrush : public QBrush 00036 { 00037 protected: 00038 QColor fBackground; 00039 int fStyle; 00040 int fFasi; 00041 int fAlpha; // transparency 00042 void SetColorOwn(); 00043 00044 public: 00045 TQtBrush(); 00046 TQtBrush(const TQtBrush &src):QBrush(src) 00047 ,fBackground(src.fBackground) 00048 ,fStyle(src.fStyle) 00049 ,fFasi(src.fFasi) 00050 ,fAlpha(src.fFasi) 00051 { } 00052 TQtBrush(const TAttFill &rootFillAttributes); 00053 virtual ~TQtBrush(); 00054 TQtBrush &operator=(const TAttFill &rootFillAttributes); 00055 void SetFillAttributes(const TAttFill &rootFillAttributes); 00056 Bool_t IsTransparent() const; 00057 void SetStyle(int newStyle=1000){ if (newStyle < 0) fStyle = fFasi = -1; 00058 else SetStyle(newStyle/1000,newStyle%1000); 00059 }; 00060 void SetStyle(int style, int fasi); 00061 void SetColor(const QColor &qtcolor); 00062 void SetColor(Color_t cindex); 00063 const QColor &GetColor() const { return fBackground;} 00064 int GetStyle() const { return 1000*fStyle + fFasi; } 00065 ClassDef(TQtBrush,0); // create QBrush object based on the ROOT "fill" attributes 00066 }; 00067 00068 inline Bool_t TQtBrush::IsTransparent() const 00069 { return fStyle >= 4000 && fStyle <= 4100 ? kTRUE : kFALSE; } 00070 00071 #endif