Mercurial > vba-linux
diff 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 |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/Throttle.cpp Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,62 @@ 1.4 +// Throttle.cpp : implementation file 1.5 +// 1.6 + 1.7 +#include "stdafx.h" 1.8 +#include "resource.h" 1.9 +#include "Throttle.h" 1.10 +#include "../common/System.h" // for system messages 1.11 + 1.12 +///////////////////////////////////////////////////////////////////////////// 1.13 +// Throttle dialog 1.14 + 1.15 +Throttle::Throttle(CWnd*pParent /*=NULL*/) 1.16 + : CDialog(Throttle::IDD, pParent) 1.17 +{ 1.18 + //{{AFX_DATA_INIT(Throttle) 1.19 + m_throttle = 100; 1.20 + //}}AFX_DATA_INIT 1.21 +} 1.22 + 1.23 +void Throttle::DoDataExchange(CDataExchange*pDX) 1.24 +{ 1.25 + CDialog::DoDataExchange(pDX); 1.26 + //{{AFX_DATA_MAP(Throttle) 1.27 + DDX_Text(pDX, IDC_THROTTLE, m_throttle); 1.28 + //}}AFX_DATA_MAP 1.29 +} 1.30 + 1.31 +BEGIN_MESSAGE_MAP(Throttle, CDialog) 1.32 +//{{AFX_MSG_MAP(Throttle) 1.33 +ON_BN_CLICKED(ID_CANCEL, OnCancel) 1.34 +ON_BN_CLICKED(ID_OK, OnOk) 1.35 +//}}AFX_MSG_MAP 1.36 +END_MESSAGE_MAP() 1.37 + 1.38 +///////////////////////////////////////////////////////////////////////////// 1.39 +// Throttle message handlers 1.40 + 1.41 +BOOL Throttle::OnInitDialog() 1.42 +{ 1.43 + CDialog::OnInitDialog(); 1.44 + 1.45 + CenterWindow(); 1.46 + 1.47 + return TRUE; // return TRUE unless you set the focus to a control 1.48 + // EXCEPTION: OCX Property Pages should return FALSE 1.49 +} 1.50 + 1.51 +void Throttle::OnCancel() 1.52 +{ 1.53 + EndDialog(false); 1.54 +} 1.55 + 1.56 +void Throttle::OnOk() 1.57 +{ 1.58 + UpdateData(); 1.59 + 1.60 + if (m_throttle < 1 || m_throttle > 1000) 1.61 + systemMessage(IDS_INVALID_THROTTLE_VALUE, "Invalid throttle value. Please enter a number between 1 and 1000"); 1.62 + else 1.63 + EndDialog(m_throttle); 1.64 +} 1.65 +