Skip to content

Commit

Permalink
添加了默认资源功能,修正了hls的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wangchyz committed Mar 24, 2015
1 parent ea28db3 commit fa7fb5a
Show file tree
Hide file tree
Showing 19 changed files with 715 additions and 406 deletions.
1 change: 0 additions & 1 deletion DuiLib/Control/UICombo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ LRESULT CComboWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
// reassigned by this operation - which is why it is important to reassign
// the items back to the righfull owner/manager when the window closes.
m_pLayout = new CVerticalLayoutUI;
m_pm.UseParentResource(m_pOwner->GetManager());
m_pLayout->SetManager(&m_pm, NULL, true);
LPCTSTR pDefaultAttributes = m_pOwner->GetManager()->GetDefaultAttributeList(_T("VerticalLayout"));
if( pDefaultAttributes ) {
Expand Down
2 changes: 2 additions & 0 deletions DuiLib/Core/UIDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
namespace DuiLib
{

#define MAX_FONT_ID 30000

enum DuiSig
{
DuiSig_end = 0, // [marks end of message map]
Expand Down
28 changes: 22 additions & 6 deletions DuiLib/Core/UIDlgBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ CControlUI* CDialogBuilder::Create(IDialogBuilderCallback* pCallback, CPaintMana
LPCTSTR pImageName = NULL;
LPCTSTR pImageResType = NULL;
DWORD mask = 0;
bool shared = false;
for( int i = 0; i < nAttributes; i++ ) {
pstrName = node.GetAttributeName(i);
pstrValue = node.GetAttributeValue(i);
Expand All @@ -71,21 +72,29 @@ CControlUI* CDialogBuilder::Create(IDialogBuilderCallback* pCallback, CPaintMana
if( *pstrValue == _T('#')) pstrValue = ::CharNext(pstrValue);
mask = _tcstoul(pstrValue, &pstr, 16);
}
else if( _tcscmp(pstrName, _T("shared")) == 0 ) {
shared = (_tcscmp(pstrValue, _T("true")) == 0);
}
}
if( pImageName ) pManager->AddImage(pImageName, pImageResType, mask);
if( pImageName ) pManager->AddImage(pImageName, pImageResType, mask, shared);
}
else if( _tcscmp(pstrClass, _T("Font")) == 0 ) {
nAttributes = node.GetAttributeCount();
int id = -1;
LPCTSTR pFontName = NULL;
int size = 12;
bool bold = false;
bool underline = false;
bool italic = false;
bool defaultfont = false;
bool shared = false;
for( int i = 0; i < nAttributes; i++ ) {
pstrName = node.GetAttributeName(i);
pstrValue = node.GetAttributeValue(i);
if( _tcscmp(pstrName, _T("name")) == 0 ) {
if( _tcscmp(pstrName, _T("id")) == 0 ) {
id = _tcstol(pstrValue, &pstr, 10);
}
else if( _tcscmp(pstrName, _T("name")) == 0 ) {
pFontName = pstrValue;
}
else if( _tcscmp(pstrName, _T("size")) == 0 ) {
Expand All @@ -103,16 +112,20 @@ CControlUI* CDialogBuilder::Create(IDialogBuilderCallback* pCallback, CPaintMana
else if( _tcscmp(pstrName, _T("default")) == 0 ) {
defaultfont = (_tcscmp(pstrValue, _T("true")) == 0);
}
else if( _tcscmp(pstrName, _T("shared")) == 0 ) {
shared = (_tcscmp(pstrValue, _T("true")) == 0);
}
}
if( pFontName ) {
pManager->AddFont(pFontName, size, bold, underline, italic);
if( defaultfont ) pManager->SetDefaultFont(pFontName, size, bold, underline, italic);
if( id >= 0 && pFontName ) {
pManager->AddFont(id, pFontName, size, bold, underline, italic, shared);
if( defaultfont ) pManager->SetDefaultFont(pFontName, size, bold, underline, italic, shared);
}
}
else if( _tcscmp(pstrClass, _T("Default")) == 0 ) {
nAttributes = node.GetAttributeCount();
LPCTSTR pControlName = NULL;
LPCTSTR pControlValue = NULL;
bool shared = false;
for( int i = 0; i < nAttributes; i++ ) {
pstrName = node.GetAttributeName(i);
pstrValue = node.GetAttributeValue(i);
Expand All @@ -122,9 +135,12 @@ CControlUI* CDialogBuilder::Create(IDialogBuilderCallback* pCallback, CPaintMana
else if( _tcscmp(pstrName, _T("value")) == 0 ) {
pControlValue = pstrValue;
}
else if( _tcscmp(pstrName, _T("shared")) == 0 ) {
shared = (_tcscmp(pstrValue, _T("true")) == 0);
}
}
if( pControlName ) {
pManager->AddDefaultAttributeList(pControlName, pControlValue);
pManager->AddDefaultAttributeList(pControlName, pControlValue, shared);
}
}
}
Expand Down
Loading

0 comments on commit fa7fb5a

Please sign in to comment.