本文整理汇总了C++中CDuiString::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString::Empty方法的具体用法?C++ CDuiString::Empty怎么用?C++ CDuiString::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDuiString
的用法示例。
在下文中一共展示了CDuiString::Empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintText
void CEditUI::PaintText(HDC hDC)
{
if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
const bool isPrompt = m_sText.IsEmpty();
if( isPrompt && m_sPrompt.IsEmpty()) return;
CDuiString sText = (isPrompt ? m_sPrompt : m_sText);
if( m_bPasswordMode && !isPrompt) {
sText.Empty();
LPCTSTR p = m_sText.GetData();
while( *p != _T('\0') ) {
sText += m_cPasswordChar;
p = ::CharNext(p);
}
}
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( IsEnabled() && !isPrompt) {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
else {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
}
示例2: ApplyAttributeList
CControlUI* CControlUI::ApplyAttributeList(LPCTSTR pstrValue)
{
// ½âÎöÑùʽ±í
if(m_pManager != NULL) {
LPCTSTR pStyle = m_pManager->GetStyle(pstrValue);
if( pStyle != NULL) {
return ApplyAttributeList(pStyle);
}
}
CDuiString sXmlData = pstrValue;
sXmlData.Replace(_T("""), _T("\""));
LPCTSTR pstrList = sXmlData.GetData();
// ½âÎöÑùʽÊôÐÔ
CDuiString sItem;
CDuiString sValue;
while( *pstrList != _T('\0') ) {
sItem.Empty();
sValue.Empty();
while( *pstrList != _T('\0') && *pstrList != _T('=') ) {
LPTSTR pstrTemp = ::CharNext(pstrList);
while( pstrList < pstrTemp) {
sItem += *pstrList++;
}
}
ASSERT( *pstrList == _T('=') );
if( *pstrList++ != _T('=') ) return this;
ASSERT( *pstrList == _T('\"') );
if( *pstrList++ != _T('\"') ) return this;
while( *pstrList != _T('\0') && *pstrList != _T('\"') ) {
LPTSTR pstrTemp = ::CharNext(pstrList);
while( pstrList < pstrTemp) {
sValue += *pstrList++;
}
}
ASSERT( *pstrList == _T('\"') );
if( *pstrList++ != _T('\"') ) return this;
SetAttribute(sItem, sValue);
if( *pstrList++ != _T(' ') && *pstrList++ != _T(',') ) return this;
}
return this;
}
示例3: PaintText
void CEditUI::PaintText(HDC hDC)
{
DWORD mCurTextColor = m_dwTextColor;
if( m_dwTextColor == 0 ) mCurTextColor = m_dwTextColor = m_pManager->GetDefaultFontColor();
if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
CDuiString sText;
if(GetText() == m_sTipValue || GetText() == _T(""))
{
mCurTextColor = m_dwTipValueColor;
sText = m_sTipValue;
}
else
{
sText = m_sText;
if( m_bPasswordMode ) {
sText.Empty();
LPCTSTR p = m_sText.GetData();
while( *p != _T('\0') ) {
sText += m_cPasswordChar;
p = ::CharNext(p);
}
}
}
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( IsEnabled() ) {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, mCurTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
else {
CRenderEngine::DrawText(hDC, m_pManager, rc, sText, m_dwDisabledTextColor, \
m_iFont, DT_SINGLELINE | m_uTextStyle);
}
}
示例4: ParseAttribute
void CImageAttribute::ParseAttribute(LPCTSTR pStrImage)
{
if (pStrImage == NULL)
return;
// 1¡¢aaa.jpg
// 2¡¢file='aaa.jpg' res='' restype='0' dest='0,0,0,0' source='0,0,0,0' corner='0,0,0,0'
// mask='#FF0000' fade='255' hole='false' xtiled='false' ytiled='false'
CDuiString sItem;
CDuiString sValue;
LPTSTR pstr = NULL;
while (*pStrImage != _T('\0'))
{
sItem.Empty();
sValue.Empty();
while (*pStrImage > _T('\0') && *pStrImage <= _T(' ')) pStrImage = ::CharNext(pStrImage);
while (*pStrImage != _T('\0') && *pStrImage != _T('=') && *pStrImage > _T(' '))
{
LPTSTR pstrTemp = ::CharNext(pStrImage);
while (pStrImage < pstrTemp)
{
sItem += *pStrImage++;
}
}
while (*pStrImage > _T('\0') && *pStrImage <= _T(' ')) pStrImage = ::CharNext(pStrImage);
if (*pStrImage++ != _T('=')) break;
while (*pStrImage > _T('\0') && *pStrImage <= _T(' ')) pStrImage = ::CharNext(pStrImage);
if (*pStrImage++ != _T('\'')) break;
while (*pStrImage != _T('\0') && *pStrImage != _T('\''))
{
LPTSTR pstrTemp = ::CharNext(pStrImage);
while (pStrImage < pstrTemp)
{
sValue += *pStrImage++;
}
}
if (*pStrImage++ != _T('\'')) break;
if (!sValue.IsEmpty())
{
if (sItem == _T("file") || sItem == _T("res"))
{
m_sImage = sValue;
}
else if (sItem == _T("restype"))
{
m_sResType = sValue;
}
else if (sItem == _T("dest"))
{
m_rcDest.left = _tcstol(sValue.GetData(), &pstr, 10); ASSERT(pstr);
m_rcDest.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
m_rcDest.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
m_rcDest.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
}
else if (sItem == _T("source"))
{
m_rcSource.left = _tcstol(sValue.GetData(), &pstr, 10); ASSERT(pstr);
m_rcSource.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
m_rcSource.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
m_rcSource.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
}
else if (sItem == _T("corner"))
{
m_rcCorner.left = _tcstol(sValue.GetData(), &pstr, 10); ASSERT(pstr);
m_rcCorner.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
m_rcCorner.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
m_rcCorner.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
}
else if (sItem == _T("mask"))
{
if (sValue[0] == _T('#')) m_dwMask = _tcstoul(sValue.GetData() + 1, &pstr, 16);
else m_dwMask = _tcstoul(sValue.GetData(), &pstr, 16);
}
else if (sItem == _T("fade"))
{
m_bFade = (BYTE)_tcstoul(sValue.GetData(), &pstr, 10);
}
else if (sItem == _T("hole"))
{
m_bHole = (_tcscmp(sValue.GetData(), _T("true")) == 0);
}
else if (sItem == _T("xtiled"))
{
m_bTiledX = (_tcscmp(sValue.GetData(), _T("true")) == 0);
}
else if (sItem == _T("ytiled"))
{
m_bTiledY = (_tcscmp(sValue.GetData(), _T("true")) == 0);
}
}
if (*pStrImage++ != _T(' ')) break;
}
}
示例5: SetAttribute
//.........这里部分代码省略.........
else if( _tcsicmp(pstrName, _T("bordersize")) == 0 ) {
CDuiString nValue = pstrValue;
if(nValue.Find(',') < 0) {
SetBorderSize(_ttoi(pstrValue));
RECT rcPadding = {0};
SetBorderSize(rcPadding);
}
else {
RECT rcPadding = { 0 };
LPTSTR pstr = NULL;
rcPadding.left = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
rcPadding.top = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
rcPadding.right = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
SetBorderSize(rcPadding);
}
}
else if( _tcsicmp(pstrName, _T("leftbordersize")) == 0 ) SetLeftBorderSize(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("topbordersize")) == 0 ) SetTopBorderSize(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("rightbordersize")) == 0 ) SetRightBorderSize(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("bottombordersize")) == 0 ) SetBottomBorderSize(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("borderstyle")) == 0 ) SetBorderStyle(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("borderround")) == 0 ) {
SIZE cxyRound = { 0 };
LPTSTR pstr = NULL;
cxyRound.cx = _tcstol(pstrValue, &pstr, 10); ASSERT(pstr);
cxyRound.cy = _tcstol(pstr + 1, &pstr, 10); ASSERT(pstr);
SetBorderRound(cxyRound);
}
else if( _tcsicmp(pstrName, _T("bkimage")) == 0 ) SetBkImage(pstrValue);
else if( _tcsicmp(pstrName, _T("foreimage")) == 0 ) SetForeImage(pstrValue);
else if( _tcsicmp(pstrName, _T("width")) == 0 ) SetFixedWidth(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("height")) == 0 ) SetFixedHeight(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("minwidth")) == 0 ) SetMinWidth(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("minheight")) == 0 ) SetMinHeight(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("maxwidth")) == 0 ) SetMaxWidth(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("maxheight")) == 0 ) SetMaxHeight(_ttoi(pstrValue));
else if( _tcsicmp(pstrName, _T("name")) == 0 ) SetName(pstrValue);
else if( _tcsicmp(pstrName, _T("drag")) == 0 ) SetDragEnable(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("drop")) == 0 ) SetDropEnable(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("resourcetext")) == 0 ) SetResourceText(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("text")) == 0 ) SetText(pstrValue);
else if( _tcsicmp(pstrName, _T("tooltip")) == 0 ) SetToolTip(pstrValue);
else if( _tcsicmp(pstrName, _T("userdata")) == 0 ) SetUserData(pstrValue);
else if( _tcsicmp(pstrName, _T("enabled")) == 0 ) SetEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("mouse")) == 0 ) SetMouseEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("keyboard")) == 0 ) SetKeyboardEnabled(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("visible")) == 0 ) SetVisible(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("float")) == 0 ) SetFloat(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("shortcut")) == 0 ) SetShortcut(pstrValue[0]);
else if( _tcsicmp(pstrName, _T("menu")) == 0 ) SetContextMenuUsed(_tcsicmp(pstrValue, _T("true")) == 0);
else if( _tcsicmp(pstrName, _T("cursor")) == 0 && pstrValue) {
if( _tcsicmp(pstrValue, _T("arrow")) == 0 ) SetCursor(DUI_ARROW);
else if( _tcsicmp(pstrValue, _T("ibeam")) == 0 ) SetCursor(DUI_IBEAM);
else if( _tcsicmp(pstrValue, _T("wait")) == 0 ) SetCursor(DUI_WAIT);
else if( _tcsicmp(pstrValue, _T("cross")) == 0 ) SetCursor(DUI_CROSS);
else if( _tcsicmp(pstrValue, _T("uparrow")) == 0 ) SetCursor(DUI_UPARROW);
else if( _tcsicmp(pstrValue, _T("size")) == 0 ) SetCursor(DUI_SIZE);
else if( _tcsicmp(pstrValue, _T("icon")) == 0 ) SetCursor(DUI_ICON);
else if( _tcsicmp(pstrValue, _T("sizenwse")) == 0 ) SetCursor(DUI_SIZENWSE);
else if( _tcsicmp(pstrValue, _T("sizenesw")) == 0 ) SetCursor(DUI_SIZENESW);
else if( _tcsicmp(pstrValue, _T("sizewe")) == 0 ) SetCursor(DUI_SIZEWE);
else if( _tcsicmp(pstrValue, _T("sizens")) == 0 ) SetCursor(DUI_SIZENS);
else if( _tcsicmp(pstrValue, _T("sizeall")) == 0 ) SetCursor(DUI_SIZEALL);
else if( _tcsicmp(pstrValue, _T("no")) == 0 ) SetCursor(DUI_NO);
else if( _tcsicmp(pstrValue, _T("hand")) == 0 ) SetCursor(DUI_HAND);
}
else if( _tcsicmp(pstrName, _T("virtualwnd")) == 0 ) SetVirtualWnd(pstrValue);
else if( _tcsicmp(pstrName, _T("innerstyle")) == 0 ) {
CDuiString sXmlData = pstrValue;
sXmlData.Replace(_T("""), _T("\""));
LPCTSTR pstrList = sXmlData.GetData();
CDuiString sItem;
CDuiString sValue;
while( *pstrList != _T('\0') ) {
sItem.Empty();
sValue.Empty();
while( *pstrList != _T('\0') && *pstrList != _T('=') ) {
LPTSTR pstrTemp = ::CharNext(pstrList);
while( pstrList < pstrTemp) {
sItem += *pstrList++;
}
}
ASSERT( *pstrList == _T('=') );
if( *pstrList++ != _T('=') ) return;
ASSERT( *pstrList == _T('\"') );
if( *pstrList++ != _T('\"') ) return;
while( *pstrList != _T('\0') && *pstrList != _T('\"') ) {
LPTSTR pstrTemp = ::CharNext(pstrList);
while( pstrList < pstrTemp) {
sValue += *pstrList++;
}
}
ASSERT( *pstrList == _T('\"') );
if( *pstrList++ != _T('\"') ) return;
SetAttribute(sItem, sValue);
if( *pstrList++ != _T(' ') && *pstrList++ != _T(',') ) return;
}
}
}
示例6: OnInitDialog
BOOL CImageDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_btnMask.EnableOtherButton(_T("Other"));
m_btnMask.SetColor((COLORREF)0);
m_btnMask.SetColumnsNumber(10);
m_ctlFade.SetRange(0,255);
m_ctlFade.SetPos(255);
CUIDesignerView* pUIView = g_pMainFrame->GetActiveUIView();
m_pManager = pUIView->GetPaintManager();
m_ImagePreview.SetManager(m_pManager);
m_strImagePathName=m_strImageProperty;
LPCTSTR pStrImage=m_strImageProperty;
CDuiString sItem;
CDuiString sValue;
LPTSTR pstr = NULL;
while( *pStrImage != _T('\0') ) {
sItem.Empty();
sValue.Empty();
while( *pStrImage != _T('\0') && *pStrImage != _T('=') ) {
LPTSTR pstrTemp = ::CharNext(pStrImage);
while( pStrImage < pstrTemp) {
sItem += *pStrImage++;
}
}
if( *pStrImage++ != _T('=') ) break;
if( *pStrImage++ != _T('\'') ) break;
while( *pStrImage != _T('\0') && *pStrImage != _T('\'') ) {
LPTSTR pstrTemp = ::CharNext(pStrImage);
while( pStrImage < pstrTemp) {
sValue += *pStrImage++;
}
}
if( *pStrImage++ != _T('\'') ) break;
if( !sValue.IsEmpty() ) {
if( sItem == _T("file"))
m_strImagePathName = sValue;
else if( sItem == _T("dest") )
m_strDest = sValue;
else if( sItem == _T("source") )
m_strSource = sValue;
else if( sItem == _T("corner") )
m_strCorner = sValue;
else if( sItem == _T("mask") ) {
DWORD dwMask;
if( sValue[0] == _T('#')) dwMask = _tcstoul(sValue.GetData() + 1, &pstr, 16);
else dwMask = _tcstoul(sValue.GetData(), &pstr, 16);
dwMask&=0x00FFFFFF;
m_btnMask.SetColor(RGB(GetBValue(dwMask),GetGValue(dwMask),GetRValue(dwMask)));
}
else if( sItem == _T("fade") ) {
m_nFade = (BYTE)_tcstoul(sValue.GetData(), &pstr, 10);
}
else if( sItem == _T("hole") ) {
m_bHole = (_tcscmp(sValue.GetData(), _T("true")) == 0);
}
}
if( *pStrImage++ != _T(' ') ) break;
}
m_ctlFade.SetPos(m_nFade);
int nIndex=m_lstImages.AddString(_T("(无)"));
m_lstImages.SetItemDataPtr(nIndex,(void*)(LPCTSTR)m_strNullImage);
LPCTSTR pstrImage=NULL;
LPTSTR pszFileName=NULL;
const CStringArray* parrImage=g_pResourceView->GetImageTree(pUIView->GetDocument()->GetTitle());
if(parrImage)
{
for(int i=0;i<parrImage->GetSize();i++)
{
pstrImage=parrImage->GetAt(i);
pszFileName=_tcsrchr((LPTSTR)pstrImage,_T('\\'))+1;
nIndex=m_lstImages.AddString(pszFileName);
m_lstImages.SetItemDataPtr(nIndex,(void*)pstrImage);
}
}
int nPos = m_strImagePathName.ReverseFind(_T('\\'));
CString strFileName = (nPos==-1) ? m_strImagePathName : m_strImagePathName.Right(m_strImagePathName.GetLength() - nPos - 1);
m_strImagePathName.IsEmpty()?m_lstImages.SelectString(-1,_T("(无)")):m_lstImages.SelectString(-1,strFileName);
UpdateData(FALSE);
SetImageProperty(m_strImagePathName);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}