本文整理汇总了C++中CDuiString类的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString类的具体用法?C++ CDuiString怎么用?C++ CDuiString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDuiString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetText
void COptionUI::PaintText(HDC hDC)
{
if( (m_uButtonState & UISTATE_SELECTED) != 0 )
{
DWORD oldTextColor = m_dwTextColor;
if( m_dwSelectedTextColor != 0 ) m_dwTextColor = m_dwSelectedTextColor;
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
CDuiString sText = GetText();
if( sText.IsEmpty() ) return;
int nLinks = 0;
RECT rc = m_rcItem;
rc.left += m_rcTextPadding.left;
rc.right -= m_rcTextPadding.right;
rc.top += m_rcTextPadding.top;
rc.bottom -= m_rcTextPadding.bottom;
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, \
NULL, NULL, nLinks, m_uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, IsEnabled()?m_dwTextColor:m_dwDisabledTextColor, \
m_iFont, m_uTextStyle);
m_dwTextColor = oldTextColor;
}
else
CButtonUI::PaintText(hDC);
}
示例2: GetText
void CGroupBoxUI::PaintText(HDC hDC)
{
CDuiString sText = GetText();
if( sText.IsEmpty() ) {
return;
}
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
if( sText.IsEmpty() ) return;
CDuiRect rcText = m_rcItem;
rcText.Deflate(5,5);
SIZE szAvailable = { rcText.right - rcText.left, rcText.bottom - rcText.top };
SIZE sz = CalcrectSize(szAvailable);
//¼ÆËãÎÄ×ÖÇøÓò
rcText.left = rcText.left + 15;
rcText.top = rcText.top - 5;
rcText.right = rcText.left + sz.cx;
rcText.bottom = rcText.top + sz.cy;
if( IsEnabled() )
{
CRenderEngine::DrawText(hDC, m_pManager, rcText, sText, m_dwTextColor, m_iFont, m_uTextStyle,
GetAdjustColor(m_dwBackColor), FALSE);
}
else
{
CRenderEngine::DrawText(hDC, m_pManager, rcText, sText, m_dwDisabledTextColor, m_iFont, m_uTextStyle,
GetAdjustColor(m_dwBackColor), FALSE);
}
}
示例3: _T
void CTestWndWindow::Notify(TNotifyUI& msg)
{
CDuiString strCtrlName = msg.pSender->GetName();
if(msg.sType == _T("click"))
{
if(strCtrlName == _T("NewItemBtn"))
{
int j = index++;
CDuiString strTxt;
strTxt.Format(L"±êÇ©%d", j);
static CDuiString strAttrOptionEx = _T("float=\"false\" group=\"group1\" maxwidth=\"174\" normalimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'0,0,87,30\'\" hotimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'87,0,174,30\'\" selectedimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'174,0,261,30\'\" ");
COptionExUI* pNewOption = new COptionExUI;
pNewOption->ApplyAttributeList(strAttrOptionEx);
pNewOption->SetText(strTxt);
CTagMoveUI* pNewTagMove = new CTagMoveUI;
pNewTagMove->ApplyAttributeList(_T("maxwidth=\"174\" "));
pNewTagMove->Add(pNewOption);
m_pTagLayout->AddAt(pNewTagMove, m_pTagLayout->GetCount());
pNewOption->Activate();
}
if(strCtrlName == _T("closebtn"))
{
PostQuitMessage(0L);
}
}
}
示例4: fopen
bool ConnInfoUI::SaveConfig( const std::string& path )
{
std::size_t theSize = m_dicServerInfo[kServerNameIndex].size();
//Json::Value serverConfig;
//Json::Value rootConfig;
FILE* fp = fopen(kConfigFilePath, "w+");
if (!fp) return false;
FileStream os(fp);
PrettyWriter<FileStream> writer(os);
writer.StartObject();
writer.String("Server");
writer.StartArray();
for (std::size_t idx=0; idx<theSize; ++idx)
{
writer.StartObject();
writer.String("name");
CDuiString name = Base::CharacterSet::ANSIToUnicode(m_dicServerInfo[kServerNameIndex][idx]).c_str();
writer.String(Base::CharacterSet::UnicodeToUTF8(name.GetData()).c_str());
writer.String("ip");
writer.String(m_dicServerInfo[kServerIpIndex][idx].c_str(), m_dicServerInfo[kServerIpIndex][idx].length());
writer.String("port");
writer.Int(atoi(m_dicServerInfo[kServerPortIndex][idx].c_str()));
writer.String("auth");
writer.String(m_dicServerInfo[kServerAuthIndex][idx].c_str());
writer.EndObject();
}
writer.EndArray();
writer.EndObject();
fclose(fp);
return true;
}
示例5: ASSERT
CDuiString CDuiString::operator+(LPCTSTR lpStr) const
{
ASSERT(!::IsBadStringPtr(lpStr,-1));
CDuiString sTemp = *this;
sTemp.Append(lpStr);
return sTemp;
}
示例6: GetText
void CComboUI::PaintText(HDC hDC)
{
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
RECT rc = m_rcItem;
rc.left += m_rcTextPadding.left;
rc.right -= m_rcTextPadding.right;
rc.top += m_rcTextPadding.top;
rc.bottom -= m_rcTextPadding.bottom;
CDuiString sText = GetText();
if( sText.IsEmpty() ) return;
int nLinks = 0;
if( IsEnabled() ) {
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, m_dwTextColor, \
NULL, NULL, nLinks, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwTextColor, \
m_iFont, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
else {
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
NULL, NULL, nLinks, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
m_iFont, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
}
}
示例7: _T
void CDateTimeUI::DoPaint(HDC hDC, const RECT& rcPaint)// Hujq 2015.09.02-06
{
if (m_nDTUpdateFlag == DT_DELETE)
{
if(!GetEnabledEffect())
m_sText = _T("");
else
m_TextValue = _T("") ;
}
else if (m_nDTUpdateFlag == DT_UPDATE)
{
CDuiString sText;
switch(m_nType)
{
case 0:
sText.SmallFormat(_T("%4d-%02d-%02d"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
break;
case 1:
sText.SmallFormat(_T("%4d-%02d"),m_sysTime.wYear, m_sysTime.wMonth);
break;
case 2:
sText.SmallFormat(_T("%4d"),m_sysTime.wYear);
break;
default:break;
}
if(!GetEnabledEffect())
m_sText = sText;
else
m_TextValue = sText;
}
CControlUI::DoPaint(hDC,rcPaint);
}
示例8: GetManager
void CLabelUI::PaintText(HDC hDC)
{
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
RECT rc = m_rcItem;
RECT m_rcTextPadding = CLabelUI::m_rcTextPadding;
GetManager()->GetDPIObj()->Scale(&m_rcTextPadding);
rc.left += m_rcTextPadding.left;
rc.right -= m_rcTextPadding.right;
rc.top += m_rcTextPadding.top;
rc.bottom -= m_rcTextPadding.bottom;
CDuiString sText = GetText();
if( sText.IsEmpty() ) return;
int nLinks = 0;
if( IsEnabled() ) {
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, m_dwTextColor, \
NULL, NULL, nLinks, m_uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwTextColor, \
m_iFont, m_uTextStyle);
}
else {
if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
NULL, NULL, nLinks, m_uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
m_iFont, m_uTextStyle);
}
}
示例9: IMPL_LUA_FUNC
IMPL_LUA_FUNC(LuaWindowExport, RegisterSkin)
{
try
{
CLuaWindow* self;
self = static_cast<CLuaWindow*>(LuaStatic::CheckUserData(l, 1));
STRINGorID xml(_T(""));
if (lua_isnumber(l, 2))
xml = STRINGorID(lua_tointeger(l, 2));
else if (lua_isstring(l, 2))
{
CDuiString pstrText;
lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);
xml = STRINGorID(pstrText.GetData());
}
LPCTSTR type = NULL;
if (lua_isstring(l, 3))
{
CDuiString pstrText;
lua_op_t<CDuiString>::lua_to_value(l, 3, pstrText);
type = pstrText.GetData();
}
IDialogBuilderCallback* pCallBack = static_cast<IDialogBuilderCallback*>(self);
CControlUI* pParent = NULL;
if (lua_isuserdata(l,5))
pParent = static_cast<CControlUI*>(LuaStatic::CheckUserData(l, 5));
lua_pushboolean(l, self->RegisterSkin(xml, type, pCallBack, pParent) ? 1 : 0);
return 1;
}
catch(...)
{
DuiException(_T("LuaWindowExport::MapWindowPoints2"));
return 0;
}
}
示例10: IMPL_LUA_FUNC
IMPL_LUA_FUNC(LuaCDialogBuilder, Create)
{
try
{
CDialogBuilder* self;
self = static_cast<CDialogBuilder*>(LuaStatic::CheckUserData(l, 1));
STRINGorID xml("");
if (lua_isnumber(l,2))
xml = STRINGorID(lua_tointeger(l, 2));
else{
CDuiString pstrText;
lua_op_t<CDuiString>::lua_to_value(l, 2, pstrText);
xml = STRINGorID(pstrText.GetData());
}
CDuiString pType;
lua_op_t<CDuiString>::lua_to_value(l, 3, pType);
return 1;
}
catch (...)
{
DuiException(_T("LuaCDialogBuilder::Create"));
return 0;
}
}
示例11: CreateControl
CControlUI* CDuiFrameWnd::CreateControl( LPCTSTR pstrClassName )
{
CDuiString strXML;
CDialogBuilder builder;
if (_tcsicmp(pstrClassName, _T("Caption")) == 0)
{
strXML = _T("Caption.xml");
}
else if (_tcsicmp(pstrClassName, _T("PlayPanel")) == 0)
{
strXML = _T("PlayPanel.xml");
}
else if (_tcsicmp(pstrClassName, _T("Playlist")) == 0)
{
strXML = _T("Playlist.xml");
}
else if (_tcsicmp(pstrClassName, _T("WndMediaDisplay")) == 0)
{
CWndUI *pUI = new CWndUI;
HWND hWnd = CreateWindow(_T("#32770"), _T("WndMediaDisplay"), WS_VISIBLE | WS_CHILD, 0, 0, 0, 0, m_PaintManager.GetPaintWindow(), (HMENU)0, NULL, NULL);
pUI->Attach(hWnd);
return pUI;
}
if (! strXML.IsEmpty())
{
CControlUI* pUI = builder.Create(strXML.GetData(), NULL, NULL, &m_PaintManager, NULL); // 这里必须传入m_PaintManager,不然子XML不能使用默认滚动条等信息。
return pUI;
}
return NULL;
}
示例12: CalPos
void CDateTimeWnd::Init(CDateTimeUI* pOwner)
{
m_pOwner = pOwner;
m_pOwner->m_nDTUpdateFlag = DT_NONE;
if (m_hWnd == NULL)
{
RECT rcPos = CalPos();
UINT uStyle =WS_CHILD|m_pOwner->m_dwStyle;// 修改者:YYM
Create(m_pOwner->GetManager()->GetPaintWindow(), NULL, uStyle, 0, rcPos);
SetWindowFont(m_hWnd, m_pOwner->GetManager()->GetFontInfo(m_pOwner->GetFont())->hFont, TRUE);
//lxm,added,修改Date控件日期为横线
if(m_pOwner->m_dwStyle == DTS_SHORTDATECENTURYFORMAT || m_pOwner->m_dwStyle == DTS_SHORTDATEFORMAT)
{
CDuiString strFormat = _T("yyyy-MM-dd");
::SendMessage(m_hWnd, DTM_SETFORMAT, 0, (LPARAM)strFormat.GetData());
}
}
if (m_pOwner->GetText().IsEmpty())
::GetLocalTime(&m_pOwner->m_sysTime);
::SendMessage(m_hWnd, DTM_SETSYSTEMTIME, 0, (LPARAM)&m_pOwner->m_sysTime);
::ShowWindow(m_hWnd, SW_SHOWNOACTIVATE);
::SetFocus(m_hWnd);
//
// SYSTEMTIME sysTimes[2];
// GetLocalTime(&(sysTimes[0]));
// DateTime_SetRange(m_hWnd,GDTR_MIN,sysTimes );
m_bInit = true;
}
示例13: SetText
void CDateTimeUI::UpdateText()
{
if (m_nDTUpdateFlag == DT_DELETE)
SetText(_T(""));
else if (m_nDTUpdateFlag == DT_UPDATE)
{// 修改者:YYM 时间:2015-7-22
CDuiString sText;
if ((m_dwStyle == DTS_SHORTDATEFORMAT) || (m_dwStyle == DTS_SHORTDATECENTURYFORMAT))
{//显示短日期
sText.SmallFormat(_T("%4d-%02d-%02d"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
}
else if (m_dwStyle == DTS_TIMEFORMAT)
{// 显示时间
sText.SmallFormat(_T("%02d:%02d:%02d"),
m_sysTime.wHour, m_sysTime.wMinute,m_sysTime.wSecond);
}
else
{// 显示长日期
sText.SmallFormat(_T("%4d年%02d月%02d日"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
}
SetText(sText);
}
}
示例14: GetText
void CMenuElementUI::DrawItemText(HDC hDC, const RECT& rcItem)
{
CDuiString sText = GetText();
if( sText.IsEmpty() ) return;
if( m_pOwner == NULL ) return;
TListInfoUI* pInfo = m_pOwner->GetListInfo();
DWORD iTextColor = pInfo->dwTextColor;
if( (m_uButtonState & UISTATE_HOT) != 0 ) {
iTextColor = pInfo->dwHotTextColor;
}
if( IsSelected() ) {
iTextColor = pInfo->dwSelectedTextColor;
}
if( !IsEnabled() ) {
iTextColor = pInfo->dwDisabledTextColor;
}
int nLinks = 0;
RECT rcText = rcItem;
rcText.left += pInfo->rcTextPadding.left;
rcText.right -= pInfo->rcTextPadding.right;
rcText.top += pInfo->rcTextPadding.top;
rcText.bottom -= pInfo->rcTextPadding.bottom;
if( pInfo->bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rcText, sText, iTextColor, \
NULL, NULL, nLinks, DT_SINGLELINE | pInfo->uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rcText, sText, iTextColor, \
pInfo->nFont, DT_SINGLELINE | pInfo->uTextStyle);
}
示例15: FreshAllGroupMemberAvatar
void SessionLayout::FreshAllGroupMemberAvatar()
{
if (!m_pGroupMemberList)
{
return;
}
for (int n = 0; n < m_pGroupMemberList->GetCount(); n++)
{
CListContainerElementUI* pItem = (CListContainerElementUI*)m_pGroupMemberList->GetItemAt(n);
if (pItem)
{
CDuiString userData = pItem->GetUserData();
if (!userData.IsEmpty())
{
std::string sid = util::cStringToString(CString(userData));
module::UserInfoEntity userInfo;
if (!module::getUserListModule()->getUserInfoBySId(sid, userInfo))
{
LOG__(ERR, _T("can't find the userInfo:%s,GroupId:%s"),util::stringToCString(sid),util::stringToCString(m_sId));
continue;;
}
CButtonUI* btnAvatarInfo = (CButtonUI*)pItem->FindSubControl(_T("AvatarInfo"));
if (btnAvatarInfo)
{
btnAvatarInfo->SetBkImage(util::stringToCString(userInfo.getAvatarPath()));
}
}
}
}
m_pGroupMemberList->SortItems(GroupMemberListItemCompareFunc, 0);
}