本文整理汇总了C++中IEvent类的典型用法代码示例。如果您正苦于以下问题:C++ IEvent类的具体用法?C++ IEvent怎么用?C++ IEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
// Return TRUE if the contact never received any message (which means the contact may need an invitation)
// Return FALSE if there is at least one message received (which means both parties have communicated successfully)
BOOL
TContact::Contact_FIsInvitationRecommended()
{
if ((m_uFlagsContact & FC_kfContactNeedsInvitation) == 0)
return FALSE;
if (m_paVaultEvents != NULL)
{
// Search the entire Chat Log to find any message received. Of course this is not the most optimal code, however the Chat Log should be rather short if there has been no communication between the two parties.
IEvent ** ppEventStop;
IEvent ** ppEvent = m_paVaultEvents->m_arraypaEvents.PrgpGetEventsStop(OUT &ppEventStop);
while (ppEvent != ppEventStop)
{
IEvent * pEvent = *--ppEventStop;
AssertValidEvent(pEvent);
EEventClass eEventClass = pEvent->EGetEventClass();
if ((eEventClass == eEventClass_eMessageTextSent && pEvent->Event_FHasCompleted()) || // If the message was sent successfully (with a confirmation receipt), then there is no need to send an invitation because the remote contact has the JID of the account
(eEventClass & eEventClass_kfReceivedByRemoteClient)) // Anything received by the remote client means there has been a communication between the two contacts, and therefore there is no need to send an invitaiton
{
m_uFlagsContact &= ~FC_kfContactNeedsInvitation; // Remove the invitation flag
return FALSE;
}
} // while
} // if
return TRUE;
}
示例2: while
void CEventManager::ProcessEvents()
{
while(!m_cEventList.empty())
{
IEvent* pEvent = *m_cEventList.begin();
// Remove from the list now to avoid problems with sorting new events
m_cEventList.erase(m_cEventList.begin());
// Make range of listeners for the current event
pair<EventIter, EventIter> range;
range = m_cListeners.equal_range(pEvent->GetEventID());
for(EventIter cMapIter = range.first; cMapIter != range.second;
cMapIter++)
{
// Call the callback function of each listener listening for this
// event
//if(cMapIter->second->m_pcListener->GetIsActive())
{
cMapIter->second->m_pfCallback(pEvent,
cMapIter->second->m_pcListener);
}
}
// clean up the event's memory
MMDELEVENT(pEvent);
// Unregister any events
UnregisterEvents();
}
}
示例3: enableEvent
void enableEvent(const std::string& eventName) {
IEvent* event = findEvent(eventName);
if (event != NULL) {
event->setEnabled(true);
}
}
示例4: Update
int Ncurses::run(IEvent &eventManager)
{
int pb;
Update();
timeout(_timeout);
while ((pb = getch()) != 'q' || pb != KEY_ESC)
{
switch (pb)
{
case KEY_LEFT :
{
eventManager.KeyLeft();
break;
}
case KEY_RIGHT :
{
eventManager.KeyRight();
break;
}
case KEY_ESC :
{
eventManager.KeyEschap();
break;
}
}
eventManager.ChooseEvent();
}
return (1);
}
示例5: ChGetCambrianActionFromUrl
void
WChatLog::SL_HyperlinkMouseHovering(const QUrl & url)
{
CStr strTip;
QString sUrl = url.toString();
CStr strUrl = sUrl; // Convert the URL to UTF-8
PSZUC pszUrl = strUrl;
if (FIsSchemeCambrian(pszUrl))
{
const CHS chCambrianAction = ChGetCambrianActionFromUrl(pszUrl);
if (chCambrianAction == d_chCambrianAction_None)
{
TIMESTAMP tsEventID;
PSZUC pszAction = Timestamp_PchDecodeFromBase64Url(OUT &tsEventID, pszUrl + 2);
Assert(pszAction[0] == d_chSchemeCambrianActionSeparator);
IEvent * pEvent = m_pContactOrGroup->Vault_PFindEventByID(tsEventID);
if (pEvent != NULL)
pEvent->HyperlinkGetTooltipText(pszAction + 1, IOUT &strTip);
else
MessageLog_AppendTextFormatSev(eSeverityErrorWarning, "WChatLog::SL_HyperlinkMouseHovering() - Unable to find matching tsEventID $t from hyperlink $s\n", tsEventID, pszUrl);
} // if
sUrl = strTip.ToQString();
}
QToolTip::showText(QCursor::pos(), sUrl, this);
} // SL_HyperlinkMouseHovering()
示例6: dispatchHandlerEvent
Boolean DetailsTreeHandler :: dispatchHandlerEvent ( IEvent& evt)
{
if(evt.eventId() == WM_PRESPARAMCHANGED)
{
if(evt.parameter1() == PP_FONTNAMESIZE ||
evt.parameter1() == PP_FONTHANDLE)
return fontChanged(evt);
}
return Inherited::dispatchHandlerEvent(evt);
}
示例7: GTK_WIDGET
/* Checks the passed xmlNode for a recognized item (ToolButton, ToggleToolButton, Separator)
* Returns the widget or NULL if nothing useful is found
*/
GtkWidget* ToolbarCreator::createToolItem(xml::Node& node, GtkToolbar* toolbar) {
const std::string nodeName = node.getName();
GtkWidget* toolItem;
if (nodeName == "separator") {
toolItem = GTK_WIDGET(gtk_separator_tool_item_new());
}
else if (nodeName == "toolbutton" || nodeName == "toggletoolbutton") {
// Found a button, load the values that are shared by both types
const std::string name = node.getAttributeValue("name");
const std::string icon = node.getAttributeValue("icon");
const std::string tooltip = _(node.getAttributeValue("tooltip").c_str());
const std::string action = node.getAttributeValue("action");
if (nodeName == "toolbutton") {
// Create a new GtkToolButton and assign the right callback
toolItem = GTK_WIDGET(gtk_tool_button_new(NULL, name.c_str()));
}
else {
// Create a new GtkToggleToolButton and assign the right callback
toolItem = GTK_WIDGET(gtk_toggle_tool_button_new());
}
IEvent* event = GlobalEventManager().findEvent(action);
if (event != NULL) {
event->connectWidget(GTK_WIDGET(toolItem));
// Tell the event to update the state of this button
event->updateWidgets();
} else {
globalErrorStream() << "ToolbarCreator: Failed to lookup command " << action << "\n";
}
// Set the tooltip, if not empty
if (!tooltip.empty()) {
gtk_tooltips_set_tip(_tooltips, GTK_WIDGET(toolItem), tooltip.c_str(), "");
//gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolItem), _tooltips, tooltip.c_str(), "");
}
// Load and assign the icon, if specified
if (icon != "") {
GtkWidget* image = gtk_image_new_from_pixbuf(gtkutil::getLocalPixbufWithMask(icon));
gtk_widget_show(image);
gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(toolItem), image);
}
}
else {
return NULL;
}
gtk_widget_show(toolItem);
return toolItem;
}
示例8: dispatchHandlerEvent
virtual Boolean
dispatchHandlerEvent ( IEvent &event )
{
Boolean stopProcessing = false;
if (event.eventId() == 0x000F && // WM_SETFOCUS
event.parameter2().number1()) // gaining focus
{
stopProcessing = true;
}
return stopProcessing;
}
示例9: while
void DummyDevDA::executeOutputLoop() {
this->outputLoopRunning = true;
while (outputLoopRunning) {
this->outputEventQueue.waitForData();
IEvent * event = this->outputEventQueue.pop();
if (event) {
cout << "DummyDevDA: " << event->getEventTypeID() << " " << event << endl;
//delete event;
}
}
}
示例10: DoEvent
void EventManager::DoEvent(typeEventID theEventID,void* theContext)
{
std::map<const typeEventID, IEvent*>::const_iterator anIter =
mList.find(theEventID);
if (anIter != mList.end())
{
// Get the event to execute
IEvent* anEvent = anIter->second;
// Now call DoEvent for this event with theContext provided
anEvent->DoEvent(theContext);
}
}
示例11: epoll_wait
int SyncReactor::epollDispatch()
{
int ret = 0;
int num = epoll_wait(_epfd, _epev, _maxEvents, 3000);
Log::DEBUG("wait done %d", num);
for(int i = 0; i < num; i++)
{
IEvent *ev = static_cast<IEvent *>(_epev[i].data.ptr);
int events = 0;
if((_epev[i].events & EPOLLHUP) ||
_epev[i].events & EPOLLERR)
{
Log::WARN("EPOLLHUP | EPOLLERR event happen in %d", _epev[i].data.fd);
events = events | IEvent::CLOSESOCK;
}
if(_epev[i].events & EPOLLIN)
events |= IEvent::IOREADABLE;
if(_epev[i].events & EPOLLOUT)
events |= IEvent::IOWRITEABLE;
if(ev->result() & IEvent::ACCEPT)
events |= IEvent::ACCEPT;
ev->setResult(events);
if(events & IEvent::CLOSESOCK)
{
delete ev;
continue;
}
if(events & IEvent::ACCEPT)
{
extEvent(ev);
continue;
}
ret = epoll_ctl(_epfd, EPOLL_CTL_DEL, ev->handle(), NULL);
if(ret < 0)
{
Log::WARN("del event fd from epoll error, %d : %s", ev->handle(), strerror(errno));
}
if(_extReactor != NULL)
_extReactor->post(ev);
else
extEvent(ev);
}
return num;
}
示例12: main
void MyMain::main (IEvent & event) // Do in this effective main function whatever you want!
{
IString s; // Two values we want the user to input.
double d;
switch (event.parameter1()) // Use this to define the different parts of your program
{
case cmdStartUp: // This part will be run when the program first comes up.
cout = text.stream(); // Assign the KrTextOutput object's stream to cout
cout.setf (ios::unitbuf); // Unfortunately, the above line does not copy this property
s = "Old value of the string"; // Since the user will be offered to use the old values,
d = 42; // those should be set to a sensible value.
wcin << "Please enter a string here:" >> s;
// Ask for a string with this text explaining what to do...
wcin << "...and a number here:" >> d // ...and for a number.
<< display; // The display manipulator will display all the
// queries we've made (in one dialog window)
if (wcin.ok()) // The result of the last dialog
cout << "You pressed OK.\n";
else
cout << "You aborted the dialog.\n";
cout << " s = " << s << "\n d = " << d;
break; // Our effective main program ends here.
};
};
示例13: fontChanged
Boolean DetailsTreeHandler :: fontChanged(IEvent& evt)
{
IFUNCTRACE_DEVELOP();
IContainerControl* thisContainer = (IContainerControl*)evt.window();
IContainerControl* otherContainer;
if(thisContainer==treeCnr) {
otherContainer = &(treeCnr->detailsContainer());
}
else {
otherContainer = treeCnr;
}
// We need to keep track of the top level entry to this
// function so that we avoid a ping-pong affect that could
// occur between the two containers on font a change. This
// works since the font change notification is WinSent.
Boolean fNested = treeCnr->fontChangeStarted();
treeCnr->setFontChangeStarted(true);
if(!fNested) {
IFont newFont(thisContainer);
otherContainer->setFont(newFont);
treeCnr->setFontChangeStarted(false);
}
return false;
}
示例14: main
void MyMain::main (IEvent & event) // Do in this effective main function whatever you want!
{
switch (event.parameter1()) // Use this to define the different parts of your program
{
case cmdStartUp: // This part will be run when the program first comes up.
cout = text.stream(); // Assign the KrTextOutput object's stream to cout
cout.setf (ios::unitbuf); // Unfortunately, the above line does not copy this property
static KrBitfield bf; // Let the user click several options on/off independently
int bf1 = bf.add ("Space"); // The int variables are used to identify the item later.
int bf2 = bf.add ("Lots of Money"); // You may also define them a priori, but this is easier.
// All options are off by default, but his can be changed.
static KrChoice ch; // Let the user choose exactly one of several choices.
int ch1 = ch.add ("Betazoid");
int ch2 = ch.add ("Klingon");
ch.set (ch1); // One choice should be set as the default.
wcin << "'Enterprise' has something to do with..." >> bf;
wcin << "Deanna Troi is..." >> ch
>> display; // The display manipulator will work with both
// the >> and the << operator.
cout << "Your choices:\n";
cout << " 'Enterprise' has " << (bf.isChecked(bf1)?"something":"nothing") << " to do with Space\n";
cout << " 'Enterprise' has " << (bf.isChecked(bf2)?"something":"nothing")
<< " to do with Lots of Money\n";
cout << " Deanna Troi is " << (ch.get()==ch1?"Betazoid":"Klingon") << "\n";
break; // Our effective main program ends here.
};
};
示例15: while
void EventManager::DoEvents(void* theContext)
{
std::map<const typeEventID, IEvent*>::const_iterator anIter =
mList.begin();
while(anIter != mList.end())
{
// Get the event to execute
IEvent* anEvent = anIter->second;
// Iterate to the next event
anIter++;
// Now call DoEvent for this event with theContext provided
anEvent->DoEvent(theContext);
}
}