Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // StrDlg.cpp : implementation file
  9. //
  10. #include "stdafx.h"
  11. #include "hammer.h"
  12. #include "StrDlg.h"
  13. // memdbgon must be the last include file in a .cpp file!!!
  14. #include <tier0/memdbgon.h>
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CStrDlg dialog
  17. CStrDlg::CStrDlg(DWORD dwFlags, LPCTSTR pszString, LPCTSTR pszPrompt,
  18. LPCTSTR pszTitle)
  19. : CDialog(CStrDlg::IDD, NULL)
  20. {
  21. //{{AFX_DATA_INIT(CStrDlg)
  22. m_string = _T("");
  23. //}}AFX_DATA_INIT
  24. iRangeLow = 0;
  25. iRangeHigh = 10;
  26. iIncrement = 1;
  27. this->dwFlags = dwFlags;
  28. m_string = pszString;
  29. m_strPrompt = pszPrompt;
  30. m_strTitle = pszTitle;
  31. }
  32. void CStrDlg::DoDataExchange(CDataExchange* pDX)
  33. {
  34. CDialog::DoDataExchange(pDX);
  35. DDX_Text(pDX, IDC_PROMPT, m_strPrompt);
  36. DDX_Text(pDX, IDC_EDIT, m_string);
  37. DDX_Control(pDX, IDC_EDIT, m_cEdit);
  38. DDX_Control(pDX, IDC_SPIN, m_cSpin);
  39. //{{AFX_DATA_MAP(CStrDlg)
  40. //}}AFX_DATA_MAP
  41. }
  42. BEGIN_MESSAGE_MAP(CStrDlg, CDialog)
  43. //{{AFX_MSG_MAP(CStrDlg)
  44. //}}AFX_MSG_MAP
  45. END_MESSAGE_MAP()
  46. /////////////////////////////////////////////////////////////////////////////
  47. // CStrDlg message handlers
  48. void CStrDlg::SetRange(int iLow, int iHigh, int iIncrement_)
  49. {
  50. iRangeLow = iLow;
  51. iRangeHigh = iHigh;
  52. this->iIncrement = 1;
  53. }
  54. BOOL CStrDlg::OnInitDialog()
  55. {
  56. CDialog::OnInitDialog();
  57. if(dwFlags & Spin) // enable spin
  58. {
  59. m_cSpin.EnableWindow(TRUE);
  60. m_cSpin.SetRange(iRangeLow, iRangeHigh);
  61. m_cSpin.SetBuddy(&m_cEdit);
  62. }
  63. else
  64. {
  65. m_cSpin.ShowWindow(SW_HIDE);
  66. }
  67. SetWindowText(m_strTitle);
  68. return TRUE;
  69. }