XComboList.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // XComboList.h
  2. //
  3. // Author: Hans Dietrich
  4. // hdietrich2@hotmail.com
  5. //
  6. // This software is released into the public domain.
  7. // You are free to use it in any way you like.
  8. //
  9. // This software is provided "as is" with no expressed
  10. // or implied warranty. I accept no liability for any
  11. // damage or loss of business that this software may cause.
  12. //
  13. ///////////////////////////////////////////////////////////////////////////////
  14. #ifndef XCOMBOLIST_H
  15. #define XCOMBOLIST_H
  16. extern UINT NEAR WM_XCOMBOLIST_VK_RETURN;
  17. extern UINT NEAR WM_XCOMBOLIST_VK_ESCAPE;
  18. extern UINT NEAR WM_XCOMBOLIST_KEYDOWN;
  19. extern UINT NEAR WM_XCOMBOLIST_LBUTTONUP;
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CXComboList window
  22. class CXComboList : public CWnd
  23. {
  24. // Construction
  25. public:
  26. CXComboList(CWnd *pParent);
  27. virtual ~CXComboList();
  28. // Attributes
  29. public:
  30. // Operations
  31. public:
  32. void SetActive(int nScrollBarWidth);
  33. int AddString(LPCTSTR lpszItem)
  34. {
  35. return m_ListBox.AddString(lpszItem);
  36. }
  37. int GetCount()
  38. {
  39. return m_ListBox.GetCount();
  40. }
  41. void GetText(int nIndex, CString& rString)
  42. {
  43. m_ListBox.GetText(nIndex, rString);
  44. }
  45. int FindStringExact(int nIndexStart, LPCTSTR lpszFind)
  46. {
  47. return m_ListBox.FindStringExact(nIndexStart, lpszFind);
  48. }
  49. int SetCurSel(int nSelect)
  50. {
  51. return m_ListBox.SetCurSel(nSelect);
  52. }
  53. int GetCurSel()
  54. {
  55. return m_ListBox.GetCurSel();
  56. }
  57. void SetFont(CFont* pFont, BOOL bRedraw = TRUE)
  58. {
  59. m_ListBox.SetFont(pFont, bRedraw);
  60. }
  61. // Overrides
  62. // ClassWizard generated virtual function overrides
  63. //{{AFX_VIRTUAL(CXComboList)
  64. public:
  65. virtual BOOL PreTranslateMessage(MSG* pMsg);
  66. virtual CScrollBar* GetScrollBarCtrl(int nBar);
  67. //}}AFX_VIRTUAL
  68. // Implementation
  69. protected:
  70. CListBox m_ListBox;
  71. CScrollBar m_wndSBVert;
  72. CWnd * m_pParent;
  73. int m_nCount;
  74. BOOL m_bFirstTime;
  75. void SendRegisteredMessage(UINT nMsg, WPARAM wParam, LPARAM lParam);
  76. // Generated message map functions
  77. protected:
  78. //{{AFX_MSG(CXComboList)
  79. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  80. afx_msg void OnKillFocus(CWnd* pNewWnd);
  81. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  82. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  83. afx_msg void OnDestroy();
  84. afx_msg void OnTimer(UINT nIDEvent);
  85. //}}AFX_MSG
  86. DECLARE_MESSAGE_MAP()
  87. };
  88. /////////////////////////////////////////////////////////////////////////////
  89. //{{AFX_INSERT_LOCATION}}
  90. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  91. #endif //XCOMBOLIST_H