//*CMZ :  2.23/02 03/09/99  12.24.28  by  Rene Brun
//*CMZ :  2.00/11 08/08/98  22.36.40  by  Rene Brun
//*CMZ :  1.03/09 10/12/97  09.34.25  by  Rene Brun
//*-- Author :    Rene Brun   03/07/96

//*KEEP,CopyRight,T=C.
/*************************************************************************
 * Copyright(c) 1995-1999, The ROOT System, All rights reserved.         *
 * Authors: Rene Brun and Fons Rademakers.                               *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/AA_LICENSE.                      *
 * For the list of contributors see $ROOTSYS/AA_CREDITS.                 *
 *************************************************************************/
//*KEND.

//*KEEP,TROOT.
#include "TROOT.h"
//*KEEP,TAttLineCanvas,T=C++.
#include "TAttLineCanvas.h"
//*KEEP,TGroupButton,T=C++.
#include "TGroupButton.h"
//*KEEP,TLine.
#include "TLine.h"
//*KEEP,TText.
#include "TText.h"
//*KEND.

ClassImp(TAttLineCanvas)

//______________________________________________________________________________
//
//   An AttLineCanvas is a TDialogCanvas specialized to set line attributes.
//
/*

*/
//
//

//______________________________________________________________________________
 TAttLineCanvas::TAttLineCanvas() : TDialogCanvas()
{
//*-*-*-*-*-*-*-*-*-*-*-*AttLineCanvas default constructor*-*-*-*-*-*-*-*-*-*-*
//*-*                    ================================

}

//_____________________________________________________________________________
 TAttLineCanvas::TAttLineCanvas(const Text_t *name, const Text_t *title, UInt_t ww, UInt_t wh)
             : TDialogCanvas(name,title,ww,wh)
{
//*-*-*-*-*-*-*-*-*-*-*-*AttLineCanvas constructor*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-*                    ========================

   TVirtualPad *padsav = gPad;

   BuildStandardButtons();

//*-*- Line styles choice buttons
   TGroupButton *test1 = 0;
   TLine *line;
   Float_t xlow, ylow, wpad, hpad;
   Int_t i,j;
   xlow = 0.05;
   wpad = 0.9;
   hpad = 0.042;
   char command[64];
   for (i=0;i<4;i++) {
      ylow = 0.13 + i*hpad;
      sprintf(command,"SetLineStyle(%d)",i+1);
      test1 = new TGroupButton("Style","",command,xlow, ylow, xlow+wpad, ylow+0.8*hpad);
      if (i == 0) test1->SetBorderMode(-1);
      test1->SetBorderSize(1);
      test1->Draw();
      test1->cd();
      line = new TLine(0.05, 0.5, 0.95,0.5);
      line->SetLineColor(1);
      line->SetLineStyle(i+1);
      line->Draw();
      cd();
   }

//*-*-  Line Width choice buttons
   wpad = 0.19;
   hpad = 0.085;
   Int_t number = 0;
   for (j=0;j<3;j++) {
      ylow = 0.32 + j*hpad;
      for (i=0;i<5;i++) {
         number++;
         xlow = 0.05 + i*wpad;
         sprintf(command,"SetLineWidth(%d)",number);
         test1 = new TGroupButton("Width","",command,xlow, ylow, xlow+0.9*wpad, ylow+0.9*hpad);
         if (number == 1) test1->SetBorderMode(-1);
         test1->SetFillColor(18);
         test1->SetBorderSize(2);
         test1->Draw();
         test1->cd();
         line = new TLine(0.5, 0.1, 0.5,0.9);
         line->SetLineColor(1);
         line->SetLineWidth(number);
         line->Draw();
         cd();
      }
   }

//*-* draw colortable pads
   test1->DisplayColorTable("SetLineColor",0.05, 0.60, 0.90, 0.38);
   Modified(kTRUE);
   Update();

   padsav->cd();
}

//______________________________________________________________________________
 TAttLineCanvas::~TAttLineCanvas()
{
//*-*-*-*-*-*-*-*-*-*-*AttLineCanvas default destructor*-*-*-*-*-*-*-*-*-*-*-*
//*-*                  ===============================
}

//______________________________________________________________________________
 void TAttLineCanvas::UpdateLineAttributes(Int_t col, Int_t sty, Int_t width)
{
//*-*-*-*-*-*-*-*-*-*-*Update object attributes*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-*                  ========================

   TIter next(GetListOfPrimitives());
   TGroupButton *button;
   char cmd[64];
   fRefObject = gROOT->GetSelectedPrimitive();
   fRefPad    = (TPad*)gROOT->GetSelectedPad();
   if (fRefObject) {
      sprintf(cmd,"attline: %s",fRefObject->GetName());
      SetTitle(cmd);
   }
   TObject *obj;
   while ((obj = next())) {
      if (!obj->InheritsFrom(TGroupButton::Class())) continue;
      button = (TGroupButton*)obj;
      if (button->GetBorderMode() < 0) {
         button->SetBorderMode(1);
         button->Modified();
      }
      sprintf(cmd,"SetLineColor(%d)",col);
      if (!strcmp(button->GetTitle(),cmd)) button->SetBorderMode(-1);
      sprintf(cmd,"SetLineStyle(%d)",sty);
      if (!strcmp(button->GetTitle(),cmd)) button->SetBorderMode(-1);
      sprintf(cmd,"SetLineWidth(%d)",width);
      if (!strcmp(button->GetTitle(),cmd)) button->SetBorderMode(-1);
      if (button->GetBorderMode() < 0) {
         button->Modified();
      }
   }
   Update();
}


ROOT page - Class index - Top of the page

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.