Skip to content

Commit

Permalink
1、统一了控件class name和interface name
Browse files Browse the repository at this point in the history
2、修正了若干bug
  • Loading branch information
wangchyz committed Mar 17, 2016
1 parent ab71040 commit 02d1ed8
Show file tree
Hide file tree
Showing 93 changed files with 4,658 additions and 1,509 deletions.
6 changes: 3 additions & 3 deletions 360SafeDemo/360Safe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ class C360SafeFrameWnd : public CWindowWnd, public INotifyUI
if( pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
&& pt.y >= rcCaption.top && pt.y < rcCaption.bottom ) {
CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt));
if( pControl && _tcscmp(pControl->GetClass(), _T("ButtonUI")) != 0 &&
_tcscmp(pControl->GetClass(), _T("OptionUI")) != 0 &&
_tcscmp(pControl->GetClass(), _T("TextUI")) != 0 )
if( pControl && _tcscmp(pControl->GetClass(), DUI_CTR_BUTTON) != 0 &&
_tcscmp(pControl->GetClass(), DUI_CTR_OPTION) != 0 &&
_tcscmp(pControl->GetClass(), DUI_CTR_TEXT) != 0 )
return HTCAPTION;
}

Expand Down
7 changes: 4 additions & 3 deletions DuiLib/Control/UIActiveX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ CActiveXUI::~CActiveXUI()

LPCTSTR CActiveXUI::GetClass() const
{
return _T("ActiveXUI");
return DUI_CTR_ACTIVEX;
}

LPVOID CActiveXUI::GetInterface(LPCTSTR pstrName)
Expand Down Expand Up @@ -1019,12 +1019,13 @@ void CActiveXUI::Move(SIZE szOffset, bool bNeedInvalidate)
}
}

void CActiveXUI::DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl)
bool CActiveXUI::DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl)
{
if( m_pControl != NULL && m_pControl->m_bWindowless && m_pControl->m_pViewObject != NULL )
{
m_pControl->m_pViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hDC, (RECTL*) &m_rcItem, (RECTL*) &m_rcItem, NULL, NULL);
}
return true;
}

void CActiveXUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
Expand Down Expand Up @@ -1058,7 +1059,7 @@ LRESULT CActiveXUI::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool
if( dwHitResult != HITRESULT_HIT ) return 0;
if( uMsg == WM_SETCURSOR ) bWasHandled = false;
else if( uMsg == WM_LBUTTONDOWN || uMsg == WM_LBUTTONDBLCLK || uMsg == WM_RBUTTONDOWN ) {
::SetFocus(GetManager()->GetPaintWindow());
if (!GetManager()->IsNoActivate()) ::SetFocus(GetManager()->GetPaintWindow());
SetFocus();
}
}
Expand Down
4 changes: 2 additions & 2 deletions DuiLib/Control/UIActiveX.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CSafeRelease
/////////////////////////////////////////////////////////////////////////////////////
//

class UILIB_API CActiveXUI : public CControlUI, public IMessageFilterUI
class DUILIB_API CActiveXUI : public CControlUI, public IMessageFilterUI
{
friend class CActiveXCtrl;
public:
Expand All @@ -51,7 +51,7 @@ class UILIB_API CActiveXUI : public CControlUI, public IMessageFilterUI
void SetInternVisible(bool bVisible = true);
void SetPos(RECT rc, bool bNeedInvalidate = true);
void Move(SIZE szOffset, bool bNeedInvalidate = true);
void DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl);
bool DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl);

void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);

Expand Down
48 changes: 29 additions & 19 deletions DuiLib/Control/UIButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace DuiLib

LPCTSTR CButtonUI::GetClass() const
{
return _T("ButtonUI");
return DUI_CTR_BUTTON;
}

LPVOID CButtonUI::GetInterface(LPCTSTR pstrName)
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace DuiLib
}
if( event.Type == UIEVENT_KEYDOWN )
{
if (IsKeyboardEnabled()) {
if (IsKeyboardEnabled() && IsEnabled()) {
if( event.chKey == VK_SPACE || event.chKey == VK_RETURN ) {
Activate();
return;
Expand All @@ -76,41 +76,51 @@ namespace DuiLib
if( event.Type == UIEVENT_BUTTONUP )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
if( ::PtInRect(&m_rcItem, event.ptMouse) ) Activate();
if( ::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled()) Activate();
m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED);
Invalidate();
}
return;
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
if( IsContextMenuUsed() ) {
if( IsContextMenuUsed() && IsEnabled()) {
m_pManager->SendNotify(this, DUI_MSGTYPE_MENU, event.wParam, event.lParam);
}
return;
}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( IsEnabled() ) {
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
if( ::PtInRect(&m_rcItem, event.ptMouse ) ) {
if( IsEnabled() ) {
if( (m_uButtonState & UISTATE_HOT) == 0 ) {
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
}
}
if ( GetFadeAlphaDelta() > 0 ) {
m_pManager->SetTimer(this, FADE_TIMERID, FADE_ELLAPSE);
}
// return;
}
if( event.Type == UIEVENT_MOUSELEAVE )
{
if( IsEnabled() ) {
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}

if ( GetFadeAlphaDelta() > 0 ) {
m_pManager->SetTimer(this, FADE_TIMERID, FADE_ELLAPSE);
}
// return;
if( !::PtInRect(&m_rcItem, event.ptMouse ) ) {
if( IsEnabled() ) {
if( (m_uButtonState & UISTATE_HOT) != 0 ) {
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}
}
if (m_pManager) m_pManager->RemoveMouseLeaveNeeded(this);
if ( GetFadeAlphaDelta() > 0 ) {
m_pManager->SetTimer(this, FADE_TIMERID, FADE_ELLAPSE);
}
}
else {
if (m_pManager) m_pManager->AddMouseLeaveNeeded(this);
return;
}
}
if( event.Type == UIEVENT_SETCURSOR )
{
Expand Down Expand Up @@ -426,7 +436,7 @@ namespace DuiLib

if( m_bShowHtml )
CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, clrColor, \
NULL, NULL, nLinks, m_uTextStyle);
NULL, NULL, nLinks, m_iFont, m_uTextStyle);
else
CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, clrColor, \
m_iFont, m_uTextStyle);
Expand Down
2 changes: 1 addition & 1 deletion DuiLib/Control/UIButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace DuiLib
{
class UILIB_API CButtonUI : public CLabelUI
class DUILIB_API CButtonUI : public CLabelUI
{
public:
CButtonUI();
Expand Down
2 changes: 1 addition & 1 deletion DuiLib/Control/UICheckBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace DuiLib
{
LPCTSTR CCheckBoxUI::GetClass() const
{
return _T("CheckBoxUI");
return DUI_CTR_CHECKBOX;
}

LPVOID CCheckBoxUI::GetInterface(LPCTSTR pstrName)
Expand Down
2 changes: 1 addition & 1 deletion DuiLib/Control/UICheckBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace DuiLib
/// 派生于COptionUI,只是每组只有一个按钮而已,组名为空,配置文件默认属性举例:
/// <CheckBox name="CheckBox" value="height='20' align='left' textpadding='24,0,0,0' normalimage='file='sys_check_btn.png' source='0,0,20,20' dest='0,0,20,20'' selectedimage='file='sys_check_btn.png' source='20,0,40,20' dest='0,0,20,20'' disabledimage='file='sys_check_btn.png' source='40,0,60,20' dest='0,0,20,20''"/>

class UILIB_API CCheckBoxUI : public COptionUI
class DUILIB_API CCheckBoxUI : public COptionUI
{
public:
LPCTSTR GetClass() const;
Expand Down
Loading

0 comments on commit 02d1ed8

Please sign in to comment.