From Piotr Gwiazdowski, "Recently I've been having some trouble with osgWidget::StyleManager
(I'll omit osgWidget namespace from now on). It seems to me that there are some inconsistency in the code. In Style there are multiple applyStyle method overloads, applying style for different widgets/windows built-in in osgWidget. Plus you can do overrides. It's good so far. The problem lies in StyleManager::_applyStyleToObject (which calls _coearceAndApply, which calls _applySpecificStyle, which calls Style::applyStyle). With current implementation Style::applyStyle variants for Input, Window, Frame::Corner, Frame::Border, Window::EmbeddedWindow are never called, because their classes' names are omitted in methods' if/else if block, making it impossible to use styles with most than half of built-in widget/window types. My fix simply adds couple else if blocks, making each Style::applyStyle variant callable. By the way, I think that next update should add Style::applyStyle overload for Table class and add proper className overloads for Input and Window."
This commit is contained in:
@@ -362,6 +362,31 @@ bool StyleManager::_applyStyleToObject(osg::Object* obj, const std::string& styl
|
||||
style,
|
||||
c
|
||||
);
|
||||
else if(!std::string("Window").compare(c)) return _coerceAndApply<Window>(
|
||||
obj,
|
||||
style,
|
||||
c
|
||||
);
|
||||
else if(!std::string("Input").compare(c)) return _coerceAndApply<Input>(
|
||||
obj,
|
||||
style,
|
||||
c
|
||||
);
|
||||
else if(!std::string("Corner").compare(c)) return _coerceAndApply<Frame::Corner>(
|
||||
obj,
|
||||
style,
|
||||
c
|
||||
);
|
||||
else if(!std::string("Border").compare(c)) return _coerceAndApply<Frame::Border>(
|
||||
obj,
|
||||
style,
|
||||
c
|
||||
);
|
||||
else if(!std::string("EmbeddedWindow").compare(c)) return _coerceAndApply<Window::EmbeddedWindow>(
|
||||
obj,
|
||||
style,
|
||||
c
|
||||
);
|
||||
|
||||
|
||||
else warn()
|
||||
|
||||
Reference in New Issue
Block a user