Example #1
0
void Container::CollectShortcuts(std::map<KeySym,Widget*> &shortcuts)
{
	{
	const std::set<KeySym> &widgetShortcuts = GetShortcuts();
	if (!widgetShortcuts.empty())
		for (std::set<KeySym>::const_iterator j = widgetShortcuts.begin(); j != widgetShortcuts.end(); ++j)
			shortcuts[*j] = this;
	}

	for (auto end = m_widgets.rend(), it = m_widgets.rbegin(); it != end; ++it) {
		const auto widget = *it;
		if (widget->IsContainer())
			static_cast<Container*>(widget.Get())->CollectShortcuts(shortcuts);
		else {
			const std::set<KeySym> &widgetShortcuts = widget->GetShortcuts();
			if (!widgetShortcuts.empty())
				for (std::set<KeySym>::const_iterator j = widgetShortcuts.begin(); j != widgetShortcuts.end(); ++j)
					shortcuts[*j] = widget.Get();
		}
	}
}
Example #2
0
void Container::CollectShortcuts(std::map<KeySym,Widget*> &shortcuts)
{
	{
	const std::set<KeySym> &widgetShortcuts = GetShortcuts();
	if (!widgetShortcuts.empty())
		for (std::set<KeySym>::const_iterator j = widgetShortcuts.begin(); j != widgetShortcuts.end(); ++j)
			shortcuts[*j] = this;
	}

	for (RefCountedPtr<Widget> widget : GetWidgets()) {
		if (widget->IsContainer())
			static_cast<Container*>(widget.Get())->CollectShortcuts(shortcuts);
		else {
			const std::set<KeySym> &widgetShortcuts = widget->GetShortcuts();
			if (!widgetShortcuts.empty())
				for (std::set<KeySym>::const_iterator j = widgetShortcuts.begin(); j != widgetShortcuts.end(); ++j)
					shortcuts[*j] = widget.Get();
		}
	}
}
Example #3
0
void Container::CollectShortcuts(std::map<KeySym,Widget*> &shortcuts)
{
	{
	const std::set<KeySym> &widgetShortcuts = GetShortcuts();
	if (!widgetShortcuts.empty())
		for (std::set<KeySym>::const_iterator j = widgetShortcuts.begin(); j != widgetShortcuts.end(); ++j)
			shortcuts[*j] = this;
	}

	for (WidgetIterator i = WidgetsBegin(); i != WidgetsEnd(); ++i) {
		Widget *widget = (*i).Get();
		if (widget->IsContainer())
			static_cast<Container*>(widget)->CollectShortcuts(shortcuts);
		else {
			const std::set<KeySym> &widgetShortcuts = widget->GetShortcuts();
			if (!widgetShortcuts.empty())
				for (std::set<KeySym>::const_iterator j = widgetShortcuts.begin(); j != widgetShortcuts.end(); ++j)
					shortcuts[*j] = widget;
		}
	}
}