InPlaceList.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #if !defined(AFX_INPLACELIST_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)
  2. #define AFX_INPLACELIST_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif // _MSC_VER >= 1000
  6. // InPlaceList.h : header file
  7. //
  8. //
  9. // Written by Chris Maunder (chrismaunder@codeguru.com)
  10. // Copyright (c) 1998.
  11. //
  12. // The code contained in this file is based on the original
  13. // CInPlaceList from http://www.codeguru.com/listview
  14. //
  15. // This code may be used in compiled form in any way you desire. This
  16. // file may be redistributed unmodified by any means PROVIDING it is
  17. // not sold for profit without the authors written consent, and
  18. // providing that this notice and the authors name is included. If
  19. // the source code in this file is used in any commercial application
  20. // then acknowledgement must be made to the author of this file
  21. // (in whatever form you wish).
  22. //
  23. // This file is provided "as is" with no expressed or implied warranty.
  24. // The author accepts no liability for any damage/loss of business that
  25. // this product may cause.
  26. //
  27. // Expect bugs!
  28. //
  29. // Please use and enjoy. Please let me know of any bugs/mods/improvements
  30. // that you have found/implemented and I will fix/incorporate them into this
  31. // file.
  32. //
  33. /////////////////////////////////////////////////////////////////////////////
  34. #define IDC_COMBOEDIT 1001
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CComboEdit window
  37. class CComboEdit : public CEdit
  38. {
  39. // Construction
  40. public:
  41. CComboEdit();
  42. // Attributes
  43. public:
  44. // Operations
  45. public:
  46. // Overrides
  47. // ClassWizard generated virtual function overrides
  48. //{{AFX_VIRTUAL(CComboEdit)
  49. virtual BOOL PreTranslateMessage(MSG* pMsg);
  50. //}}AFX_VIRTUAL
  51. // Implementation
  52. public:
  53. virtual ~CComboEdit();
  54. // Generated message map functions
  55. protected:
  56. //{{AFX_MSG(CComboEdit)
  57. afx_msg void OnKillFocus(CWnd* pNewWnd);
  58. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  59. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  60. //}}AFX_MSG
  61. DECLARE_MESSAGE_MAP()
  62. };
  63. /////////////////////////////////////////////////////////////////////////////
  64. // CInPlaceList window
  65. class CInPlaceList : public CComboBox
  66. {
  67. friend class CComboEdit;
  68. // Construction
  69. public:
  70. CInPlaceList(CWnd* pParent, // parent
  71. CRect& rect, // dimensions & location
  72. DWORD dwStyle, // window/combobox style
  73. UINT nID, // control ID
  74. int nRow, int nColumn, // row and column
  75. CStringArray& Items, // Items in list
  76. CString sInitText, // initial selection
  77. UINT nFirstChar); // first character to pass to control
  78. // Attributes
  79. public:
  80. CComboEdit m_edit; // subclassed edit control
  81. // Operations
  82. public:
  83. // Overrides
  84. // ClassWizard generated virtual function overrides
  85. //{{AFX_VIRTUAL(CInPlaceList)
  86. protected:
  87. virtual void PostNcDestroy();
  88. //}}AFX_VIRTUAL
  89. // Implementation
  90. public:
  91. virtual ~CInPlaceList();
  92. protected:
  93. void EndEdit();
  94. // Generated message map functions
  95. protected:
  96. //{{AFX_MSG(CInPlaceList)
  97. afx_msg void OnKillFocus(CWnd* pNewWnd);
  98. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  99. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  100. //}}AFX_MSG
  101. DECLARE_MESSAGE_MAP()
  102. private:
  103. int m_nNumLines;
  104. CString m_sInitText;
  105. int m_nRow;
  106. int m_nCol;
  107. UINT m_nLastChar;
  108. BOOL m_bExitOnArrows;
  109. };
  110. /////////////////////////////////////////////////////////////////////////////
  111. //{{AFX_INSERT_LOCATION}}
  112. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  113. #endif // !defined(AFX_INPLACELIST_H__ECD42822_16DF_11D1_992F_895E185F9C72__INCLUDED_)