本文整理汇总了C++中TreeViewItem类的典型用法代码示例。如果您正苦于以下问题:C++ TreeViewItem类的具体用法?C++ TreeViewItem怎么用?C++ TreeViewItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TreeViewItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateButtonUnderMouse
void updateButtonUnderMouse (const MouseEvent& e)
{
TreeViewItem* newItem = 0;
if (owner.openCloseButtonsVisible)
{
Rectangle<int> pos;
TreeViewItem* item = findItemAt (e.y, pos);
if (item != 0 && e.x < pos.getX() && e.x >= pos.getX() - owner.getIndentSize())
{
newItem = item;
if (! newItem->mightContainSubItems())
newItem = 0;
}
}
if (buttonUnderMouse != newItem)
{
if (buttonUnderMouse != 0 && containsItem (buttonUnderMouse))
{
const Rectangle<int> r (buttonUnderMouse->getItemPosition (false));
repaint (0, r.getY(), r.getX(), buttonUnderMouse->getItemHeight());
}
buttonUnderMouse = newItem;
if (buttonUnderMouse != 0)
{
const Rectangle<int> r (buttonUnderMouse->getItemPosition (false));
repaint (0, r.getY(), r.getX(), buttonUnderMouse->getItemHeight());
}
}
}
示例2: AcceptDragObject
virtual Int32 AcceptDragObject(void *root,void *userdata,void *obj,Int32 dragtype,void *dragobject, Bool &bAllowCopy)
{
TreeView* pTree = (TreeView*)userdata;
if (dragtype == DRAGTYPE_FILES)
{
return INSERT_BEFORE | INSERT_AFTER | INSERT_UNDER;
}
if (pTree->m_lFlags & TREE_VIEW_HAS_DRAG_DROP)
{
if (dragtype == pTree->m_lElementType)
{
Int32 lRet = INSERT_BEFORE | INSERT_AFTER;
TreeViewItem* pDragDest = (TreeViewItem*)obj;
CDialogItem* pDlgItem = (CDialogItem*)pDragDest->GetData()->GetVoid(TREEVIEW_DATA);
if (pDlgItem->GetType() == Group || pDlgItem->GetType() == Dialog)
lRet |= INSERT_UNDER;
if (pDlgItem->GetType() == Dialog) bAllowCopy = false;
else bAllowCopy = true;
return lRet;
}
}
return false;
}
示例3: selectBasedOnModifiers
void selectBasedOnModifiers (TreeViewItem* const item, const ModifierKeys& modifiers)
{
TreeViewItem* firstSelected = 0;
if (modifiers.isShiftDown() && ((firstSelected = owner.getSelectedItem (0)) != 0))
{
TreeViewItem* const lastSelected = owner.getSelectedItem (owner.getNumSelectedItems() - 1);
jassert (lastSelected != 0);
int rowStart = firstSelected->getRowNumberInTree();
int rowEnd = lastSelected->getRowNumberInTree();
if (rowStart > rowEnd)
swapVariables (rowStart, rowEnd);
int ourRow = item->getRowNumberInTree();
int otherEnd = ourRow < rowEnd ? rowStart : rowEnd;
if (ourRow > otherEnd)
swapVariables (ourRow, otherEnd);
for (int i = ourRow; i <= otherEnd; ++i)
owner.getItemOnRow (i)->setSelected (true, false);
}
else
{
const bool cmd = modifiers.isCommandDown();
item->setSelected ((! cmd) || ! item->isSelected(), ! cmd);
}
}
示例4: MakeVisible
/*********************************************************************\
Function name : CDialogPreview::MakeVisible
Description :
Created at : 07.09.01, @ 16:14:42
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CDialogPreview::MakeVisible(CDialogItem* pItem)
{
TreeViewItem* pTreeItem = pItem->m_pTreeViewItem;
Int32 lLastID = pItem->m_lID;
CDialogItem* pSearchItem;
while (pTreeItem)
{
pSearchItem = (CDialogItem*)pTreeItem->GetData()->GetVoid(TREEVIEW_DATA);
if (pSearchItem)
{
if (((pSearchItem->GetType()) == Group) && (pSearchItem != pItem))
{
CDialogGroup* pGroup = (CDialogGroup*)pSearchItem;
if (pGroup->m_lGroupType == GROUP_TYPE_TAB)
{
pGroup->m_lLastChildID = lLastID;
m_wndSubDlg.SetInt32(pGroup->m_lID, lLastID);
}
}
lLastID = pSearchItem->m_lID;
}
pTreeItem = pTreeItem->GetParent();
};
}
示例5: GetUp
virtual void* GetUp(void *root,void *userdata,void *obj)
{
TreeViewItem *p = (TreeViewItem*)obj;
void* pUp = p->GetUp();
if (pUp == root) return nullptr;
return pUp;
}
示例6: BrowsePath
/*********************************************************************\
Function name : CResEditBrowser::BrowsePath
Description :
Created at : 26.09.01, @ 11:59:42
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CResEditBrowser::BrowsePath(Filename fn)
{
AutoAlloc <BrowseFiles> pBrowse;
pBrowse->Init(fn, false);
Filename fnBrowse;
TreeViewItem* pNewItem;
//TRACE_STRING(fn.GetString());
while (pBrowse->GetNext())
{
fnBrowse = pBrowse->GetFilename();
if (pBrowse->IsDir())
{
BrowsePath(fn + fnBrowse);
continue;
}
pNewItem = nullptr;
if (fnBrowse.CheckSuffix("res"))
pNewItem = m_wndTreeView.AddItem(fnBrowse.GetFileString(), m_pDialogsItem);
else if (fnBrowse.CheckSuffix("tif") || fnBrowse.CheckSuffix("jpg") || fnBrowse.CheckSuffix("bmp"))
pNewItem = m_wndTreeView.AddItem(fnBrowse.GetFileString(), m_pImagesItem);
if (pNewItem)
pNewItem->GetData()->SetString(ITEM_PATH_NAME, (fn + fnBrowse).GetString());
}
}
示例7: openOrCloseAllSubGroups
static void openOrCloseAllSubGroups (TreeViewItem& item, bool shouldOpen)
{
item.setOpen (shouldOpen);
for (int i = item.getNumSubItems(); --i >= 0;)
if (TreeViewItem* sub = item.getSubItem(i))
openOrCloseAllSubGroups (*sub, shouldOpen);
}
示例8: IsChildOf
/*********************************************************************\
Function name : TreeViewItem::IsChildOf
Description : checks, if pItem is a child of this
Created at : 15.08.01, @ 11:37:53
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
Bool TreeViewItem::IsChildOf(TreeViewItem* pItem)
{
TreeViewItem* pParent = this;
while (pParent)
{
if (pParent == pItem) return true;
pParent = pParent->GetParent();
}
return false;
}
示例9: _maxTreeDepth
BuildQtTreeView::BuildQtTreeView(osg::Node *node)
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
, _maxTreeDepth(0)
{
TreeViewItem *item = new TreeViewItem();
item->setText(0, QObject::tr("Root"));
item->setIcon(0, QIcon(":/icons/TreeView/Group.png"));
item->setOsgNode(node);
item->setCheckState(0, Qt::Checked);
_parents.push(item);
}
示例10: QVariant
QVariant TableListModel::data(const QModelIndex &index, int role) const
{
if(!index.isValid() || role != Qt::DisplayRole)
{
return QVariant();
}
TreeViewItem *item = static_cast<TreeViewItem *>(index.internalPointer());
return item->data(index.column());
}
示例11: throw
TreeViewItem* TreeViewItem::getDeepestOpenParentItem() throw()
{
TreeViewItem* result = this;
TreeViewItem* item = this;
while (item->parentItem != 0)
{
item = item->parentItem;
if (! item->isOpen())
result = item;
}
return result;
}
示例12: rowCount
int TableListModel::rowCount(const QModelIndex &parent) const
{
TreeViewItem *parentItem;
if(!parent.isValid())
{
parentItem = rootItem;
}
else
{
parentItem = static_cast<TreeViewItem *>(parent.internalPointer());
}
return parentItem->childCount();
}
示例13: getSelectedItem
void TreeView::moveSelectedRow (int delta)
{
if (delta == 0)
return;
int rowSelected = 0;
TreeViewItem* const firstSelected = getSelectedItem (0);
if (firstSelected != 0)
rowSelected = firstSelected->getRowNumberInTree();
rowSelected = jlimit (0, getNumRowsInTree() - 1, rowSelected + delta);
for (;;)
{
TreeViewItem* item = getItemOnRow (rowSelected);
if (item != 0)
{
if (! item->canBeSelected())
{
// if the row we want to highlight doesn't allow it, try skipping
// to the next item..
const int nextRowToTry = jlimit (0, getNumRowsInTree() - 1,
rowSelected + (delta < 0 ? -1 : 1));
if (rowSelected != nextRowToTry)
{
rowSelected = nextRowToTry;
continue;
}
else
{
break;
}
}
item->setSelected (true, true);
scrollToKeepItemVisible (item);
}
break;
}
}
示例14: QModelIndex
QModelIndex TableListModel::parent(const QModelIndex &index) const
{
if(!index.isValid())
{
return QModelIndex();
}
TreeViewItem *childItem = static_cast<TreeViewItem *>(index.internalPointer());
TreeViewItem *parentItem = childItem->parent();
if(parentItem == rootItem)
{
return QModelIndex();
}
return createIndex(parentItem->row(),0,parentItem);
}
示例15: SelectItem
/*********************************************************************\
Function name : TreeView::SelectItem
Description :
Created at : 14.08.01, @ 23:17:56
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void TreeView::SelectItem(TreeViewItem* pTreeItem)
{
m_pCurrentItem = pTreeItem;
TreeViewItem* pParent = pTreeItem->GetParent();
while (pParent)
{
pParent->m_bIsExpanded = true;
pParent = pParent->GetParent();
};
//m_VisibleItems.FreeList();
if (m_bMayUpdate)
{
//CreateVisibleItemList();
Redraw();
//UpdateParentLayout();
}
}