ROOT logo
// @(#)root/gui:$Id: TRootEmbeddedCanvas.h 28464 2009-05-06 12:37:21Z brun $
// Author: Fons Rademakers   15/07/98

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/


#ifndef ROOT_TRootEmbeddedCanvas
#define ROOT_TRootEmbeddedCanvas

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TRootEmbeddedCanvas                                                  //
//                                                                      //
// This class creates a TGCanvas in which a TCanvas is created. Use     //
// GetCanvas() to get a pointer to the TCanvas.                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TGCanvas
#include "TGCanvas.h"
#endif


class TCanvas;
class TRootEmbeddedContainer;
class TDNDData;

class TRootEmbeddedCanvas : public TGCanvas {

friend class TRootEmbeddedContainer;

protected:
   Int_t                   fCWinId;           // window id used by embedded TCanvas
   TRootEmbeddedContainer *fCanvasContainer;  // container in canvas widget
   TCanvas                *fCanvas;           // pointer to TCanvas
   Bool_t                  fAutoFit;          // canvas container keeps same size as canvas
   Int_t                   fButton;           // currently pressed button
   Atom_t                 *fDNDTypeList;      // handles DND types
   
   virtual Bool_t HandleContainerButton(Event_t *ev);
   virtual Bool_t HandleContainerDoubleClick(Event_t *ev);
   virtual Bool_t HandleContainerConfigure(Event_t *ev);
   virtual Bool_t HandleContainerKey(Event_t *ev);
   virtual Bool_t HandleContainerMotion(Event_t *ev);
   virtual Bool_t HandleContainerExpose(Event_t *ev);
   virtual Bool_t HandleContainerCrossing(Event_t *ev);

private:
   TRootEmbeddedCanvas(const TRootEmbeddedCanvas&);              // not implemented
   TRootEmbeddedCanvas& operator=(const TRootEmbeddedCanvas&);   // not implemented

public:
   TRootEmbeddedCanvas(const char *name = 0, const TGWindow *p = 0, UInt_t w = 10,
            UInt_t h = 10, UInt_t options = kSunkenFrame | kDoubleBorder,
            Pixel_t back = GetDefaultFrameBackground());
   virtual ~TRootEmbeddedCanvas();

   void       AdoptCanvas(TCanvas *c);
   TCanvas   *GetCanvas() const { return fCanvas; }
   Int_t      GetCanvasWindowId() const { return fCWinId; }
   Bool_t     GetAutoFit() const { return fAutoFit; }
   void       SetAutoFit(Bool_t fit = kTRUE) { fAutoFit = fit; }
   virtual void SavePrimitive(ostream &out, Option_t *option = "");

   virtual Bool_t HandleDNDDrop(TDNDData *data);
   virtual Atom_t HandleDNDPosition(Int_t /*x*/, Int_t /*y*/, Atom_t action,
                                    Int_t /*xroot*/, Int_t /*yroot*/);
   virtual Atom_t HandleDNDEnter(Atom_t * typelist);
   virtual Bool_t HandleDNDLeave();

   ClassDef(TRootEmbeddedCanvas,0)  //A ROOT TCanvas that can be embedded in a TGFrame
};

#endif
 TRootEmbeddedCanvas.h:1
 TRootEmbeddedCanvas.h:2
 TRootEmbeddedCanvas.h:3
 TRootEmbeddedCanvas.h:4
 TRootEmbeddedCanvas.h:5
 TRootEmbeddedCanvas.h:6
 TRootEmbeddedCanvas.h:7
 TRootEmbeddedCanvas.h:8
 TRootEmbeddedCanvas.h:9
 TRootEmbeddedCanvas.h:10
 TRootEmbeddedCanvas.h:11
 TRootEmbeddedCanvas.h:12
 TRootEmbeddedCanvas.h:13
 TRootEmbeddedCanvas.h:14
 TRootEmbeddedCanvas.h:15
 TRootEmbeddedCanvas.h:16
 TRootEmbeddedCanvas.h:17
 TRootEmbeddedCanvas.h:18
 TRootEmbeddedCanvas.h:19
 TRootEmbeddedCanvas.h:20
 TRootEmbeddedCanvas.h:21
 TRootEmbeddedCanvas.h:22
 TRootEmbeddedCanvas.h:23
 TRootEmbeddedCanvas.h:24
 TRootEmbeddedCanvas.h:25
 TRootEmbeddedCanvas.h:26
 TRootEmbeddedCanvas.h:27
 TRootEmbeddedCanvas.h:28
 TRootEmbeddedCanvas.h:29
 TRootEmbeddedCanvas.h:30
 TRootEmbeddedCanvas.h:31
 TRootEmbeddedCanvas.h:32
 TRootEmbeddedCanvas.h:33
 TRootEmbeddedCanvas.h:34
 TRootEmbeddedCanvas.h:35
 TRootEmbeddedCanvas.h:36
 TRootEmbeddedCanvas.h:37
 TRootEmbeddedCanvas.h:38
 TRootEmbeddedCanvas.h:39
 TRootEmbeddedCanvas.h:40
 TRootEmbeddedCanvas.h:41
 TRootEmbeddedCanvas.h:42
 TRootEmbeddedCanvas.h:43
 TRootEmbeddedCanvas.h:44
 TRootEmbeddedCanvas.h:45
 TRootEmbeddedCanvas.h:46
 TRootEmbeddedCanvas.h:47
 TRootEmbeddedCanvas.h:48
 TRootEmbeddedCanvas.h:49
 TRootEmbeddedCanvas.h:50
 TRootEmbeddedCanvas.h:51
 TRootEmbeddedCanvas.h:52
 TRootEmbeddedCanvas.h:53
 TRootEmbeddedCanvas.h:54
 TRootEmbeddedCanvas.h:55
 TRootEmbeddedCanvas.h:56
 TRootEmbeddedCanvas.h:57
 TRootEmbeddedCanvas.h:58
 TRootEmbeddedCanvas.h:59
 TRootEmbeddedCanvas.h:60
 TRootEmbeddedCanvas.h:61
 TRootEmbeddedCanvas.h:62
 TRootEmbeddedCanvas.h:63
 TRootEmbeddedCanvas.h:64
 TRootEmbeddedCanvas.h:65
 TRootEmbeddedCanvas.h:66
 TRootEmbeddedCanvas.h:67
 TRootEmbeddedCanvas.h:68
 TRootEmbeddedCanvas.h:69
 TRootEmbeddedCanvas.h:70
 TRootEmbeddedCanvas.h:71
 TRootEmbeddedCanvas.h:72
 TRootEmbeddedCanvas.h:73
 TRootEmbeddedCanvas.h:74
 TRootEmbeddedCanvas.h:75
 TRootEmbeddedCanvas.h:76
 TRootEmbeddedCanvas.h:77
 TRootEmbeddedCanvas.h:78
 TRootEmbeddedCanvas.h:79
 TRootEmbeddedCanvas.h:80