Logo ROOT   6.14/05
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 #include "TGCanvas.h"
26 
27 
28 class TCanvas;
29 class TRootEmbeddedContainer;
30 class TDNDData;
31 
32 class TRootEmbeddedCanvas : public TGCanvas {
33 
35 
36 protected:
37  Int_t fCWinId; // window id used by embedded TCanvas
38  TRootEmbeddedContainer *fCanvasContainer; // container in canvas widget
39  TCanvas *fCanvas; // pointer to TCanvas
40  Bool_t fAutoFit; // canvas container keeps same size as canvas
41  Int_t fButton; // currently pressed button
42  Atom_t *fDNDTypeList; // handles DND types
43 
47  virtual Bool_t HandleContainerKey(Event_t *ev);
51 
52 private:
53  TRootEmbeddedCanvas(const TRootEmbeddedCanvas&); // not implemented
54  TRootEmbeddedCanvas& operator=(const TRootEmbeddedCanvas&); // not implemented
55 
56 public:
57  TRootEmbeddedCanvas(const char *name = 0, const TGWindow *p = 0, UInt_t w = 10,
58  UInt_t h = 10, UInt_t options = kSunkenFrame | kDoubleBorder,
60  virtual ~TRootEmbeddedCanvas();
61 
62  void AdoptCanvas(TCanvas *c);
63  TCanvas *GetCanvas() const { return fCanvas; }
64  Int_t GetCanvasWindowId() const { return fCWinId; }
65  Bool_t GetAutoFit() const { return fAutoFit; }
66  void SetAutoFit(Bool_t fit = kTRUE) { fAutoFit = fit; }
67  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
68 
70  virtual Atom_t HandleDNDPosition(Int_t /*x*/, Int_t /*y*/, Atom_t action,
71  Int_t /*xroot*/, Int_t /*yroot*/);
72  virtual Atom_t HandleDNDEnter(Atom_t * typelist);
73  virtual Bool_t HandleDNDLeave();
74 
75  ClassDef(TRootEmbeddedCanvas,0) //A ROOT TCanvas that can be embedded in a TGFrame
76 };
77 
78 #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)
const char Option_t
Definition: RtypesCore.h:62
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:320
ULong_t Pixel_t
Definition: GuiTypes.h:39
static Pixel_t GetDefaultFrameBackground()
Get default frame background.
Definition: TGFrame.cxx:665
Handle_t Atom_t
Definition: GuiTypes.h:36
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
#define h(i)
Definition: RSha256.hxx:106
The Canvas class.
Definition: TCanvas.h:31
TCanvas * GetCanvas() const
TRootEmbeddedCanvas(const TRootEmbeddedCanvas &)
#define c(i)
Definition: RSha256.hxx:101
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
virtual Bool_t HandleContainerMotion(Event_t *ev)
Handle mouse motion event in the canvas container.