Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:23

0001 // @(#)root/gui:$Id$
0002 // Author: Fons Rademakers   15/07/98
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2021, 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 
0013 #ifndef ROOT_TRootEmbeddedCanvas
0014 #define ROOT_TRootEmbeddedCanvas
0015 
0016 
0017 #include "TGCanvas.h"
0018 
0019 
0020 class TCanvas;
0021 class TRootEmbeddedContainer;
0022 class TDNDData;
0023 
0024 class TRootEmbeddedCanvas : public TGCanvas {
0025 
0026 friend class TRootEmbeddedContainer;
0027 
0028 protected:
0029    Int_t                   fCWinId;           ///< window id used by embedded TCanvas
0030    TRootEmbeddedContainer *fCanvasContainer;  ///< container in canvas widget
0031    TCanvas                *fCanvas;           ///< pointer to TCanvas
0032    Bool_t                  fAutoFit;          ///< canvas container keeps same size as canvas
0033    Int_t                   fButton;           ///< currently pressed button
0034    Atom_t                 *fDNDTypeList;      ///< handles DND types
0035 
0036    virtual Bool_t HandleContainerButton(Event_t *ev);
0037    virtual Bool_t HandleContainerDoubleClick(Event_t *ev);
0038    virtual Bool_t HandleContainerConfigure(Event_t *ev);
0039    virtual Bool_t HandleContainerKey(Event_t *ev);
0040    virtual Bool_t HandleContainerMotion(Event_t *ev);
0041    virtual Bool_t HandleContainerExpose(Event_t *ev);
0042    virtual Bool_t HandleContainerCrossing(Event_t *ev);
0043 
0044 private:
0045    TRootEmbeddedCanvas(const TRootEmbeddedCanvas&) = delete;
0046    TRootEmbeddedCanvas& operator=(const TRootEmbeddedCanvas&) = delete;
0047 
0048 public:
0049    TRootEmbeddedCanvas(const char *name = nullptr, const TGWindow *p = nullptr, UInt_t w = 10,
0050             UInt_t h = 10, UInt_t options = kSunkenFrame | kDoubleBorder,
0051             Pixel_t back = GetDefaultFrameBackground());
0052    ~TRootEmbeddedCanvas() override;
0053 
0054    void       AdoptCanvas(TCanvas *c);
0055    TCanvas   *GetCanvas() const { return fCanvas; }
0056    Int_t      GetCanvasWindowId() const { return fCWinId; }
0057    Bool_t     GetAutoFit() const { return fAutoFit; }
0058    void       SetAutoFit(Bool_t fit = kTRUE) { fAutoFit = fit; }
0059    void       SavePrimitive(std::ostream &out, Option_t *option = "") override;
0060 
0061    Bool_t     HandleDNDDrop(TDNDData *data) override;
0062    Atom_t     HandleDNDPosition(Int_t /*x*/, Int_t /*y*/, Atom_t action,
0063                                     Int_t /*xroot*/, Int_t /*yroot*/) override;
0064    Atom_t     HandleDNDEnter(Atom_t * typelist) override;
0065    Bool_t     HandleDNDLeave() override;
0066 
0067    ClassDefOverride(TRootEmbeddedCanvas,0)  //A ROOT TCanvas that can be embedded in a TGFrame
0068 };
0069 
0070 #endif