本文整理汇总了C++中CControlUI::SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ CControlUI::SetAttribute方法的具体用法?C++ CControlUI::SetAttribute怎么用?C++ CControlUI::SetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CControlUI
的用法示例。
在下文中一共展示了CControlUI::SetAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UIModify
void CALLBACK CUICommandHistory::UIModify(TiXmlNode* pNode)
{
TiXmlElement* pElement = pNode->ToElement();
CStringA strName = pElement->Attribute("myname");
pElement->RemoveAttribute("myname");
if(strName.IsEmpty())
return;
CPaintManagerUI* pManager = g_pMainFrame->GetActiveUIView()->GetPaintManager();
CControlUI* pControl = pManager->FindControl(StringConvertor::Utf8ToWide(strName));
TiXmlAttribute* pAttrib = pElement->FirstAttribute();
if(pControl == NULL)
return;
while(pAttrib)
{
if(strcmp(pAttrib->Name(), "name") == 0)
{
pManager->ReapObjects(pControl);
g_pClassView->RenameUITreeItem(pControl, StringConvertor::Utf8ToWide(pAttrib->Value()));
pControl->SetAttribute(StringConvertor::Utf8ToWide(pAttrib->Name())
, StringConvertor::Utf8ToWide(pAttrib->Value()));
pManager->InitControls(pControl);
}
else
pControl->SetAttribute(StringConvertor::Utf8ToWide(pAttrib->Name())
, StringConvertor::Utf8ToWide(pAttrib->Value()));
pAttrib = pAttrib->Next();
}
CControlUI* pParent = pControl->GetParent();
if(pParent == NULL)
pParent = pControl;
pParent->SetPos(pParent->GetPos());
}
示例2: SetUIValue
void CDialogUIAttribEdit::SetUIValue(CMFCPropertyGridProperty* pProp,int nTag)
{
CControlUI* pControl = m_wndUIProperties.GetCurUI();
if(pControl == NULL)
return;
CString strName=pProp->GetName();
strName.MakeLower();
CString strValue;
strValue = pProp->FormatProperty();
if(nTag!=tagName && nTag!=tagText && strName.Find(_T("image"))==-1)
strValue.MakeLower();
switch(nTag)
{
case tagName:
return;
case tagPos:
return;
case tagSize:
case tagMinSize:
case tagMaxSize:
case tagMinMax:
SetUIValue(pProp->GetSubItem(0),-1);
SetUIValue(pProp->GetSubItem(1),-1);
break;
}
pControl->SetAttribute(strName,strValue);
}
示例3: OnKillFocus
void CMainDialog::OnKillFocus( CControlUI* pSender )
{
if (pSender->GetName() == _T ("editSearch")) {
CControlUI* pbtnTip = static_cast <CControlUI*> (m_pm.FindControl(_T ("btnTip")));
CEditUI* peditSearch = static_cast <CEditUI*> (m_pm.FindControl(_T ("editSearch")));
if (pbtnTip && peditSearch) {
CDuiString strText = peditSearch->GetText();
if (strText.IsEmpty()) {
strText = "請輸入查找條件";
pbtnTip->SetAttribute(_T("textcolor"), _T("#00A0A0A4"));
} else {
pbtnTip->SetAttribute(_T("textcolor"), _T("#FF000000"));
}
pbtnTip->SetText(strText);
pbtnTip->SetVisible(true);
}
}
}
示例4: SetUIValue
void CPropertiesWnd::SetUIValue(CMFCPropertyGridProperty* pProp,int nTag)
{
CControlUI* pControl = m_wndUIProperties.GetCurUI();
if(pControl == NULL)
return;
int nUpdate=UPDATE_REDRAW_CONTROL;
CString strName=pProp->GetName();
strName.MakeLower();
CString strNewVal;
CString strOldVal;
strNewVal = pProp->FormatProperty();
strOldVal = m_wndUIProperties.FormatOrigProperty(pProp);
if(nTag!=tagName && nTag!=tagText && strName.Find(_T("image"))==-1)
{
strNewVal.MakeLower();
strOldVal.MakeLower();
}
switch(nTag)
{
case tagName:
{
CPaintManagerUI* pManager = g_pMainFrame->GetActiveUIView()->GetPaintManager();
if(strNewVal.IsEmpty() || pManager->FindControl(strNewVal))
{
if(!strNewVal.IsEmpty())
MessageBox(strNewVal + _T(" 名称已被其他控件使用!"));
pProp->SetValue((_variant_t)pControl->GetName());
return;
}
else
pManager->ReapObjects(pControl);
g_pClassView->RenameUITreeItem(pControl, strNewVal);
break;
}
case tagPos:
case tagPadding:
SetPropValue(pControl,tagSize);
nUpdate=UPDATE_POS;
break;
case tagSize:
case tagMinSize:
case tagMaxSize:
case tagMinMax:
SetUIValue(pProp->GetSubItem(0),-1);
SetUIValue(pProp->GetSubItem(1),-1);
SetPropValue(pControl,tagPos);
nUpdate=UPDATE_POS;
break;
case tagFloat:
case tagColumns:
nUpdate=UPDATE_POS;
break;
case tagVisible:
nUpdate=UPDATE_REDRAW_PARENT;
break;
case tagListHeader:
if (strNewVal.Compare(_T("false"))==0)
{
strNewVal = _T("hidden");
}
break;
case tagAlpha:
{
int alpha=_ttoi(strNewVal);
if (alpha<0)
{
strNewVal=_T("0");
pProp->SetValue((_variant_t)(LONG)0);
}
else
{
strNewVal=_T("255");
pProp->SetValue((_variant_t)(LONG)255);
}
break;
}
}
CUIDesignerView* pUIView=g_pMainFrame->GetActiveUIView();
ASSERT(pUIView);
TNotifyUI Msg;
UIAttribute oldAttrib = {strName, strOldVal};
Msg.pSender=pControl;
Msg.sType=_T("PropertyBeginChanged");
Msg.wParam=0;
Msg.lParam=(LPARAM)&oldAttrib;
pUIView->Notify(Msg);
pControl->SetAttribute(strName,strNewVal);
pProp->SetOriginalValue(pProp->GetValue());
UIAttribute newAttrib = {strName, strNewVal};
Msg.sType = _T("PropertyEndChanged");
Msg.lParam = (LPARAM)&newAttrib;
pUIView->Notify(Msg);
//.........这里部分代码省略.........
示例5: _Parse
CControlUI* CDialogBuilder::_Parse(CMarkupNode* pRoot, CControlUI* pParent, CPaintManagerUI* pManager)
{
CControlUI* pReturn = NULL;
for (CMarkupNode node = pRoot->GetChild(); node.IsValid(); node = node.GetSibling())
{
LPCTSTR pstrClass = node.GetName();
CControlUI* pControl = NULL;
if (strcmp(pstrClass, _T("Include")) == 0)
{
if (!node.HasAttributes()) continue;
}
else if (strcmp(pstrClass, _T("TreeNode")) == 0)
{
}
else
{
SIZE_T cchLen = strlen(pstrClass);
switch (cchLen)
{
case 5:
if (strcmp(pstrClass, DUI_CTR_LABEL) == 0) pControl = new CLabelUI;
break;
case 9:
if (strcmp(pstrClass, DUI_CTR_CONTAINER) == 0) pControl = new CContainerUI;
break;
case 7:
if (strcmp(pstrClass, DUI_CTR_CONTROL) == 0) pControl = new CControlUI;
}
}
if (pControl == NULL)
continue;
if (node.HasChildren())
{
_Parse(&node, pControl, pManager);
}
if (pParent != NULL)
{
if (pParent->GetClass() == DUI_CTR_CONTAINER)
{
IContainerUI* pContainer = static_cast<IContainerUI*>(pParent->GetInterface(DUI_CTR_ICONTAINER));
pContainer->Add(pControl);
}
}
if (node.HasAttributes()) {
// Set ordinary attributes
int nAttributes = node.GetAttributeCount();
for (int i = 0; i < nAttributes; i++) {
pControl->SetAttribute(node.GetAttributeName(i), node.GetAttributeValue(i));
}
}
if (pManager)
{
pControl->SetManager(pManager, pParent, false);
}
if (pReturn == NULL) pReturn = pControl;
}
return pReturn;
}
示例6: _Parse
//.........这里部分代码省略.........
else if( _tcscmp(pstrClass, _T("TextPanel")) == 0 ) pControl = new CTextPanelUI;
break;
case 10:
if( _tcscmp(pstrClass, _T("ListHeader")) == 0 ) pControl = new CListHeaderUI;
else if( _tcscmp(pstrClass, _T("ListFooter")) == 0 ) pControl = new CListFooterUI;
else if( _tcscmp(pstrClass, _T("TileLayout")) == 0 ) pControl = new CTileLayoutUI;
else if( _tcscmp(pstrClass, _T("ToolButton")) == 0 ) pControl = new CToolButtonUI;
else if( _tcscmp(pstrClass, _T("ImagePanel")) == 0 ) pControl = new CImagePanelUI;
else if( _tcscmp(pstrClass, _T("LabelPanel")) == 0 ) pControl = new CLabelPanelUI;
break;
case 11:
if( _tcscmp(pstrClass, _T("ToolGripper")) == 0 ) pControl = new CToolGripperUI;
else if( _tcscmp(pstrClass, _T("WhiteCanvas")) == 0 ) pControl = new CWhiteCanvasUI;
else if( _tcscmp(pstrClass, _T("TitleShadow")) == 0 ) pControl = new CTitleShadowUI;
break;
case 12:
if( _tcscmp(pstrClass, _T("WindowCanvas")) == 0 ) pControl = new CWindowCanvasUI;
else if( _tcscmp(pstrClass, _T("DialogCanvas")) == 0 ) pControl = new CDialogCanvasUI;
else if( _tcscmp(pstrClass, _T("DialogLayout")) == 0 ) pControl = new CDialogLayoutUI;
else if( _tcscmp(pstrClass, _T("PaddingPanel")) == 0 ) pControl = new CPaddingPanelUI;
else if( _tcscmp(pstrClass, _T("WarningPanel")) == 0 ) pControl = new CWarningPanelUI;
break;
case 13:
if( _tcscmp(pstrClass, _T("SeparatorLine")) == 0 ) pControl = new CSeparatorLineUI;
else if( _tcscmp(pstrClass, _T("ControlCanvas")) == 0 ) pControl = new CControlCanvasUI;
else if( _tcscmp(pstrClass, _T("MultiLineEdit")) == 0 ) pControl = new CMultiLineEditUI;
else if( _tcscmp(pstrClass, _T("ToolSeparator")) == 0 ) pControl = new CToolSeparatorUI;
break;
case 14:
if( _tcscmp(pstrClass, _T("VerticalLayout")) == 0 ) pControl = new CVerticalLayoutUI;
else if( _tcscmp(pstrClass, _T("SingleLineEdit")) == 0 ) pControl = new CSingleLineEditUI;
else if( _tcscmp(pstrClass, _T("SingleLinePick")) == 0 ) pControl = new CSingleLinePickUI;
else if( _tcscmp(pstrClass, _T("NavigatorPanel")) == 0 ) pControl = new CNavigatorPanelUI;
else if( _tcscmp(pstrClass, _T("ListHeaderItem")) == 0 ) pControl = new CListHeaderItemUI;
else if( _tcscmp(pstrClass, _T("GreyTextHeader")) == 0 ) pControl = new CGreyTextHeaderUI;
break;
case 15:
if( _tcscmp(pstrClass, _T("ListTextElement")) == 0 ) pControl = new CListTextElementUI;
else if( _tcscmp(pstrClass, _T("NavigatorButton")) == 0 ) pControl = new CNavigatorButtonUI;
else if( _tcscmp(pstrClass, _T("TabFolderCanvas")) == 0 ) pControl = new CTabFolderCanvasUI;
break;
case 16:
if( _tcscmp(pstrClass, _T("ListHeaderShadow")) == 0 ) pControl = new CListHeaderShadowUI;
else if( _tcscmp(pstrClass, _T("HorizontalLayout")) == 0 ) pControl = new CHorizontalLayoutUI;
else if( _tcscmp(pstrClass, _T("ListLabelElement")) == 0 ) pControl = new CListLabelElementUI;
else if( _tcscmp(pstrClass, _T("SearchTitlePanel")) == 0 ) pControl = new CSearchTitlePanelUI;
break;
case 17:
if( _tcscmp(pstrClass, _T("ToolbarTitlePanel")) == 0 ) pControl = new CToolbarTitlePanelUI;
else if( _tcscmp(pstrClass, _T("ListExpandElement")) == 0 ) pControl = new CListExpandElementUI;
break;
}
// User-supplied control factory
if( pControl == NULL && m_pCallback != NULL ) {
pControl = m_pCallback->CreateControl(pstrClass);
}
ASSERT(pControl);
if( pControl == NULL ) return NULL;
// Add children
if( node.HasChildren() ) {
_Parse(&node, pControl);
}
// Attach to parent
if( pParent != NULL ) {
if( pContainer == NULL ) pContainer = static_cast<IContainerUI*>(pParent->GetInterface(_T("Container")));
ASSERT(pContainer);
if( pContainer == NULL ) return NULL;
pContainer->Add(pControl);
}
// Process attributes
if( node.HasAttributes() ) {
TCHAR szValue[500] = { 0 };
SIZE_T cchLen = lengthof(szValue) - 1;
// Set ordinary attributes
int nAttributes = node.GetAttributeCount();
for( int i = 0; i < nAttributes; i++ ) {
pControl->SetAttribute(node.GetAttributeName(i), node.GetAttributeValue(i));
}
// Very custom attributes
if( node.GetAttributeValue(_T("stretch"), szValue, cchLen) ) {
if( pStretched == NULL ) pStretched = static_cast<CDialogLayoutUI*>(pParent->GetInterface(_T("DialogLayout")));
ASSERT(pStretched);
if( pStretched == NULL ) return NULL;
UINT uMode = 0;
if( _tcsstr(szValue, _T("move_x")) != NULL ) uMode |= UISTRETCH_MOVE_X;
if( _tcsstr(szValue, _T("move_y")) != NULL ) uMode |= UISTRETCH_MOVE_Y;
if( _tcsstr(szValue, _T("move_xy")) != NULL ) uMode |= UISTRETCH_MOVE_X | UISTRETCH_MOVE_Y;
if( _tcsstr(szValue, _T("size_x")) != NULL ) uMode |= UISTRETCH_SIZE_X;
if( _tcsstr(szValue, _T("size_y")) != NULL ) uMode |= UISTRETCH_SIZE_Y;
if( _tcsstr(szValue, _T("size_xy")) != NULL ) uMode |= UISTRETCH_SIZE_X | UISTRETCH_SIZE_Y;
if( _tcsstr(szValue, _T("group")) != NULL ) uMode |= UISTRETCH_NEWGROUP;
if( _tcsstr(szValue, _T("line")) != NULL ) uMode |= UISTRETCH_NEWLINE;
pStretched->SetStretchMode(pControl, uMode);
}
}
// Return first item
if( pReturn == NULL ) pReturn = pControl;
}
return pReturn;
}