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.

78 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #include "cbase.h"
  8. #include "resource.h"
  9. #include "InputProperties.h"
  10. #include "workspacemanager.h"
  11. static CInputParams g_Params;
  12. //-----------------------------------------------------------------------------
  13. // Purpose:
  14. // Input : hwndDlg -
  15. // uMsg -
  16. // wParam -
  17. // lParam -
  18. // Output : static BOOL CALLBACK
  19. //-----------------------------------------------------------------------------
  20. static BOOL CALLBACK InputPropertiesDialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
  21. {
  22. switch(uMsg)
  23. {
  24. case WM_INITDIALOG:
  25. // Insert code here to put the string (to find and replace with)
  26. // into the edit controls.
  27. // ...
  28. {
  29. g_Params.PositionSelf( hwndDlg );
  30. SetDlgItemText( hwndDlg, IDC_INPUTSTRING, g_Params.m_szInputText );
  31. SetDlgItemText( hwndDlg, IDC_STATIC_PROMPT, g_Params.m_szPrompt );
  32. SetWindowText( hwndDlg, g_Params.m_szDialogTitle );
  33. SetFocus( GetDlgItem( hwndDlg, IDC_INPUTSTRING ) );
  34. SendMessage( GetDlgItem( hwndDlg, IDC_INPUTSTRING ), EM_SETSEL, 0, MAKELONG(0, 0xffff) );
  35. }
  36. return FALSE;
  37. case WM_COMMAND:
  38. switch (LOWORD(wParam))
  39. {
  40. case IDOK:
  41. g_Params.m_szInputText[ 0 ] = 0;
  42. GetDlgItemText( hwndDlg, IDC_INPUTSTRING, g_Params.m_szInputText, sizeof( g_Params.m_szInputText ) );
  43. EndDialog( hwndDlg, 1 );
  44. break;
  45. case IDCANCEL:
  46. EndDialog( hwndDlg, 0 );
  47. break;
  48. }
  49. return TRUE;
  50. }
  51. return FALSE;
  52. }
  53. //-----------------------------------------------------------------------------
  54. // Purpose:
  55. // Input : *view -
  56. // *actor -
  57. // Output : int
  58. //-----------------------------------------------------------------------------
  59. int InputProperties( CInputParams *params )
  60. {
  61. g_Params = *params;
  62. int retval = DialogBox( (HINSTANCE)GetModuleHandle( 0 ),
  63. MAKEINTRESOURCE( IDD_INPUTDIALOG ),
  64. (HWND)GetWorkspaceManager()->getHandle(),
  65. (DLGPROC)InputPropertiesDialogProc );
  66. *params = g_Params;
  67. return retval;
  68. }