本文整理汇总了C++中FindById函数的典型用法代码示例。如果您正苦于以下问题:C++ FindById函数的具体用法?C++ FindById怎么用?C++ FindById使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindById函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindById
wxString wxToolBarBase::GetToolLongHelp(int toolid) const
{
wxToolBarToolBase *tool = FindById(toolid);
wxCHECK_MSG( tool, wxEmptyString, wxT("no such tool") );
return tool->GetLongHelp();
}
示例2: finally
bool TrackList::ApplyPendingTracks()
{
bool result = false;
ListOfTracks additions;
ListOfTracks updates;
{
// Always clear, even if one of the update functions throws
auto cleanup = finally( [&] { ClearPendingTracks( &additions ); } );
UpdatePendingTracks();
updates.swap( mPendingUpdates );
}
// Remaining steps must be NOFAIL-GUARANTEE so that this function
// gives STRONG-GUARANTEE
std::vector< std::shared_ptr<Track> > reinstated;
for (auto &pendingTrack : updates) {
if (pendingTrack) {
auto src = FindById( pendingTrack->GetId() );
if (src)
this->Replace(src, pendingTrack), result = true;
else
// Perhaps a track marked for pending changes got deleted by
// some other action. Recreate it so we don't lose the
// accumulated changes.
reinstated.push_back(pendingTrack);
}
}
// If there are tracks to reinstate, append them to the list.
for (auto &pendingTrack : reinstated)
if (pendingTrack)
this->Add( pendingTrack ), result = true;
// Put the pending added tracks back into the list, preserving their
// positions.
bool inserted = false;
ListOfTracks::iterator first;
for (auto &pendingTrack : additions) {
if (pendingTrack) {
auto iter = ListOfTracks::begin();
std::advance( iter, pendingTrack->GetIndex() );
iter = ListOfTracks::insert( iter, pendingTrack );
pendingTrack->SetOwner( shared_from_this(), {iter, this} );
pendingTrack->SetId( TrackId{ ++sCounter } );
if (!inserted) {
first = iter;
inserted = true;
}
}
}
if (inserted) {
RecalcPositions({first, this});
result = true;
}
return result;
}
示例3: FindById
wxString wxToolBarBase::GetToolShortHelp(int id) const
{
wxToolBarToolBase *tool = FindById(id);
wxCHECK_MSG( tool, wxEmptyString, _T("no such tool") );
return tool->GetShortHelp();
}
示例4: SetToolShortHelp
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
(void)tool->SetShortHelp(helpString);
if (tool->m_item)
{
#if GTK_CHECK_VERSION(2, 12, 0)
if (GTK_CHECK_VERSION(3,0,0) || gtk_check_version(2,12,0) == NULL)
{
gtk_tool_item_set_tooltip_text(tool->m_item,
wxGTK_CONV(helpString));
}
else
#endif
{
#if !GTK_CHECK_VERSION(3,0,0) && !defined(GTK_DISABLE_DEPRECATED)
gtk_tool_item_set_tooltip(tool->m_item,
m_tooltips, wxGTK_CONV(helpString), "");
#endif
}
}
}
}
示例5: FindById
BOOL CJabberClientCaps::SetPartialCaps(int nIqId, JabberCapsBits jcbCaps)
{
CJabberClientPartialCaps *pCaps = FindById(nIqId);
if (!pCaps)
return FALSE;
pCaps->SetCaps(jcbCaps, -1);
return TRUE;
}
示例6: SetToolDisabledBitmap
void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
tool->SetDisabledBitmap(bitmap);
}
}
示例7: SetToolShortHelp
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
{
wxToolBarTool *tool = (wxToolBarTool *)FindById(id);
if ( tool )
{
(void)tool->SetShortHelp(helpString);
gtk_tooltips_set_tip(m_toolbar->tooltips, tool->m_item,
wxGTK_CONV( helpString ), "");
}
}
示例8: SetToolShortHelp
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
(void)tool->SetShortHelp(helpString);
//TODO - other qt actions for tool tip string
// if (tool->m_item)
// {}
}
}
示例9: FindById
void CHuiFxEffectCache::ParsingEnded(TInt aHandle)
{
//MHuiFxEffectCacheNode **node2 = iDuplicateEffects.Find(aHandle);
TInt index = FindById(aHandle);
if (index == -1) return;
MHuiFxEffectCacheNode *node = iDuplicateEffects[index].iNode;
node->ParsingEndedBefore();
iCachedEffects.AppendL(node); // takes ownership
iDuplicateEffects.Remove(index);
node->Ref(1);
node->ParsingEndedAfter(node);
}
示例10: WXUNUSED
bool wxToolMenuBar::MSWCommand(WXUINT WXUNUSED(cmd), WXWORD id_)
{
const int id = (signed short)id_;
wxToolBarToolBase *tool = FindById(id);
if ( !tool )
{
bool checked = false;
if ( m_menuBar )
{
wxMenuItem *item = m_menuBar->FindItem(id);
if ( item && item->IsCheckable() )
{
item->Toggle();
checked = item->IsChecked();
}
}
wxCommandEvent event(wxEVT_MENU);
event.SetEventObject(this);
event.SetId(id);
event.SetInt(checked);
return GetEventHandler()->ProcessEvent(event);
}
if ( tool->CanBeToggled() )
{
LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0);
tool->Toggle((state & TBSTATE_CHECKED) != 0);
}
bool toggled = tool->IsToggled();
// avoid sending the event when a radio button is released, this is not
// interesting
if ( !tool->CanBeToggled() || tool->GetKind() != wxITEM_RADIO || toggled )
{
// OnLeftClick() can veto the button state change - for buttons which
// may be toggled only, of course.
if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() )
{
// revert back
toggled = !toggled;
tool->SetToggle(toggled);
::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
}
}
return true;
}
示例11: SetToolShortHelp
void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
{
wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
if ( tool )
{
(void)tool->SetShortHelp(helpString);
if (tool->m_item)
{
gtk_tool_item_set_tooltip(tool->m_item,
m_tooltips, wxGTK_CONV(helpString), "");
}
}
}
示例12: FindById
//
// Okay, so we've left the tool we're in ... we must check if the tool we're
// leaving was a 'sprung push button' and if so, spring it back to the up
// state.
//
void wxToolBar::SpringUpButton(
int vId
)
{
wxToolBarToolBase* pTool = FindById(vId);
if (pTool && pTool->CanBeToggled())
{
if (pTool->IsToggled())
pTool->Toggle();
DrawTool(pTool);
}
} // end of wxToolBar::SpringUpButton
示例13: InsertById
int InsertById(mlink * h, id_tm key, id_tm nid)
{
mlink *where = h;
if (NULL == h)
return -1;
if (NULL == (where = FindById(where, key)))
return -1;
if (-1 == Insert(where, nid))
return -1;
return 0;
}
示例14: GetId
void Track::SetY(int y)
{
auto pList = mList.lock();
if (pList && !pList->mPendingUpdates.empty()) {
auto orig = pList->FindById( GetId() );
if (orig && orig != this) {
// delegate, and rely on the update to copy back
orig->SetY(y);
pList->UpdatePendingTracks();
return;
}
}
DoSetY(y);
}
示例15: ChangeById
int ChangeById(mlink * h, id_tm who, mem_t sz, maddr_t * addr)
{
mlink *p = h;
if (NULL == h || sz < 0)
return -1;
if (NULL == (p = FindById(p, who)))
return -1;
if (-1 == Change(p, sz, addr))
return -1;
return 0;
}