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