本文整理汇总了C++中TSTR::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ TSTR::Append方法的具体用法?C++ TSTR::Append怎么用?C++ TSTR::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSTR
的用法示例。
在下文中一共展示了TSTR::Append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IAddComponent
HTREEITEM plComponentDlg::IAddComponent(HWND hTree, plMaxNode *node)
{
plComponentBase *comp = node->ConvertToComponent();
// Try and find the component category in the tree
const char *category = comp->GetCategory();
HTREEITEM hCat = IFindTreeItem(hTree, category, TVI_ROOT);
// If it isn't there yet, add it
if (!hCat)
hCat = IAddLeaf(hTree, TVI_ROOT, category, 0);
// Try and find the component type in the tree
int idx = plComponentMgr::Inst().FindClassID(comp->ClassID());
HTREEITEM hType = ISearchTree(hTree, idx+1, hCat);
if (!hType)
{
// If it isn't there yet, add it
TSTR type;
comp->GetClassName(type);
if (IIsHidden(comp->ClassID()))
type.Append(" (Hidden)");
hType = IAddLeaf(hTree, hCat, type, idx+1);
}
// Add the name of this component to this type
return IAddLeaf(hTree, hType, node->GetName(), (LPARAM)node);
}
示例2: IOpenRightClickMenu
void plComponentDlg::IOpenRightClickMenu()
{
HWND hTree = GetDlgItem(fhDlg, IDC_TREE);
// Get the position of the cursor in screen and tree client coords
POINT point, localPoint;
GetCursorPos(&point);
localPoint = point;
ScreenToClient(hTree, &localPoint);
// Check if there is a tree item at that point
TVHITTESTINFO hitTest;
hitTest.pt = localPoint;
TreeView_HitTest(hTree, &hitTest);
if (!(hitTest.flags & TVHT_ONITEMLABEL))
return;
// Check if the tree item has an lParam (is a component)
TVITEM item;
item.mask = TVIF_PARAM;
item.hItem = hitTest.hItem;
TreeView_GetItem(hTree, &item);
HMENU menu = nil;
if (IIsComponent(item.lParam))
menu = fCompMenu;
else if (IIsType(item.lParam))
menu = fTypeMenu;
else
return;
// Select the item we're working with, so the user isn't confused
TreeView_SelectItem(hTree, item.hItem);
// Create the popup menu and get the option the user selects
SetForegroundWindow(fhDlg);
int sel = TrackPopupMenu(menu, TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, 0, fhDlg, NULL);
switch(sel)
{
case kMenuDelete:
IDeleteComponent((plMaxNode*)item.lParam);
break;
case kMenuRename:
TreeView_EditLabel(hTree, hitTest.hItem);
break;
case kMenuCopy:
{
// Component to copy
INode *node = (INode*)item.lParam;
INodeTab tab;
tab.Append(1, &node);
// Copy
INodeTab copy;
// Make the copy
fInterface->CloneNodes(tab, Point3(0,0,0), true, NODE_COPY, NULL, ©);
// Delete the targets for the copy and add it to the tree
plMaxNode *newNode = (plMaxNode*)copy[0];
newNode->ConvertToComponent()->DeleteAllTargets();
HTREEITEM hItem = IAddComponent(GetDlgItem(fhDlg, IDC_TREE), newNode);
TreeView_SelectItem(GetDlgItem(fhDlg, IDC_TREE), hItem);
}
break;
case kMenuHide:
{
ClassDesc *desc = plComponentMgr::Inst().Get(item.lParam-1);
std::vector<Class_ID>::iterator it;
it = std::find(fHiddenComps.begin(), fHiddenComps.end(), desc->ClassID());
TSTR name = desc->ClassName();
if (it == fHiddenComps.end())
{
fHiddenComps.push_back(desc->ClassID());
name.Append(" (Hidden)");
}
else
fHiddenComps.erase(it);
item.mask = TVIF_TEXT;
item.pszText = name;
TreeView_SetItem(GetDlgItem(fhDlg, IDC_TREE), &item);
plComponentUtil::Instance().IUpdateRollups();
}
break;
}
PostMessage(fhDlg, WM_USER, 0, 0);
}