00001 // @(#)root/qt:$Id: TQtRootSlot.h 33707 2010-06-02 06:27:34Z brun $ 00002 // Author: Valery Fine 18/01/2007 00003 00004 /**************************************************************************** 00005 ** $Id: TQtRootSlot.h 33707 2010-06-02 06:27:34Z brun $ 00006 ** 00007 ** Copyright (C) 2007 by Valeri Fine. Brookhaven National Laboratory. 00008 ** All rights reserved. 00009 ** 00010 ** This file may be distributed under the terms of the Q Public License 00011 ** as defined by Trolltech AS of Norway and appearing in the file 00012 ** LICENSE.QPL included in the packaging of this file. 00013 ** 00014 *****************************************************************************/ 00015 //________________________________________________________________________ 00016 // 00017 // The TQRootSlot singleton class introduces the global SLOT to invoke 00018 // the ROOT command line from the GUI signals 00019 // Optionally one can execute TApplication::Terminate method directly 00020 // 00021 // It provides a Qt slot to attach the the CINT C++ interpreter 00022 // to any Qt signal 00023 // To execute any C++ statement from the GUI oen should connect 00024 // his/her Qt signal with the Qt slot of the global instance of this class 00025 //________________________________________________________________________ 00026 00027 #ifndef ROOT_TQRootSlot 00028 #define ROOT_TQRootSlot 00029 00030 #ifndef __CINT__ 00031 #include <qobject.h> 00032 #else 00033 class QObject; 00034 #define Q_OBJECT 00035 #define slots 00036 #endif 00037 00038 class QString; 00039 00040 class TQtRootSlot : public QObject { 00041 Q_OBJECT 00042 private: 00043 TQtRootSlot (const TQtRootSlot &); 00044 void operator=(const TQtRootSlot &); 00045 protected: 00046 static TQtRootSlot *fgTQtRootSlot; 00047 TQtRootSlot () {} 00048 public: 00049 static TQtRootSlot *CintSlot(); 00050 virtual ~TQtRootSlot() {} 00051 00052 public slots: 00053 void ProcessLine(const char *); 00054 void ProcessLine(const QString &); 00055 void EndOfLine(); 00056 void Terminate(int status) const; 00057 void Terminate() const; 00058 void TerminateAndQuit() const; 00059 00060 #ifndef __CINT__ 00061 signals: 00062 void Error(int error); 00063 #endif 00064 }; 00065 00066 bool QConnectCint(const QObject *sender, const char *signal); 00067 bool QConnectTerminate( const QObject *sender, const char *signal); 00068 #endif