#include "TMDisplayingFastorProblemAll.h"
#include "TMHistogrammingFastorProblemAll.h"
#include "TMMainFrame.h"
#include "TMControlSPD.h"
#include "SPDMood.h"
#include <TSystem.h>
#include <TCanvas.h>
#include <TGStatusBar.h>

ClassImp(TMDisplayingFastorProblemAll)

//_____________________________________________________________________
TMDisplayingFastorProblemAll::TMDisplayingFastorProblemAll(const Char_t *frameName, const TGWindow *p, UInt_t width, UInt_t height, TMHistogramming *hist, UInt_t id, UInt_t plotNr, UInt_t cloneId) :
  TMDisplaying(frameName,p,width,height,hist,id,plotNr,cloneId,kTRUE)
{
  gClient->GetColorByName("green", green);
  gClient->GetColorByName("gray", gray);

  CreateTopFrame();
  CreateStatusFrame();
  CreateBottomFrame();

  MapSubwindows();
  Resize();
  MapWindow();

  TCanvas *canv = fTheCanvas->GetCanvas();
  fHist->Draw(canv);
  Update();
}
//_____________________________________________________________________
TMDisplayingFastorProblemAll::~TMDisplayingFastorProblemAll() {}
//_____________________________________________________________________
void TMDisplayingFastorProblemAll::CreateStatusFrame() {
  fTotalStatus = new TGStatusBar(this, fWidth, 27, kHorizontalFrame | kFixedSize);
  fTotalStatus->Draw3DCorner(kFALSE);
  AddFrame(fTotalStatus, new TGLayoutHints(kLHintsExpandX, 0,0,0,0));
}
//_____________________________________________________________________
void TMDisplayingFastorProblemAll::Update() {
  ULong_t nrproblems = ((TMHistogrammingFastorProblemAll*)fHist)->GetTotalNumberOfProblems();
  TString totalmsg;
  totalmsg = Form("Total number of events with hits without fastor in some chip: %ld",nrproblems);
  fTotalStatus->SetText(totalmsg.Data(),0);
  TMDisplaying::Update();
}
