BOOL duTreeListCtrl::SetSelTreeItem(TreeListItem *pItem) { if (pItem == &m_RootItem) return FALSE; if (pItem) { if (pItem->pPlugin == m_pSel) return FALSE; if (pItem->pPlugin) { pItem->pPlugin->SetState(DU_STATE_OVER); Plugin_Redraw(pItem->pPlugin, TRUE); } } if (m_pSel) { m_pSel->SetState(DU_STATE_NORMAL); if (m_pSel->IsVisible()) Plugin_Redraw(m_pSel, TRUE); } if (pItem) m_pSel = pItem->pPlugin; else m_pSel = NULL; return TRUE; }
void WINAPI duComboBox::OnKeyDown(UINT key, UINT nRepCnt, UINT nFlags) { int nItemCount = GetItemCount(); if (key == VK_UP) { if (nItemCount == 0) return; int nSel = GetCurSel(); nSel--; if (nSel < 0) nSel = 0; if (nSel >= nItemCount) nSel = nItemCount - 1; SetCurSel(nSel); Plugin_Redraw(this, TRUE); } else if (key == VK_DOWN) { int nSel = GetCurSel(); nSel++; if (nSel >= nItemCount) nSel = nItemCount - 1; if (nSel < 0) nSel = 0; SetCurSel(nSel); Plugin_Redraw(this, TRUE); } else duEdit::OnKeyDown(key, nRepCnt, nFlags); }
void duSpin::OnMouseLDown(POINT pt) { duPoint ptSpin(pt); duRect rcSpin; Plugin_GetRect(this, &rcSpin); ptSpin.Offset(-rcSpin.left, -rcSpin.top); if (!m_fReadOnly && ::PtInRect(&m_rcFormat, ptSpin)) duEdit::OnMouseLDown(pt); else { duRect rcSpinUpButton, rcSpinDownButton; rcSpinUpButton.left = rcSpin.right - m_nSpinLeft; rcSpinUpButton.top = rcSpin.top + m_nSpinTop; rcSpinUpButton.right = rcSpinUpButton.left + n_nSpinWidth; rcSpinUpButton.bottom = rcSpinUpButton.top + (rcSpin.Height() - m_nSpinTop - m_nSpinBottom) / 2; rcSpinDownButton = rcSpinUpButton; rcSpinDownButton.top = rcSpinUpButton.bottom; rcSpinDownButton.bottom = rcSpin.bottom - m_nSpinBottom; if (rcSpinUpButton.PtInRect(pt)) { m_uUpState = DU_STATE_PRESS; Plugin_Redraw(this, TRUE); } else if (rcSpinDownButton.PtInRect(pt)) { m_uDownState = DU_STATE_PRESS; Plugin_Redraw(this, TRUE); } } }
void WINAPI duListBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) { int nItemCount = GetItemCount(); if (nItemCount == 0) return; if (nChar == VK_UP) { int nSel = GetSel(); nSel--; if (nSel < 0) nSel = 0; if (nSel >= nItemCount) nSel = nItemCount - 1; SetSel(nSel); duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll); if (pScroll) { pScroll->SetPos(m_nItemHeight * nSel); UpdateScroll(); } if (!m_fCombobox) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else { FadeRedraw(); } } else if (nChar == VK_DOWN) { int nSel = GetSel(); _TRACE(_T("nSel :%d\n"), nSel); nSel++; if (nSel >= nItemCount) nSel = nItemCount - 1; if (nSel < 0) nSel = 0; SetSel(nSel); duScroll *pScroll = (duScroll *)GetPluginByName(m_szVertScroll); if (pScroll) { pScroll->SetPos(m_nItemHeight * nSel); UpdateScroll(); } if (!m_fCombobox) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else FadeRedraw(); } }
void WINAPI duListCtrl::OnHScroll(ScrollBarAction sbAction, int nPos) { switch (sbAction) { case SCROLL_NO_WHERE: m_nXOffset = 0; break; case SCROLL_UP: case SCROLL_DOWN: case SCROLL_TRACK: case SCROLL_PAGEUP: case SCROLL_PAGEDOWN: case SCROLL_WHEEL_UP: case SCROLL_WHEEL_DOWN: { if (m_nXOffset != nPos) { HorzScroll(nPos); m_nXOffset = nPos; Plugin_Redraw(this, TRUE); //::InvalidateRect(m_hWnd, NULL, TRUE); } } break; default: break; } }
void WINAPI duListCtrl::OnVScroll(ScrollBarAction sbAction, int nPos) { switch (sbAction) { case SCROLL_NO_WHERE: m_nYOffset = 0; break; case SCROLL_UP: case SCROLL_DOWN: case SCROLL_PAGEDOWN: case SCROLL_PAGEUP: case SCROLL_TRACK: case SCROLL_WHEEL_UP: case SCROLL_WHEEL_DOWN: { if (m_nYOffset != nPos) { VertScroll(nPos - m_nYOffset); m_nYOffset = nPos; Plugin_Redraw(this, TRUE); // 重绘 } } break; default: _TRACE(_T("OnVScroll Error pos[%d]\n"), nPos); break; } }
void duIMPanelNode::OnMouseLUp(POINT pt) { int nState = GetState(); if (IS_STATE_CHECKED(nState)) { if (nState == DU_STATE_CHECKEDPRESS) { SetState(DU_STATE_NORMAL); Expand(TRUE); } else SetState(DU_STATE_CHECKED); } else { if (nState == DU_STATE_PRESS) { SetState(DU_STATE_CHECKED); Expand(FALSE); } else SetState(DU_STATE_NORMAL); } Plugin_Redraw(this, TRUE); }
int CCtxFeedbackWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!theApp.GetWindowManager()->Attach(GetSafeHwnd(), _T("feedback_wnd"))) return -1; // TODO: 在此添加您专用的创建代码 TransnBizApi::GetFeedbackItems(TT_IMG, m_vtFeedbackItems); for (unsigned int i = 0; i < m_vtFeedbackItems.size(); i++) { TCHAR szBtnName[MAX_PATH] = { 0 }; _stprintf_s(szBtnName, MAX_PATH, _T("%s%d"), _T("feedback_btn"), i); duButton* pBtn = (duButton*)GetPluginByName(GetSafeHwnd(), szBtnName); if (pBtn) { pBtn->SetText(base::stdcxx_s2ws(m_vtFeedbackItems[i].msg).c_str()); pBtn->SetParam(m_vtFeedbackItems[i].code); Plugin_Redraw(pBtn, FALSE); } } return 0; }
void WINAPI duListCtrl::HorzScroll(int nPos) { int i; int nLineCount = m_vtLines.size(); for (i = 0;i < nLineCount; i++) { duPlugin *pTemp = m_vtLines[i]; pTemp->SetPosLeft( - nPos ); } duHeaderCtrl *pHeaderCtrl = (duHeaderCtrl *)GetPluginByName(m_szHeaderCtrl); if (pHeaderCtrl) { //CRect rc; //GetRect(&rc); //_TRACE(_T("HorzScroll %d TotalWidth %d ListCtrlWidth :%d\n"), nPos, pHeaderCtrl->GetTotalWidth(), rc.Width()); //duScroll *p = (duScroll *)GetPluginByName(m_szHorzScroll); //_TRACE(_T("maxpos :%d page :%d pos :%d\n"), p->GetMaxPos(), p->GetPage(), p->GetPos()); pHeaderCtrl->SetOffsetX(nPos); Plugin_Redraw(pHeaderCtrl, TRUE); } Resize(NULL); }
void CTransChatWebWnd::OnTimer(UINT_PTR nIDEvent) { // TODO: 在此添加消息处理程序代码和/或调用默认值 switch (nIDEvent) { case TIMER_AUTO_CLOSE: { if (m_nSecCount == AUTO_CLOSE_WND_TIME) { KillTimer(nIDEvent); EndDialog(0); } else { m_nSecCount++; TCHAR szTitle[MAX_PATH] = { 0 }; _stprintf_s(szTitle, _countof(szTitle), _T("会话已结束,%d 秒自动关闭"), AUTO_CLOSE_WND_TIME - m_nSecCount); duWindow* pWnd = (duWindow*)GetPluginByName(GetSafeHwnd(), _T("trans_chat_web_wnd")); if (pWnd) { pWnd->SetText(szTitle); Plugin_Redraw(pWnd, FALSE); } } break; } default: break; } CDialogEx::OnTimer(nIDEvent); }
void WINAPI duListBox::OnMouseLeave(POINT pt) { if (m_pHotItem) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } }
void duTreeCtrl::SetItemHeight(int nItemHeight) { if (nItemHeight > 0) { m_nItemHeight = nItemHeight; UpdateScroll(); Plugin_Redraw(this, TRUE); } }
void duTreeListCtrl::SetHeaderCtrlCheckBoxState(UINT uState) { duHeaderCtrl *pHeaderCtrl = (duHeaderCtrl *)GetPluginByName(m_szHeaderCtrl); if (pHeaderCtrl == NULL) return; pHeaderCtrl->SetCheckBoxState(uState); Plugin_Redraw(pHeaderCtrl, TRUE); }
void duTreeCtrl::OnMouseLeave(POINT pt) { if (m_pHot) { m_pHot = NULL; Plugin_Redraw(this, TRUE); } m_hitCode = tc_hit_empty; }
void WINAPI duListCtrl::SetSel(int nSel) { int nLineCount = GetLineCount(); if (nSel < 0 || nSel >= nLineCount) return; duPlugin *pNewSel = m_vtLines[nSel]; if (m_pSel) { m_pSel->SetState(DU_STATE_NORMAL); if (m_pSel->IsVisible()) Plugin_Redraw(m_pSel, TRUE); } pNewSel->SetState(DU_STATE_OVER); m_pSel = pNewSel; if (pNewSel->IsVisible()) Plugin_Redraw(m_pSel, TRUE); }
void WINAPI duXmlStatic::OnMouseLeave(POINT pt) { if (IsHrefSegment(m_pHotSegMent)) { m_pHotSegMent = NULL; Plugin_Redraw(this, TRUE); } m_pHotSegMent = NULL; }
void duTreeCtrl::OnMouseMove(POINT pt) { duCtrlManager *pCtrlManager = GetCtrlManager(m_hWnd); duRect rcTreeCtrl; Plugin_GetRect(this, &rcTreeCtrl); duRect rcItem; rcItem.SetRectEmpty(); TreeCtrlItem *pItem = yHitTest(rcTreeCtrl, pt, rcItem); if (m_pHot != pItem) { m_pHot = pItem; Plugin_Redraw(this, TRUE); if(m_fShowTooltip) { pCtrlManager->DelToolTip(); m_fShowTooltip = FALSE; } } if (pItem == NULL) { m_hitCode = tc_hit_empty; if(m_fShowTooltip) { pCtrlManager->DelToolTip(); m_fShowTooltip = FALSE; } } else { POINT ptClient(pt); ptClient.x -= rcTreeCtrl.left; ptClient.y -= rcTreeCtrl.top; int nLeft = (pItem->nLevel - 1) * m_nIndentWidth; duRect rcIndent = CalcVCenterRect(rcItem, nLeft, m_nIndentWidth, m_nIndentHeight); if (ItemHasChildren(pItem) && (rcIndent.PtInRect(ptClient))) m_hitCode = tc_hit_indent; nLeft += (m_nIndentWidth + m_nIndentIconSpace); duRect rcIcon = CalcVCenterRect(rcItem, nLeft, m_nIconWidth, m_nIconHeight); if (rcIcon.PtInRect(ptClient)) m_hitCode = tc_hit_icon; duRect rcText; nLeft += (m_nIconWidth + m_nIconTextSpace); rcText = rcItem; rcText.left = rcItem.left + nLeft; if (rcText.PtInRect(ptClient)) m_hitCode = tc_hit_text; } }
void WINAPI duListBox::OnMouseLDown(POINT pt) { if (m_pHotItem != m_pSelItem) { ListBoxItem *pTemp = m_pSelItem; m_pSelItem = m_pHotItem; Plugin_Redraw(this, TRUE); int nOldSelItemIndex = GetItemIndex(pTemp); int nNewSelItemIndex = GetItemIndex(m_pHotItem); NotifyUser(DUM_LBSELCHANGED, (WPARAM)nOldSelItemIndex, (LPARAM)nNewSelItemIndex); } }
void duLEDTimer::OnTimer(UINT nEventId) { if (nEventId != m_nTimerID) return; if (!Plugin_IsVisible(this)) return; TCHAR szTime[MAX_NAME]; ZeroMemory(szTime, MAX_NAME *sizeof(TCHAR)); _tstrtime(szTime); SetText(szTime); Plugin_Redraw(this, TRUE); }
LRESULT WINAPI duAnimation::OnWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (!Plugin_IsVisible(this)) return 0; if (uMsg == WM_ANIMATION_TIMER) { if ((duAnimation *)wParam == this) { Plugin_Redraw(this, TRUE); } } return 0; }
void WINAPI duListCtrl::ResetLine() { m_nYOffset = 0; m_nFirstLine = 0; m_nFLTotalHeight = 0; m_nHotLine = 0; if (Plugin_IsValid(m_pHot)) { m_pHot->SetState(DU_STATE_NORMAL); Plugin_Redraw(m_pHot, TRUE); } UpdateScroll(); AdjustVisibleLine(0); }
void duListBox::FadeRedraw() { if (m_fFade) { m_fFadeIn = TRUE; m_nAlphaFadeIn = 0; Plugin_KillTimer(this, m_nTimerFadeIn); Plugin_SetTimer(this, m_nTimerFadeIn, 30); } else { m_nAlphaFadeIn = 255; Plugin_Redraw(this, TRUE); } }
void duReportHeader::OnMouseLeave() { if (m_fTracking) return; if (m_nHot != -1) { ReportHeaderItem *pOldItem = GetItem(m_nHot); if (pOldItem) { pOldItem->uState = DU_STATE_NORMAL; Plugin_Redraw(m_pReportView, TRUE); } m_nHot = -1; } }
void WINAPI duOutlookBar::OnMouseMove(POINT pt) { duRect rect; GetRect(&rect); int i; OutlookBarItem *pOutlookBarItem = NULL; int nItemCount = GetItemCount(); duRect rectItem = rect; rectItem.bottom = rectItem.top + m_nItemHeight; BOOL fRedraw = FALSE; for (i = 0;i < nItemCount; i++) { pOutlookBarItem = m_vtItems[i]; if (rectItem.PtInRect(pt)) { if (pOutlookBarItem->iState == DU_STATE_NORMAL) { pOutlookBarItem->iState = DU_STATE_OVER; fRedraw = TRUE; } } else { if (pOutlookBarItem->iState != DU_STATE_NORMAL) { pOutlookBarItem->iState = DU_STATE_NORMAL; fRedraw = TRUE; } } if (pOutlookBarItem->fSelected) { rectItem.top = rect.bottom - (nItemCount - i - 1) * m_nItemHeight; rectItem.bottom = rectItem.top + m_nItemHeight; } else { rectItem.OffsetRect(0, m_nItemHeight); } } if (fRedraw) Plugin_Redraw(this, TRUE); }
void WINAPI duListBox::OnMouseMove(POINT pt) { duRect rcListBox; Plugin_GetRect(this, &rcListBox); pt.x -= rcListBox.left; pt.y -= rcListBox.top; duPlugin *pScroll = GetPluginByName(m_szVertScroll); duRect rcItem; rcItem.SetRectEmpty(); if(pScroll != NULL && Plugin_IsVisible(pScroll)) rcItem.right = rcListBox.Width() - pScroll->GetPosWidth(); else rcItem.right = rcListBox.Width(); rcItem.OffsetRect(0, -m_nYOffset); int i; int nItemCount = GetItemCount(); ListBoxItem *pItem = NULL; for (i = 0;i < nItemCount; i++) { rcItem.top = rcItem.bottom; rcItem.bottom = rcItem.top + m_nItemHeight; pItem = m_vtItem[i]; if (rcItem.PtInRect(pt) && m_pHotItem != pItem) { if (pItem->fDisable) { m_pHotItem = NULL; Plugin_Redraw(this, TRUE); } else { m_pHotItem = pItem; if (m_pHotItem != m_pSelItem) FadeRedraw(); } break; } } }
void WINAPI duListBox::OnTimer(UINT nEventId) { if (nEventId == m_nTimerFadeIn) { m_nAlphaFadeIn += 10; if (m_nAlphaFadeIn >= 255) m_nAlphaFadeIn = 255; Plugin_Redraw(this, TRUE); if (m_nAlphaFadeIn >= 255) { Plugin_KillTimer(this, m_nTimerFadeIn); m_fFadeIn = FALSE; m_nAlphaFadeIn = 0; } } }
void duSpin::OnMouseLeave(POINT pt) { BOOL fRedraw = FALSE; if (m_uUpState != DU_STATE_NORMAL) { m_uUpState = DU_STATE_NORMAL; fRedraw = TRUE; } if (m_uDownState != DU_STATE_NORMAL) { m_uDownState = DU_STATE_NORMAL; fRedraw = TRUE; } if (fRedraw) Plugin_Redraw(this, TRUE); }
void duTreeCtrl::SetFont(LPCTSTR lpszFont) { if (lpszFont) { if (!GetResObj(lpszFont, DU_RES_FONT)) return; _tcsncpy(m_szFont, lpszFont, MAX_NAME); TreeCtrlItem *pItem = m_pRoot; while (pItem) { pItem->nTextWidth = 0; pItem = GetNextItem(pItem); } UpdateScroll(); Plugin_Redraw(this, TRUE); } }
void duSplitter::OnMouseLDown(POINT pt) { duPlugin *pFPlugin = GetPluginByName(m_szFName); duPlugin *pSPlugin = GetPluginByName(m_szSName); if (!Plugin_IsValid(pFPlugin) || !Plugin_IsValid(pSPlugin)) return; duRect rectSplitter; Plugin_GetRect(this, &rectSplitter); if (rectSplitter.PtInRect(pt)) { m_ptStart = pt; m_rectLast.SetRectEmpty(); m_fTracking = TRUE; Plugin_SetState(this, DU_STATE_PRESS); Plugin_SetCapture(this); Plugin_Redraw(this, TRUE); } }
void WINAPI duOutlookBar::OnMouseLeave(POINT pt) { int i; OutlookBarItem *pOutlookBarItem = NULL; BOOL fRedraw = FALSE; int nItemCount = GetItemCount(); for (i = 0;i < nItemCount; i++) { pOutlookBarItem = m_vtItems[i]; if (pOutlookBarItem->iState != DU_STATE_NORMAL) { pOutlookBarItem->iState = DU_STATE_NORMAL; fRedraw = TRUE; } } if (fRedraw) Plugin_Redraw(this, TRUE); }