FriendPromptDlg.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // FriendPromptDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CP_Main.h"
  5. #include "FriendPromptDlg.h"
  6. #include "afxdialogex.h"
  7. #include "Shared\Tokenizer.h"
  8. // CFriendPromptDlg dialog
  9. IMPLEMENT_DYNAMIC(CFriendPromptDlg, CDialogEx)
  10. CFriendPromptDlg::CFriendPromptDlg(CWnd* pParent /*=NULL*/)
  11. : CDialogEx(IDD_DIALOG_FREIND_PROMPT, pParent)
  12. {
  13. m_save = false;
  14. m_clearList = false;
  15. }
  16. CFriendPromptDlg::~CFriendPromptDlg()
  17. {
  18. }
  19. void CFriendPromptDlg::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CDialogEx::DoDataExchange(pDX);
  22. DDX_Control(pDX, IDC_EDIT_NAME, m_textBox);
  23. DDX_Control(pDX, IDC_EDIT_DESC, m_description);
  24. }
  25. BEGIN_MESSAGE_MAP(CFriendPromptDlg, CDialogEx)
  26. ON_BN_CLICKED(IDOK, &CFriendPromptDlg::OnBnClickedOk)
  27. ON_WM_SIZE()
  28. ON_WM_CTLCOLOR()
  29. ON_BN_CLICKED(IDCANCEL, &CFriendPromptDlg::OnBnClickedCancel)
  30. ON_BN_CLICKED(IDC_BUTTON_CLEAR, &CFriendPromptDlg::OnBnClickedButtonClear)
  31. END_MESSAGE_MAP()
  32. void CFriendPromptDlg::OnBnClickedOk()
  33. {
  34. m_textBox.GetWindowTextW(m_name);
  35. m_description.GetWindowTextW(m_desc);
  36. if (::IsDlgButtonChecked(m_hWnd, IDC_CHECK_SAVE) == BST_CHECKED)
  37. {
  38. m_save = true;
  39. }
  40. CDialogEx::OnOK();
  41. }
  42. BOOL CFriendPromptDlg::OnInitDialog()
  43. {
  44. CDialogEx::OnInitDialog();
  45. ::SendMessage(this->m_hWnd, WM_SETICON, 0, NULL);
  46. m_brush.CreateSolidBrush(RGB(255, 255, 255)); // color white brush
  47. //remove the default icon in top left of window
  48. int extendedStyle = GetWindowLong(m_hWnd, GWL_EXSTYLE);
  49. SetWindowLong(m_hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME);
  50. SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
  51. ::CheckDlgButton(m_hWnd, IDC_CHECK_SAVE, BST_CHECKED);
  52. m_textBox.SetFocus();
  53. return FALSE;
  54. }
  55. void CFriendPromptDlg::OnSize(UINT nType, int cx, int cy)
  56. {
  57. CDialogEx::OnSize(nType, cx, cy);
  58. }
  59. HBRUSH CFriendPromptDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  60. {
  61. HBRUSH hbr = CDialogEx::OnCtlColor(pDC, pWnd, nCtlColor);
  62. // TODO: Change any attributes of the DC here
  63. // TODO: Return a different brush if the default is not desired
  64. return hbr;
  65. //return m_brush;
  66. }
  67. void CFriendPromptDlg::OnBnClickedCancel()
  68. {
  69. // TODO: Add your control notification handler code here
  70. CDialogEx::OnCancel();
  71. }
  72. void CFriendPromptDlg::OnBnClickedButtonClear()
  73. {
  74. m_clearList = true;
  75. CDialogEx::OnOK();
  76. }