当前位置: 首页>>代码示例>>C++>>正文


C++ GetItemCount函数代码示例

本文整理汇总了C++中GetItemCount函数的典型用法代码示例。如果您正苦于以下问题:C++ GetItemCount函数的具体用法?C++ GetItemCount怎么用?C++ GetItemCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetItemCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetItemCount

int CHeaderCtrlExt::IndexToOrder(int nIndex)
{
	int nOrder = -1;
	const int nCount = GetItemCount();
	if(nCount > 0)
	{
        int* piColOrder = new int[nCount];
        ASSERT(piColOrder);

		GetOrderArray(piColOrder, nCount);
		for(int i = 0;i < nCount;++i)
		{
			if(piColOrder[i] == nIndex)
			{
				nOrder = i;
				break;
			}
		}
        delete []piColOrder;
	}

	return nOrder;
}
开发者ID:CodeingBoy,项目名称:StudentRatingSystem,代码行数:23,代码来源:HeaderCtrlExt.cpp

示例2: QuickSort

void CListCtrlEx::QuickSort(int nSortColumn)
{
	if (this->m_pColumnMap[abs(nSortColumn) - 1] > 0)
	{
		this->m_nSortColumn = nSortColumn;
		this->m_nCompareType = this->m_pColumnArray[abs(nSortColumn) - 1].compare;
	}
	else
		return;

	QuickSort(0, GetItemCount()-1);

	CHeaderCtrl* pHeaderCtrl = GetHeaderCtrl();
	pHeaderCtrl->SetImageList(&this->m_nArrowList);

	HDITEM hdrItem;
	int nColumns = pHeaderCtrl->GetItemCount();
	for (int index = 0; index < nColumns; index++)
	{
		hdrItem.mask = HDI_FORMAT | HDI_IMAGE | HDI_LPARAM;
		pHeaderCtrl->GetItem(index, &hdrItem);
		if (abs(this->m_nSortColumn) - 1 ==  hdrItem.lParam && this->m_nSortColumn > 0)
		{
			hdrItem.iImage = 0;
			hdrItem.fmt = hdrItem.fmt & HDF_JUSTIFYMASK | HDF_IMAGE | HDF_STRING | HDF_BITMAP_ON_RIGHT;
		}
		else if (abs(this->m_nSortColumn) - 1 == hdrItem.lParam && this->m_nSortColumn < 0)
		{
			hdrItem.iImage = 1;
			hdrItem.fmt = hdrItem.fmt & HDF_JUSTIFYMASK | HDF_IMAGE | HDF_STRING | HDF_BITMAP_ON_RIGHT;
		}
		else
			hdrItem.fmt = hdrItem.fmt & HDF_JUSTIFYMASK | HDF_STRING;

		pHeaderCtrl->SetItem(index, &hdrItem);
	}
}
开发者ID:albertzeng,项目名称:eRadQueue,代码行数:37,代码来源:ListCtrlEx.cpp

示例3: PreTranslateMessage

BOOL CMyListCtrl::PreTranslateMessage(MSG* pMsg)
{
	if( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_CONTROL )
	{
		mkey1 = VK_CONTROL;
	}
	if( pMsg->message == WM_KEYDOWN && pMsg->wParam == 'A' )
	{
		if( mkey1 != 0 )
		{
			if( mkey2 == 0 )
			{
				mkey2 = 'A';
				for (int i=0;i<GetItemCount();++i)
				{
					SetItemState( i,LVIS_SELECTED,LVIS_SELECTED);		
				}
				return TRUE;
			}
		}
	}
	if( pMsg->message == WM_KEYUP )
	{
		mkey2 = 0;
		if(pMsg->wParam == VK_CONTROL)
			mkey1 = 0;
	}
	if( pMsg->hwnd == m_hWnd && mkey1 == 0
		&& pMsg->message == WM_KEYDOWN 
		&& (((pMsg->wParam > 0X40)&&(pMsg->wParam < 0X5B))||((pMsg->wParam > 0X60)&&(pMsg->wParam < 0X7B))) )
	{
		//Ctrol_a_z_KeyDown( short(pMsg->wParam) );
		return TRUE;
	}

	return __super::PreTranslateMessage(pMsg);
}
开发者ID:2Dou,项目名称:PlayBox,代码行数:37,代码来源:MyListCtrl.cpp

示例4: SetSelection

/// Updates the list
void wxRichTextStyleListBox::UpdateStyles()
{
    if (GetStyleSheet())
    {
        SetSelection(wxNOT_FOUND);

        m_styleNames.Clear();

        size_t i;
        if (GetStyleType() == wxRICHTEXT_STYLE_ALL || GetStyleType() == wxRICHTEXT_STYLE_PARAGRAPH)
        {
            for (i = 0; i < GetStyleSheet()->GetParagraphStyleCount(); i++)
                m_styleNames.Add(GetStyleSheet()->GetParagraphStyle(i)->GetName());
        }
        if (GetStyleType() == wxRICHTEXT_STYLE_ALL || GetStyleType() == wxRICHTEXT_STYLE_CHARACTER)
        {
            for (i = 0; i < GetStyleSheet()->GetCharacterStyleCount(); i++)
                m_styleNames.Add(GetStyleSheet()->GetCharacterStyle(i)->GetName());
        }
        if (GetStyleType() == wxRICHTEXT_STYLE_ALL || GetStyleType() == wxRICHTEXT_STYLE_LIST)
        {
            for (i = 0; i < GetStyleSheet()->GetListStyleCount(); i++)
                m_styleNames.Add(GetStyleSheet()->GetListStyle(i)->GetName());
        }

        m_styleNames.Sort();
        SetItemCount(m_styleNames.GetCount());

        Refresh();

        if (GetItemCount() > 0)
        {
            SetSelection(0);
            SendSelectedEvent();
        }
    }
}
开发者ID:hgwells,项目名称:tive,代码行数:38,代码来源:richtextstyles.cpp

示例5: InsertItem

void CRulesList::AddConflict (const CdlConflict &conf)
{
  // set the item column string
  CString strMacroName = (conf)->get_node ()->get_name ().c_str ();
  int nIndex = InsertItem (GetItemCount (), strMacroName);
  SetItemData (nIndex, (DWORD) (conf));
  
  // set the conflict column string
  if (0 != dynamic_cast<CdlConflict_Unresolved> (conf)) {// a conflict of type 'unresolved'
    SetItemText (nIndex, 1, _T("Unresolved"));
  } else if (0 != dynamic_cast<CdlConflict_IllegalValue> (conf)) { // a conflict of type 'illegal value'
    SetItemText (nIndex, 1, _T("Illegal"));
  } else if (0 != dynamic_cast<CdlConflict_EvalException> (conf)) { // a conflict of type 'evaluation exception'
    SetItemText (nIndex, 1, _T("Exception"));
  } else if (0 != dynamic_cast<CdlConflict_Requires> (conf)) { // a conflict of type 'goal unsatisfied'
    SetItemText (nIndex, 1, _T("Unsatisfied"));
  } else if (0 != dynamic_cast<CdlConflict_Data> (conf)) { // a conflict of type 'bad data'
    SetItemText (nIndex, 1, _T("Bad data"));
  } else {
    ASSERT (0);
  }
  
	// set the property column string
	CString strProperty = conf->get_property ()->get_property_name ().c_str ();
	strProperty += _T(" ");
	const std::vector<std::string> & argv = conf->get_property ()->get_argv ();
	std::vector<std::string>::const_iterator argv_i;
  for (argv_i = argv.begin (); argv_i != argv.end (); argv_i++) {// for each property argument...
    if (argv_i != argv.begin ())                              // ...except the first
    {
      strProperty += argv_i->c_str (); // add the argument to the string
      strProperty += _T (" "); // separate arguments by a space character
    }
  }
	strProperty.TrimRight (); // remove the trailing space character
	SetItemText (nIndex, 2, strProperty);
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:37,代码来源:RulesList.cpp

示例6: wxXmlNode

void wxExListViewFile::DoFileSave(bool save_as)
{
  wxXmlNode* root = new wxXmlNode(wxXML_ELEMENT_NODE, "files");
  wxXmlNode* comment = new wxXmlNode(
    wxXML_COMMENT_NODE,
    wxEmptyString,
    wxTheApp->GetAppDisplayName() + " project " + GetFileName().GetFullName() + 
      " "  + wxDateTime::Now().Format());

  root->AddChild(comment);

  for (int i = 0; i < GetItemCount(); i++)
  {
    const wxExFileName fn = wxExListItem(this, i).GetFileName();

    wxXmlNode* element = new wxXmlNode(
      wxXML_ELEMENT_NODE,
      (fn.FileExists() ? "file": "folder"));

    if (!fn.FileExists() && fn.DirExists())
    {
      element->AddAttribute("extensions", GetItemText(i, _("Type")));
    }
    
    wxXmlNode* text = new wxXmlNode(
      wxXML_TEXT_NODE, 
      wxEmptyString, 
      fn.GetFullPath());
      
    element->AddChild(text);
    root->AddChild(element);
  }
  
  wxXmlDocument doc;
  doc.SetRoot(root);
  doc.Save(GetFileName().GetFullPath());
}
开发者ID:hugofvw,项目名称:wxExtension,代码行数:37,代码来源:listviewfile.cpp

示例7: Input

/******************************************************************************
 Function Name  :   OnRButtonDown

 Description    :   The framework calls this member function when the user
                    right clicks on the list box
 Input(s)       :   nFlags -
                    point -
 Output         :   -
 Functionality  :   Shows a popup menu to remove an entry or to clear entries
 Member of      :   CSignalWatchListBox

 Author(s)      :   Ratnadip Choudhury, Amarnath Shastri
 Date Created   :   03-04-2002
 Modified by    :   Ratnadip Choudhury
 Modified on    :   26-04-2002
 Modified by    :   Raja N
 Modified on    :   22.07.2004, Modified the function call to refer ListCtrl
******************************************************************************/
void CSignalWatchListBox::OnRButtonDown(UINT nFlags, CPoint omPoint)
{
    if (GetItemCount() > 0)
    {
        CMenu* pomContextMenu = new CMenu;
        if (pomContextMenu != NULL)
        {
            // Load the Menu from the resource
            pomContextMenu->DestroyMenu();
            pomContextMenu->LoadMenu(IDM_MENU_SIGNAL_WATCH);
            CMenu* pomSubMenu = pomContextMenu->GetSubMenu(1);

            if (pomSubMenu != NULL)
            {
                CPoint omSrcPt = omPoint;
                ClientToScreen(&omSrcPt);
                UINT unEnable;
                // If no item is selected, make "Delete" menu item disabled
                if (GetSelectedCount() == -1)
                {
                    unEnable = MF_BYCOMMAND | MF_DISABLED | MF_GRAYED;
                }
                else
                {
                    unEnable = MF_BYCOMMAND | MF_ENABLED;
                }
                pomSubMenu->EnableMenuItem(IDM_SG_WATCH_CLEAR, unEnable);
                pomSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
                                           omSrcPt.x, omSrcPt.y, this, NULL);
            }
            delete pomContextMenu;
            pomContextMenu = NULL;
        }
    }

    CFFListCtrl::OnRButtonDown(nFlags, omPoint);
}
开发者ID:Huigang610,项目名称:busmaster-1,代码行数:55,代码来源:SignalWatchListBox.cpp

示例8: wxASSERT

int ecPropertyListCtrl::SetItem(const wxString& item, const wxString& value, int nInsertAs, int nRepeat)
{
    wxASSERT( nInsertAs <= GetItemCount() );

/*
    LVFINDINFO info;
    info.flags =LVFI_STRING;
    info.psz   =pszItem;
    info.vkDirection=VK_DOWN;
    int nIndex=-1;
    do {
        nIndex=FindItem(&info,nIndex);
    } while (--nRepeat>0 && nIndex!=-1);
*/
    // NB: wxListCtrl doesn't support reverse search, so could do it explicitly
    // by iterating through the items.
    // But for now, just ignore the nRepeat flag and find the first one.
    int nIndex = -1;
    nIndex = FindItem(0, /* nIndex */ item);
    
    if(-1==nIndex){
        nIndex = InsertItem(nInsertAs, item);
    }
    
    wxListCtrl::SetItem(nIndex, 1, value);

    // TODO
#if 0
    CDC *pDC=GetDC();
    CFont *pOldFont=pDC->SelectObject(GetFont());
    m_nMaxValueWidth=max(m_nMaxValueWidth,pDC->GetTextExtent(pszValue).cx);
    pDC->SelectObject(pOldFont);
    ReleaseDC(pDC);
#endif

    return nIndex;
}
开发者ID:0xCA5A,项目名称:dd-wrt,代码行数:37,代码来源:propertywin.cpp

示例9: GetItemCount

BOOL CTDLFindResultsListCtrl::AddHeaderRow(LPCTSTR szText, BOOL bSpaceAbove)
{
	int nPos = GetItemCount();

	// add space above?
	if (bSpaceAbove)
	{
		int nIndex = InsertItem(nPos, _T(""));
		SetItemData(nIndex, 0);
		nPos++;
	}

	// add result
	int nIndex = InsertItem(nPos, szText);
	SetItemData(nIndex, 0);

	// bold font for rendering
	if (m_fontBold.GetSafeHandle() == NULL)
	{
		GraphicsMisc::CreateFont(m_fontBold, (HFONT)SendMessage(WM_GETFONT), MFS_BOLD);
	}

	return (nIndex != -1);
}
开发者ID:noindom99,项目名称:repositorium,代码行数:24,代码来源:TDLFindResultsListCtrl.cpp

示例10: ASSERT_VALID

//*********************************************************************************
int CBCGPHeaderCtrl::GetSortColumn () const
{
    ASSERT_VALID (this);

    if (m_bMultipleSort)
    {
        TRACE0("Call CBCGPHeaderCtrl::GetColumnState for muliple sort\n");
        ASSERT (FALSE);
        return -1;
    }

    int nCount = GetItemCount ();
    for (int i = 0; i < nCount; i++)
    {
        int nSortVal = 0;
        if (m_mapColumnsStatus.Lookup (i, nSortVal) &&
                nSortVal != 0)
        {
            return i;
        }
    }

    return -1;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:25,代码来源:BCGPHeaderCtrl.cpp

示例11: OnMDIActivate

void CXTPMDIWndTab::OnMDIActivate(HWND hWnd)
{
	// Loop through all of the tabs to find the view that has activated.
	int iItem;
	for (iItem = 0; iItem < GetItemCount(); ++iItem)
	{
		// Get the item data for this tab.
		TC_ITEM tci;
		tci.mask = TCIF_PARAM;

		if (GetItem(iItem, &tci))
		{
			MDICHILD* pMDIChild = (MDICHILD*)tci.lParam;
			ASSERT(pMDIChild != NULL);

			// If it is the activated window select it and exit loop.
			if (pMDIChild && (hWnd == pMDIChild->hWnd))
			{
				SetCurSel(iItem);
				break;
			}
		}
	}
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:24,代码来源:XTPMDIWndTab.cpp

示例12: InsertItem

int CSortListCtrl::AddItem( LPCTSTR pszText, ... )
{
	const int iIndex = InsertItem( GetItemCount(), pszText );
	LPTSTR* arrpsz = new LPTSTR[ m_iNumColumns ];
	COLORREF * clrText = new COLORREF[ m_iNumColumns ];
	COLORREF * clrBak= new COLORREF[ m_iNumColumns ];

	arrpsz[ 0 ] = new TCHAR[ lstrlen( pszText ) + 1 ];
	clrText[ 0 ] = crWindowText;
	clrBak[ 0 ] = crWindow;
	(void)lstrcpy( arrpsz[ 0 ], pszText );
	

 	va_list list;
	va_start( list, pszText );


	//insert sub item  and set subitem data
	for( int iColumn = 1; iColumn < m_iNumColumns; iColumn++ )
	{
		pszText = va_arg( list, LPCTSTR );
		ASSERT_VALID_STRING( pszText );
		VERIFY( CListCtrl::SetItem( iIndex, iColumn, LVIF_TEXT, pszText, 0, 0, 0, 0 ) );

		arrpsz[ iColumn ] = new TCHAR[ lstrlen( pszText ) + 1 ];
		clrText[ iColumn ] = crWindowText;
		clrBak[ iColumn ] = crWindow;
		(void)lstrcpy( arrpsz[ iColumn ], pszText );
	}

	va_end( list );

	VERIFY( SetArray( iIndex, arrpsz,clrText,clrBak ) );

	return iIndex;
}
开发者ID:myswirl,项目名称:myworkspace,代码行数:36,代码来源:SortListCtrl.cpp

示例13: ApplyLanguageToMenu

void CWndLog::OnRClick()
{
	CMenu menu;
	menu.LoadMenu (IDM_LOG);
	CMenu *pPopup = menu.GetSubMenu (0);
	ApplyLanguageToMenu (pPopup);

	if (m_bAutoScroll)
		pPopup->CheckMenuItem (ID_AUTOSCROLL, MF_CHECKED | MF_BYCOMMAND);

	if (GetItemCount () == 0)
	{
		pPopup->EnableMenuItem (ID_CLEAR, MF_BYCOMMAND | MF_GRAYED);
		pPopup->EnableMenuItem (ID_COPY_TO_CB, MF_BYCOMMAND | MF_GRAYED);
	}

	ClientToScreen (&m_rbPt);

	m_odmenu.Attach (&menu, FALSE);
	pPopup->TrackPopupMenu (TPM_RIGHTBUTTON | TPM_TOPALIGN | TPM_LEFTALIGN,	m_rbPt.x, m_rbPt.y, this);
	m_odmenu.Detach ();

	menu.DestroyMenu ();
}
开发者ID:HackLinux,项目名称:Free-Download-Manager-vs2010,代码行数:24,代码来源:WndLog.cpp

示例14: FindCellRef

int CEsmSubListCtrl::AddItem (CEsmSubCellRef* pCellRef) {
  esmrecinfo_t*   pRecInfo;
  CEsmSubNameFix* pName;
  int		  ListIndex;
  int		  ImageIndex;
  
	/* Find an existing reference in the list (no duplicates) */
  ListIndex = FindCellRef(pCellRef);
  if (ListIndex >= 0) return (ListIndex);

	/* Initialize the record info */
  if (pCellRef != NULL && pCellRef->GetRecInfo() == NULL) {
    pName = (CEsmSubNameFix *) pCellRef->FindSubRecord(MWESM_SUBREC_NAME);

    if (pName != NULL) {
      pRecInfo = m_pEsmDlgHandler->GetDocument()->FindRecord(pName->GetName());
      pCellRef->SetRecInfo(pRecInfo);
     }
   
   }

  if (pCellRef->GetRecInfo() == NULL)
    ImageIndex = -1;
  else
    ImageIndex = GetImageIndex(pCellRef->GetRecInfo()->pRecord);
  
	/* Add the item to the end of the list */
  ListIndex = InsertItem(GetItemCount(), "", ImageIndex);
  if (ListIndex < 0) return (ListIndex);

	/* Set the item data */
  SetItemData(ListIndex, (DWORD) pCellRef);
  SetItem(ListIndex, pCellRef);

  return (ListIndex);
 }
开发者ID:Purr4me,项目名称:TES5Edit-GoogleCode,代码行数:36,代码来源:EsmSubListCtrl.cpp

示例15: OnLvnEndlabeledit

void CMyListCtrl::OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult)
{
    NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
    *pResult = 0;
    
    if (pDispInfo->item.mask & LVIF_TEXT)
    {
        if (pDispInfo->item.iItem == (GetItemCount() - 1))
        {
            InsertItem(pDispInfo->item.iItem, pDispInfo->item.pszText);
        }
        else
        {
            if (strlen(pDispInfo->item.pszText) > 0)
            {
                SetItemText(pDispInfo->item.iItem, 0, pDispInfo->item.pszText);
            }
            else
            {
                GetParent()->PostMessage(WM_COMMAND, MAKEWPARAM(ID_FILE_CLIPBOARD_REMOVE, BN_CLICKED));
            }
        }
    }
}
开发者ID:cdesjardins,项目名称:DCom,代码行数:24,代码来源:FileClipBoardDlg.cpp


注:本文中的GetItemCount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。