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