comparison src/win32/Throttle.cpp @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
comparison
equal deleted inserted replaced
0:8ced16adf2e1 1:f9f4f1b99eed
1 // Throttle.cpp : implementation file
2 //
3
4 #include "stdafx.h"
5 #include "resource.h"
6 #include "Throttle.h"
7 #include "../common/System.h" // for system messages
8
9 /////////////////////////////////////////////////////////////////////////////
10 // Throttle dialog
11
12 Throttle::Throttle(CWnd*pParent /*=NULL*/)
13 : CDialog(Throttle::IDD, pParent)
14 {
15 //{{AFX_DATA_INIT(Throttle)
16 m_throttle = 100;
17 //}}AFX_DATA_INIT
18 }
19
20 void Throttle::DoDataExchange(CDataExchange*pDX)
21 {
22 CDialog::DoDataExchange(pDX);
23 //{{AFX_DATA_MAP(Throttle)
24 DDX_Text(pDX, IDC_THROTTLE, m_throttle);
25 //}}AFX_DATA_MAP
26 }
27
28 BEGIN_MESSAGE_MAP(Throttle, CDialog)
29 //{{AFX_MSG_MAP(Throttle)
30 ON_BN_CLICKED(ID_CANCEL, OnCancel)
31 ON_BN_CLICKED(ID_OK, OnOk)
32 //}}AFX_MSG_MAP
33 END_MESSAGE_MAP()
34
35 /////////////////////////////////////////////////////////////////////////////
36 // Throttle message handlers
37
38 BOOL Throttle::OnInitDialog()
39 {
40 CDialog::OnInitDialog();
41
42 CenterWindow();
43
44 return TRUE; // return TRUE unless you set the focus to a control
45 // EXCEPTION: OCX Property Pages should return FALSE
46 }
47
48 void Throttle::OnCancel()
49 {
50 EndDialog(false);
51 }
52
53 void Throttle::OnOk()
54 {
55 UpdateData();
56
57 if (m_throttle < 1 || m_throttle > 1000)
58 systemMessage(IDS_INVALID_THROTTLE_VALUE, "Invalid throttle value. Please enter a number between 1 and 1000");
59 else
60 EndDialog(m_throttle);
61 }
62