]>
Commit | Line | Data |
---|---|---|
1 | #include "NLTPolygonSetEditor.h" | |
2 | #include <Reve/NLTPolygonSet.h> | |
3 | ||
4 | #include <TColor.h> | |
5 | ||
6 | #include <TGLabel.h> | |
7 | #include <TGNumberEntry.h> | |
8 | #include <TGColorSelect.h> | |
9 | #include <TGColorDialog.h> | |
10 | ||
11 | using namespace Reve; | |
12 | ||
13 | ||
14 | ClassImp(NLTPolygonSetEditor) | |
15 | ||
16 | NLTPolygonSetEditor::NLTPolygonSetEditor(const TGWindow *p, | |
17 | Int_t width, Int_t height, | |
18 | UInt_t options, Pixel_t back) : | |
19 | TGedFrame(p, width, height, options | kVerticalFrame, back), | |
20 | fPS(0), | |
21 | // fFillColor(0), | |
22 | fLineWidth(0), | |
23 | fLineColor(0) | |
24 | { | |
25 | MakeTitle("NLTPolygonSet"); | |
26 | /* | |
27 | { | |
28 | TGCompositeFrame *f1 = new TGCompositeFrame(this, 80, 20, kHorizontalFrame); | |
29 | TGLabel *l = new TGLabel(f1, "FillColor:"); | |
30 | f1->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1)); | |
31 | fFillColor = new TGColorSelect(f1, 0, -1); | |
32 | fFillColor->Connect("ColorSelected(Pixel_t)", "Reve::NLTPolygonSetEditor", this, "DoFillColor(Pixel_t)"); | |
33 | f1->AddFrame(fFillColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
34 | AddFrame(f1, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0)); | |
35 | } | |
36 | */ | |
37 | ||
38 | { | |
39 | TGCompositeFrame *f = new TGCompositeFrame(this, 80, 20, kHorizontalFrame); | |
40 | ||
41 | TGLabel *l = new TGLabel(f, "LineColor:"); | |
42 | f->AddFrame(l, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 25, 2, 1, 1)); | |
43 | fLineColor = new TGColorSelect(f, 0, -1); | |
44 | fLineColor->Connect("ColorSelected(Pixel_t)", "Reve::NLTPolygonSetEditor", this, "DoLineColor(Pixel_t)"); | |
45 | f->AddFrame(fLineColor, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
46 | ||
47 | fLineWidth = new TGNumberEntry(f, 0., 6, -1, | |
48 | TGNumberFormat::kNESRealOne, TGNumberFormat::kNEAPositive, | |
49 | TGNumberFormat::kNELLimitMinMax, 0.1, 2000.0); | |
50 | fLineWidth->GetNumberEntry()->SetToolTipText("Line witdth of outline."); | |
51 | fLineWidth->Connect("ValueSet(Long_t)", "Reve::NLTPolygonSetEditor", this, "DoLineWidth()"); | |
52 | f->AddFrame(fLineWidth, new TGLayoutHints(kLHintsLeft, 1, 1, 1, 1)); | |
53 | ||
54 | AddFrame(f, new TGLayoutHints(kLHintsTop, 1, 1, 0, 0)); | |
55 | } | |
56 | } | |
57 | ||
58 | ||
59 | /**************************************************************************/ | |
60 | NLTPolygonSetEditor::~NLTPolygonSetEditor() | |
61 | {} | |
62 | ||
63 | /**************************************************************************/ | |
64 | /* | |
65 | void NLTPolygonSetEditor::DoFillColor(Pixel_t pixel) | |
66 | { | |
67 | printf("do fill color \n"); | |
68 | fPS->SetFillColor(pixel); | |
69 | Update(); | |
70 | } | |
71 | */ | |
72 | /**************************************************************************/ | |
73 | void NLTPolygonSetEditor::DoLineWidth() | |
74 | { | |
75 | // Double_t lw = fLineWidth->GetNumber(); | |
76 | //fPS->SetLineWidth(lw); | |
77 | fPS->fLineWidth = fLineWidth->GetNumber(); | |
78 | Update(); | |
79 | } | |
80 | ||
81 | /**************************************************************************/ | |
82 | void NLTPolygonSetEditor::DoLineColor(Pixel_t pixel) | |
83 | { | |
84 | fPS->SetLineColor(pixel); | |
85 | Update(); | |
86 | } | |
87 | ||
88 | /**************************************************************************/ | |
89 | ||
90 | void NLTPolygonSetEditor::SetModel(TObject* obj) | |
91 | { | |
92 | fPS = dynamic_cast<NLTPolygonSet*>(obj); | |
93 | // fFillColor->SetColor(TColor::Number2Pixel(fPS->GetFillColor()), kFALSE); | |
94 | fLineWidth->SetNumber(fPS->fLineWidth); | |
95 | fLineColor->SetColor(TColor::Number2Pixel(fPS->GetLineColor()), kFALSE); | |
96 | } |