本文整理汇总了C++中LLToast类的典型用法代码示例。如果您正苦于以下问题:C++ LLToast类的具体用法?C++ LLToast怎么用?C++ LLToast使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLToast类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeToastsFromChannel
// removes all toasts from a channel
virtual void removeToastsFromChannel()
{
for(std::vector<LLToast*>::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
{
LLToast* toast = (*it);
toast->setVisible(FALSE);
toast->stopTimer();
m_toast_pool.push_back(toast);
}
m_active_toasts.clear();
};
示例2: find
//--------------------------------------------------------------------------
void LLScreenChannel::removeStoredToastByNotificationID(LLUUID id)
{
// *TODO: may be remove this function
std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
if( it == mStoredToastList.end() )
return;
LLToast* toast = (*it).toast;
mStoredToastList.erase(it);
mRejectToastSignal(toast->getNotificationID());
}
示例3: find
//--------------------------------------------------------------------------
void LLScreenChannel::killToastByNotificationID(LLUUID id)
{
// searching among toasts on a screen
std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
if( it != mToastList.end())
{
LLToast* toast = it->getToast();
// if it is a notification toast and notification is UnResponded - then respond on it
// else - simply destroy a toast
//
// NOTE: if a notification is unresponded this function will be called twice for the same toast.
// At first, the notification will be discarded, at second (it will be caused by discarding),
// the toast will be destroyed.
if(toast && toast->isNotificationValid())
{
mRejectToastSignal(toast->getNotificationID());
}
else
{
deleteToast(toast);
mToastList.erase(it);
redrawToasts();
}
return;
}
// searching among stored toasts
it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
if (it != mStoredToastList.end())
{
LLToast* toast = it->getToast();
if (toast)
{
// send signal to a listener to let him perform some action on toast rejecting
mRejectToastSignal(toast->getNotificationID());
deleteToast(toast);
}
}
// Call find() once more, because the mStoredToastList could have been changed
// in mRejectToastSignal callback and the iterator could have become invalid.
it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
if (it != mStoredToastList.end())
{
mStoredToastList.erase(it);
}
}
示例4: hideToastsFromScreen
//--------------------------------------------------------------------------
void LLScreenChannel::hideToastsFromScreen()
{
for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++)
{
LLToast* toast = it->getToast();
if (toast)
{
toast->setVisible(FALSE);
}
else
{
llwarns << "Attempt to hide a deleted toast." << llendl;
}
}
}
示例5: closeHiddenToasts
void LLScreenChannel::closeHiddenToasts(const Matcher& matcher)
{
// since we can't guarantee that close toast operation doesn't change mToastList
// we collect matched toasts that should be closed into separate list
std::list<LLToast*> toasts;
for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
!= mToastList.end(); it++)
{
LLToast* toast = it->getToast();
// add to list valid toast that match to provided matcher criteria
if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
&& !toast->getVisible() && matcher.matches(toast->getNotification()))
{
toasts.push_back(toast);
}
}
// close collected toasts
for (std::list<LLToast*>::iterator it = toasts.begin(); it
!= toasts.end(); it++)
{
LLToast* toast = *it;
toast->closeFloater();
}
}
示例6: updateSize
void LLNearbyChatScreenChannel::updateSize(LLRect old_world_rect, LLRect new_world_rect)
{
for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
{
LLToast* toast = it->get();
if (toast)
{
LLNearbyChatToastPanel* panel = dynamic_cast<LLNearbyChatToastPanel*>(toast->getPanel());
if(panel)
{
reshapePanel(panel);
toast->reshapeToPanel();
}
}
}
arrangeToasts();
}
示例7: updateBottom
void LLNearbyChatScreenChannel::showToastsBottom()
{
if(mStopProcessing)
return;
LLRect toast_rect;
updateBottom();
S32 channel_bottom = getRect().mBottom;
S32 bottom = channel_bottom;
S32 margin = gSavedSettings.getS32("ToastGap");
//sort active toasts
std::sort(m_active_toasts.begin(),m_active_toasts.end(),sort_toasts_predicate);
//calc max visible item and hide other toasts.
for(toast_vec_t::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
{
LLToast* toast = it->get();
if (!toast)
{
llwarns << "NULL found in the active chat toasts list!" << llendl;
continue;
}
S32 toast_top = bottom + toast->getRect().getHeight() + margin;
if(toast_top > gFloaterView->getRect().getHeight())
{
while(it!=m_active_toasts.end())
{
addToToastPool(it->get());
it=m_active_toasts.erase(it);
}
break;
}
toast_rect = toast->getRect();
toast_rect.setLeftTopAndSize(getRect().mLeft , bottom + toast_rect.getHeight(), toast_rect.getWidth() ,toast_rect.getHeight());
toast->setRect(toast_rect);
bottom += toast_rect.getHeight() - toast->getTopPad() + margin;
}
// use reverse order to provide correct z-order and avoid toast blinking
for(toast_vec_t::reverse_iterator it = m_active_toasts.rbegin(); it != m_active_toasts.rend(); ++it)
{
LLToast* toast = it->get();
if (toast)
{
toast->setIsHidden(false);
toast->setVisible(TRUE);
}
}
}
示例8: m_create_toast_panel_callback_t
bool LLNearbyChatScreenChannel::createPoolToast()
{
LLToastPanelBase* panel= m_create_toast_panel_callback_t();
if(!panel)
return false;
LLToast::Params p;
p.panel = panel;
p.lifetime_secs = gSavedSettings.getS32("NearbyToastLifeTime");
p.fading_time_secs = gSavedSettings.getS32("NearbyToastFadingTime");
LLToast* toast = new LLNearbyChatToast(p, this);
toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1));
LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << llendl;
m_toast_pool.push_back(toast->getHandle());
return true;
}
示例9: m_create_toast_panel_callback_t
bool LLNearbyChatScreenChannel::createPoolToast()
{
LLToastPanelBase* panel= m_create_toast_panel_callback_t();
if(!panel)
return false;
LLToast::Params p;
p.panel = panel;
p.lifetime_secs = gSavedSettings.getS32("NearbyToastLifeTime");
p.fading_time_secs = gSavedSettings.getS32("NearbyToastFadingTime");
LLToast* toast = new LLToast(p);
toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1));
toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, this, _1));
m_toast_pool.push_back(toast);
return true;
}
示例10: loadStoredToastsToChannel
//--------------------------------------------------------------------------
void LLScreenChannel::loadStoredToastsToChannel()
{
std::vector<ToastElem>::iterator it;
if(mStoredToastList.size() == 0)
return;
for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
{
LLToast* toast = it->getToast();
if (toast)
{
toast->setIsHidden(false);
toast->startTimer();
mToastList.push_back(*it);
}
}
mStoredToastList.clear();
redrawToasts();
}
示例11: getRect
//--------------------------------------------------------------------------
void LLScreenChannel::showToastsCentre()
{
LLToast* toast = mToastList[0].getToast();
if (!toast)
{
llwarns << "Attempt to display a deleted toast." << llendl;
return;
}
LLRect toast_rect;
S32 bottom = (getRect().mTop - getRect().mBottom)/2 + toast->getRect().getHeight()/2;
std::vector<ToastElem>::reverse_iterator it;
for(it = mToastList.rbegin(); it != mToastList.rend(); ++it)
{
LLToast* toast = it->getToast();
if (!toast)
{
llwarns << "Attempt to display a deleted toast." << llendl;
return;
}
toast_rect = toast->getRect();
toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight());
toast->setRect(toast_rect);
toast->setVisible(TRUE);
}
}
示例12: m_create_toast_panel_callback_t
bool LLNearbyChatScreenChannel::createPoolToast()
{
LLToastPanelBase* panel= m_create_toast_panel_callback_t();
if(!panel)
return false;
LLToast::Params p;
p.panel = panel;
p.lifetime_secs = gSavedSettings.getS32("NearbyToastLifeTime");
p.fading_time_secs = gSavedSettings.getS32("NearbyToastFadingTime");
LLToast* toast = new LLNearbyChatToast(p, this);
reshapePanel(panel);
toast->setOnFadeCallback(boost::bind(&LLNearbyChatScreenChannel::onToastFade, this, _1));
// If the toast gets somehow prematurely destroyed, deactivate it to prevent crash (STORM-1352).
toast->setOnToastDestroyedCallback(boost::bind(&LLNearbyChatScreenChannel::onToastDestroyed, this, _1, false));
LL_DEBUGS("NearbyChat") << "Creating and pooling toast" << llendl;
m_toast_pool.push_back(toast->getHandle());
return true;
}
示例13: mRejectToastSignal
//--------------------------------------------------------------------------
void LLScreenChannel::addToast(const LLToast::Params& p)
{
bool store_toast = false, show_toast = false;
mDisplayToastsAlways ? show_toast = true : show_toast = mWasStartUpToastShown && (mShowToasts || p.force_show);
store_toast = !show_toast && p.can_be_stored && mCanStoreToasts;
if(!show_toast && !store_toast)
{
mRejectToastSignal(p.notif_id);
return;
}
LLToast* toast = new LLToast(p);
ToastElem new_toast_elem(toast->getHandle());
toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, _1));
toast->setOnToastDestroyedCallback(boost::bind(&LLScreenChannel::onToastDestroyed, this, _1));
if(mControlHovering)
{
toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2));
toast->setMouseEnterCallback(boost::bind(&LLScreenChannel::stopToastTimer, this, toast));
toast->setMouseLeaveCallback(boost::bind(&LLScreenChannel::startToastTimer, this, toast));
}
if(show_toast)
{
mToastList.push_back(new_toast_elem);
if(p.can_be_stored)
{
// store toasts immediately - EXT-3762
storeToast(new_toast_elem);
}
updateShowToastsState();
redrawToasts();
}
else // store_toast
{
mHiddenToastsNum++;
storeToast(new_toast_elem);
}
}
示例14: getRect
void LLNearbyChatScreenChannel::showToastsBottom()
{
if(mStopProcessing)
return;
LLRect toast_rect;
S32 bottom = getRect().mBottom;
S32 margin = gSavedSettings.getS32("ToastGap");
for(std::vector<LLToast*>::iterator it = m_active_toasts.begin(); it != m_active_toasts.end(); ++it)
{
LLToast* toast = (*it);
S32 toast_top = bottom + toast->getRect().getHeight() + margin;
if(toast_top > gFloaterView->getRect().getHeight())
{
while(it!=m_active_toasts.end())
{
toast->setVisible(FALSE);
toast->stopTimer();
m_toast_pool.push_back(toast);
it=m_active_toasts.erase(it);
}
break;
}
bottom = toast_top - toast->getTopPad();
}
// use reverse order to provide correct z-order and avoid toast blinking
for(std::vector<LLToast*>::reverse_iterator it = m_active_toasts.rbegin(); it != m_active_toasts.rend(); ++it)
{
LLToast* toast = (*it);
S32 toast_top = bottom + toast->getTopPad();
toast_rect = toast->getRect();
toast_rect.setLeftTopAndSize(getRect().mLeft , toast_top, toast_rect.getWidth() ,toast_rect.getHeight());
toast->setRect(toast_rect);
toast->setIsHidden(false);
toast->setVisible(TRUE);
bottom = toast->getRect().mBottom - margin;
}
}
示例15: arrangeToasts
void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
{
//look in pool. if there is any message
if(mStopProcessing)
return;
/*
find last toast and check ID
*/
if(m_active_toasts.size())
{
LLUUID fromID = notification["from_id"].asUUID(); // agent id or object id
std::string from = notification["from"].asString();
LLToast* toast = m_active_toasts[0];
LLNearbyChatToastPanel* panel = dynamic_cast<LLNearbyChatToastPanel*>(toast->getPanel());
if(panel && panel->messageID() == fromID && panel->getFromName() == from && panel->canAddText())
{
panel->addMessage(notification);
toast->reshapeToPanel();
toast->resetTimer();
arrangeToasts();
return;
}
}
if(m_toast_pool.empty())
{
//"pool" is empty - create one more panel
if(!createPoolToast())//created toast will go to pool. so next call will find it
return;
addNotification(notification);
return;
}
int chat_type = notification["chat_type"].asInteger();
if( ((EChatType)chat_type == CHAT_TYPE_DEBUG_MSG))
{
if(gSavedSettings.getBOOL("ShowScriptErrors") == FALSE)
return;
if(gSavedSettings.getS32("ShowScriptErrorsLocation")== 1)
return;
}
//take 1st element from pool, (re)initialize it, put it in active toasts
LLToast* toast = m_toast_pool.back();
m_toast_pool.pop_back();
LLToastPanelBase* panel = dynamic_cast<LLToastPanelBase*>(toast->getPanel());
if(!panel)
return;
panel->init(notification);
toast->reshapeToPanel();
toast->resetTimer();
m_active_toasts.insert(m_active_toasts.begin(),toast);
arrangeToasts();
}