FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairEveTransparencyControl.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 
10  #include <TGButton.h> // for TGCheckButton
11  #include <TGNumberEntry.h> // for TGNumberEntry, TGNumberFormat, TGNumbe...
12  #include "FairEventManager.h" // for FairEventManager
13 
14 
15 FairEveTransparencyControl::FairEveTransparencyControl(TGFrame const *parent, char const *label)
16  : TGHorizontalFrame(parent)
17  , fCheck(new TGCheckButton(this, label))
18  , fNumber(new TGNumberEntry(this,
19  80., // initial number
20  6, // digitwidth
21  -1,
22  TGNumberFormat::kNESInteger,
23  TGNumberFormat::kNEANonNegative,
24  TGNumberFormat::kNELLimitMinMax,
25  0, // min
26  100)) // max
27 {
28  SetCleanup(kDeepCleanup);
29 
30  // display
31  AddFrame(fCheck); // takes ownership
32  AddFrame(fNumber); // takes ownership
33 
34  // wire up observers
35  fCheck->Connect("Toggled(Bool_t)", this->ClassName(), this, "Toggled(Bool_t)");
36  fNumber->Connect("ValueSet(Long_t)", this->ClassName(), this, "ValueSet()");
37 }
38 
40 {
41  if (fCheck->IsOn()) {
42  FairEventManager::Instance()->SetTransparency(kFALSE, fNumber->GetIntNumber());
43  } else {
44  FairEventManager::Instance()->SetTransparency(kTRUE, fNumber->GetIntNumber());
45  }
46 }
47 
49 {
50  if (fCheck->IsOn()) {
51  FairEventManager::Instance()->SetTransparency(kFALSE, fNumber->GetIntNumber());
52  } else {
53  FairEventManager::Instance()->SetTransparency(kTRUE, fNumber->GetIntNumber());
54  }
55 }
virtual void SetTransparency(Bool_t use_xml, Int_t trans)
static FairEventManager * Instance()
FairEveTransparencyControl(TGFrame const *parent, char const *label="Transparency")