16#ifndef OSGWIDGET_STYLE_MANAGER
17#define OSGWIDGET_STYLE_MANAGER
36 Style (
const std::string& =
"",
const std::string& =
"");
87 typedef std::map<std::string, osg::ref_ptr<Style> >
Styles;
99 return _applyStyles(widget);
103 return _applyStyles(window);
110 bool _applySpecificStyle(T* t,
const std::string& style)
114 std::istringstream input(_styles[style]->getStyle());
122 if(_styles[style]->applyStyle(t, r))
134 bool _coerceAndApply(
136 const std::string& style,
137 const std::string& className
139 T* t =
dynamic_cast<T*
>(obj);
143 <<
"An attempt was made to coerce Object [" << obj->
getName()
144 <<
"] into a " << className <<
" but failed." << std::endl
150 return _applySpecificStyle(t, style);
154 bool _applyStyleToObject(
osg::Object*,
const std::string&);
160 bool _applyStyles(T* t)
166 <<
"Cannot call StyleManager::applyStyle with a NULL object or coerce object into osg::Object."
175 if(t->getStyle().empty())
178 if(_styles.find(c) == _styles.end())
return false;
180 return _applyStyleToObject(obj, c);
184 if(_styles.find(t->getStyle()) != _styles.end())
return _applyStyleToObject(
Definition osgDB/Input:185
void attach(std::istream *input)
void advanceOverCurrentFieldOrBlock()
bool matchSequence(const char *str)
virtual const char * className() const =0
const std::string & getName() const
Definition Object:213