0029367: Visualization - simplify interface of V3d_View and V3d_Viewer
[occt.git] / samples / mfc / standard / 04_Viewer3d / src / BoxRadius.cpp
1 // BoxRadius.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "Viewer3dApp.h"
6 #include "BoxRadius.h"
7
8 /////////////////////////////////////////////////////////////////////////////
9
10 BoxRadius::BoxRadius(CWnd* pParent,
11                                          double rad)
12         : CDialog(BoxRadius::IDD, pParent)
13 {
14         //{{AFX_DATA_INIT(BoxRadius)
15         m_radius = rad;
16         //}}AFX_DATA_INIT
17 }
18
19
20 void BoxRadius::DoDataExchange(CDataExchange* pDX)
21 {
22         CDialog::DoDataExchange(pDX);
23         //{{AFX_DATA_MAP(BoxRadius)
24         DDX_Control(pDX, IDC_SPIN_RADIUS, m_spinradius);
25         DDX_Text(pDX, IDC_EDIT_RADIUS, m_radius);
26         //}}AFX_DATA_MAP
27 }
28
29
30 BEGIN_MESSAGE_MAP(BoxRadius, CDialog)
31         //{{AFX_MSG_MAP(BoxRadius)
32         ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN_RADIUS, OnDeltaposSpinRadius)
33         //}}AFX_MSG_MAP
34 END_MESSAGE_MAP()
35
36 /////////////////////////////////////////////////////////////////////////////
37 // BoxRadius message handlers
38
39 BOOL BoxRadius::OnInitDialog() 
40 {
41         CDialog::OnInitDialog();
42         
43         // TODO: Add extra initialization here
44         m_spinradius.SetRange(-10000,10000);
45         return TRUE;  // return TRUE unless you set the focus to a control
46                       // EXCEPTION: OCX Property Pages should return FALSE
47 }
48
49 void BoxRadius::OnDeltaposSpinRadius(NMHDR* pNMHDR, LRESULT* pResult) 
50 {
51         NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
52         // TODO: Add your control notification handler code here
53         if (pNMUpDown->iDelta == 1)
54                 pNMUpDown->iDelta = 1;
55         else 
56                 pNMUpDown->iDelta = -1;
57         m_radius = m_radius + pNMUpDown->iDelta;
58         UpdateData(FALSE);
59         *pResult = 0;
60 }
61