//**************************************************************************************** void CFolderItem::OnClickButton (CPoint /*point*/) { CBCGPGridCtrl* pGridCtrl = GetOwnerList (); m_bButtonIsDown = TRUE; Redraw (); CString strPath = (LPCTSTR)(_bstr_t)m_varValue; if (theApp.GetShellManager ()->BrowseForFolder (strPath, NULL, strPath)) { m_varValue = (LPCTSTR) strPath; } m_bButtonIsDown = FALSE; Redraw (); if (m_pWndInPlace != NULL) { m_pWndInPlace->SetWindowText (strPath); m_pWndInPlace->SetFocus (); } else { pGridCtrl->SetFocus (); } }
//**************************************************************************************** void CFileItem::OnClickButton (CPoint /*point*/) { CBCGPGridCtrl* pGridCtrl = GetOwnerList(); m_bButtonIsDown = TRUE; Redraw (); CString strPath = (LPCTSTR)(_bstr_t)m_varValue; CFileDialog dlg (TRUE, strPath); if (dlg.DoModal () == IDOK) { strPath = dlg.GetPathName (); m_varValue = (LPCTSTR) strPath; } m_bButtonIsDown = FALSE; Redraw (); if (m_pWndInPlace != NULL) { m_pWndInPlace->SetWindowText (strPath); m_pWndInPlace->SetFocus (); } else { pGridCtrl->SetFocus (); } }
//***************************************************************************************** BOOL CBCGPGridButtonItem::OnClickValue(UINT uiMsg, CPoint point) { if (uiMsg != WM_LBUTTONUP) { return CBCGPGridItem::OnClickValue(uiMsg, point); } CBCGPGridCtrl* pGridCtrl = GetOwnerList(); ASSERT_VALID (pGridCtrl); pGridCtrl->GetOwner()->PostMessage(WM_COMMAND, MAKEWPARAM(m_id, BN_CLICKED)); return TRUE; }
//****************************************************************************** CWnd* CPasswordItem::CreateInPlaceEdit (CRect rectEdit, BOOL& bDefaultFormat) { CEdit* pWndEdit = new CEdit; DWORD dwStyle = WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL | ES_PASSWORD; if (!m_bEnabled || !m_bAllowEdit) { dwStyle |= ES_READONLY; } pWndEdit->Create (dwStyle, rectEdit, GetOwnerList(), BCGPROPLIST_ID_INPLACE); pWndEdit->SetPasswordChar (cPassword); bDefaultFormat = TRUE; return pWndEdit; }
//***************************************************************************************** void CFontItem::OnClickButton (CPoint /*point*/) { CBCGPGridCtrl* pGridCtrl = GetOwnerList(); ASSERT_VALID (pGridCtrl); ASSERT_VALID (this); ASSERT_VALID (m_pWndInPlace); ASSERT (::IsWindow (m_pWndInPlace->GetSafeHwnd ())); m_bButtonIsDown = TRUE; Redraw (); CFontDialog dlg (&m_lf); if (m_Color != (COLORREF)-1) { dlg.m_cf.rgbColors = m_Color; } if (dlg.DoModal () == IDOK) { dlg.GetCurrentFont (&m_lf); m_Color = dlg.GetColor (); if (m_pWndInPlace != NULL) { m_pWndInPlace->SetWindowText (FormatProperty ()); } else { m_varValue = (LPCTSTR) FormatProperty (); } } if (m_pWndInPlace != NULL) { m_pWndInPlace->SetFocus (); } else { pGridCtrl->SetFocus (); } m_bButtonIsDown = FALSE; Redraw (); }
//***************************************************************************************** void CIconListItem::OnDrawValue (CDC* pDC, CRect rect) { CBCGPGridCtrl* pGridCtrl = GetOwnerList(); ASSERT_VALID (pGridCtrl); ASSERT_VALID (pDC); CString strVal = (LPCTSTR)(_bstr_t) m_varValue; if (strVal.IsEmpty () || m_imageListIcons.GetCount () == 0) { return; } int nIndex = -1; #if _MSC_VER < 1400 _stscanf (strVal, _T("%d"), &nIndex); #else _stscanf_s (strVal, _T("%d"), &nIndex); #endif if (nIndex < 0) { return; } CRect rectImage = rect; rectImage.right = rectImage.left + rectImage.Height () + 2 * nIconMargin; m_imageListIcons.DrawEx (pDC, rectImage, nIndex, CBCGPToolBarImages::ImageAlignHorzCenter, CBCGPToolBarImages::ImageAlignVertCenter); if (!m_lstIconNames.IsEmpty ()) { CFont* pOldFont = pDC->SelectObject (pGridCtrl->GetFont ()); CString str = m_lstIconNames.GetAt (m_lstIconNames.FindIndex (nIndex)); rect.left = rectImage.right; pDC->DrawText (str, rect, DT_SINGLELINE | DT_VCENTER); pDC->SelectObject (pOldFont); } m_bValueIsTrancated = FALSE; }
//************************************************************************************ CWnd* CSliderItem::CreateInPlaceEdit (CRect rectEdit, BOOL& bDefaultFormat) { CBCGPGridCtrl* pWndList = GetOwnerList (); ASSERT_VALID (pWndList); CRect rectSpin; AdjustInPlaceEditRect (rectEdit, rectSpin); rectEdit.left += rectEdit.Height ()+ 5; CItemSliderCtrl* pWndSlider = new CItemSliderCtrl (this, pWndList->GetBkColor ()); pWndSlider->Create (WS_VISIBLE | WS_CHILD, rectEdit, pWndList, BCGPROPLIST_ID_INPLACE); pWndSlider->SetPos ((long) m_varValue); bDefaultFormat = FALSE; return pWndSlider; }
//****************************************************************************************** BOOL CSliderItem::OnUpdateValue () { ASSERT_VALID (this); CBCGPGridCtrl* pWndList = GetOwnerList (); ASSERT_VALID (pWndList); ASSERT_VALID (m_pWndInPlace); ASSERT (::IsWindow (m_pWndInPlace->GetSafeHwnd ())); CItemSliderCtrl* pWndSlider = (CItemSliderCtrl*) m_pWndInPlace; long lNewValue = (long) pWndSlider->GetPos (); long lCurrValue = m_varValue; if (lCurrValue != lNewValue) { SetValue (lNewValue); } return TRUE; }
//***************************************************************************** CString CFontItem::FormatProperty () { CBCGPGridCtrl* pGridCtrl = GetOwnerList (); ASSERT_VALID (pGridCtrl); CWindowDC dc (pGridCtrl); int nLogY = dc.GetDeviceCaps (LOGPIXELSY); CString str; if (nLogY != 0) { str.Format( _T("%s(%i)"), m_lf.lfFaceName, MulDiv (72, -m_lf.lfHeight, nLogY)); } else { str = m_lf.lfFaceName; } return str; }