Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveSecondarySelectable.cxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, 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
13#include <ROOT/REveElement.hxx>
14
15using namespace ROOT::Experimental;
16
17/** \class REveSecondarySelectable
18\ingroup REve
19Semi-abstract interface for classes supporting secondary-selection.
20
21Element class that inherits from this, should also implement the
22following virtual methods from REveElement:
23~~~ {.cpp}
24 virtual void UnSelected();
25 virtual void UnHighlighted();
26~~~
27and clear corresponding selection-set from there.
28
29To support tooltips for sub-elements, implement:
30~~~ {.cpp}
31 virtual std::string REveElement::GetHighlightTooltip() const;
32~~~
33and return tooltip for the entry in the fHighlightedSet.
34There should always be a single entry there.
35See EveDigitSet for an example.
36*/
37
38
39////////////////////////////////////////////////////////////////////////////////
40/// Process secondary GL selection and populate selected set accordingly.
41
42/*
43
44void REveSecondarySelectable::ProcessGLSelection(TGLSelectRecord& rec)
45{
46 if (rec.GetHighlight())
47 ProcessGLSelectionInternal(rec, fHighlightedSet);
48 else
49 ProcessGLSelectionInternal(rec, fSelectedSet);
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Process secondary GL selection and populate given set accordingly.
54
55void REveSecondarySelectable::ProcessGLSelectionInternal(TGLSelectRecord& rec,
56 SelectionSet_t& sset)
57{
58 Int_t id = (rec.GetN() > 1) ? (Int_t) rec.GetItem(1) : -1;
59
60 if (sset.empty())
61 {
62 if (id >= 0)
63 {
64 sset.insert(id);
65 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
66 }
67 }
68 else
69 {
70 if (id >= 0)
71 {
72 if (rec.GetMultiple())
73 {
74 if (sset.find(id) == sset.end())
75 {
76 sset.insert(id);
77 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
78 }
79 else
80 {
81 sset.erase(id);
82 if (sset.empty())
83 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
84 else
85 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
86 }
87 }
88 else
89 {
90 if (sset.size() != 1 || sset.find(id) == sset.end())
91 {
92 sset.clear();
93 sset.insert(id);
94 rec.SetSecSelResult(TGLSelectRecord::kModifyingInternalSelection);
95 }
96 }
97 }
98 else
99 {
100 if (!rec.GetMultiple())
101 {
102 sset.clear();
103 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
104 }
105 }
106 }
107
108 if (rec.GetSecSelResult() != TGLSelectRecord::kNone)
109 {
110 dynamic_cast<REveElement*>(this)->StampColorSelection();
111 }
112}
113
114*/