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


C++ CField::GetName方法代码示例

本文整理汇总了C++中CField::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ CField::GetName方法的具体用法?C++ CField::GetName怎么用?C++ CField::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CField的用法示例。


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

示例1: OnDblclkListFields

void CBibitemView::OnDblclkListFields(NMHDR* pNMHDR, LRESULT* pResult) 
{
	if (m_SelField != -1) {
		// Open URL
		CField *fi = (CField*)m_ListFields.GetItemData(m_SelField);
		if (fi) {
			if (!fi->GetValue().IsEmpty() && 
				(fi->GetName().CompareNoCase(STR_LOCALURL) == 0 || 
				fi->GetName().CompareNoCase(STR_URL) == 0)) {
				CString val = fi->GetValue();
				CStringList lst;
				SplitSepString(val, &lst);
				POSITION p = lst.GetHeadPosition();
				while (p) {
					if (ShellExec(lst.GetNext(p))) {
						if (p)
							// Wait some time if there are other files to show
							Sleep(500);
					} else
						MessageBeep(MB_ICONEXCLAMATION);
				}
			} else
				// Or show edit dialog
				OnFieldlistPopupEdit();
		}
	}
	
	*pResult = 0;
}
开发者ID:stievie,项目名称:bibedt,代码行数:29,代码来源:BibitemView.cpp

示例2: UpdateFieldDescription

//----------------------------------------
void CFieldsTreeCtrl::UpdateFieldDescription(const wxTreeItemId& id)
{
  if (!id.IsOk())
  {
    return;
  }

  CFieldsTreeItemData* itemData = GetItemDataValue(id);;


  if (itemData == NULL)
  {
    return;
  }


  CField* field = itemData->GetField();

  if (field == NULL)
  {
    return;
  }

  itemData->SetSplittedFieldDescr(field);

  wxString str;
  if (field->GetUnit().empty())
  {
    str.Printf(wxT("%s"), field->GetName().c_str());
  }
  else
  {
    str.Printf(wxT("%s (%s)"), field->GetName().c_str(), field->GetUnit().c_str());
  }

  SetItemText(id, str);

  Refresh();

}
开发者ID:adakite,项目名称:main,代码行数:41,代码来源:FieldsTreeCtrl.cpp

示例3: GetAllFieldNames

/**
 * Fill lst with all field names in the list, duplicates are ignored.
 */
void CBibList::GetAllFieldNames(CStringList *lst)
{
	POSITION p = GetHeadPosition();
	while (p) {
		CBibItem *bi = (CBibItem*)GetNext(p);
		if (bi->IsRegularItem()) {
			POSITION pf = bi->GetHeadPosition();
			while (pf) {
				CField *fi = (CField*)bi->GetNext(pf);
				CString fn = fi->GetName();
				fn.MakeLower();
				if (lst->Find(fn) == NULL)
					lst->AddTail(fn);
			}
		}
	}
}
开发者ID:stievie,项目名称:bibedt,代码行数:20,代码来源:BibList.cpp

示例4: PopulateFields

void CBibitemView::PopulateFields()
{
	// At the moment nothing is selected
	m_SelField = -1;

	BeginUpdate();
	int l = -1, c = -1;
	m_ListFields.GetEditPos(l, c);

	m_ListFields.DeleteAllItems();
	POSITION h = m_TmpItem->GetHeadPosition();
	CField* fi;
	int j = 0;
	for (int i = 0; i < m_TmpItem->GetCount(); i++) {
		fi = (CField*)m_TmpItem->GetNext(h);
		if (fi) {
			j = m_ListFields.InsertItem(j, fi->GetName(), m_BibDef->GetRequired(m_TmpItem->GetType(), fi->GetName()));
			m_ListFields.SetItemText(j, 1, fi->GetValue());
			m_ListFields.SetItemData(j, (DWORD)fi);
		}
		if (h == NULL)
			break;
	}

	// Add all other fields
	CField *finew;
	CBibItem *bi = m_BibDef->FindType(m_TmpItem->GetType());
	if (bi != NULL) {
		h = bi->GetHeadPosition();
		for (i = 0; i < bi->GetCount(); i++) {
			fi = (CField*)bi->GetNext(h);
			if (fi != NULL && m_TmpItem->Find(fi->GetName()) == NULL) {
				finew = m_TmpItem->New();
				finew->SetName(fi->GetName());
				finew->SetModified(FALSE);
				j = m_ListFields.InsertItem(j, finew->GetName(), m_BibDef->GetRequired(m_TmpItem->GetType(), finew->GetName()));
				m_ListFields.SetItemText(j, 1, _T(""));
				m_ListFields.SetItemData(j, (DWORD)finew);
			}
			if (h == NULL)
				break;
		}
	}

	// Sort it
	LVSORTPARAM ss;
	ss.iHeader = 0;
	ss.pListView = &m_ListFields;
	ss.bSortAsc = TRUE;

	// Sort the list
	m_ListFields.SortItems(SortFunc, (LPARAM)&ss);

	m_SortAsc = FALSE;

	// Edit the last cell if any
	if (l > -1 && c > -1) {
		if (l >= m_ListFields.GetItemCount()) {
			m_ListFields.CancelEdit(TRUE);
			m_ListFields.EditSubItem(m_ListFields.GetItemCount()-1, c);
		} else
			m_ListFields.EditSubItem(l, c);
	}

	m_ListFields.UpdateEditor();

	EndUpdate();
}
开发者ID:stievie,项目名称:bibedt,代码行数:68,代码来源:BibitemView.cpp

示例5: ShowMenu

//----------------------------------------
void CFieldsTreeCtrl::ShowMenu(wxTreeItemId id, const wxPoint& pt)
{
  CFieldsTreeItemData* itemData = id.IsOk() ? dynamic_cast<CFieldsTreeItemData*>(GetItemData(id))
                                       : NULL;
  if (itemData == NULL)
  {
    return;
  }

  CField* field = itemData->GetField();
  if (field == NULL)
  {
    return;
  }


  wxString title;
  //title << wxT("Menu for ") << field->GetName().c_str();
  title.Printf(wxT("Menu for '%s'"), field->GetName().c_str());

  wxMenu* menu = wxGetApp().GetMenuFieldsTreeCtrl();
  if (menu == NULL)
  {
    return;
  }

  menu->SetTitle(title);

  wxMenuItem* menuItem = menu->FindItem(ID_ASXMENU);
  if (menuItem != NULL)
  {
    menuItem->Enable(!ItemHasChildren(id));
  }

  menuItem = menu->FindItem(ID_ASYMENU);
  if (menuItem != NULL)
  {
    menuItem->Enable(!ItemHasChildren(id));
  }

  menuItem = menu->FindItem(ID_ASDATAMENU);
  if (menuItem != NULL)
  {
    menuItem->Enable(!ItemHasChildren(id));
  }

  menuItem = menu->FindItem(ID_ASSELECTMENU);
  if (menuItem != NULL)
  {
    menuItem->Enable(!ItemHasChildren(id));
  }

  menuItem = menu->FindItem(ID_FIELD_ATTR_CHANGE_UNIT);
  if (menuItem != NULL)
  {
    menuItem->Enable(CField::GetFieldNetCdfCFAttr(field, false) != NULL);
  }


  PopupMenu(menu, pt);
/*
#if wxUSE_MENUS
    wxMenu menu(title);
    menu.Append(-1, wxT("&Set as X..."));
    menu.Append(-1, wxT("&Set as Y..."));
    menu.Append(-1, wxT("&Set as Data..."));
    menu.Append(-1, wxT("&Set as Selection criteria..."));

#endif // wxUSE_MENUS
*/
}
开发者ID:adakite,项目名称:main,代码行数:72,代码来源:FieldsTreeCtrl.cpp

示例6: InsertField

//----------------------------------------
wxTreeItemId CFieldsTreeCtrl::InsertField(const wxTreeItemId& parentId, CObjectTreeNode* node)
{
  int32_t depth = node->GetLevel();

  long numChildren = node->ChildCount();

  CField *field  = dynamic_cast<CField*>(node->GetData());
  if (field == NULL)
  {
    wxMessageBox("ERROR in CFieldsTreeCtrl::InsertField - at least one of the tree object is not a CField object",
                 "Error",
              wxOK | wxICON_ERROR);
    return parentId;
  }

  if ((typeid(*field) == typeid(CFieldIndex)) && field->IsVirtual())
  {
    return parentId;
  }

  if ( depth <= 1 )
  {

    wxString str;
    str.Printf(wxT("%s"), field->GetName().c_str());

    // here we pass to AppendItem() normal and selected item images (we
    // suppose that selected image follows the normal one in the enum)
    int32_t image = TreeCtrlIcon_Folder;
    int32_t imageSel = image + 1;

    wxTreeItemId id = AddRoot(str, image, image, new CFieldsTreeItemData(field));

    return id;
  }



  bool hasChildren = numChildren > 0;

  wxString str;
  if (field->GetUnit().empty())
  {
    str.Printf(wxT("%s"), field->GetName().c_str());
  }
  else
  {
    str.Printf(wxT("%s (%s)"), field->GetName().c_str(), field->GetUnit().c_str());
  }

  /*
  // at depth 1 elements won't have any more children
  if ( hasChildren )
  {
      str.Printf(wxT("%s"), field->GetName().c_str());
  }
  else
  {
    str.Printf(wxT("%s child %d.%d"), wxT("File"), folder, n + 1);
  }
  */
  // here we pass to AppendItem() normal and selected item images (we
  // suppose that selected image follows the normal one in the enum)
  int32_t image = (hasChildren) ?  TreeCtrlIcon_Folder : TreeCtrlIcon_File;
  int32_t imageSel = image + 1;

  //wxTreeItemId id = AppendItem(idParent, str, image, imageSel,
  //                             new MyTreeItemData(str));

  wxTreeItemId id = AppendItem(parentId, str, image, imageSel,
                               new CFieldsTreeItemData(field));


  //Expand(parentId);

  if    ( (typeid(*field) == typeid(CFieldRecord))
     || ( (typeid(*field) == typeid(CFieldArray)) && (field->IsFixedSize() == false) ) )
  {
    SetItemBold(id, true);
    //SetItemFont(parentId, *wxSWISS_FONT);
    //SetItemFont(rootId, *wxITALIC_FONT);
  }

  // and now we also set the expanded one (only for the folders)
  if ( hasChildren )
  {
      SetItemImage(id, TreeCtrlIcon_FolderOpened,
                   wxTreeItemIcon_Expanded);
  }

  // remember the last child for OnEnsureVisible()
  if ( !hasChildren  )
  {
      m_lastItem = id;
  }

  wxTreeItemId returnId;

  if (hasChildren)
//.........这里部分代码省略.........
开发者ID:adakite,项目名称:main,代码行数:101,代码来源:FieldsTreeCtrl.cpp


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