#ifndef ROOT_TQtWidget
#define ROOT_TQtWidget
#include <assert.h>
#include "Rtypes.h"
#include "TCanvas.h"
#ifndef __CINT__
#  include <qwidget.h>
#  if (QT_VERSION > 0x039999)
#     include <QMouseEvent>
#     include <QCustomEvent>
#     include <QShowEvent>
#     include <QFocusEvent>
#     include <QKeyEvent>
#     include <QResizeEvent>
#     include <QEvent>
#     include <QPaintEvent>
#  endif
#  include <qpixmap.h>
#else
  
  class QWidget;
  class QPixmap;
  class QMouseEvent;
  class QFocusEvent;
  class QCustomEvent;
  class QKeyEvent;
  class QShowEvent;
  class QPaintEvent;
  class QResizeEvent;
  class QSize;  
  class QString;
  class QEvent;
  class QSizePolicy;
#endif
  class TApplication;
enum EEventTrackingBits {
       kMousePressEvent       = BIT(0), 
       kMouseMoveEvent        = BIT(1), 
       kMouseReleaseEvent     = BIT(2), 
       kMouseDoubleClickEvent = BIT(3), 
       kKeyPressEvent         = BIT(4), 
       kEnterEvent            = BIT(5), 
       kLeaveEvent            = BIT(6)  
};
class TQtWidgetBuffer : public QPixmap
{
  private:
    QWidget *fWidget;
  public:
    TQtWidgetBuffer(QWidget *w=0) :  QPixmap(), fWidget(w)
    { if (w) resize(w->size()); }
    inline QRect rect () const { return fWidget->rect();}
};
class  TQtWidget : public QWidget {
#ifndef __CINT__   
 Q_OBJECT
#endif
private:
		void operator=(const TQtWidget&);
      TQtWidget(const TQtWidget&);
   
   UInt_t         fBits;       
   enum {
      kBitMask       = 0x00ffffff
   };
public:
   enum {
      kEXITSIZEMOVE,
      kENTERSIZEMOVE,
      kFORCESIZE
   };
#ifndef __CINT__
   TQtWidget( QWidget* parent=0, const char* name=0, Qt::WFlags f=Qt::WStyle_NoBorder, bool embedded=TRUE);
#else
  TQtWidget( QWidget* parent=0);
#endif  
  virtual ~TQtWidget();
  void SetCanvas(TCanvas *c)                 { fCanvas = c;}
  inline TCanvas  *GetCanvas() const         { return (!fIsShadow) ? fCanvas : ((TQtWidget *)parentWidget())->GetCanvas(); }
  inline QPixmap  &GetBuffer()               { return fPixmapID;}
  inline const QPixmap  &GetBuffer()  const  { return fPixmapID;}
  
  virtual void adjustSize();
  void resize (int w, int h);
  void resize (const QSize &size);
  virtual void Erase ();
  bool    IsDoubleBuffered() { return fDoubleBufferOn; }
  void    SetDoubleBuffer(bool on=TRUE);
  virtual void SetSaveFormat(const char *format);
protected:
   friend class TGQt;
   TCanvas         *fCanvas;
   TQtWidgetBuffer  fPixmapID; 
   TQtWidget       *fShadowWidget ; 
   bool        fIsShadow;
   bool        fPaint;
   bool        fSizeChanged;
   bool        fDoubleBufferOn;
   bool        fEmbedded;
   QSize       fSizeHint;
   QWidget    *fWrapper;
   QString     fSaveFormat;
   TQtWidget(TQtWidget &main);
   void SetRootID(QWidget *wrapper);
   QWidget *GetRootID() const;
   virtual void EmitCanvasPainted() { emit CanvasPainted(); }
   TCanvas  *Canvas();
   bool paintFlag(bool mode=TRUE);
   void AdjustBufferSize();
   
   bool paintingActive () const;
   virtual void enterEvent       ( QEvent *      );
#if (QT_VERSION > 0x039999)
   virtual void customEvent      ( QEvent *      );
#else   
   virtual void customEvent      ( QCustomEvent *);
#endif   
   virtual void focusInEvent     ( QFocusEvent * );
   virtual void focusOutEvent    ( QFocusEvent * );
   virtual void leaveEvent       ( QEvent *      );
   virtual void mouseDoubleClickEvent(QMouseEvent* );
   virtual void mouseMoveEvent   ( QMouseEvent * );
   virtual void mousePressEvent  ( QMouseEvent * );
   virtual void mouseReleaseEvent( QMouseEvent * );
   virtual void keyPressEvent    ( QKeyEvent *   );
   virtual void keyReleaseEvent  ( QKeyEvent *   );
   virtual void showEvent        ( QShowEvent *  );
   virtual void paintEvent       ( QPaintEvent * );
   virtual void resizeEvent      ( QResizeEvent *);
   
   virtual void        SetSizeHint (const QSize &size);
public:
   virtual QSize       sizeHint () const;        
   virtual QSize       minimumSizeHint () const; 
   virtual QSizePolicy sizePolicy () const;      
protected:
   
   virtual void exitSizeEvent ();
   virtual void stretchWidget(QResizeEvent *e);
public:
   
   void     SetBit     (UInt_t f, Bool_t set);
   void     SetBit     (UInt_t f);
   void     ResetBit   (UInt_t f);
   Bool_t   TestBit    (UInt_t f) const;
   Int_t    TestBits   (UInt_t f) const;
   void     InvertBit  (UInt_t f);
   void     EmitSignal (UInt_t f);
   void     EmitTestedSignal();
   UInt_t   GetAllBits() const;
   void     SetAllBits(UInt_t f);
   
public:
   
   static TApplication *InitRint(Bool_t prompt=kFALSE, const char *appClassName="QtRint", int *argc=0, char **argv=0,
          void *options = 0, int numOptions = 0, Bool_t noLogo = kFALSE);
   
   
   Int_t             GetEvent()       const;
   Int_t             GetEventX()      const;
   Int_t             GetEventY()      const;
   TObject          *GetSelected()    const;
   Int_t             GetSelectedX()   const;
   Int_t             GetSelectedY()   const;
   TVirtualPad      *GetSelectedPad() const;
   
   void     EnableSignalEvents  (UInt_t f);
   void     DisableSignalEvents (UInt_t f);
   Bool_t   IsSignalEventEnabled(UInt_t f) const;
   
   static TCanvas   *Canvas(TQtWidget *widget);
   static TQtWidget *Canvas(const TCanvas *canvas);
   static TQtWidget *Canvas(Int_t id);
   bool    IsShadow() const { return fIsShadow; }
   TQtWidget *GetShadow() const { return fShadowWidget;}
public slots:
   virtual void cd();
   virtual void cd(int subpadnumber);
   void Disconnect();
   void Refresh();
   virtual bool Save(const QString &fileName) const;
   virtual bool Save(const char    *fileName) const;
   virtual bool Save(const QString &fileName,const char *format,int quality=60) const;
   virtual bool Save(const char    *fileName,const char *format,int quality=60) const;
#ifndef __CINT__
signals:
   
   void CanvasPainted();  
   void Saved(bool ok);   
   void RootEventProcessed(TObject *selected, unsigned int event, TCanvas *c);
#endif
#ifndef Q_MOC_RUN
   ClassDef(TQtWidget,0) 
#endif
};
inline void TQtWidget::AdjustBufferSize()
   {  if (fPixmapID.size() != size() ) fPixmapID.resize(size()); }
inline bool TQtWidget::paintingActive () const {
  return QWidget::paintingActive() || fPixmapID.paintingActive();
}
inline void TQtWidget::SetRootID(QWidget *wrapper) { fWrapper = wrapper;}
inline QWidget *TQtWidget::GetRootID() const { return fWrapper;}
inline Int_t        TQtWidget::GetEvent()       const { return GetCanvas()->GetEvent();       }
inline Int_t        TQtWidget::GetEventX()      const { return GetCanvas()->GetEventX();      }
inline Int_t        TQtWidget::GetEventY()      const { return GetCanvas()->GetEventY();      }
inline TObject     *TQtWidget::GetSelected()    const { return GetCanvas()->GetSelected();    }
inline Int_t        TQtWidget::GetSelectedX()   const { return GetCanvas()->GetSelectedX();   }
inline Int_t        TQtWidget::GetSelectedY()   const { return GetCanvas()->GetSelectedY();   }
inline TVirtualPad *TQtWidget::GetSelectedPad() const { return GetCanvas()->GetSelectedPad(); }
inline UInt_t TQtWidget::GetAllBits() const       { return fBits;                       }
inline void   TQtWidget::SetAllBits(UInt_t f)     { fBits = f;                          }
inline void   TQtWidget::SetBit(UInt_t f)         { fBits |= f & kBitMask;              }
inline void   TQtWidget::ResetBit(UInt_t f)       { fBits &= ~(f & kBitMask);           }
inline Bool_t TQtWidget::TestBit(UInt_t f) const  { return (Bool_t) ((fBits & f) != 0); }
inline Int_t  TQtWidget::TestBits(UInt_t f) const { return (Int_t) (fBits & f);         }
inline void   TQtWidget::InvertBit(UInt_t f)      { fBits ^= f & kBitMask;              }
   
inline void   TQtWidget::EnableSignalEvents  (UInt_t f){ SetBit  (f); }
inline void   TQtWidget::DisableSignalEvents (UInt_t f){ ResetBit(f); }
inline Bool_t TQtWidget::IsSignalEventEnabled(UInt_t f) const { return TestBit (f); }
inline void   TQtWidget::EmitSignal(UInt_t f)  {if (IsSignalEventEnabled(f)) EmitTestedSignal();}
#endif
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.