Ejemplo n.º 1
0
	bool Widget::TabbableWindow_KeyDown(const CEGUI::EventArgs& args)
	{
		auto& keyEventArgs = static_cast<const CEGUI::KeyEventArgs&>(args);
		if (keyEventArgs.scancode == CEGUI::Key::Tab)
		{
			//find the window in the list of tabbable windows
			CEGUI::Window* activeWindow = mMainWindow->getActiveChild();
			if (activeWindow) {
//				WindowMap::iterator I = std::find(mTabOrder.begin(), mTabOrder.end(), activeWindow);
				auto I = mTabOrder.find(activeWindow);
				if (I != mTabOrder.end()) {
					I->second->activate();
					//we don't want to process the event any more, in case something else will try to interpret the tab event to also change the focus
					Input::getSingleton().suppressFurtherHandlingOfCurrentEvent();
					return true;
				}
			}
		} else if (keyEventArgs.scancode == CEGUI::Key::Return)
		{
			//iterate through all enter buttons, and if anyone is visible, activate it
			for (auto& enterButton : mEnterButtons) {
				if (enterButton->isVisible()) {
					CEGUI::Window* window = enterButton;
					WindowEventArgs eventArgs(window);
					window->fireEvent(PushButton::EventClicked, eventArgs, PushButton::EventNamespace);
					break;
				}
			}
		}
		return false;
	}
Ejemplo n.º 2
0
int ICMPClient::ping(SocketAddress& address, int repeat) const
{
	if (repeat <= 0) return 0;

	ICMPSocket icmpSocket(_family);
	SocketAddress returnAddress;

	ICMPEventArgs eventArgs(address, repeat, icmpSocket.dataSize(), icmpSocket.ttl());
	pingBegin.notify(this, eventArgs);

	for (int i = 0; i < repeat; ++i)
	{
		icmpSocket.sendTo(address);
		++eventArgs;

		try
		{
			int t = icmpSocket.receiveFrom(returnAddress);
			eventArgs.setReplyTime(i, t);
			pingReply.notify(this, eventArgs);
		}
		catch (TimeoutException&)
		{
			std::ostringstream os;
			os << address.host().toString() << ": Request timed out.";
			eventArgs.setError(i, os.str());
			pingError.notify(this, eventArgs);
			continue;
		}
		catch (ICMPException& ex)
		{
			std::ostringstream os;
			os << address.host().toString() << ": " << ex.what();
			eventArgs.setError(i, os.str());
			pingError.notify(this, eventArgs);
			continue;
		}
		catch (Exception& ex)
		{
			std::ostringstream os;
			os << ex.displayText();
			eventArgs.setError(i, os.str());
			pingError.notify(this, eventArgs);
			continue;
		}
	}
	pingEnd.notify(this, eventArgs);
	return eventArgs.received();
}
Ejemplo n.º 3
0
void ofxLiteGroup::onSort(int oldPosition, int newPosition){
	ofxLiteEventGroupSorted eventArgs(this, &sortedBoxes);
	eventArgs.oldPosition = oldPosition;
	eventArgs.newPosition = newPosition;
	ofNotifyEvent(groupEvents.groupSorted, eventArgs, this);
}
Ejemplo n.º 4
0
void ofxLiteGroup::onSingleSelect(ofxLiteBox* singleSelected){
	ofxLiteEventGroupSingleSelected eventArgs(this, singleSelected);
	ofNotifyEvent(groupEvents.groupSingleSelected, eventArgs, this);
}