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; }
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(); }
void ofxLiteGroup::onSort(int oldPosition, int newPosition){ ofxLiteEventGroupSorted eventArgs(this, &sortedBoxes); eventArgs.oldPosition = oldPosition; eventArgs.newPosition = newPosition; ofNotifyEvent(groupEvents.groupSorted, eventArgs, this); }
void ofxLiteGroup::onSingleSelect(ofxLiteBox* singleSelected){ ofxLiteEventGroupSingleSelected eventArgs(this, singleSelected); ofNotifyEvent(groupEvents.groupSingleSelected, eventArgs, this); }