• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TreeViewItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了TreeViewItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: DrawCell

		virtual void DrawCell(void *root,void *userdata,void *obj,Int32 col,DrawInfo *drawinfo, const GeData& bgColor)
		{
			TreeViewItem* p = (TreeViewItem*)obj;
			if (col=='icon')
			{
				Int32 wx,wy,wh,ww;
				/*BaseBitmap *pBmp = p->GetIcon();
				if (pBmp)
				{
					wx = drawinfo->xpos;
					wy = drawinfo->ypos;
					ww = drawinfo->width;
					wh = drawinfo->height;

					if (ww > pBmp->GetBw()) { wx += (ww - pBmp->GetBw()) / 2; ww = pBmp->GetBw(); }
					if (wh > pBmp->GetBh()) { wy += (wh - pBmp->GetBh()) / 2; wh = pBmp->GetBh(); }

					drawinfo->frame->DrawSetPen(COLOR_BG);
					drawinfo->frame->DrawBitmap(pBmp, wx, wy, ww, wh, 0, 0, pBmp->GetBw(), pBmp->GetBh(), BMP_NORMALSCALED);
				}*/
				Int32 lWidth = CONTROLIMAGE_SIZE, lHeight = CONTROLIMAGE_SIZE;
				Int32 i = p->GetIcon();
				Int32 x = (i % 9) * CONTROLIMAGE_SIZE;
				Int32 y = (i / 9) * CONTROLIMAGE_SIZE;

				wx = drawinfo->xpos;
				wy = drawinfo->ypos;
				ww = drawinfo->width;
				wh = drawinfo->height;

				if (ww > lWidth) { wx += (ww - lWidth) / 2; ww = lWidth; }
				if (wh > lHeight) { wy += (wh - lHeight) / 2; wh = lHeight; }

				drawinfo->frame->DrawSetPen(COLOR_BG);
				drawinfo->frame->DrawBitmap(g_pControlImages, wx, wy, ww, wh, x, y, lWidth, lHeight, BMP_NORMALSCALED | BMP_ALLOWALPHA);
			}
		}
开发者ID:bonsak,项目名称:resedit,代码行数:37,代码来源:TreeView.cpp


示例17: index

QModelIndex TableListModel::index(int row,int column,const QModelIndex &parent) const
{
    TreeViewItem *parentItem;

    if(!parent.isValid())
    {
        parentItem = rootItem;
    }
    else
    {
        parentItem = static_cast<TreeViewItem *>(parent.internalPointer());
    }

    TreeViewItem *childItem = parentItem->child(row);

    if(childItem)
    {
        return createIndex(row,column,childItem);
    }
    else
    {
        return QModelIndex();
    }
}
开发者ID:mejwaller,项目名称:MothDB,代码行数:24,代码来源:TableListModel.cpp


示例18: addLiveBuildConfigItem

void ProjucerApplication::addLiveBuildConfigItem (Project& project, TreeViewItem& parent)
{
    parent.addSubItem (new LiveBuildConfigItem (project));
}
开发者ID:bome,项目名称:JUCE,代码行数:4,代码来源:jucer_Application.cpp


示例19: TreeViewItem

void BuildQtTreeView::apply(osg::Node& node)
{
	osg::Geode *geode = 0L;
    bool isGroup = false;
    QString nodeName;
    if(node.className()!="")
        nodeName = "[" + QString::fromStdString(node.className()) + "]";

    if(node.getName()!="")
        nodeName += " " + QString::fromStdString(node.getName());
    if (nodeName.isEmpty())
        nodeName = QObject::tr("[<unknow_type>] <unnamed>");

    TreeViewItem *item = new TreeViewItem(_parents.top());
	item->setCheckState(0, Qt::Checked);
	item->setOsgNode(&node);
    item->setData(0, Qt::DisplayRole, nodeName);

    if (dynamic_cast<osg::PagedLOD*>(&node))
    {
        item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/LOD.png"));
        _parents.push(item);
        isGroup = true;
    }
    else if (dynamic_cast<osg::LOD*>(&node))
    {
        item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/LOD.png"));
        _parents.push(item);
        isGroup = true;
    }
	else if (dynamic_cast<osg::Group*>(&node))
    {
        if (dynamic_cast<osg::MatrixTransform*>(&node))
            item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/Matrix.png"));
        else
            item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/Group.png"));
        _parents.push(item);
        isGroup = true;
    }
	else if (dynamic_cast<osg::Billboard*>(&node))
    {
        item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/Billboard.png"));
	}
	else if ((geode = dynamic_cast<osg::Geode*>(&node)))
    {
        item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/Geode.png"));

		for (unsigned int i=0; i<geode->getNumDrawables(); ++i)
		{
			osg::ref_ptr<osg::Drawable> drawable = geode->getDrawable(i);

			if (drawable.valid())
			{
				TreeViewItem *subItem = new TreeViewItem(item);
				//item->setCheckState(0, Qt::Checked);
				//item->setOsgNode(&node);
				subItem->setOsgObject(drawable.get());
                subItem->setData(0, Qt::DisplayRole, "Drawable");
			}
		}
    }
	else
    {
        item->setData(0, Qt::DecorationRole, QIcon(":/icons/TreeView/Other.png"));
    }

    _maxTreeDepth = std::max<int>(_maxTreeDepth, _parents.size());

    traverse(node);

    if (isGroup)
    {
        _parents.pop();
    }
}
开发者ID:oliviertournaire,项目名称:QosgSceneEdit,代码行数:75,代码来源:BuildQtTreeView.cpp


示例20: GetFirst

		virtual void*	GetFirst(void *pRoot, void *userdata)
		{
			TreeViewItem *p = (TreeViewItem*)pRoot;
			return p->GetChild(0);
		}
开发者ID:bonsak,项目名称:resedit,代码行数:5,代码来源:TreeView.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TreeVisitor类代码示例发布时间:2022-05-31
下一篇:
C++ TreeType类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap