void CXTPReportInplaceList::PostNcDestroy() { CXTPMouseMonitor::SetupHook(NULL); SetItemArgs(NULL); CListBox::PostNcDestroy(); }
void CXTPReportInplaceEdit::HideWindow() { if (m_hWnd) { ShowWindow(SW_HIDE); SetItemArgs(0); } }
void CXTPReportInplaceButton::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs, CRect& rcButtons) { m_bPressed = m_bOver = FALSE; m_nState = 0; m_nSpinIncrement = 0; m_unSpinTimerCnt = 0; m_unSpinTimerId = 0; SetItemArgs(pItemArgs); CRect rect(rcButtons); if (pControl->GetPaintManager()->IsFixedInplaceButtonHeight()) { rect.bottom = min(rect.bottom, rect.top + m_nFixedHeight); } if (m_bInsideCell) { rect.right = rcButtons.left; rect.left = rect.right - m_nWidth; rcButtons.left = rect.left; } else { rect.left = rcButtons.right; rect.right = rect.left + m_nWidth; rcButtons.right = rect.right; } //to keep focused frame no touched rect.top++; rect.bottom -= 2; rect.left--; if (m_nID == XTP_ID_REPORT_COMBOBUTTON) rect.right--; if (!m_hWnd) CStatic::Create(NULL, SS_NOTIFY | WS_CHILD, rect, pItemArgs->pControl); SetWindowPos(0, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW); }
CXTPReportInplaceControl::~CXTPReportInplaceControl() { SetItemArgs(0); }
void CXTPReportInplaceList::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs, CXTPReportRecordItemConstraints* pConstaints) { SetItemArgs(pItemArgs); CRect rect(pItemArgs->rcItem); if (!m_hWnd) { CListBox::CreateEx(WS_EX_TOOLWINDOW | (pControl->GetExStyle() & WS_EX_LAYOUTRTL), _T("LISTBOX"), _T(""), LBS_NOTIFY | WS_CHILD | WS_BORDER | WS_VSCROLL, CRect(0, 0, 0, 0), pControl, 0); SetOwner(pControl); } SetFont(pControl->GetPaintManager()->GetTextFont()); ResetContent(); int dx = rect.right - rect.left + 1; CWindowDC dc(pControl); CXTPFontDC font(&dc, GetFont()); int nThumbLength = GetSystemMetrics(SM_CXHTHUMB); CString strCaption = pItem->GetCaption(pColumn); DWORD dwData = pItem->GetSelectedConstraintData(pItemArgs); for (int i = 0; i < pConstaints->GetCount(); i++) { CXTPReportRecordItemConstraint* pConstaint = pConstaints->GetAt(i); CString str = pConstaint->m_strConstraint; int nIndex = AddString(str); SetItemDataPtr(nIndex, pConstaint); dx = max(dx, dc.GetTextExtent(str).cx + nThumbLength); if ((dwData == (DWORD)-1 && strCaption == str) || (dwData == pConstaint->m_dwData)) SetCurSel(nIndex); } int nHeight = GetItemHeight(0); rect.top = rect.bottom; //rect.bottom += nHeight * min(10, GetCount()) + 2; rect.bottom += nHeight * min(m_Items2Show, GetCount()) + 2; rect.left = rect.right - dx; pControl->ClientToScreen(&rect); CRect rcWork = XTPMultiMonitor()->GetWorkArea(rect); if (rect.bottom > rcWork.bottom && rect.top > rcWork.CenterPoint().y) rect.OffsetRect(0, - rect.Height() - pItemArgs->rcItem.Height()); if (rect.left < rcWork.left) rect.OffsetRect(rcWork.left - rect.left, 0); if (rect.right > rcWork.right) rect.OffsetRect(rcWork.right - rect.right, 0); SetFocus(); if (!m_hWnd) // Can be destroyed after focus set return; SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, 0); ModifyStyle(WS_CHILD, WS_POPUP); SetWindowLongPtr(m_hWnd, GWLP_HWNDPARENT, (LONG_PTR)pControl->m_hWnd); SetWindowPos(&CWnd::wndTopMost, rect.left, rect.top, rect.Width(), rect.Height(), SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOOWNERZORDER); CXTPMouseMonitor::SetupHook(this); }
void CXTPReportInplaceEdit::Create(XTP_REPORTRECORDITEM_ARGS* pItemArgs) { SetItemArgs(pItemArgs); m_pSelectedConstraint = NULL; XTP_REPORTRECORDITEM_METRICS* pMetrics = new XTP_REPORTRECORDITEM_METRICS; CXTPReportRecordItemText* pTextItem = DYNAMIC_DOWNCAST(CXTPReportRecordItemText, pItem); pItemArgs->pRow->FillMetrics(pColumn, pItem, pMetrics); if (pTextItem != NULL) { pMetrics->strText = pTextItem->GetValue(); } else //not CXTPReportRecordItemText case! { pMetrics->strText = pItem->GetCaption(pColumn); } CXTPReportRecordItemEditOptions* pEditOptions = pItem->GetEditOptions(pColumn); ASSERT(pEditOptions); if (!pEditOptions) return; CRect rect = pItemArgs->rcItem; rect.DeflateRect(2, 1, 2, 2); m_clrText = pMetrics->clrForeground; m_strValue = pMetrics->strText; m_strText_prev = pMetrics->strText; DWORD dwEditStyle = WS_CHILD | pEditOptions->m_dwEditStyle; dwEditStyle &= ~(ES_LEFT | ES_RIGHT | ES_CENTER); if (pControl->GetPaintManager()->m_bUseEditTextAlignment) { if (pMetrics->nColumnAlignment & DT_RIGHT) dwEditStyle |= ES_RIGHT; else if (pMetrics->nColumnAlignment & DT_CENTER) dwEditStyle |= ES_CENTER; } if (m_hWnd) { DWORD dwStyle = WS_CHILD | WS_VISIBLE | ES_READONLY; if ((GetStyle() & dwStyle) != (dwEditStyle & dwStyle)) DestroyWindow(); } if (!m_hWnd) CEdit::Create(dwEditStyle, rect, pControl, 0); if (pControl->GetExStyle() & WS_EX_RTLREADING) ModifyStyleEx(0, WS_EX_RTLREADING); SetLimitText(pEditOptions->m_nMaxLength); //SetFocus(); SetFont(pMetrics->pFont); SetWindowText(m_strValue); pMetrics->InternalRelease(); if (rect.right > rect.left) { SetWindowPos(0, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_SHOWWINDOW); SetFocus(); } else { HideWindow(); } SetMargins(0, 0); }