OutBarEdit.cpp
上传用户:zslianheng
上传日期:2013-04-03
资源大小:946k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Visual C++

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   This program is free software; you can redistribute it and/or modify  *
  4.  *   it under the terms of the GNU General Public License as published by  *
  5.  *   the Free Software Foundation; either version 2 of the License, or     *
  6.  *   (at your option) any later version.                                   *
  7.  *                                                                         *
  8.  *   copyright            : (C) 2002 by Zhang Yong                         *
  9.  *   email                : z-yong163@163.com                              *
  10.  ***************************************************************************/
  11. // OutBarEdit.cpp : implementation file
  12. //
  13. #include "stdafx.h"
  14. #include "myicq.h"
  15. #include "OutBarEdit.h"
  16. #include "OutBarCtrl.h"
  17. #ifdef _DEBUG
  18. #define new DEBUG_NEW
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21. #endif
  22. /////////////////////////////////////////////////////////////////////////////
  23. // OutBarEdit
  24. OutBarEdit::OutBarEdit(OutBarCtrl *l, int obj, int index)
  25. : listener(l)
  26. {
  27. this->obj = obj;
  28. this->index = index;
  29. }
  30. OutBarEdit::~OutBarEdit()
  31. {
  32. }
  33. BEGIN_MESSAGE_MAP(OutBarEdit, CEdit)
  34. //{{AFX_MSG_MAP(OutBarEdit)
  35. ON_WM_KILLFOCUS()
  36. //}}AFX_MSG_MAP
  37. END_MESSAGE_MAP()
  38. /////////////////////////////////////////////////////////////////////////////
  39. // OutBarEdit message handlers
  40. void OutBarEdit::OnKillFocus(CWnd* pNewWnd) 
  41. {
  42. CEdit::OnKillFocus(pNewWnd);
  43. listener->onEditCanceled();
  44. }
  45. BOOL OutBarEdit::PreTranslateMessage(MSG* pMsg) 
  46. {
  47. if (pMsg->message == WM_KEYDOWN) {
  48. if (pMsg->wParam == VK_RETURN) {
  49. listener->onEditFinished();
  50. return TRUE;
  51. }
  52. if (pMsg->wParam == VK_ESCAPE) {
  53. listener->onEditCanceled();
  54. return TRUE;
  55. }
  56. }
  57. return CEdit::PreTranslateMessage(pMsg);
  58. }