Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-27 09:00:58

0001 // @(#)root/graf:$Id$
0002 // Author: Rene Brun   16/10/95
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TPave
0013 #define ROOT_TPave
0014 
0015 
0016 #include "TBox.h"
0017 #include "TString.h"
0018 
0019 class TPave : public TBox {
0020 
0021 protected:
0022    Double_t     fX1NDC;         ///< X1 point in NDC coordinates
0023    Double_t     fY1NDC;         ///< Y1 point in NDC coordinates
0024    Double_t     fX2NDC;         ///< X2 point in NDC coordinates
0025    Double_t     fY2NDC;         ///< Y2 point in NDC coordinates
0026    Int_t        fBorderSize;    ///< window box bordersize in pixels
0027    Int_t        fInit;          ///< (=0 if transformation to NDC not yet done)
0028    Int_t        fShadowColor;   ///< Color of the pave's shadow
0029    Double_t     fCornerRadius;  ///< Corner radius in case of option arc
0030    TString      fOption;        ///< Pave style
0031    TString      fName;          ///< Pave name
0032 
0033    TString GetSavePaveArgs(const char *extra_arg = nullptr, Bool_t save_option = kTRUE);
0034 
0035 public:
0036    // TPave status bits
0037    enum {
0038       kNameIsAction = BIT(11)   ///< double clicking on TPave will execute action
0039    };
0040 
0041    TPave();
0042    TPave(Double_t x1, Double_t y1,Double_t x2 ,Double_t y2,
0043          Int_t bordersize=4, Option_t *option="br");
0044    TPave(const TPave &pave);
0045    ~TPave() override;
0046 
0047    TPave &operator=(const TPave &src);
0048 
0049    void           Copy(TObject &pave) const override;
0050    virtual void   ConvertNDCtoPad();
0051    Int_t          DistancetoPrimitive(Int_t px, Int_t py) override;
0052    void           Draw(Option_t *option="") override;
0053    virtual TPave *DrawPave(Double_t x1, Double_t y1,Double_t x2 ,Double_t y2,
0054                           Int_t bordersize=4 ,Option_t *option="br");
0055    void           ExecuteEvent(Int_t event, Int_t px, Int_t py) override;
0056    Int_t          GetBorderSize() const { return fBorderSize;}
0057    Double_t       GetCornerRadius() const {return fCornerRadius;}
0058    const char    *GetName() const override {return fName.Data();}
0059    Option_t      *GetOption() const override {return fOption.Data();}
0060    Int_t          GetShadowColor() const {return fShadowColor;}
0061    Double_t       GetX1NDC() const {return fX1NDC;}
0062    Double_t       GetX2NDC() const {return fX2NDC;}
0063    Double_t       GetY1NDC() const {return fY1NDC;}
0064    Double_t       GetY2NDC() const {return fY2NDC;}
0065    ULong_t        Hash() const override { return fName.Hash(); }
0066    Bool_t         IsSortable() const override { return kTRUE; }
0067    void           ls(Option_t *option="") const override;
0068    void           Paint(Option_t *option="") override;
0069    virtual void   PaintPave(Double_t x1, Double_t y1,Double_t x2 ,Double_t y2,
0070                             Int_t bordersize=4 ,Option_t *option="br");
0071    virtual void   PaintPaveArc(Double_t x1, Double_t y1,Double_t x2 ,Double_t y2,
0072                                Int_t bordersize=4 ,Option_t *option="br");
0073    void           Print(Option_t *option="") const override;
0074    void           SavePrimitive(std::ostream &out, Option_t *option = "") override;
0075    /**
0076     * \brief Sets the border size of the TPave box and shadow
0077     * \param bordersize 0: disable shadow and box, 1: disable only shadow, 2+: tunes the shadow border size
0078     */
0079    virtual void   SetBorderSize(Int_t bordersize=4) {fBorderSize = bordersize;} // *MENU*
0080    virtual void   SetCornerRadius(Double_t rad = 0.2) {fCornerRadius = rad;} // *MENU*
0081    virtual void   SetName(const char *name="") {fName = name;} // *MENU*
0082    virtual void   SetOption(Option_t *option="br") {fOption = option;}
0083    virtual void   SetShadowColor(Int_t color) {fShadowColor=color;} // *MENU*
0084    virtual void   SetX1NDC(Double_t x1) {fX1NDC=x1;}
0085    virtual void   SetX2NDC(Double_t x2) {fX2NDC=x2;}
0086    virtual void   SetY1NDC(Double_t y1) {fY1NDC=y1;}
0087    virtual void   SetY2NDC(Double_t y2) {fY2NDC=y2;}
0088    void   SetX1(Double_t x1) override;
0089    void   SetX2(Double_t x2) override;
0090    void   SetY1(Double_t y1) override;
0091    void   SetY2(Double_t y2) override;
0092 
0093    ClassDefOverride(TPave,3)  //Pave. A box with shadowing
0094 };
0095 
0096 #endif
0097