Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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
18 ROOT::Experimental::RDrawable::~RDrawable() {}
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 drawble data itself
41 
42 std::unique_ptr<ROOT::Experimental::RDisplayItem> ROOT::Experimental::RDrawable::Display() const
43 {
44  return std::make_unique<RDrawableDisplayItem>(*this);
45 }