Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveViewerListEditor.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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 #include "TEveViewerListEditor.h"
13 #include "TEveViewer.h"
14 #include "TEveGValuators.h"
15 
16 /** \class TEveViewerListEditor
17 \ingroup TEve
18 GUI editor for TEveViewerList.
19 */
20 
21 ClassImp(TEveViewerListEditor);
22 
23 ////////////////////////////////////////////////////////////////////////////////
24 /// Constructor.
25 
26 TEveViewerListEditor::TEveViewerListEditor(const TGWindow *p, Int_t width, Int_t height,
27  UInt_t options, Pixel_t back) :
28  TGedFrame(p, width, height, options | kVerticalFrame, back),
29  fM(0),
30 
31  fBrightness(0),
32  fColorSet(0)
33 {
34  MakeTitle("TEveViewerList");
35 
36  Int_t labelW = 63;
37  fBrightness = new TEveGValuator(this, "Brightness:", 90, 0);
38  fBrightness->SetLabelWidth(labelW);
39  fBrightness->SetNELength(4);
40  fBrightness->Build();
41  fBrightness->SetLimits(-2, 2 , 41 , TGNumberFormat::kNESRealTwo);
42  fBrightness->Connect("ValueSet(Double_t)", "TEveViewerListEditor", this, "DoBrightness()");
43  AddFrame(fBrightness, new TGLayoutHints(kLHintsTop, 1, 1, 1, 1));
44 
45  fColorSet = new TGTextButton(this , "Switch ColorSet");
46  fColorSet->Connect("Clicked()", "TEveViewerListEditor", this, "SwitchColorSet()");
47  AddFrame(fColorSet, new TGLayoutHints(kLHintsLeft, 2, 1, 4, 4));
48 }
49 
50 ////////////////////////////////////////////////////////////////////////////////
51 /// Set model object.
52 
53 void TEveViewerListEditor::SetModel(TObject* obj)
54 {
55  fM = dynamic_cast<TEveViewerList*>(obj);
56 
57  fBrightness->SetValue(fM->GetColorBrightness());
58 }
59 
60 ////////////////////////////////////////////////////////////////////////////////
61 /// Slot for brightness.
62 
63 void TEveViewerListEditor::DoBrightness()
64 {
65  fColorSet->SetText(fM->UseLightColorSet()?"DarkColorSet": "Light ColorSet");
66  fM->SetColorBrightness(fBrightness->GetValue());
67 }
68 
69 ////////////////////////////////////////////////////////////////////////////////
70 /// Slot for color set.
71 
72 void TEveViewerListEditor::SwitchColorSet()
73 {
74  fColorSet->SetText(fM->UseLightColorSet()? "Light ColorSet":"Dark ColorSet");
75  fM->SwitchColorSet();
76 }