Logo ROOT   6.08/07
Reference Guide
TRootEmbeddedCanvas.h
Go to the documentation of this file.
1 // @(#)root/gui:$Id$
2 // Author: Fons Rademakers 15/07/98
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 
13 #ifndef ROOT_TRootEmbeddedCanvas
14 #define ROOT_TRootEmbeddedCanvas
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TRootEmbeddedCanvas //
19 // //
20 // This class creates a TGCanvas in which a TCanvas is created. Use //
21 // GetCanvas() to get a pointer to the TCanvas. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #ifndef ROOT_TGCanvas
26 #include "TGCanvas.h"
27 #endif
28 
29 
30 class TCanvas;
31 class TRootEmbeddedContainer;
32 class TDNDData;
33 
34 class TRootEmbeddedCanvas : public TGCanvas {
35 
37 
38 protected:
39  Int_t fCWinId; // window id used by embedded TCanvas
40  TRootEmbeddedContainer *fCanvasContainer; // container in canvas widget
41  TCanvas *fCanvas; // pointer to TCanvas
42  Bool_t fAutoFit; // canvas container keeps same size as canvas
43  Int_t fButton; // currently pressed button
44  Atom_t *fDNDTypeList; // handles DND types
45 
49  virtual Bool_t HandleContainerKey(Event_t *ev);
53 
54 private:
55  TRootEmbeddedCanvas(const TRootEmbeddedCanvas&); // not implemented
56  TRootEmbeddedCanvas& operator=(const TRootEmbeddedCanvas&); // not implemented
57 
58 public:
59  TRootEmbeddedCanvas(const char *name = 0, const TGWindow *p = 0, UInt_t w = 10,
60  UInt_t h = 10, UInt_t options = kSunkenFrame | kDoubleBorder,
62  virtual ~TRootEmbeddedCanvas();
63 
64  void AdoptCanvas(TCanvas *c);
65  TCanvas *GetCanvas() const { return fCanvas; }
66  Int_t GetCanvasWindowId() const { return fCWinId; }
67  Bool_t GetAutoFit() const { return fAutoFit; }
68  void SetAutoFit(Bool_t fit = kTRUE) { fAutoFit = fit; }
69  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
70 
72  virtual Atom_t HandleDNDPosition(Int_t /*x*/, Int_t /*y*/, Atom_t action,
73  Int_t /*xroot*/, Int_t /*yroot*/);
74  virtual Atom_t HandleDNDEnter(Atom_t * typelist);
75  virtual Bool_t HandleDNDLeave();
76 
77  ClassDef(TRootEmbeddedCanvas,0) //A ROOT TCanvas that can be embedded in a TGFrame
78 };
79 
80 #endif
virtual Bool_t HandleContainerKey(Event_t *ev)
Handle keyboard events in the canvas container.
Bool_t GetAutoFit() const
virtual Bool_t HandleContainerCrossing(Event_t *ev)
Handle enter/leave events. Only leave is activated at the moment.
TRootEmbeddedCanvas & operator=(const TRootEmbeddedCanvas &)
void SetAutoFit(Bool_t fit=kTRUE)
return c
const char Option_t
Definition: RtypesCore.h:62
TH1 * h
Definition: legend2.C:5
virtual Bool_t HandleDNDLeave()
Handle drag leave events.
virtual Bool_t HandleContainerDoubleClick(Event_t *ev)
Handle mouse button double click events in the canvas container.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual Bool_t HandleContainerConfigure(Event_t *ev)
Handle configure (i.e. resize) event.
void AdoptCanvas(TCanvas *c)
Canvas c is adopted from this embedded canvas.
virtual Atom_t HandleDNDEnter(Atom_t *typelist)
Handle drag enter events.
#define ClassDef(name, id)
Definition: Rtypes.h:254
ULong_t Pixel_t
Definition: GuiTypes.h:41
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
Handle_t Atom_t
Definition: GuiTypes.h:38
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save an embedded canvas as a C++ statement(s) on output stream out.
virtual Bool_t HandleContainerExpose(Event_t *ev)
Handle expose events.
friend class TRootEmbeddedContainer
virtual Bool_t HandleContainerButton(Event_t *ev)
Handle mouse button events in the canvas container.
virtual ~TRootEmbeddedCanvas()
Delete embedded ROOT canvas.
virtual Bool_t HandleDNDDrop(TDNDData *data)
Handle drop events.
virtual Atom_t HandleDNDPosition(Int_t, Int_t, Atom_t action, Int_t, Int_t)
Handle dragging position events.
TRootEmbeddedContainer * fCanvasContainer
unsigned int UInt_t
Definition: RtypesCore.h:42
Int_t GetCanvasWindowId() const
The Canvas class.
Definition: TCanvas.h:41
TCanvas * GetCanvas() const
TRootEmbeddedCanvas(const TRootEmbeddedCanvas &)
const Bool_t kTRUE
Definition: Rtypes.h:91
char name[80]
Definition: TGX11.cxx:109
virtual Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.