本文整理汇总了C++中COptionUI::SetTag方法的典型用法代码示例。如果您正苦于以下问题:C++ COptionUI::SetTag方法的具体用法?C++ COptionUI::SetTag怎么用?C++ COptionUI::SetTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptionUI
的用法示例。
在下文中一共展示了COptionUI::SetTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddFiles
void CDuiFrameWnd::AddFiles( const std::vector<PlayFileInfo> &vctString, bool bInit )
{
COptionUI *pOptionTmp;
CVerticalLayoutUI* pLayout = NULL;
CDuiString strTmp;
TCHAR szName[_MAX_FNAME];
TCHAR szExt[_MAX_EXT];
unsigned i, uWantedCount;
pLayout = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("playlist")));
if (! pLayout)
{
return;
}
for(i = 0, uWantedCount = 0; i < vctString.size(); i++)
{
if (IsWantedFile(vctString[i].szFileName))
{
_tsplitpath_s(vctString[i].szFileName, NULL, 0, NULL, 0, szName, _MAX_FNAME, szExt, _MAX_EXT);
strTmp.Format(_T("%s%s"), szName, szExt); // 文件名
pOptionTmp = new COptionUI;
pOptionTmp->SetTextColor(0xFFC8C6CB);
pOptionTmp->SetHotTextColor(0xFFC8C6CB);
pOptionTmp->SetSelectedTextColor(0xFFC8C6CB);
pOptionTmp->SetTag(U_TAG_PLAYLIST);
pOptionTmp->SetText(strTmp);
pOptionTmp->SetAttribute(_T("height"), _T("22"));
pOptionTmp->SetAttribute(_T("inset"), _T("7,0,0,0"));
pOptionTmp->SetAttribute(_T("align"), _T("center"));
pOptionTmp->SetAttribute(_T("font"),_T("4"));
pOptionTmp->SetUserData(vctString[i].szFileName);
pOptionTmp->SetName(vctString[i].szFileName);
pOptionTmp->SetSelectedImage(_T("file='btn_bk.png'"));
pLayout->Add(pOptionTmp);
uWantedCount++;
if (! bInit)
{
m_cPlayList.Add(vctString[i]); // 完整路径
}
}
}
Rand(m_queRand, uWantedCount);
ShowPlaylist(true);
}
示例2: Notify
void CMainDlg::Notify(TNotifyUI& msg)
{
//throw std::exception("The method or operation is not implemented.");
//单击事件
if(msg.sType == DUI_MSGTYPE_CLICK)
{
//点击关闭按钮
if(msg.pSender->GetName() == _T("sys_close_btn")) //退出
Close(0);
//点击添加按钮
else if(msg.pSender->GetName() == _T("add_option"))
{
//新建一个option按钮
CDialogBuilder builder;
COptionUI * p = static_cast<COptionUI *>(builder.Create(_T("option.xml"),0,NULL,&m_pm));
if(NULL == p)
return;
CContainerUI * pContainer = static_cast<CContainerUI *>(m_pm.FindControl(_T("main_option_layout")));
int nCount = pContainer->GetCount();
static int i = 1;
CDuiString str1;
str1.Format(_T("新增按钮%d"), i);
p->SetText(str1);
pContainer->AddAt(p, nCount - 1);
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
if(NULL != pTab)
{
CDuiString str2;
str2.Format(_T("新增界面%d"), i);
//增加一个界面,这里可以像上边option一样使用xml创建
CButtonUI * pButton = new CButtonUI;
pButton->SetTextColor(0xffffffff);
pButton->SetText(str2);
pTab->Add(pButton);
p->SetTag(pTab->GetCount() - 1);
}
i++;
}
}
//切换选项卡按钮时根据不同的按钮,选中不同的界面
else if(msg.sType == DUI_MSGTYPE_SELECTCHANGED)
{
if(msg.pSender->GetName() == _T("option_1"))
{
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
if(NULL != pTab)
{
CControlUI * pControl = pTab->FindSubControl(_T("tab_01"));
if(NULL != pControl)
pTab->SelectItem(pControl);
}
}
else if(msg.pSender->GetName() == _T("option_2"))
{
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
if(NULL != pTab)
{
CControlUI * pControl = pTab->FindSubControl(_T("tab_02"));
if(NULL != pControl)
pTab->SelectItem(pControl);
}
}
else if(msg.pSender->GetName() == _T("option"))
{
CTabLayoutUI * pTab = static_cast<CTabLayoutUI *>(m_pm.FindControl(_T("main_tab")));
pTab->SelectItem(msg.pSender->GetTag());
}
}
}