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


C++ TreeViewItem类代码示例

本文整理汇总了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());
            }
        }
    }
开发者ID:Labmind,项目名称:GUI,代码行数:35,代码来源:juce_TreeView.cpp

示例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;
		}
开发者ID:bonsak,项目名称:resedit,代码行数:26,代码来源:TreeView.cpp

示例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);
        }
    }
开发者ID:Labmind,项目名称:GUI,代码行数:29,代码来源:juce_TreeView.cpp

示例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();
	};
}
开发者ID:phohale,项目名称:ResEdit,代码行数:32,代码来源:DialogPreview.cpp

示例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;
		}
开发者ID:bonsak,项目名称:resedit,代码行数:7,代码来源:TreeView.cpp

示例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());
	}
}
开发者ID:nr-plugins,项目名称:resedit,代码行数:35,代码来源:ResEditBrowser.cpp

示例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);
}
开发者ID:bketech,项目名称:element,代码行数:8,代码来源:AssetTreeView.cpp

示例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;
}
开发者ID:bonsak,项目名称:resedit,代码行数:17,代码来源:TreeView.cpp

示例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);
}
开发者ID:oliviertournaire,项目名称:QosgSceneEdit,代码行数:11,代码来源:BuildQtTreeView.cpp

示例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());
}
开发者ID:mejwaller,项目名称:MothDB,代码行数:12,代码来源:TableListModel.cpp

示例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;
}
开发者ID:Labmind,项目名称:GUI,代码行数:15,代码来源:juce_TreeView.cpp

示例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();

}
开发者ID:mejwaller,项目名称:MothDB,代码行数:15,代码来源:TableListModel.cpp

示例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;
    }
}
开发者ID:Labmind,项目名称:GUI,代码行数:45,代码来源:juce_TreeView.cpp

示例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);

}
开发者ID:mejwaller,项目名称:MothDB,代码行数:18,代码来源:TableListModel.cpp

示例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();
	}
}
开发者ID:bonsak,项目名称:resedit,代码行数:25,代码来源:TreeView.cpp


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