172 lines
4.5 KiB
C++
172 lines
4.5 KiB
C++
// DangFloorDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "DangFloorDlg.h"
|
|
#include "SanitaryDangDlg.h"
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDangFloorDlg dialog
|
|
|
|
|
|
TGridDang::TGridDang(int mode)
|
|
{
|
|
m_iMode = mode;
|
|
AppendCol(_T("楼层"), 40);
|
|
if(mode == 0){
|
|
AppendCol(_T("当量"), 60);
|
|
AppendCol(_T("自闭冲洗阀"));
|
|
}
|
|
else{
|
|
AppendCol(_T("当量"), 40);
|
|
AppendCol(_T("最大流量"),55);
|
|
AppendCol(_T("额定流量"));
|
|
}
|
|
SetColPosFix();
|
|
SetColFixLength();
|
|
SetNoPaste();
|
|
FitLastCol();
|
|
GetCol(1).SetRightButton();
|
|
if(mode == 0)
|
|
GetCol(2).SetComboSel();
|
|
else{
|
|
GetCol(2).SetRightButton();
|
|
GetCol(3).SetRightButton();
|
|
}
|
|
}
|
|
|
|
void TGridDang::OnCellComboString(WDGridCell&cell,CComboBox&combo)
|
|
{
|
|
if(cell.GetColIndex()==2 && m_iMode == 0){
|
|
combo.AddString(_T("有"));
|
|
combo.AddString(_T("无"));
|
|
}
|
|
}
|
|
|
|
bool TGridDang::OnCellButtonDown(WDGridCell &cell, CString &res)
|
|
{
|
|
if(cell.GetColIndex() == 1 || cell.GetColIndex() == 2 || cell.GetColIndex() == 3)
|
|
{
|
|
|
|
CTemporaryResourceOverride vTemp;
|
|
CSanitaryDangDlg dlg;
|
|
|
|
dlg.m_iMode = m_iMode;
|
|
dlg.m_bMultSel = TRUE;
|
|
if(dlg.DoModal() != IDOK)
|
|
return false;
|
|
WDGridRow &row = cell.GetRow();
|
|
row[1].SetText(XString(_T("%.2f"), dlg.m_nRet));
|
|
if(m_iMode == 1){
|
|
row[2].SetText(XString(_T("%.2f"), dlg.m_nBigQ));
|
|
row[3].SetText(XString(_T("%.2f"), dlg.m_nAllQ));
|
|
}
|
|
Refresh();
|
|
res=(const TCHAR*)cell;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
CDangFloorDlg::CDangFloorDlg(int mode, CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDangFloorDlg::IDD, pParent), m_grid(mode)
|
|
{
|
|
//{{AFX_DATA_INIT(CDangFloorDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_iFloorNum = 0;
|
|
m_iMode = mode;
|
|
}
|
|
|
|
|
|
void CDangFloorDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDangFloorDlg)
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDangFloorDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CDangFloorDlg)
|
|
ON_BN_CLICKED(IDC_BUTTON_YES, OnButtonYes)
|
|
ON_BN_CLICKED(IDC_BUTTON_NO, OnButtonNo)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDangFloorDlg message handlers
|
|
|
|
BOOL CDangFloorDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
m_grid.Clear();
|
|
m_grid.Create(this, IDC_LIST_DANG);
|
|
m_grid.FitLastCol();
|
|
m_grid.SetNoAppendButton(TRUE);
|
|
m_grid.SetNoDefaultMenu(true);
|
|
for(int i=0;i<m_iFloorNum;i++){
|
|
m_grid.AppendRow();
|
|
CString csText;
|
|
csText.Format(_T("%d楼"), i+1);
|
|
m_grid.GetCell(i, 0).SetText(csText);
|
|
m_grid.GetCell(i, 1).SetText(m_lstDang[i]);
|
|
if(m_iMode == 0)
|
|
m_grid.GetCell(i, 2).SetText(_T("无"));
|
|
else{
|
|
m_grid.GetCell(i, 2).SetText(_T("1.5"));
|
|
m_grid.GetCell(i, 3).SetText(_T("1.5"));
|
|
}
|
|
}
|
|
if(m_iMode == 1){
|
|
CWnd *pWnd1 = GetDlgItem(IDC_BUTTON_YES);
|
|
CWnd *pWnd2 = GetDlgItem(IDC_BUTTON_NO);
|
|
pWnd1->ShowWindow(SW_HIDE);
|
|
pWnd2->ShowWindow(SW_HIDE);
|
|
}
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CDangFloorDlg::OnButtonYes()
|
|
{
|
|
for(m_grid.MoveToFirst(); !m_grid.IsOut(); m_grid.MoveToNext()){
|
|
WDGridRow *pRow = m_grid.CurRow();
|
|
(*pRow)[2].SetText(_T("有"));
|
|
}
|
|
m_grid.Refresh();
|
|
}
|
|
|
|
void CDangFloorDlg::OnButtonNo()
|
|
{
|
|
for(m_grid.MoveToFirst(); !m_grid.IsOut(); m_grid.MoveToNext()){
|
|
WDGridRow *pRow = m_grid.CurRow();
|
|
(*pRow)[2].SetText(_T("无"));
|
|
}
|
|
m_grid.Refresh();
|
|
}
|
|
|
|
void CDangFloorDlg::OnOK()
|
|
{
|
|
m_lstDang.Reset();
|
|
for(m_grid.MoveToFirst(); !m_grid.IsOut(); m_grid.MoveToNext()){
|
|
WDGridRow *pRow = m_grid.CurRow();
|
|
CString csName1 = (*pRow)[1].GetText().cs();
|
|
CString csName2 = (*pRow)[2].GetText().cs();
|
|
m_lstDang.Append(tstrnew(csName1));
|
|
m_lstAutoClose.Append(tstrnew(csName2));
|
|
if(m_iMode == 1){
|
|
CString csName3 = (*pRow)[3].GetText().cs();
|
|
m_lstAllQ.Append(tstrnew(csName3));
|
|
}
|
|
}
|
|
CDialog::OnOK();
|
|
}
|