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

C++ wxListItem类代码示例

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

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



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

示例1: GetItem

bool wxListCtrl::GetItem(wxListItem& info) const
{
    const long id = info.GetId();
    QTreeWidgetItem *qitem = QtGetItem(id);
    if ( qitem != NULL )
    {
        if ( !info.m_mask )
            // by default, get everything for backwards compatibility
            info.m_mask = -1;
        if ( info.m_mask & wxLIST_MASK_TEXT )
            info.SetText(wxQtConvertString(qitem->text(info.GetColumn())));
        if ( info.m_mask & wxLIST_MASK_DATA )
        {
            QVariant variant = qitem->data(0, Qt::UserRole);
            info.SetData(variant.value<long>());
        }
        if ( info.m_mask & wxLIST_MASK_STATE )
        {
            info.m_state = wxLIST_STATE_DONTCARE;
            if ( info.m_stateMask & wxLIST_STATE_FOCUSED )
            {
                if ( m_qtTreeWidget->currentIndex().row() == id )
                    info.m_state |= wxLIST_STATE_FOCUSED;
            }
            if ( info.m_stateMask & wxLIST_STATE_SELECTED )
            {
                if ( qitem->isSelected() )
                    info.m_state |= wxLIST_STATE_SELECTED;
            }
        }
        return true;
    }
    else
        return false;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:35,代码来源:listctrl.cpp


示例2: HandleCommonItemAttrs

void wxListCtrlXmlHandler::HandleCommonItemAttrs(wxListItem& item)
{
    if (HasParam(wxT("align")))
        item.SetAlign((wxListColumnFormat)GetStyle(wxT("align")));
    if (HasParam(wxT("text")))
        item.SetText(GetText(wxT("text")));
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:7,代码来源:xh_listc.cpp


示例3: SortRoutine

wxInt32 SortRoutine(wxInt32 Order, wxListItem &Item1, wxListItem &Item2)
{
    if (Order == 1)
        return NaturalCompare(Item1.GetText(), Item2.GetText());

    return NaturalCompare(Item2.GetText(), Item1.GetText());
}
开发者ID:darkranger-red,项目名称:odamex-maemo5,代码行数:7,代码来源:lst_custom.cpp


示例4: RestoreListColumnState

void CViewBase::RestoreListColumnState(wxString strName, wxListItem& liColumnInfo)
{
    CConfigManager* pConfig = wxGetApp().GetConfigManager();
    long lTempValue = 0;

    if (pConfig->GetConfigValue(GetViewName(), strName, wxT("Width"), -1, &lTempValue))
    {
        liColumnInfo.SetWidth(lTempValue);
    }

    m_pListPane->SetColumn(liColumnInfo.GetColumn(), liColumnInfo);
}
开发者ID:romw,项目名称:boincsentinels,代码行数:12,代码来源:ViewBase.cpp


示例5: GetColumn

bool wxListCtrl::GetColumn(int col, wxListItem& info) const
{
    QTreeWidgetItem *qitem = m_qtTreeWidget->headerItem();
    if ( qitem != NULL )
    {
        info.SetText(wxQtConvertString(qitem->text(col)));
        info.SetAlign(wxQtConvertAlignFlag(qitem->textAlignment(col)));
        info.SetWidth(m_qtTreeWidget->columnWidth(col));
        return true;
    }
    else
        return false;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:13,代码来源:listctrl.cpp


示例6: DoInsertColumn

long wxListCtrl::DoInsertColumn(long col, const wxListItem& info)
{
    QTreeWidgetItem *qitem = m_qtTreeWidget->headerItem();
    if ( qitem != NULL )
    {
        qitem->setText(col, wxQtConvertString(info.GetText()));
        qitem->setTextAlignment(col, wxQtConvertTextAlign(info.GetAlign()));
        if (info.GetWidth())
            m_qtTreeWidget->setColumnWidth(col, info.GetWidth());
        return col;
    }
    else
        return -1;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:14,代码来源:listctrl.cpp


示例7: ALCInsertItem

// Our variation of InsertItem, so we can do magical things!
long wxAdvancedListCtrl::ALCInsertItem(wxListItem &info)
{
    //Sort();

    // TODO: We need to remember this item id, because the last item on the list
    // does not get sorted, we can't move sort either, because then the return 
    // index would be stale.
    info.SetId(InsertItem(info));
   
    ColourListItem(info);

    SetItem(info);

    return info.GetId();
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:16,代码来源:lst_custom.cpp


示例8: InsertItem

long wxCheckedListCtrl::InsertItem(wxListItem &info)
{
	int additionalstate = GetAndRemoveAdditionalState(&info.m_state, info.m_stateMask);
	if (!(info.m_mask & wxLIST_MASK_STATE) ||
		!(info.m_stateMask & wxLIST_STATE_ENABLED)) {

		// if not specified, the default additional state is ENABLED
		additionalstate = wxLIST_STATE_ENABLED;
	}

	// we always want to insert items with images...
	info.m_mask |= wxLIST_MASK_IMAGE;
	info.m_image = GetItemImageFromAdditionalState(additionalstate);
	info.SetBackgroundColour(GetBgColourFromAdditionalState(additionalstate));

	int itemcount = GetItemCount();
	wxASSERT_MSG(info.m_itemId <= itemcount, wxT("Invalid index !"));
	wxASSERT_MSG((int)m_stateList.GetCount() == (int)GetItemCount(),
					wxT("Something wrong !"));
	if (info.m_itemId == itemcount) {

		// we are adding a new item at the end of the list
		m_stateList.Add(additionalstate);

	} else {

		// we must shift all following items
		for (int i=itemcount; i > info.m_itemId; i++)
			m_stateList[i] = m_stateList[i-1];
		m_stateList[info.m_itemId] = additionalstate;
	}
	
	return wxListCtrl::InsertItem(info);
}
开发者ID:KastB,项目名称:OpenCPN,代码行数:34,代码来源:checkedlistctrl.cpp


示例9: SetColumnImage

// Adjusts the index, so it jumps over the sort arrow images.
void wxAdvancedListCtrl::SetColumnImage(wxListItem &li, wxInt32 ImageIndex)
{
    if (ImageIndex < -1)
        ImageIndex = -1;

    li.SetImage(((ImageIndex == -1) ? ImageIndex : FIRST_IMAGE + ImageIndex));
}
开发者ID:JohnnyonFlame,项目名称:odamex,代码行数:8,代码来源:lst_custom.cpp


示例10: original

bool wxCheckedListCtrl::GetItem(wxListItem &info) const
{
	// wx internal wxListCtrl::GetItem remove from the state mask the
	// wxLIST_STATE_CHECKED & wxLIST_STATE_ENABLED bits since they
	// are not part of wx standard flags... so we need to check those
	// flags against the original wxListItem's statemask...
	wxListItem original(info);
#ifdef __WXDEBUG__
	// we always want to retrieve also the image state for checking purposes...
	info.m_mask |= wxLIST_MASK_IMAGE;
#endif

	if (!wxListCtrl::GetItem(info))
		return FALSE;

	// these are our additional supported states: read them from m_stateList
	bool checked = (m_stateList[info.m_itemId] & wxLIST_STATE_CHECKED) != 0;
	bool enabled = (m_stateList[info.m_itemId] & wxLIST_STATE_ENABLED) != 0;

	// now intercept state requests about enable or check mode
	if ((original.m_mask & wxLIST_MASK_STATE) &&
	        (original.m_stateMask & wxLIST_STATE_CHECKED))
	{
		info.m_state |= (m_stateList[info.m_itemId] & wxLIST_STATE_CHECKED);
		info.m_stateMask |= wxLIST_STATE_CHECKED;
		info.m_mask |= wxLIST_MASK_STATE;       // contains valid info !
	}

	if ((original.m_mask & wxLIST_MASK_STATE) &&
	        (original.m_stateMask & wxLIST_STATE_ENABLED))
	{
		info.m_state |= (m_stateList[info.m_itemId] & wxLIST_STATE_ENABLED);
		info.m_stateMask |= wxLIST_STATE_ENABLED;
		info.m_mask |= wxLIST_MASK_STATE;       // contains valid info !
	}

	// check that state & image are synch
#if CLC_VBAM_USAGE

	if (info.GetColumn())
		return TRUE;

#endif
#ifdef __WXDEBUG__
	wxASSERT_MSG((int)m_stateList.GetCount() == (int)GetItemCount(),
	             wxT("Something wrong ! See InsertItem()"));
	// read info by image index
	bool imagecheck = (info.m_image == wxCLC_CHECKED_IMGIDX) ||
	                  (info.m_image == wxCLC_DISABLED_CHECKED_IMGIDX);
	bool imageenabled = (info.m_image == wxCLC_CHECKED_IMGIDX) ||
	                    (info.m_image == wxCLC_UNCHECKED_IMGIDX);
	wxASSERT_MSG((checked && imagecheck) || (!checked && !imagecheck),
	             wxT("This is item has checked state but it's shown as unchecked (or viceversa)"));
	wxASSERT_MSG((enabled && imageenabled) || (!enabled && !imageenabled),
	             wxT("This is item has enabled state but it's shown as disabled (or viceversa)"));
#endif
	return TRUE;
}
开发者ID:MrSwiss,项目名称:visualboyadvance-m,代码行数:58,代码来源:checkedlistctrl.cpp


示例11: SetItem

bool wxCheckedListCtrl::SetItem(wxListItem& info)
{
	// remove the checked & enabled states from the state flag:
	// we'll store them in our separate array
	int additionalstate = GetAndRemoveAdditionalState(&info.m_state, info.m_stateMask);

	// set image index	
	// we will ignore the info.m_image field since we need
	// to overwrite it...
	if (info.m_mask & wxLIST_MASK_STATE) {

		// if some state is not included in the state mask, then get the state info
		// from our internal state array
		if (!(info.m_stateMask & wxLIST_STATE_ENABLED))
			additionalstate |= (m_stateList[info.m_itemId] & wxLIST_STATE_ENABLED);
		if (!(info.m_stateMask & wxLIST_STATE_CHECKED))
			additionalstate |= (m_stateList[info.m_itemId] & wxLIST_STATE_CHECKED);

		// state is valid: use it to determine the image to set...
		info.m_mask |= wxLIST_MASK_IMAGE;
		info.m_image = GetItemImageFromAdditionalState(additionalstate);

		// since when changing the background color, also the foreground color
		// and the font of the item are changed, we try to respect the user
		// choices of such attributes
		info.SetTextColour(this->GetItemTextColour(info.GetId()));
#if wxCHECK_VERSION(2, 6, 2)
		// before wx 2.6.2 the wxListCtrl::SetItemFont function is missing
		info.SetFont(this->GetItemFont(info.GetId()));
#endif
		
		// change the background color to respect the enabled/disabled status...
		info.SetBackgroundColour(GetBgColourFromAdditionalState(additionalstate));

		m_stateList[info.m_itemId] = additionalstate;

	} else {

		// state is invalid; don't change image
		info.m_mask &= ~wxLIST_MASK_IMAGE;
	}

	// save the changes
	return wxListCtrl::SetItem(info);
}
开发者ID:KastB,项目名称:OpenCPN,代码行数:45,代码来源:checkedlistctrl.cpp


示例12: MakeItem

void wxFileData::MakeItem( wxListItem &item )
{
    item.m_text = m_fileName;
    item.ClearAttributes();
    if (IsExe())
        item.SetTextColour(*wxRED);
    if (IsDir())
        item.SetTextColour(*wxBLUE);

    item.m_image = m_image;

    if (IsLink())
    {
        wxColour dg = wxTheColourDatabase->Find( _T("MEDIUM GREY") );
        if ( dg.Ok() )
            item.SetTextColour(dg);
    }
    item.m_data = (long)this;
}
开发者ID:BackupTheBerlios,项目名称:wxbeos-svn,代码行数:19,代码来源:filedlgg.cpp


示例13: ColourListItem

void wxAdvancedListCtrl::ColourListItem(wxListItem &info)
{
    static bool SwapColour = false;

    wxColour col;
    wxListItemAttr *ListItemAttr = info.GetAttributes();

    // Don't change a background colour we didn't set.
    if (ListItemAttr && ListItemAttr->HasBackgroundColour())
    {
        return;
    }

    // light grey coolness
    if (SwapColour)
        col = ItemShade;
    else
        col = BgColor;

    SwapColour = !SwapColour;

    info.SetBackgroundColour(col);
}
开发者ID:darkranger-red,项目名称:odamex-maemo5,代码行数:23,代码来源:lst_custom.cpp


示例14: wxASSERT_MSG

long wxListCtrl::InsertItem(const wxListItem& info)
{
    // default return value if not successful:
    int index = -1;
    wxASSERT_MSG( info.m_itemId != -1, wxS("Item ID must be set.") );
    QTreeWidgetItem *qitem = new QTreeWidgetItem();
    if ( qitem != NULL )
    {
        // insert at the correct index and return it:
        m_qtTreeWidget->insertTopLevelItem(info.GetId(), qitem);
        // return the correct position of the item or -1 if not found:
        index = m_qtTreeWidget->indexOfTopLevelItem(qitem);
        if ( index != -1 )
        {
            // temporarily copy the item info (we need a non-const instance)
            wxListItem tmp = info;
            // set the text, image, etc.:
            SetItem(tmp);
        }
    }
    return index;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:22,代码来源:listctrl.cpp


示例15: SaveListColumnState

void CViewBase::SaveListColumnState(wxString strName, wxListItem& liColumnInfo)
{
    CConfigManager* pConfig = wxGetApp().GetConfigManager();

    pConfig->SetConfigValue(GetViewName(), strName, wxT("Width"), liColumnInfo.GetWidth());
}
开发者ID:romw,项目名称:boincsentinels,代码行数:6,代码来源:ViewBase.cpp


示例16: SetItem

bool wxListCtrl::SetItem(wxListItem& info)
{
    const long id = info.GetId();
    QTreeWidgetItem *qitem = QtGetItem(id);
    if ( qitem != NULL )
    {
        if ((info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().IsNull() )
            qitem->setText(info.GetColumn(), wxQtConvertString(info.GetText()));
        qitem->setTextAlignment(info.GetColumn(), wxQtConvertTextAlign(info.GetAlign()));

        if ( info.m_mask & wxLIST_MASK_DATA )
        {
            QVariant variant = qVariantFromValue(info.GetData());
            qitem->setData(0, Qt::UserRole, variant);
        }
        if (info.m_mask & wxLIST_MASK_STATE)
        {
            if ((info.m_stateMask & wxLIST_STATE_FOCUSED) &&
                (info.m_state & wxLIST_STATE_FOCUSED))
                    m_qtTreeWidget->setCurrentItem(qitem, 0);
            if (info.m_stateMask & wxLIST_STATE_SELECTED)
                qitem->setSelected(info.m_state & wxLIST_STATE_SELECTED);
        }
        if (info.m_mask & wxLIST_MASK_IMAGE)
        {
            if (info.m_image >= 0)
            {
                wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL);
                wxCHECK_MSG(imglst, false, "invalid listctrl imagelist");
                const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image);
                if (bitmap != NULL)
                {
                    // set the new image:
                    qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() ));
                }
            }
            else
            {
                // remove the image using and empty qt icon:
                qitem->setIcon( info.GetColumn(), QIcon() );
            }
        }
        for (int col=0; col<GetColumnCount(); col++)
        {
            if ( info.GetFont().IsOk() )
                qitem->setFont(col, info.GetFont().GetHandle() );
            if ( info.GetTextColour().IsOk() )
                qitem->setTextColor(col, info.GetTextColour().GetHandle());
            if ( info.GetBackgroundColour().IsOk() )
                qitem->setBackgroundColor(col, info.GetBackgroundColour().GetHandle());
        }
        return true;
    }
    else
        return false;
}
开发者ID:AaronDP,项目名称:wxWidgets,代码行数:56,代码来源:listctrl.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ wxLongLong类代码示例发布时间:2022-05-31
下一篇:
C++ wxListEvent类代码示例发布时间: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