本文整理汇总了C++中IsMouseEnabled函数的典型用法代码示例。如果您正苦于以下问题:C++ IsMouseEnabled函数的具体用法?C++ IsMouseEnabled怎么用?C++ IsMouseEnabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsMouseEnabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT
LRESULT CActiveXUI::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
{
if( m_pControl == NULL ) return 0;
ASSERT(m_pControl->m_bWindowless);
if( !m_pControl->m_bInPlaceActive ) return 0;
if( m_pControl->m_pInPlaceObject == NULL ) return 0;
if( !IsMouseEnabled() && uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST ) return 0;
bool bWasHandled = true;
if( (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST) || uMsg == WM_SETCURSOR ) {
// Mouse message only go when captured or inside rect
DWORD dwHitResult = m_pControl->m_bCaptured ? HITRESULT_HIT : HITRESULT_OUTSIDE;
if( dwHitResult == HITRESULT_OUTSIDE && m_pControl->m_pViewObject != NULL ) {
IViewObjectEx* pViewEx = NULL;
m_pControl->m_pViewObject->QueryInterface(IID_IViewObjectEx, (LPVOID*) &pViewEx);
if( pViewEx != NULL ) {
POINT ptMouse = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
pViewEx->QueryHitPoint(DVASPECT_CONTENT, &m_rcItem, ptMouse, 0, &dwHitResult);
pViewEx->Release();
}
}
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());
SetFocus();
}
}
else if( uMsg >= WM_KEYFIRST && uMsg <= WM_KEYLAST ) {
// Keyboard messages just go when we have focus
if( !IsFocused() ) return 0;
}
else {
switch( uMsg ) {
case WM_HELP:
case WM_CONTEXTMENU:
bWasHandled = false;
break;
default:
return 0;
}
}
LRESULT lResult = 0;
HRESULT Hr = m_pControl->m_pInPlaceObject->OnWindowMessage(uMsg, wParam, lParam, &lResult);
if( Hr == S_OK ) bHandled = bWasHandled;
return lResult;
}
示例2: DoEvent
//************************************
// 函数名称: DoEvent
// 返回类型: void
// 参数信息: TEventUI & event
// 函数说明:
//************************************
void CTreeNodeUI::DoEvent( TEventUI& event )
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pOwner != NULL ) m_pOwner->DoEvent(event);
else CContainerUI::DoEvent(event);
return;
}
CListContainerElementUI::DoEvent(event);
if( event.Type == UIEVENT_DBLCLICK )
{
if( IsEnabled() ) {
m_pManager->SendNotify(this, _T("itemdbclick"));
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( IsEnabled()) {
if(m_bSelected && GetSelItemHotTextColor())
pItemButton->SetTextColor(GetSelItemHotTextColor());
else
pItemButton->SetTextColor(GetItemHotTextColor());
}
else
pItemButton->SetTextColor(pItemButton->GetDisabledTextColor());
return;
}
if( event.Type == UIEVENT_MOUSELEAVE )
{
if( IsEnabled()) {
if(m_bSelected && GetSelItemTextColor())
pItemButton->SetTextColor(GetSelItemTextColor());
else if(!m_bSelected)
pItemButton->SetTextColor(GetItemTextColor());
}
else
pItemButton->SetTextColor(pItemButton->GetDisabledTextColor());
return;
}
}
示例3: DoEvent
void CCheckBoxUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else COptionUI::DoEvent(event);
return;
}
if( m_bAutoCheck && (event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK)) {
if( ::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled() ) {
SetCheck(!GetCheck());
m_pManager->SendNotify(this, DUI_MSGTYPE_CHECKCLICK, 0, 0);
Invalidate();
}
return;
}
COptionUI::DoEvent(event);
}
示例4: DoEvent
void CHotButtonUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else CButtonUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( IsEnabled() ) {
m_uButtonState |= UISTATE_HOT;
m_pManager->SendNotify(this, DUI_MSGTYPE_BUTTON_HOT, event.wParam, event.lParam);
Invalidate();
}
return;
}
CButtonUI::DoEvent(event);
}
示例5: DoEvent
void CMusicListGroupUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN &&
event.Type < UIEVENT__MOUSEEND ) {
if( m_pOwner != NULL ) m_pOwner->DoEvent(event);
else CContainerUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_BUTTONDOWN)
{
return;
}
else if( event.Type == UIEVENT_CONTEXTMENU )
{
if( IsContextMenuUsed() ) {
m_pManager->SendNotify(this, DUI_MSGTYPE_MENU, event.wParam, event.lParam);
}
}
else
{
CTreeNodeUI::DoEvent(event);
}
}
示例6: DoEvent
void CButtonUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else CLabelUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_SETFOCUS )
{
Invalidate();
}
if( event.Type == UIEVENT_KILLFOCUS )
{
Invalidate();
}
if( event.Type == UIEVENT_KEYDOWN )
{
if (IsKeyboardEnabled()) {
if( event.chKey == VK_SPACE || event.chKey == VK_RETURN ) {
Activate();
return;
}
}
}
if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
{
if( ::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled() ) {
m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
if( ::PtInRect(&m_rcItem, event.ptMouse) ) m_uButtonState |= UISTATE_PUSHED;
else m_uButtonState &= ~UISTATE_PUSHED;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_BUTTONUP )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
if( ::PtInRect(&m_rcItem, event.ptMouse) ) Activate();
m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED);
Invalidate();
}
return;
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
if( IsContextMenuUsed() ) {
m_pManager->SendNotify(this, _T("menu"), event.wParam, event.lParam);
}
return;
}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( IsEnabled() ) {
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
// return;
}
if( event.Type == UIEVENT_MOUSELEAVE )
{
if( IsEnabled() ) {
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}
// return;
}
if( event.Type == UIEVENT_SETCURSOR ) {
::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
return;
}
CLabelUI::DoEvent(event);
}
示例7: DoEvent
void CTextUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else CLabelUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_SETCURSOR ) {
for( int i = 0; i < m_nLinks; i++ ) {
if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
return;
}
}
}
if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK && IsEnabled() ) {
for( int i = 0; i < m_nLinks; i++ ) {
if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
Invalidate();
return;
}
}
}
if( event.Type == UIEVENT_BUTTONUP && IsEnabled() ) {
for( int i = 0; i < m_nLinks; i++ ) {
if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
m_pManager->SendNotify(this, DUI_MSGTYPE_LINK, i);
return;
}
}
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
return;
}
// When you move over a link
if( m_nLinks > 0 && event.Type == UIEVENT_MOUSEMOVE && IsEnabled() ) {
int nHoverLink = -1;
for( int i = 0; i < m_nLinks; i++ ) {
if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) {
nHoverLink = i;
break;
}
}
if(m_nHoverLink != nHoverLink) {
m_nHoverLink = nHoverLink;
Invalidate();
return;
}
}
if( event.Type == UIEVENT_MOUSELEAVE ) {
if( m_nLinks > 0 && IsEnabled() ) {
if(m_nHoverLink != -1) {
m_nHoverLink = -1;
Invalidate();
return;
}
}
}
CLabelUI::DoEvent(event);
}
示例8: DoEvent
void CRotateButtonUI::DoEvent(TEventUI& event)
{
if (!IsMouseEnabled() &&
event.Type > UIEVENT__MOUSEBEGIN &&
event.Type < UIEVENT__MOUSEEND)
{
if (m_pParent)
{
m_pParent->DoEvent(event);
}
return;
}
if (event.Type == UIEVENT_MOUSEMOVE)
{
if ((m_uButtonState & UISTATE_CAPTURED) != 0)
{
AdjustDragButton(event.ptMouse);
Invalidate();
}
return;
}
if (event.Type == UIEVENT_BUTTONDOWN)
{
if (IsEnabled())
{
if (::PtInRect(&m_rcItem, event.ptMouse))
m_uButtonState |= UISTATE_CAPTURED;
}
return;
}
if (event.Type == UIEVENT_BUTTONUP)
{
if ((m_uButtonState & UISTATE_CAPTURED) != 0 )
{
if (::PtInRect(&m_rcItem, event.ptMouse))
Activate();
m_uButtonState &= ~UISTATE_CAPTURED;
Invalidate();
}
return;
}
if (event.Type == UIEVENT_CONTEXTMENU)
{
return;
}
if (event.Type == UIEVENT_KEYDOWN)
{
if (IsKeyboardEnabled())
{
if (event.chKey == VK_SPACE || event.chKey == VK_RETURN)
{
Activate();
return;
}
}
}
if (event.Type == UIEVENT_SETFOCUS)
{
Invalidate();
}
if ( event.Type == UIEVENT_KILLFOCUS)
{
Invalidate();
}
CControlUI::DoEvent(event);
}
示例9: DoEvent
void CScrollBarUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pOwner != NULL ) m_pOwner->DoEvent(event);
else CControlUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_SETFOCUS )
{
return;
}
if( event.Type == UIEVENT_KILLFOCUS )
{
return;
}
if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
{
if( !IsEnabled() ) return;
m_nLastScrollOffset = 0;
m_nScrollRepeatDelay = 0;
m_pManager->SetTimer(this, DEFAULT_TIMERID, 50U);
if( ::PtInRect(&m_rcButton1, event.ptMouse) ) {
m_uButton1State |= UISTATE_PUSHED;
if( !m_bHorizontal ) {
if( m_pOwner != NULL ) m_pOwner->LineUp();
else SetScrollPos(m_nScrollPos - m_nLineSize);
}
else {
if( m_pOwner != NULL ) m_pOwner->LineLeft();
else SetScrollPos(m_nScrollPos - m_nLineSize);
}
}
else if( ::PtInRect(&m_rcButton2, event.ptMouse) ) {
m_uButton2State |= UISTATE_PUSHED;
if( !m_bHorizontal ) {
if( m_pOwner != NULL ) m_pOwner->LineDown();
else SetScrollPos(m_nScrollPos + m_nLineSize);
}
else {
if( m_pOwner != NULL ) m_pOwner->LineRight();
else SetScrollPos(m_nScrollPos + m_nLineSize);
}
}
else if( ::PtInRect(&m_rcThumb, event.ptMouse) ) {
m_uThumbState |= UISTATE_CAPTURED | UISTATE_PUSHED;
ptLastMouse = event.ptMouse;
m_nLastScrollPos = m_nScrollPos;
}
else {
if( !m_bHorizontal ) {
if( event.ptMouse.y < m_rcThumb.top ) {
if( m_pOwner != NULL ) m_pOwner->PageUp();
else SetScrollPos(m_nScrollPos + m_rcItem.top - m_rcItem.bottom);
}
else if ( event.ptMouse.y > m_rcThumb.bottom ){
if( m_pOwner != NULL ) m_pOwner->PageDown();
else SetScrollPos(m_nScrollPos - m_rcItem.top + m_rcItem.bottom);
}
}
else {
if( event.ptMouse.x < m_rcThumb.left ) {
if( m_pOwner != NULL ) m_pOwner->PageLeft();
else SetScrollPos(m_nScrollPos + m_rcItem.left - m_rcItem.right);
}
else if ( event.ptMouse.x > m_rcThumb.right ){
if( m_pOwner != NULL ) m_pOwner->PageRight();
else SetScrollPos(m_nScrollPos - m_rcItem.left + m_rcItem.right);
}
}
}
if( m_pManager != NULL && m_pOwner == NULL ) m_pManager->SendNotify(this, DUI_MSGTYPE_SCROLL);
return;
}
if( event.Type == UIEVENT_BUTTONUP )
{
m_nScrollRepeatDelay = 0;
m_nLastScrollOffset = 0;
m_pManager->KillTimer(this, DEFAULT_TIMERID);
if( (m_uThumbState & UISTATE_CAPTURED) != 0 ) {
m_uThumbState &= ~( UISTATE_CAPTURED | UISTATE_PUSHED );
Invalidate();
}
else if( (m_uButton1State & UISTATE_PUSHED) != 0 ) {
m_uButton1State &= ~UISTATE_PUSHED;
Invalidate();
}
else if( (m_uButton2State & UISTATE_PUSHED) != 0 ) {
m_uButton2State &= ~UISTATE_PUSHED;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
if( (m_uThumbState & UISTATE_CAPTURED) != 0 ) {
if( !m_bHorizontal ) {
//.........这里部分代码省略.........
示例10: DoEvent
void ZSlider::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else ZProgress::DoEvent(event);
return;
}
if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
{
if( IsEnabled() ) {
RECT rcThumb = GetThumbRect();
if( PtInRect(&rcThumb, event.ptMouse) ) {
m_uButtonState |= UISTATE_CAPTURED;
}
}
return;
}
if( event.Type == UIEVENT_BUTTONUP )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
m_uButtonState &= ~UISTATE_CAPTURED;
}
if( m_bHorizontal ) {
if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) m_nValue = m_nMax;
else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) m_nValue = m_nMin;
else m_nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
}
else {
if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) m_nValue = m_nMin;
else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) m_nValue = m_nMax;
else m_nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
}
DoLuaEvent("valueChanged",GetValue());
Invalidate();
return;
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
return;
}
if( event.Type == UIEVENT_SCROLLWHEEL )
{
switch(event.wParam) {
case SBT_LINEUP:
SetValue(GetValue() + GetChangeStep());
break;
case SBT_LINEDOWN:
SetValue(GetValue() - GetChangeStep());
break;
}
DoLuaEvent("valueChanged",GetValue());
return;
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
if( m_bHorizontal ) {
if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) m_nValue = m_nMax;
else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) m_nValue = m_nMin;
else m_nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
}
else {
if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) m_nValue = m_nMin;
else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) m_nValue = m_nMax;
else m_nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
}
Invalidate();
}
return;
}
//if( event.Type == UIEVENT_SETCURSOR )
//{
// RECT rcThumb = GetThumbRect();
// if( IsEnabled() && ::PtInRect(&rcThumb, event.ptMouse) ) {
// ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
// return;
// }
//}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( IsEnabled() ) {
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSELEAVE )
{
if( IsEnabled() ) {
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}
return;
}
ZControl::DoEvent(event);
}
示例11: DoEvent
void CComboUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else CContainerUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_SETFOCUS )
{
Invalidate();
}
if( event.Type == UIEVENT_KILLFOCUS )
{
Invalidate();
}
if( event.Type == UIEVENT_BUTTONDOWN )
{
if( IsEnabled() ) {
Activate();
m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED;
}
return;
}
if( event.Type == UIEVENT_BUTTONUP )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
m_uButtonState &= ~ UISTATE_CAPTURED;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
return;
}
if( event.Type == UIEVENT_KEYDOWN )
{
switch( event.chKey ) {
case VK_F4:
Activate();
return;
case VK_UP:
SelectItem(FindSelectable(m_iCurSel - 1, false));
return;
case VK_DOWN:
SelectItem(FindSelectable(m_iCurSel + 1, true));
return;
case VK_PRIOR:
SelectItem(FindSelectable(m_iCurSel - 1, false));
return;
case VK_NEXT:
SelectItem(FindSelectable(m_iCurSel + 1, true));
return;
case VK_HOME:
SelectItem(FindSelectable(0, false));
return;
case VK_END:
SelectItem(FindSelectable(GetCount() - 1, true));
return;
}
}
if( event.Type == UIEVENT_SCROLLWHEEL )
{
bool bDownward = LOWORD(event.wParam) == SB_LINEDOWN;
SelectItem(FindSelectable(m_iCurSel + (bDownward ? 1 : -1), bDownward));
return;
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
return;
}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( ::PtInRect(&m_rcItem, event.ptMouse ) ) {
if( (m_uButtonState & UISTATE_HOT) == 0 )
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSELEAVE )
{
if( (m_uButtonState & UISTATE_HOT) != 0 ) {
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}
return;
}
CControlUI::DoEvent(event);
}
示例12: DoEvent
void CEditUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else CLabelUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_SETCURSOR && IsEnabled() )
{
::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM)));
return;
}
if( event.Type == UIEVENT_WINDOWSIZE )
{
if( m_pWindow != NULL ) m_pManager->SetFocusNeeded(this);
}
if( event.Type == UIEVENT_SCROLLWHEEL )
{
if( m_pWindow != NULL ) return;
}
if( event.Type == UIEVENT_SETFOCUS && IsEnabled() )
{
if( m_pWindow ) return;
m_pWindow = new CEditWnd();
ASSERT(m_pWindow);
m_pWindow->Init(this);
Invalidate();
}
if( event.Type == UIEVENT_KILLFOCUS && IsEnabled() )
{
Invalidate();
}
if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK || event.Type == UIEVENT_RBUTTONDOWN)
{
if( IsEnabled() ) {
GetManager()->ReleaseCapture();
if( IsFocused() && m_pWindow == NULL )
{
m_pWindow = new CEditWnd();
ASSERT(m_pWindow);
m_pWindow->Init(this);
if( PtInRect(&m_rcItem, event.ptMouse) )
{
int nSize = GetWindowTextLength(*m_pWindow);
if( nSize == 0 )
nSize = 1;
Edit_SetSel(*m_pWindow, 0, nSize);
}
}
else if( m_pWindow != NULL )
{
#if 1
int nSize = GetWindowTextLength(*m_pWindow);
if( nSize == 0 )
nSize = 1;
Edit_SetSel(*m_pWindow, 0, nSize);
#else
POINT pt = event.ptMouse;
pt.x -= m_rcItem.left + m_rcTextPadding.left;
pt.y -= m_rcItem.top + m_rcTextPadding.top;
::SendMessage(*m_pWindow, WM_LBUTTONDOWN, event.wParam, MAKELPARAM(pt.x, pt.y));
#endif
}
}
return;
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
return;
}
if( event.Type == UIEVENT_BUTTONUP )
{
return;
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
return;
}
if( event.Type == UIEVENT_MOUSEENTER )
{
if( IsEnabled() ) {
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
return;
}
if( event.Type == UIEVENT_MOUSELEAVE )
{
if( IsEnabled() ) {
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}
return;
}
CLabelUI::DoEvent(event);
}
示例13: DoEvent
void CUIButton::DoEvent(TEventUI& Event)
{
if(!IsMouseEnabled() && Event.Type > UIEVENT__MOUSEBEGIN && Event.Type < UIEVENT__MOUSEEND){
if(m_Parent != NULL)
m_Parent->DoEvent(Event);
else
CUILabel::DoEvent(Event);
return;
}
if(Event.Type == UIEVENT_SETFOCUS){
Invalidate();
}
if(Event.Type == UIEVENT_KILLFOCUS){
Invalidate();
}
if(Event.Type == UIEVENT_KEYDOWN){
//
// TODO: keyboard support.
//
/*if (IsKeyboardEnabled()) {
if( Event.chKey == VK_SPACE || Event.chKey == VK_RETURN ) {
Activate();
return;
}
}*/
}
if(Event.Type == UIEVENT_BUTTONDOWN || Event.Type == UIEVENT_DBLCLICK){
if(m_rcItem.IsPtIn(Event.ptMouse) && IsEnabled()){
m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED;
Invalidate();
}
return;
}
if(Event.Type == UIEVENT_MOUSEMOVE){
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
UINT State = m_uButtonState;
if(m_rcItem.IsPtIn(Event.ptMouse))
m_uButtonState |= UISTATE_PUSHED;
else
m_uButtonState &= ~UISTATE_PUSHED;
if (State != m_uButtonState){
Invalidate();
}
}
return;
}
if(Event.Type == UIEVENT_BUTTONUP){
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
if(m_rcItem.IsPtIn(Event.ptMouse))
Activate();
m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED);
Invalidate();
}
return;
}
if(Event.Type == UIEVENT_CONTEXTMENU){
/*if( IsContextMenuUsed() ) {
m_pManager->SendNotify(this, DUI_MSGTYPE_MENU, Event.wParam, Event.lParam);
}*/
return;
}
if(Event.Type == UIEVENT_MOUSEENTER){
if(IsEnabled()){
m_uButtonState |= UISTATE_HOT;
Invalidate();
}
// return;
}
if(Event.Type == UIEVENT_MOUSELEAVE)
{
if(IsEnabled()){
m_uButtonState &= ~UISTATE_HOT;
Invalidate();
}
// return;
}
if(Event.Type == UIEVENT_SETCURSOR){
//::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
return;
}
CUILabel::DoEvent(Event);
}
示例14: DoEvent
void CSliderUI::DoEvent(TEventUI& event)
{
if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
if( m_pParent != NULL ) m_pParent->DoEvent(event);
else CProgressUI::DoEvent(event);
return;
}
if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
{
if( IsEnabled() ) {//2014.7.28 redrain 注释掉原来的代码,加上这些代码后可以让Slider不是在鼠标弹起时才改变滑块的位置
m_uButtonState |= UISTATE_CAPTURED;
int nValue;
if( m_bHorizontal ) {
if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) nValue = m_nMax;
else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) nValue = m_nMin;
else nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
}
else {
if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) nValue = m_nMin;
else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) nValue = m_nMax;
else nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
}
if(m_nValue !=nValue && nValue>=m_nMin && nValue<=m_nMax)
{
m_nValue =nValue;
Invalidate();
}
}
return;
}
// if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
// {
// if( IsEnabled() ) {
// RECT rcThumb = GetThumbRect();
// if( ::PtInRect(&rcThumb, event.ptMouse) ) {
// m_uButtonState |= UISTATE_CAPTURED;
// }
// }
// return;
// }
if( event.Type == UIEVENT_BUTTONUP )
{
int nValue;
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
m_uButtonState &= ~UISTATE_CAPTURED;
}
if( m_bHorizontal ) {
if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) nValue = m_nMax;
else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) nValue = m_nMin;
else nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
}
else {
if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) nValue = m_nMin;
else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) nValue = m_nMax;
else nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
}
if(/*m_nValue !=nValue && 2014.7.28 redrain 这个注释很关键,是他导致了鼠标拖动滑块无法发出DUI_MSGTYPE_VALUECHANGED消息*/nValue>=m_nMin && nValue<=m_nMax)
{
m_nValue =nValue;
m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
Invalidate();
}
return;
}
if( event.Type == UIEVENT_CONTEXTMENU )
{
return;
}
if( event.Type == UIEVENT_SCROLLWHEEL )
{
switch( LOWORD(event.wParam) ) {
case SB_LINEUP:
SetValue(GetValue() + GetChangeStep());
m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
return;
case SB_LINEDOWN:
SetValue(GetValue() - GetChangeStep());
m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED);
return;
}
}
if( event.Type == UIEVENT_MOUSEMOVE )
{
if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {//2014.7.28 redrain 重写这个消息判断让Slider发出DUI_MSGTYPE_VALUECHANGED_MOVE消息,让他在滑动过程也发出消息,比如用在改变音量时,一边滑动就可以一边改变音量
if( m_bHorizontal ) {
if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) m_nValue = m_nMax;
else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) m_nValue = m_nMin;
else m_nValue = m_nMin + (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx);
}
else {
if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) m_nValue = m_nMin;
else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) m_nValue = m_nMax;
else m_nValue = m_nMin + (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy);
}
if (m_bSendMove)
m_pManager->SendNotify(this, DUI_MSGTYPE_VALUECHANGED_MOVE);
//.........这里部分代码省略.........
示例15: DoEvent
void CGroupsUI::DoEvent(TEventUI& event)
{
if (!IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND)
{
if (m_pParent != NULL)
m_pParent->DoEvent(event);
else
CVerticalLayoutUI::DoEvent(event);
return;
}
if (event.Type == UIEVENT_TIMER && event.wParam == SCROLL_TIMERID)
{
if (delay_left_ > 0)
{
--delay_left_;
SIZE sz = GetScrollPos();
LONG lDeltaY = (LONG)(CalculateDelay((double)delay_left_ / delay_number_) * delay_deltaY_);
if ((lDeltaY > 0 && sz.cy != 0) || (lDeltaY < 0 && sz.cy != GetScrollRange().cy ))
{
sz.cy -= lDeltaY;
SetScrollPos(sz);
return;
}
}
delay_deltaY_ = 0;
delay_number_ = 0;
delay_left_ = 0;
m_pManager->KillTimer(this, SCROLL_TIMERID);
return;
}
if (event.Type == UIEVENT_SCROLLWHEEL)
{
LONG lDeltaY = 0;
if (delay_number_ > 0)
lDeltaY = (LONG)(CalculateDelay((double)delay_left_ / delay_number_) * delay_deltaY_);
switch (LOWORD(event.wParam))
{
case SB_LINEUP:
if (delay_deltaY_ >= 0)
delay_deltaY_ = lDeltaY + 8;
else
delay_deltaY_ = lDeltaY + 12;
break;
case SB_LINEDOWN:
if (delay_deltaY_ <= 0)
delay_deltaY_ = lDeltaY - 8;
else
delay_deltaY_ = lDeltaY - 12;
break;
}
if
(delay_deltaY_ > 100) delay_deltaY_ = 100;
else if
(delay_deltaY_ < -100) delay_deltaY_ = -100;
delay_number_ = (DWORD)sqrt((double)abs(delay_deltaY_)) * 5;
delay_left_ = delay_number_;
m_pManager->SetTimer(this, SCROLL_TIMERID, 50U);
return;
}
CListUI::DoEvent(event);
}