Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / mfc / standard / 06_Ocaf / src / NewBoxDlg.cpp
1 // NewBoxDlg.cpp : implementation file
2 //
3
4 #ifdef _DEBUG
5 #define new DEBUG_NEW
6 #undef THIS_FILE
7 static char THIS_FILE[] = __FILE__;
8 #endif
9
10 #include "stdafx.h"
11
12 #include "NewBoxDlg.h"
13
14 //#include "OcafApp.h"
15
16 /////////////////////////////////////////////////////////////////////////////
17 // CNewBoxDlg dialog
18
19 CNewBoxDlg::CNewBoxDlg(CWnd* pParent /*=NULL*/)
20         : CDialog(CNewBoxDlg::IDD, pParent)
21 {
22         //{{AFX_DATA_INIT(CNewBoxDlg)
23         m_h = 10.0;
24         m_l = 15.0;
25         m_Name = _T("Box");
26         m_w = 10.0;
27         m_x = 0.0;
28         m_y = 0.0;
29         m_z = 0.0;
30         //}}AFX_DATA_INIT
31 }
32
33 void CNewBoxDlg::DoDataExchange(CDataExchange* pDX)
34 {
35         CDialog::DoDataExchange(pDX);
36         //{{AFX_DATA_MAP(CNewBoxDlg)
37         DDX_Text(pDX, IDC_H, m_h);
38         DDX_Text(pDX, IDC_L, m_l);
39         DDX_Text(pDX, IDC_NAME, m_Name);
40         DDX_Text(pDX, IDC_W, m_w);
41         DDX_Text(pDX, IDC_X, m_x);
42         DDX_Text(pDX, IDC_Y, m_y);
43         DDX_Text(pDX, IDC_Z, m_z);
44         //}}AFX_DATA_MAP
45 }
46
47
48 BEGIN_MESSAGE_MAP(CNewBoxDlg, CDialog)
49         //{{AFX_MSG_MAP(CNewBoxDlg)
50         //}}AFX_MSG_MAP
51 END_MESSAGE_MAP()
52
53 /////////////////////////////////////////////////////////////////////////////
54 // CNewBoxDlg message handlers
55
56 void CNewBoxDlg::OnOK() 
57 {
58         UpdateData(TRUE);
59         if( (m_h<=Precision::Confusion()) || (m_l<=Precision::Confusion()) || (m_w<=Precision::Confusion()) )
60         {
61                 MessageBox("Length, height and width of a box should be srictly positives.", "New box",MB_ICONEXCLAMATION);
62                 return;
63         }
64         
65         CDialog::OnOK();
66 }
67
68 void CNewBoxDlg::InitFields(Standard_Real x, Standard_Real y, Standard_Real z, Standard_Real w, Standard_Real l, Standard_Real h, const TCollection_ExtendedString &Name)
69 {
70         m_x=x;
71         m_y=y;
72         m_z=z;
73         m_w=w;
74         m_l=l;
75         m_h=h;
76         TCollection_AsciiString AsciiName(Name);
77         m_Name=AsciiName.ToCString();
78 }