00001 00002 /////////////////////////////////////////////////////////////////// 00003 // Animated Text with cool wave effect. 00004 // 00005 // ROOT implementation of the hello world example borrowed 00006 // from the Qt hello world example. 00007 // 00008 // To run this example do the following: 00009 // $ root 00010 // root [0] gSystem.Load("Hello") 00011 // root [1] Hello h 00012 // <enjoy> 00013 // root [2] .q 00014 // 00015 // Other ROOT fun examples: Tetris, Aclock ... 00016 /////////////////////////////////////////////////////////////////// 00017 00018 #ifndef HELLO_H 00019 #define HELLO_H 00020 00021 #include <TTimer.h> 00022 #include <TCanvas.h> 00023 #include <TText.h> 00024 00025 class TList; 00026 00027 class TChar : public TText { 00028 00029 public: 00030 TChar(char ch='\0',Coord_t x=0, Coord_t y=0); 00031 virtual ~TChar() { } 00032 00033 char GetChar() { 00034 char *tmp; 00035 tmp = (char*)GetTitle(); 00036 return GetTitle()[0]; 00037 } 00038 00039 virtual Float_t GetWidth(); 00040 }; 00041 00042 00043 class Hello : public TTimer { 00044 00045 private: 00046 TList *fList; // list of characters 00047 UInt_t fI; // "infinit" counter 00048 TPad *fPad; // pad where this text is drawn 00049 00050 public: 00051 Hello(const char *text = "Hello, World!"); 00052 virtual ~Hello(); 00053 00054 Bool_t Notify(); 00055 void ExecuteEvent(Int_t event, Int_t px, Int_t py); 00056 Int_t DistancetoPrimitive(Int_t, Int_t) { return 0; } 00057 00058 Float_t GetWidth(); 00059 void Paint(Option_t* option=""); 00060 void Print(Option_t * = "") const; 00061 void ls(Option_t * = "") const; 00062 TList *GetList() { return fList; } 00063 00064 ClassDef(Hello,0) // animated text with cool wave effect 00065 }; 00066 00067 #endif