Пример #1
0
void CArrayGrid::OnLButtonDown(UINT nFlags, CPoint point)
{
	CBCGPGridCtrl::OnLButtonDown(nFlags, point);
	CDlgParamEditArray::DataType type = ((CDlgParamEditArray*)GetParent())->m_dataType;
	if (type!=CDlgParamEditArray::TypeBool)
		return;

	if (IsColumnSelected(0))
		return;

	CBCGPGridItem * pItem = GetCurSelItem();
	if (pItem==NULL)
		return;

	CString str;
	ConvertBSTR2CString( str, pItem->GetValue().bstrVal );
	if ( str.CompareNoCase("true") == 0 )
		str = "false";
	else
		str = "true";

	pItem->SetValue( (LPCTSTR)(str) );
	int iRow = pItem->GetGridItemID().m_nRow;
	((CDlgParamEditArray*)GetParent())->m_vArray[iRow] = str;
}
void CToolGridListDlg::OnBnClickedButtonEditSel()
{
    // TODO: 在此添加控件通知处理程序代码
    CBCGPGridRow *pSelRow = m_wndGridTools.GetCurSel();
    if (pSelRow==NULL) return;

    CBCGPGridItem * pItemId = pSelRow->GetItem(0);
    if (pItemId==NULL) return;

    CString strId = pItemId->GetValue();
    if (m_ToolMap.find(strId)== m_ToolMap.end()) return;

    ToolObject & tool = m_ToolMap[strId];
    if (CToolsProUnity::ConfigTool(&tool))
    {
        CToolsProUnity::WriteToolConfigXml(tool);
    }
}
HRESULT CToolGridListDlg::OnMsgGridDoubleClick(WPARAM wp,LPARAM lp)
{
    int iRow = wp;
    CBCGPGridRow *pDbClicRow = m_wndGridTools.GetRow(iRow);
    if (pDbClicRow==NULL) return S_OK;

    CBCGPGridItem * pItemId = pDbClicRow->GetItem(0);
    if (pItemId==NULL) return S_OK;

    CString strId = pItemId->GetValue();
    if (m_ToolMap.find(strId)== m_ToolMap.end()) return S_OK;

    ToolObject & tool = m_ToolMap[strId];
    if (CToolsProUnity::ConfigTool(&tool))
    {
        CToolsProUnity::WriteToolConfigXml(tool);
    }

    return S_OK;
}
void CToolGridListDlg::OnBnClickedButtonDelSel()
{
    // TODO: 在此添加控件通知处理程序代码
    CBCGPGridRow *pSelRow = m_wndGridTools.GetCurSel();
    if (pSelRow==NULL) return;

    CBCGPGridItem * pItemId = pSelRow->GetItem(0);
    if (pItemId==NULL) return;

    CString strId = pItemId->GetValue();
    map<CString,ToolObject>::iterator iterFind = m_ToolMap.find(strId);
    if (iterFind== m_ToolMap.end()) return;

    if (MessageBox("确定要删除选中的配置?","提示",MB_YESNO|MB_ICONQUESTION)==IDNO)
        return;

    m_ToolMap.erase(iterFind);
    CToolsProUnity::DeleteToolConfigFromXml(strId);
    m_wndGridTools.RemoveRow(pSelRow->GetRowId());
    m_wndGridTools.AdjustLayout ();
}
//**********************************************************************
LRESULT CBCGPRibbonCustomizeRibbonPage::OnChangeRibbonTree(WPARAM /*wp*/, LPARAM lp)
{
#ifndef BCGP_EXCLUDE_GRID_CTRL
	BCGPGRID_ITEM_INFO* pInfo = (BCGPGRID_ITEM_INFO*)lp;
	if (pInfo == NULL)
	{
		return 0;
	}

	CBCGPGridRow* pRow = m_wndRibbonTreeDest.GetCurSel();
	if (pRow != NULL)
	{
		ASSERT_VALID(pRow);

		CBCGPGridItem* pItem = pRow->GetItem(0);
		ASSERT_VALID(pItem);

		m_CustomizationData.ShowTab((CBCGPRibbonCategory*)pRow->GetData(), (bool)pItem->GetValue());
	}
#endif
	return 0;
}