Line | |
---|
1 | //
|
---|
2 | // This File contains the definition of the MGCoordinates-class
|
---|
3 | //
|
---|
4 | // Author: Thomas Bretz
|
---|
5 | // Version: V1.0 (1-8-2000)
|
---|
6 |
|
---|
7 | #include "MGEmbeddedCanvas.h"
|
---|
8 |
|
---|
9 | #include <TList.h>
|
---|
10 | #include <TCanvas.h>
|
---|
11 |
|
---|
12 | ClassImp(MGEmbeddedCanvas);
|
---|
13 |
|
---|
14 | MGEmbeddedCanvas::MGEmbeddedCanvas(const char *name, const TGWindow* p,
|
---|
15 | const UInt_t width, Float_t range)
|
---|
16 | : TRootEmbeddedCanvas(name, p, width+1, width+1, 0/*kRaisedFrame*/),
|
---|
17 | fModified(kFALSE), fWidth(width), fRange(range), fPix(2.*range/width)
|
---|
18 | {
|
---|
19 | fCanvas = GetCanvas();
|
---|
20 |
|
---|
21 | fCanvas->SetFillColor(39); // s. TAttFill
|
---|
22 | fCanvas->Range(-fRange, -fRange, fRange, fRange);
|
---|
23 |
|
---|
24 | fList = new TList;
|
---|
25 | fList->SetOwner();
|
---|
26 | }
|
---|
27 |
|
---|
28 | MGEmbeddedCanvas::~MGEmbeddedCanvas()
|
---|
29 | {
|
---|
30 | delete fList;
|
---|
31 | }
|
---|
32 |
|
---|
33 | void MGEmbeddedCanvas::InitCanvas()
|
---|
34 | {
|
---|
35 | MapSubwindows();
|
---|
36 |
|
---|
37 | Resize(fWidth, fWidth); //GetDefaultSize()); // ???
|
---|
38 | MapWindow();
|
---|
39 |
|
---|
40 | fCanvas->SetEditable(kFALSE);
|
---|
41 | }
|
---|
42 |
|
---|
43 | void MGEmbeddedCanvas::UpdateCanvas()
|
---|
44 | {
|
---|
45 | if (!fModified)
|
---|
46 | return;
|
---|
47 |
|
---|
48 | //
|
---|
49 | // FIXME: Sometimes (if the canvas couldn't be created correctly:
|
---|
50 | // X11 Pixmap error) Update hangs the Gui system.
|
---|
51 | //
|
---|
52 | // Fixed: Using root 3.01/06 and doing the update from within the
|
---|
53 | // mainthread.
|
---|
54 | //
|
---|
55 |
|
---|
56 | fCanvas->Modified();
|
---|
57 | fCanvas->Update();
|
---|
58 |
|
---|
59 | fModified = kFALSE;
|
---|
60 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.