Пример #1
0
void ViewBody::setParent(View const& _p)
{
	if (m_parent != _p)
	{
		auto op = m_parent;
		if (m_parent)
		{
			m_parent->m_children.erase(this);
		}
		m_parent = _p.get();

		if (!m_parent || m_parent->isVisible())
			visibilityChangedRecursive(m_isShown);

		if (_p)
		{
			if (_p->m_children.size())
				m_childIndex = (*prev(_p->m_children.end()))->m_childIndex + 1;
			else
				m_childIndex = 0;
			_p->m_children.insert(this);

			// We can safely kill this safety measure now.
			finalConstructor();
		}

		if (op)
			op->noteLayoutDirty();
		if (m_parent)
			m_parent->noteLayoutDirty();
	}
}
Пример #2
0
typename
sge::image::traits::dim<
	Tag
>::type
size_any(
	View const &_view
)
{
	return
		fcppt::variant::apply_unary(
			[](
				auto const &_src
			)
			{
				return
					sge::image::impl::from_mizuiro_dim(
						_src.size()
					);
			},
			_view.get()
		);
}
Пример #3
0
std::string lb::toString(View const& _v, std::string const& _insert)
{
	std::stringstream out;
	out << (_v->m_isEnabled ? "EN" : "--") << " "
		<< (_v->m_isShown ? "VIS" : "hid") << " "
		<< (_v->m_graphicsInitialized ? "GFX " : "___ ")
		<< "*" << _v->m_layers.size() << " [";
	for (auto const& i: _v->m_layers)
		out << (i.isDirty() ? i.isShown() ? "!" : "_" : i.isShown() ? "*" : "+");
	out	<< (_v->m_visibleLayoutChanged ? " LAY" : " lay") << "] "
		<< _insert
		<< _v->name() << ": "
//		<< _v->minimumSize() << " -> "
//		<< _v->maximumSize() << "  "
		<< _v->geometry() << " (" << _v->m_children.size() << " children)";
	out << (void*)_v.get();
	for (auto const& i: _v->m_misc)
	{
		try	{ int x = boost::any_cast<int>(i.second); out << " " << i.first << "=" << x; } catch (...) {}	// i.first (string) BAD!!!
		try	{ string x = boost::any_cast<string>(i.second); out << " " << i.first << "=" << x; } catch (...) {}
	}
	return out.str();
}