Logo ROOT   master
Reference Guide
RDrawable.cxx
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) 1995-2015, Rene Brun and Fons Rademakers. *
3  * All rights reserved. *
4  * *
5  * For the licensing terms see $ROOTSYS/LICENSE. *
6  * For the list of contributors see $ROOTSYS/README/CREDITS. *
7  *************************************************************************/
8 
9 #include "ROOT/RDrawable.hxx"
10 #include "ROOT/RDisplayItem.hxx"
11 
12 
13 #include <cassert>
14 #include <string>
15 
16 
17 // pin vtable
19 
20 void ROOT::Experimental::RDrawable::Execute(const std::string &)
21 {
22  assert(false && "Did not expect a menu item to be invoked!");
23 }
24 
25 /////////////////////////////////////////////////////////////////////////////
26 /// Preliminary method which checks if drawable matches with given selector
27 /// Following selector are allowed:
28 /// "type" or "#id" or ".class_name"
29 /// Here type is drawable kind like 'rect' or 'pad'
30 /// id is drawable identifier, specified with RDrawable::SetId() method
31 /// class_name is drawable class name, specified with RDrawable::SetCssClass() method
32 
33 bool ROOT::Experimental::RDrawable::MatchSelector(const std::string &selector) const
34 {
35  return (selector == fCssType) || (!fCssClass.empty() && (selector == std::string(".") + fCssClass)) || (!fId.empty() && (selector == std::string("#") + fId));
36 }
37 
38 /////////////////////////////////////////////////////////////////////////////
39 /// Creates display item for drawable
40 /// By default item contains drawable data itself
41 
42 std::unique_ptr<ROOT::Experimental::RDisplayItem> ROOT::Experimental::RDrawable::Display() const
43 {
44  return std::make_unique<RDrawableDisplayItem>(*this);
45 }
virtual std::unique_ptr< RDisplayItem > Display() const
Creates display item for drawable By default item contains drawable data itself.
Definition: RDrawable.cxx:42
virtual void Execute(const std::string &)
Definition: RDrawable.cxx:20
bool MatchSelector(const std::string &selector) const
Preliminary method which checks if drawable matches with given selector Following selector are allowe...
Definition: RDrawable.cxx:33