#ifndef MGEVTDISPLAY_H
#define MGEVTDISPLAY_H

#ifndef MAGIC_H
#include "MAGIC.h"
#endif

#ifndef ROOT_TGFrame
#include <TGFrame.h>
#endif

class TList;
class TCanvas;
class TGLabel;
class TGTextEntry;

class MEvtLoop;
class MParList;
class MTaskList;
class MReadTree;

class MGEvtDisplay : public TGTransientFrame
{
private:
    //
    // GUI stuff
    //
    TGLabel     *fNumOfEvts;
    TGTextEntry *fTxtEvtNr;

    void AddTopFramePart1(TGVerticalFrame *frame,
                          const char *filename,
                          const char *treename);
    void AddTopFramePart2(TGVerticalFrame *frame);
    void AddMidFrame(TGHorizontalFrame *frame);
    void AddLowFrame(TGHorizontalFrame *frame);

    void AddFrames(const char *filename, const char *treename);

    void ReadinEvent(UInt_t iEvt);

protected:
    TList     *fList;
    MEvtLoop  *fEvtLoop;

    TCanvas   *fCanvas;

    TGCompositeFrame *fTab1;
    TGCompositeFrame *fTab2;

    TGVerticalFrame  *fMidFrame;

    MParList  *GetParList() const;
    MTaskList *GetTaskList() const;
    MReadTree *GetReader() const;

    void UpdateEventCounter();
    void UpdateNumOfEvts();

    virtual void UpdateDisplay() = 0;

public:
    MGEvtDisplay(const char *fname, const char *tname,
                 const TGWindow *p, const TGWindow *main,
                 UInt_t w, UInt_t h);

    ~MGEvtDisplay();

    void CloseWindow();

    virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);

    ClassDef(MGEvtDisplay, 0) // base class to display something event by event
};

#endif


