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


C++ AddItem函数代码示例

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


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

示例1: TAP_Hdd_ChangeDir

void AutoStartPage::PopulateList()
{
	m_taps.clear();

	// Get a list of TAPs in the current Auto Start
	TAP_Hdd_ChangeDir( autoStartPath );

	TYPE_File file;

	int index = 0;
	for ( dword totalEntry = TAP_Hdd_FindFirst( &file ); totalEntry > 0; )
	{
		if ( file.attr == ATTR_NORMAL )
		{
			char* ext = strrchr(file.name, '.');
			if ( ext )
			{
				// ensure we're only looking at .tap files
				++ext;
				bool enabled = stricmp( ext, "tap" ) == 0;
				if ( enabled || stricmp( ext, "nap" ) == 0 )
				{
					// that we can open
					TYPE_File* f = TAP_Hdd_Fopen( file.name );
					if ( f )
					{
						// read the TAP header
						tTAPHeader header;
						memset( &header, 0, sizeof(header) );
						TAP_Hdd_Fread( &header, sizeof(header), 1, f );
						TAP_Hdd_Fclose( f );
						// ensure that it's actually a TAP format file
						if ( strncmp( header.Signature, "TFAPMIPS", 8 ) == 0 )
						{
							m_taps.push_back(AutoStartTAP());
							AutoStartTAP& t = m_taps.back();
							// store the filename with the extension .tap in the order array
							*ext = 't';
							t.index = index;
							t.filename = file.name;
							t.enabled = enabled;
							t.id = header.TAPID;
							t.name = header.Name;
							// and generate the text that will be shown in the footer
							t.footer.format( "%s\n%s\n%s\n", header.Description, header.AuthorName, header.EtcStr );
							++index;
						}
					}
				}
			}
		}

		dword currentEntry = TAP_Hdd_FindNext( &file );
		if ( totalEntry == currentEntry || currentEntry == 0 )
			break;
	}

	// Remove the Loading message and redraw the window contents
	DiscardItems();
	for (unsigned int i=0; i < m_taps.size(); ++i)
		AddItem(new TAPListItem(this, i));
	AddItem(new FooterActionListItem(this, &Commit, "Press OK to save the new TAP order\nTAPs will be loaded in this order next time the unit wakes from standby", 0, "", "Save Changes"));
	AddItem(new FooterActionListItem(this, &Backup, "Press OK to backup the TAP order and enabled state as listed above", 0, "", "Backup"));
	AddItem(new FooterActionListItem(this, &Restore, "Press OK to restore the previous backup to the list above\nThis does not save changes to disk", 0, "", "Restore"));

	Draw();
}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:67,代码来源:AutoStartPage.cpp

示例2: connect

void VSCSearch::SetupConnections()
{
    connect( this->ui.pushButtonStart, SIGNAL( clicked() ), this, SLOT(StartSearch()));
    connect( this->ui.pushButtonStop, SIGNAL( clicked() ), this, SLOT(StopSearch()));
    connect( this->ui.pushButtonAdd, SIGNAL( clicked() ), this, SLOT(AddAll()));
	connect( this->ui.pushButtonSelect, SIGNAL( clicked() ), this, SLOT(SelectAll()));
	connect( this, SIGNAL(NewSearchedItem(astring, astring, astring, astring, astring, astring) ), this, SLOT(AddItem(astring, astring, astring, astring, astring, astring)), Qt::QueuedConnection);
	//Qt::QueuedConnection
}
开发者ID:Wonderful2014,项目名称:vdc,代码行数:9,代码来源:vscsearch.cpp

示例3: self

void
TExpandoMenuBar::AttachedToWindow()
{
	BMessenger self(this);
	BList teamList;
	TBarApp::Subscribe(self, &teamList);
	float width = fVertical ? Frame().Width() : kMinimumWindowWidth;
	float height = -1.0f;

	// top or bottom mode, add be menu and sep for menubar tracking consistency
	if (!fVertical) {	
		TBeMenu *beMenu = new TBeMenu(fBarView);
		TBarWindow::SetBeMenu(beMenu);
 		fBeMenuItem = new TBarMenuTitle(kBeMenuWidth, Frame().Height(),
 			AppResSet()->FindBitmap(B_MESSAGE_TYPE, R_BeLogoIcon), beMenu, true);
		AddItem(fBeMenuItem);
		
		fSeparatorItem = new TTeamMenuItem(kSepItemWidth, height, fVertical);
		AddItem(fSeparatorItem);
		fSeparatorItem->SetEnabled(false);
		fFirstApp = 2;
	} else {
		fBeMenuItem = NULL;
		fSeparatorItem = NULL;
	}

	desk_settings *settings = ((TBarApp *)be_app)->Settings();
	
	if (settings->sortRunningApps)
		teamList.SortItems(CompareByName);

	int32 count = teamList.CountItems();
	for (int32 i = 0; i < count; i++) {
		BarTeamInfo *barInfo = (BarTeamInfo *)teamList.ItemAt(i);
		if ((barInfo->flags & B_BACKGROUND_APP) == 0
			&& strcasecmp(barInfo->sig, TASK_BAR_MIME_SIG) != 0) {
			if ((settings->trackerAlwaysFirst)
				&& (strcmp(barInfo->sig, kTrackerSignature)) == 0) {
				AddItem(new TTeamMenuItem(barInfo->teams, barInfo->icon, 
					barInfo->name, barInfo->sig, width, height,
					fDrawLabel, fVertical), fFirstApp);
			} else {
				AddItem(new TTeamMenuItem(barInfo->teams, barInfo->icon, 
					barInfo->name, barInfo->sig, width, height,
					fDrawLabel, fVertical));
			}

			barInfo->teams = NULL;
			barInfo->icon = NULL;
			barInfo->name = NULL;
			barInfo->sig = NULL;
		}
		
		delete barInfo;
	}

	BMenuBar::AttachedToWindow();

	if (fVertical) {
		sDoMonitor = true;
		sMonThread = spawn_thread(monitor_team_windows,
			"Expando Window Watcher", B_LOW_PRIORITY, this);
		resume_thread(sMonThread);
	}
}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:65,代码来源:ExpandoMenuBar.cpp

示例4: AddItem

void CServerListView::Add(IRCQuery *pQuery)
{
  AddItem(STI_QUERY,(void *)pQuery);
}
开发者ID:HydraIRC,项目名称:hydrairc,代码行数:4,代码来源:ServerList.cpp

示例5: AddItem

void CSitesWnd::AddSiteToList(fsSiteInfo *pSite)
{
	int iItem = AddItem ("", GetSysColor (COLOR_WINDOW), GetSysColor (COLOR_WINDOWTEXT));
	SetItemData (iItem, (DWORD)pSite);
	UpdateSite (pSite);
}
开发者ID:andyTsing,项目名称:freedownload,代码行数:6,代码来源:SitesWnd.cpp

示例6: AddItem

//增加一个内容为{keyword, font}的配置(QRichConfigureItem)到配置列表中(QRichConfigureList),
//缺少的字体颜色(color)项根据默认配置(defaultItem)的对应项(color)补全
bool QRichConfigureList::AddItem(const QString keyword, const QFont font)
{
    return AddItem(keyword, font, defaultItem.color);
}
开发者ID:RTNelo,项目名称:Lutetium,代码行数:6,代码来源:qrichconfigure.cpp

示例7: _

void PixelInfoListCtrl::AddSurfaceItem( LayerSurface* surf, double* pos, bool bUpdateCount )
{
  if ( m_bShowSurfaceCoordinates )
  {
    double sf_pos[3];
    surf->GetSurfaceRASAtTarget( pos, sf_pos );
    wxString strg;
    strg.Printf( _("[%.2f, %.2f, %.2f]"), sf_pos[0], sf_pos[1], sf_pos[2] );
    wxString text = ( AppendSpaceString( _("Coordinate") ) << strg );
    AddItem( wxString::FromAscii( surf->GetName() ), text, (long)surf );
  }
  int nVertex = surf->GetVertexIndexAtTarget( pos, NULL );
  if ( nVertex < 0 )
  {
    if ( !m_bShowSurfaceCoordinates )
      AddItem( wxString::FromAscii( surf->GetName() ), _(""), (long)surf, bUpdateCount );
  }
  else
  {
    wxString text = AppendSpaceString( _("Vertex") );
    text << nVertex;
    double ras[3];
    surf->GetSurfaceRASAtVertex( nVertex, ras ); 
    wxString strg;
    strg.Printf( _("[%.2f, %.2f, %.2f]"), ras[0], ras[1], ras[2] );
    text = ( AppendSpaceString(text) << strg );    
    AddItem( ( m_bShowSurfaceCoordinates ? wxString("") : wxString::FromAscii( surf->GetName() ) ), text, (long)surf );
    
    double vec[3];
    surf->GetNormalAtVertex( nVertex, vec ); 
    strg.Printf( _("[%.2f, %.2f, %.2f]"), vec[0], vec[1], vec[2] );
    text = ( AppendSpaceString( _("Normal") ) << strg );
    AddItem( _(""), text );
    
    if ( surf->GetActiveVector() >= 0 )
    {
      surf->GetVectorAtVertex( nVertex, vec ); 
      wxString strg;
      strg.Printf( _("[%.2f, %.2f, %.2f]"), vec[0], vec[1], vec[2] );
      text = ( AppendSpaceString( _("Vector") ) << strg );
      AddItem( _(""), text );
    }
    
    if ( surf->HasCurvature() && m_bShowSurfaceCurvature )
      AddItem( _(""), ( AppendSpaceString( _("Curvature") ) << surf->GetCurvatureValue( nVertex ) ), 0, bUpdateCount );
    
    
    int nOverlays = surf->GetNumberOfOverlays();
    for ( int i = 0; i < nOverlays; i++ )
    {
      SurfaceOverlay* overlay = surf->GetOverlay( i );
      wxString strg = overlay->GetName();
      AddItem( _(""), ( AppendSpaceString( strg ) << overlay->GetDataAtVertex( nVertex ) ), 0, bUpdateCount ); 
    }
    
    int nAnnotations = surf->GetNumberOfAnnotations();
    for ( int i = 0; i < nAnnotations; i++ )
    {
      SurfaceAnnotation* annot = surf->GetAnnotation( i );
      wxString strg = annot->GetName();
      AddItem( _(""), ( AppendSpaceString( strg ) << annot->GetAnnotationNameAtVertex( nVertex ).c_str() ), 0, bUpdateCount ); 
    }
  }
}
开发者ID:CBoensel,项目名称:freesurfer,代码行数:64,代码来源:PixelInfoPanel.cpp

示例8: SetFont

void
TWindowMenu::AttachedToWindow()
{
	SetFont(be_plain_font);

	RemoveItems(0, CountItems(), true);

	int32 miniCount = 0;

	bool dragging = false;
	TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView();
	if (barview && barview->LockLooper()) {
		//	'dragging' mode set in BarView::CacheDragData
		//		invoke in MouseEnter in ExpandoMenuBar
		dragging = barview->Dragging();
		if (dragging) {
			// We don't want to show the menu when dragging, but it's not
			// possible to remove a submenu once it exists, so we simply hide it
			// Don't call BMenu::Hide(), it causes the menu to pop up every now
			// and then.
			Window()->Hide();
			//	if in expando (horizontal or vertical)
			if (barview->Expando()) {
				SetTrackingHook(barview->MenuTrackingHook,
					barview->GetTrackingHookData());
			}
			barview->DragStart();
		}
		barview->UnlockLooper();
	}

	int32 parentMenuItems = 0;

	int32 numTeams = fTeam->CountItems();
	for (int32 i = 0; i < numTeams; i++) {
		team_id	theTeam = (team_id)fTeam->ItemAt(i);
		int32 count = 0;
		int32* tokens = get_token_list(theTeam, &count);

		for (int32 j = 0; j < count; j++) {
			client_window_info* wInfo = get_window_info(tokens[j]);
			if (wInfo == NULL)
				continue;

			if (WindowShouldBeListed(wInfo->feel)
				&& (wInfo->show_hide_level <= 0 || wInfo->is_mini)) {
				// Don't add new items if we're expanded. We've already done
				// this, they've just been moved.
				int32 numItems = CountItems();
				int32 addIndex = 0;
				for (; addIndex < numItems; addIndex++)
					if (strcasecmp(ItemAt(addIndex)->Label(), wInfo->name) > 0)
						break;

				if (!fExpanded) {
					TWindowMenuItem* item = new TWindowMenuItem(wInfo->name,
						wInfo->server_token, wInfo->is_mini,
						((1 << current_workspace()) & wInfo->workspaces) != 0,
						dragging);

					// disable app's window dropping for now
					if (dragging)
						item->SetEnabled(false);

					AddItem(item,
						TWindowMenuItem::InsertIndexFor(this, 0, item));
				} else {
					TTeamMenuItem* parentItem
						= static_cast<TTeamMenuItem*>(Superitem());
					if (parentItem->ExpandedWindowItem(wInfo->server_token)) {
						TWindowMenuItem* item = parentItem->ExpandedWindowItem(
							wInfo->server_token);
						if (item == NULL)
							continue;

						item->SetTo(wInfo->name, wInfo->server_token,
							wInfo->is_mini,
							((1 << current_workspace()) & wInfo->workspaces)
								!= 0, dragging);
						parentMenuItems++;
					}
				}

				if (wInfo->is_mini)
					miniCount++;
			}
			free(wInfo);
		}
		free(tokens);
	}

	int32 itemCount = CountItems() + parentMenuItems;
	if (itemCount < 1) {
		TWindowMenuItem* noWindowsItem =
 			new TWindowMenuItem("No windows", -1, false, false);

		noWindowsItem->SetEnabled(false);

		AddItem(noWindowsItem);

//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:WindowMenu.cpp

示例9: AddItems

//---------------------------------------------------------------------------
//Add Items
void AddItems() {

    for (int i = 0; i < iItemNum; i++)
        itmRoot = AddItem(itmRoot, rand() % iWeightRange + 1, rand() % iProfitRange + 1);

}
开发者ID:YI-YING,项目名称:Algorithm,代码行数:8,代码来源:Knapsack.cpp

示例10: GetDlgItem

/*
** Called when tab is displayed.
**
*/
void CDialogAbout::CTabLog::Initialize()
{
	m_Initialized = true;

	// Add columns to the list view
	HWND item = GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW);
	ListView_SetExtendedListViewStyleEx(item, 0, LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_DOUBLEBUFFER);

	// Set folder/.ini icons for tree list
	HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR32, 2, 10);
	HMODULE hDLL = GetModuleHandle(L"user32");

	HICON hIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(103), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
	ImageList_AddIcon(hImageList, hIcon);
	DeleteObject(hIcon);

	hIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(101), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
	ImageList_AddIcon(hImageList, hIcon);
	DeleteObject(hIcon);

	hIcon = (HICON)LoadImage(hDLL, MAKEINTRESOURCE(104), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); 
	ImageList_AddIcon(hImageList, hIcon);
	DeleteObject(hIcon);

	ListView_SetImageList(item, (WPARAM)hImageList, LVSIL_SMALL);

	LVCOLUMN lvc;
	lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
	lvc.fmt = LVCFMT_LEFT;  // left-aligned column
	lvc.iSubItem = 0;
	lvc.cx = 75;
	lvc.pszText = GetString(ID_STR_TYPE);
	ListView_InsertColumn(item, 0, &lvc);
	lvc.iSubItem = 1;
	lvc.cx = 85;
	lvc.pszText = GetString(ID_STR_TIME);
	ListView_InsertColumn(item, 1, &lvc);
	lvc.iSubItem = 2;
	lvc.cx = 370;
	lvc.pszText = GetString(ID_STR_MESSAGE);
	ListView_InsertColumn(item, 2, &lvc);

	// Add stored entires
	std::list<CRainmeter::LOG_INFO>::const_iterator iter = Rainmeter->GetAboutLogData().begin();
	for ( ; iter != Rainmeter->GetAboutLogData().end(); ++iter)
	{
		AddItem((*iter).level, (*iter).timestamp.c_str(), (*iter).message.c_str());
	}

	item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX);
	Button_SetCheck(item, BST_CHECKED);

	item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX);
	Button_SetCheck(item, BST_CHECKED);

	item = GetDlgItem(m_Window, IDC_ABOUTLOG_NOTICE_CHECKBOX);
	Button_SetCheck(item, BST_CHECKED);

	item = GetDlgItem(m_Window, IDC_ABOUTLOG_DEBUG_CHECKBOX);
	Button_SetCheck(item, BST_CHECKED);
}
开发者ID:testaccountx,项目名称:testrepo,代码行数:65,代码来源:DialogAbout.cpp

示例11: while

int MD5Calc::do_check(FILE *chkf)
{
    int rc, ex = 0, failed = 0, checked = 0;
    unsigned char chk_digest[16], file_digest[16];
    char filename[256];
    FILE *fp;
    unsigned int flen = 14;

    while ((rc = get_md5_line(chkf, chk_digest, filename)) >= 0) {
        if (rc == 0)	/* not an md5 line */
            continue;
        if(filename[strlen(filename)-1] == '\r' ||
            filename[strlen(filename)-1] == '\n')
            filename[strlen(filename)-1] = 0;

        if (verbose) {
            if (strlen(filename) > flen)
                flen = strlen(filename);
            fprintf(stderr, "%-*s ", flen, filename);
        }
        if (bin_mode || rc == 2)
            fp = fopen(filename, FOPRBIN);
        else
            fp = fopen(filename, FOPRTXT);
        if (fp == NULL) {
            AddItem(filename,chk_digest,file_digest,2);
            fprintf(stderr, "%s: can't open %s\n", progname, filename);
            ex = 2;
            continue;
        }
        if (mdfile(fp, file_digest)) {
            AddItem(filename,chk_digest,file_digest,2);
            fprintf(stderr, "%s: error reading %s\n", progname, filename);
            ex = 2;
            fclose(fp);
            continue;
        }
        fclose(fp);
        if (memcmp(chk_digest, file_digest, 16) != 0) {
            AddItem(filename,chk_digest,file_digest, 0);
            if (verbose)
                fprintf(stderr, "FAILED\n");
            else
                fprintf(stderr, "%s: MD5 check failed for '%s'\n", progname, filename);
            ++failed;
        } else {
            if (verbose)
                fprintf(stderr, "OK\n");
            AddItem(filename,chk_digest,file_digest,1);
        }

        ++checked;
    }
    if (verbose && failed)
        fprintf(stderr, "%s: %d of %d file(s) failed MD5 check\n", progname, failed, checked);
    if (!checked) {
        fprintf(stderr, "%s: no files checked\n", progname);
        return 3;
    }
    if (!ex && failed)
        ex = 1;
    return ex;
}
开发者ID:camillemuller,项目名称:Galaxy-flash-heimball-mac,代码行数:63,代码来源:md5calc.cpp

示例12: AddItem

void Game_Party::RemoveItem(int item_id, int amount) {
	AddItem(item_id, -amount);
}
开发者ID:glynnc,项目名称:Player,代码行数:3,代码来源:game_party.cpp

示例13: switch

dword AutoStartPage::OnKey( dword key, dword extKey )
{
	switch ( key )
	{
	case RKEY_Exit:
		if ( CanExit() )
			Close();
		return 0;
	case RKEY_Mute:
		// pass Mute to the firmware
		return key;
	case RKEY_Menu:
	{
		if (menuActivates)
		{
			Close();
			return key;
		}
		Replace(new ConfigPage());
		return 0;
	}
	case RKEY_PlayList:
		if ( CanExit() )
			Replace(new LoadedTAPPage());
		return 0;
	case RKEY_VolUp:
	{
		int index = GetSelectedIndex();
		if ( index < (int)m_taps.size()-1 )
		{
			// swap the filenames
			AutoStartTAP t = m_taps[index];
			m_taps[index] = m_taps[index+1];
			m_taps[index+1] = t;
			// move the selection
			MoveSelection( 1, false );
			m_dirty = true;
		}
		return 0;
	}
	case RKEY_VolDown:
	{
		int index = GetSelectedIndex();
		if ( index > 0 && index < (int)m_taps.size() )
		{
			// swap the filenames
			AutoStartTAP t = m_taps[index];
			m_taps[index] = m_taps[index-1];
			m_taps[index-1] = t;
			// move the selection
			MoveSelection( -1, false );
			m_dirty = true;
		}
		return 0;
	}
	case RKEY_NewF1:
	{
		// enable/disable TAP
		int index = GetSelectedIndex();
		EnableTAP( index, !m_taps[index].enabled );
		return 0;
	}
	case RKEY_F2:
	{
		int index = GetSelectedIndex();
		if ( index < (int)m_taps.size() )
		{
			bool enable = !m_taps[index].enabled;
			for ( unsigned int i = 0; i < m_taps.size(); ++i )
				EnableTAP( i, enable );
		}
		return 0;
	}
	// Discard changes
	case RKEY_Recall:
		// get rid of the list items, then the 
		DiscardItems();
		AddItem(new SimpleTextListItem(this, 0, "", "Loading..."));
		Draw();
		PopulateList();
		m_dirty = false;
		return 0;
	// Save Changes
	case RKEY_Record:
		Save();
		Close();
		return 0;
	}
	ListPage::OnKey( key, extKey );

	return 0;
}
开发者ID:BackupTheBerlios,项目名称:tap-svn,代码行数:92,代码来源:AutoStartPage.cpp

示例14: FillListView

void FillListView ( void ) {
    AddItem(IDS_TOOLS_CMD_NAME, IDS_TOOLS_CMD_DESCR, IDS_TOOLS_CMD_CMD, IDS_TOOLS_CMD_PARAM, CSIDL_SYSTEM);
    AddItem(IDS_TOOLS_REGEDIT_NAME, IDS_TOOLS_REGEDIT_DESCR, IDS_TOOLS_REGEDIT_CMD,IDS_TOOLS_REGEDIT_PARAM, CSIDL_WINDOWS);
    AddItem(IDS_TOOLS_SYSDM_NAME, IDS_TOOLS_SYSDM_DESCR, IDS_TOOLS_SYSDM_CMD, IDS_TOOLS_SYSDM_PARAM, CSIDL_SYSTEM);
    AddItem(IDS_TOOLS_INFO_NAME, IDS_TOOLS_INFO_DESCR, IDS_TOOLS_INFO_CMD, IDS_TOOLS_INFO_PARAM, CSIDL_SYSTEM);
}
开发者ID:AmineKhaldi,项目名称:reactos,代码行数:6,代码来源:toolspage.c

示例15: AddItem

void CPlayerPlaylistBar::AddItem(CString fn, CAtlList<CString>* subs)
{
    CAtlList<CString> sl;
    sl.AddTail(fn);
    AddItem(sl, subs);
}
开发者ID:Azpidatziak,项目名称:mpc-hc,代码行数:6,代码来源:PlayerPlaylistBar.cpp


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