本文整理汇总了C++中GetItemByIndex函数的典型用法代码示例。如果您正苦于以下问题:C++ GetItemByIndex函数的具体用法?C++ GetItemByIndex怎么用?C++ GetItemByIndex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetItemByIndex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACEST
void InfoProviderFactory::SaveSettings()
{
TRACEST(_T("InfoProviderFactory::SaveSettings."));
if (m_pAppSettings != NULL)
{
INT idx = 0;
IInfoProvider* ip = GetItemByIndex(idx);
while (ip != NULL)
{
LPCTSTR ipName = ip->GetModuleInfo(IInfoProvider::IPI_Name);
IConfigurable::SettingInfo setting;
INT setIdx = 0;
while (ip->GetSettingInfo(setIdx, setting))
{
if (setting.type == IConfigurable::COVT_LPCTSTR)
m_pAppSettings->Write(ipName, setting.name, ip->GetLPCTSTRSetting(setIdx));
else
m_pAppSettings->Write(ipName, setting.name, ip->GetIntSetting(setIdx));
setIdx++;
}
idx++;
ip = GetItemByIndex(idx);
}
}
}
示例2: entArmor
/* ================== */
int
entArmor(edict_t * ent)
{
gitem_t *item;
int index , iCells, iArmor;
int power_armor_type;
power_armor_type = PowerArmorType(ent);
if (power_armor_type) {
iCells = ent->client->pers.inventory[ITEM_INDEX(FindItem("cells"))];
if (iCells == 0) { /* ran out of cells for power armor */
ent->flags &= ~FL_POWER_ARMOR;
power_armor_type = 0;;
}
}
index = ArmorIndex(ent);
if (power_armor_type && (!index || (level.framenum & 8)))
iArmor = iCells;
else if (index) {
item = GetItemByIndex(index);
iArmor = ent->client->pers.inventory[index];
} else
iArmor = 0;
return iArmor;
}
示例3: GetItemByIndex
BOOL CSkinTabCtrl::SetItemBack(int nIndex, LPCTSTR lpNormal,
LPCTSTR lpHighlight, LPCTSTR lpDown, CONST LPRECT lprcNinePart)
{
CSkinTabCtrlItem * lpItem = GetItemByIndex(nIndex);
if (NULL == lpItem)
return FALSE;
RenderEngine->RemoveImage(lpItem->m_lpBgImgN);
RenderEngine->RemoveImage(lpItem->m_lpBgImgH);
RenderEngine->RemoveImage(lpItem->m_lpBgImgD);
lpItem->m_lpBgImgN = RenderEngine->GetImage(lpNormal);
lpItem->m_lpBgImgH = RenderEngine->GetImage(lpHighlight);
lpItem->m_lpBgImgD = RenderEngine->GetImage(lpDown);
if (lpItem->m_lpBgImgN != NULL)
lpItem->m_lpBgImgN->SetNinePart(lprcNinePart);
if (lpItem->m_lpBgImgH != NULL)
lpItem->m_lpBgImgH->SetNinePart(lprcNinePart);
if (lpItem->m_lpBgImgD != NULL)
lpItem->m_lpBgImgD->SetNinePart(lprcNinePart);
if ((lpNormal != NULL && NULL == lpItem->m_lpBgImgN) ||
(lpHighlight != NULL && NULL == lpItem->m_lpBgImgH) ||
(lpDown != NULL && NULL == lpItem->m_lpBgImgD))
return FALSE;
else
return TRUE;
}
示例4: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
nsXFormsSelectableAccessible::IsChildSelected(PRInt32 aIndex,
PRBool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
nsCOMPtr<nsIDOMNode> item = GetItemByIndex(&aIndex);
if (!item)
return NS_OK;
nsresult rv;
if (mIsSelect1Element) {
nsCOMPtr<nsIDOMNode> selitem;
rv = sXFormsService->GetSelectedItemForSelect1(mDOMNode,
getter_AddRefs(selitem));
NS_ENSURE_SUCCESS(rv, rv);
if (selitem == item)
*aIsSelected = PR_TRUE;
return NS_OK;
}
return sXFormsService->IsSelectItemSelected(mDOMNode, item, aIsSelected);
}
示例5: if
nsIContent*
nsXFormsSelectableAccessible::GetItemByIndex(PRUint32* aIndex,
nsAccessible* aAccessible)
{
nsAccessible* accessible = aAccessible ? aAccessible : this;
PRInt32 childCount = accessible->GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = accessible->GetChildAt(childIdx);
nsIContent* childContent = child->GetContent();
nsINodeInfo *nodeInfo = childContent->NodeInfo();
if (nodeInfo->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS))) {
if (nodeInfo->Equals(nsAccessibilityAtoms::item)) {
if (!*aIndex)
return childContent;
--*aIndex;
} else if (nodeInfo->Equals(nsAccessibilityAtoms::choices)) {
nsIContent* itemContent = GetItemByIndex(aIndex, child);
if (itemContent)
return itemContent;
}
}
}
return nsnull;
}
示例6: GetItemByIndex
/***********************************************************************************
**
** RegroupItem
**
***********************************************************************************/
void TreeViewModel::RegroupItem(INT32 pos)
{
TreeViewModelItem* item = GetItemByIndex(pos);
if (!GetTreeModelGrouping() || !GetTreeModelGrouping()->HasGrouping() || !item)
return;
while(item->GetParentItem() && !item->GetParentItem()->IsHeader())
item = item->GetParentItem();
TreeViewModelItem* parent = static_cast<TreeViewModelItem*>(GetTreeModelGrouping()->GetGroupHeader(GetTreeModelGrouping()->GetGroupForItem(item)));
// Don't regroup in some cases, to avoid "thread jumping" (DSK-350587) '
// eg when a thread must move to another group because an item in the thread was removed (painful to understand what's happening for the user)
// the thread will be in the correct group when the whole tree is regrouped
if (parent && parent->GetID() < item->GetParentItem()->GetID())
return;
if(parent && parent != item->GetParentItem())
{
if (!parent->IsOpen() && (IsEmptyGroup(parent) || m_view->GetSelectedItemPos() == pos))
{
m_view->OpenItemRecursively(parent->GetIndex(), TRUE, FALSE);
}
Move(item->GetIndex(), parent->GetIndex(), -1);
if (GetSortListener())
ResortItem(item->GetIndex());
}
}
示例7: GetItemByIndex
BOOL CSkinToolBar::SetItemRightBgPic(int nIndex, LPCTSTR lpHighlight,
LPCTSTR lpDown, CONST LPRECT lprcNinePart)
{
CSkinToolBarItem * lpItem = GetItemByIndex(nIndex);
if (NULL == lpItem)
return FALSE;
RenderEngine->RemoveImage(lpItem->m_lpRightH);
RenderEngine->RemoveImage(lpItem->m_lpRightD);
lpItem->m_lpRightH = RenderEngine->GetImage(lpHighlight);
lpItem->m_lpRightD = RenderEngine->GetImage(lpDown);
if (lpItem->m_lpRightH != NULL)
lpItem->m_lpRightH->SetNinePart(lprcNinePart);
if (lpItem->m_lpRightD != NULL)
lpItem->m_lpRightD->SetNinePart(lprcNinePart);
if ((lpHighlight != NULL && NULL == lpItem->m_lpRightH) ||
(lpDown != NULL && NULL == lpItem->m_lpRightD))
return FALSE;
else
return TRUE;
}
示例8: GetItemByIndex
// Returns the number value an the give array index
double JSON::GetArrayNumber(int index)
{
if (Type == JSON_Array)
{
JSON* number = GetItemByIndex(index);
return number ? number->dValue : 0.0;
}
return 0;
}
示例9: HitTest
void CSkinToolBar::OnLButtonUp(UINT nFlags, CPoint point)
{
HWND hWnd = ::GetCapture();
if (m_hWnd == hWnd)
::ReleaseCapture();
int nIndex = HitTest(point);
BOOL bClicked;
if (nIndex != -1 && nIndex == m_nPressIndex)
bClicked = TRUE;
else
bClicked = FALSE;
if (m_nPressIndex != -1)
{
m_nPressIndex = -1;
Invalidate(FALSE);
}
if (bClicked)
{
CSkinToolBarItem * lpItem = GetItemByIndex(nIndex);
if (lpItem != NULL)
{
CRect rcItem;
GetItemRectByIndex(m_nPressIndex, rcItem);
CRect rcLeft, rcRight;
BOOL bClickLorR = FALSE;
if (lpItem->m_dwStyle & STBI_STYLE_DROPDOWN ||
lpItem->m_dwStyle & STBI_STYLE_WHOLEDROPDOWN)
{
rcLeft = rcItem;
rcLeft.right = rcLeft.left + lpItem->m_nLeftWidth;
rcRight = rcItem;
rcRight.left += lpItem->m_nLeftWidth;
rcRight.right = rcRight.left + lpItem->m_nRightWidth;
if (rcLeft.PtInRect(point))
bClickLorR = TRUE;
if (rcRight.PtInRect(point))
bClickLorR = FALSE;
}
if ((!(lpItem->m_dwStyle & STBI_STYLE_WHOLEDROPDOWN))
|| (lpItem->m_dwStyle & STBI_STYLE_DROPDOWN && bClickLorR && bClickLorR == m_bPressLorR))
::SendMessage(::GetParent(m_hWnd), WM_COMMAND, MAKEWPARAM(lpItem->m_nID, BN_CLICKED), 0);
}
}
__super::OnLButtonUp(nFlags, point);
}
示例10: while
IInfoProvider* InfoProviderFactory::CreateInfoProviderByService(IInfoProvider::ServiceEnum service)
{
INT idx = 0;
IInfoProvider* pIP = NULL;
while ((pIP = GetItemByIndex(idx)) != NULL)
{
if (pIP->CanHandle(service))
return CreateInfoProviderByUniqueID(pIP->GetModuleInfo(IInfoProvider::IPI_UniqueID));
idx++;
}
return NULL;
}
示例11: SetFocus
void CSkinTabCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
SetFocus();
int nIndex = HitTest(point);
if (nIndex != -1)
{
if (nIndex != m_nSelIndex)
{
m_nSelIndex = nIndex;
Invalidate(FALSE);
NMHDR nmhdr = {m_hWnd, GetDlgCtrlID(), TCN_SELCHANGE};
::SendMessage(::GetParent(m_hWnd), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr);
}
else
{
CSkinTabCtrlItem * lpItem = GetItemByIndex(nIndex);
if (lpItem != NULL && lpItem->m_dwStyle & STCI_STYLE_DROPDOWN)
{
CRect rcItem;
GetItemRectByIndex(nIndex, rcItem);
CRect rcArrow;
rcArrow.left = rcItem.left+lpItem->m_nLeftWidth;
rcArrow.right = rcArrow.left + lpItem->m_nRightWidth;
rcArrow.top = rcItem.top;
rcArrow.bottom = rcItem.bottom;
if (rcArrow.PtInRect(point))
m_bPressArrow = TRUE;
else
m_bPressArrow = FALSE;
if (m_bPressArrow)
{
Invalidate(FALSE);
NMHDR nmhdr = {0};
nmhdr.hwndFrom = m_hWnd;
nmhdr.idFrom = GetDlgCtrlID();
nmhdr.code = TCN_DROPDOWN;
::SendMessage(::GetParent(m_hWnd), WM_NOTIFY, GetDlgCtrlID(), (LPARAM)&nmhdr);
m_bPressArrow = FALSE;
Invalidate(FALSE);
}
}
}
}
__super::OnLButtonDown(nFlags, point);
}
示例12: GetItemByIndex
NS_IMETHODIMP
nsXFormsSelectableAccessible::AddChildToSelection(PRInt32 aIndex)
{
nsCOMPtr<nsIDOMNode> item = GetItemByIndex(&aIndex);
if (!item)
return NS_OK;
if (mIsSelect1Element)
return sXFormsService->SetSelectedItemForSelect1(mDOMNode, item);
return sXFormsService->AddItemToSelectionForSelect(mDOMNode, item);
}
示例13: TrackMouseLeave
void CSkinTabCtrl::OnMouseMove(UINT nFlags, CPoint point)
{
if (!m_bMouseTracking)
{
TrackMouseLeave(GetSafeHwnd());
m_bMouseTracking = TRUE;
}
int nIndex;
nIndex = HitTest(point);
if (nIndex != -1)
{
CSkinTabCtrlItem * lpItem = GetItemByIndex(nIndex);
if (lpItem != NULL)
{
CRect rcItem;
GetItemRectByIndex(nIndex, rcItem);
if (nIndex != m_nHoverIndex && lpItem->m_strToolTipText.GetLength() > 0)
{
if (!m_ToolTipCtrl.GetSafeHwnd())
{
m_ToolTipCtrl.Create(this);
m_ToolTipCtrl.SetMaxTipWidth(200);
}
if (m_ToolTipCtrl.GetSafeHwnd())
{
if (m_ToolTipCtrl.GetToolCount() <= 0)
{
m_ToolTipCtrl.Activate(TRUE);
m_ToolTipCtrl.AddTool(this, lpItem->m_strToolTipText.GetBuffer(), &rcItem, 1);
}
else
{
m_ToolTipCtrl.Activate(TRUE);
m_ToolTipCtrl.UpdateTipText(lpItem->m_strToolTipText.GetBuffer(), this, 1);
m_ToolTipCtrl.SetToolRect(this, 1, &rcItem);
}
}
}
}
}
if (nIndex != m_nHoverIndex)
{
m_nHoverIndex = nIndex;
Invalidate();
}
__super::OnMouseMove(nFlags, point);
}
示例14: GetItemByPath
void GroupsModel::OnFolderRenamed(UINT16 account_id, const OpStringC& old_path, const OpStringC& new_path)
{
if (account_id != m_account_id)
return;
INT32 pos = GetItemByPath(old_path);
if (pos == -1)
return;
GroupsModelItem* item = GetItemByIndex(pos);
item->SetPath(new_path);
item->Change();
}
示例15: switch
BOOL CChatSelector::OnCommand(WPARAM wParam, LPARAM lParam)
{
switch (wParam) {
case MP_DETAIL:{
const CChatItem* ci = GetItemByIndex(m_iContextIndex);
if (ci) {
CClientDetailDialog dialog(ci->client);
dialog.DoModal();
}
return TRUE;
}
case MP_ADDFRIEND:{
const CChatItem* ci = GetItemByIndex(m_iContextIndex);
if (ci) {
CFriend* fr = theApp.friendlist->SearchFriend(ci->client->GetUserHash(), 0, 0);
if (!fr)
theApp.friendlist->AddFriend(ci->client);
}
return TRUE;
}
case MP_REMOVEFRIEND:{
const CChatItem* ci = GetItemByIndex(m_iContextIndex);
if (ci) {
CFriend* fr = theApp.friendlist->SearchFriend(ci->client->GetUserHash(), 0, 0);
if (fr)
theApp.friendlist->RemoveFriend(fr);
}
return TRUE;
}
case MP_REMOVE:{
const CChatItem* ci = GetItemByIndex(m_iContextIndex);
if (ci)
EndSession(ci->client);
return TRUE;
}
}
return CClosableTabCtrl::OnCommand(wParam, lParam);
}