UInt32 ComponentTreeModel::getChildCount(const boost::any& parent) const { try { ComponentContainerRefPtr TheContainer = dynamic_pointer_cast<ComponentContainer>(boost::any_cast<ComponentWeakPtr>(parent)); if(TheContainer != NULL) { return TheContainer->getMFChildren()->getSize(); } else { return 0; } } catch(boost::bad_any_cast &) { return 0; } }
boost::any ComponentTreeModel::getChild(const boost::any& parent, const UInt32& index) const { try { ComponentContainerRefPtr TheContainer = dynamic_pointer_cast<ComponentContainer>(boost::any_cast<ComponentWeakPtr>(parent)); if(TheContainer != NULL && TheContainer->getMFChildren()->size() > index) { return boost::any(ComponentWeakPtr(TheContainer->getChildren(index))); } else { return boost::any(); } } catch(boost::bad_any_cast &) { return boost::any(); } }
UInt32 ComponentTreeModel::getIndexOfChild(const boost::any& parent, const boost::any& child) const { try { ComponentContainerRefPtr ParentContainer = dynamic_pointer_cast<ComponentContainer>(boost::any_cast<ComponentWeakPtr>(parent)); ComponentWeakPtr ChildComponent = boost::any_cast<ComponentWeakPtr>(child); if(ParentContainer != NULL && ChildComponent != NULL) { return ParentContainer->getChildIndex(ChildComponent); } else { return 0; } } catch(boost::bad_any_cast &) { return 0; } }
void CardLayout::previous(const ComponentContainerRefPtr TheContainer) { setCard((getCard()-1)%TheContainer->getMFChildren()->size()); }
void CardLayout::last(const ComponentContainerRefPtr TheContainer) { setCard(TheContainer->getMFChildren()->size()-1); }