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


C++ wxListItem::SetBackgroundColour方法代码示例

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


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

示例1: 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

示例2: SetItem

bool wxCheckedListCtrl::SetItem(wxListItem &info)
{
#if CLC_VBAM_USAGE

	// only col 0 gets a checkbox
	if (info.GetColumn())
		return wxListCtrl::SetItem(info);

#endif
	// 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:MrSwiss,项目名称:visualboyadvance-m,代码行数:50,代码来源:checkedlistctrl.cpp

示例3: 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


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