DropWnd.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /////////////////////////////////////////////////////////////////////////////
  2. // DropWnd.h : header file
  3. //
  4. // CAdvComboBox Control
  5. // Version: 2.1
  6. // Date: September 2002
  7. // Author: Mathias Tunared
  8. // Email: Mathias@inorbit.com
  9. // Copyright (c) 2002. All Rights Reserved.
  10. //
  11. // This code, in compiled form or as source code, may be redistributed
  12. // unmodified PROVIDING it is not sold for profit without the authors
  13. // written consent, and providing that this notice and the authors name
  14. // and all copyright notices remains intact.
  15. //
  16. // This file is provided "as is" with no expressed or implied warranty.
  17. // The author accepts no liability for any damage/loss of business that
  18. // this product may cause.
  19. //
  20. /////////////////////////////////////////////////////////////////////////////
  21. #ifndef DROPWND_H
  22. #define DROPWND_H
  23. #pragma warning(push, 3)
  24. #include <list>
  25. #include <string>
  26. #pragma warning(pop)
  27. #include <tchar.h>
  28. typedef std::basic_string<TCHAR> tstring;
  29. using namespace std;
  30. typedef struct _LIST_ITEM
  31. {
  32. tstring strText;
  33. BOOL bDisabled;
  34. BOOL bChecked;
  35. void* vpItemData;
  36. _LIST_ITEM()
  37. {
  38. strText = _T("");
  39. bDisabled = FALSE;
  40. bChecked = FALSE;
  41. vpItemData = NULL;
  42. }
  43. BOOL operator <(_LIST_ITEM other)
  44. {
  45. if( strText < other.strText )
  46. return TRUE;
  47. else
  48. return FALSE;
  49. }
  50. } LIST_ITEM, *PLIST_ITEM;
  51. #include "DropListBox.h"
  52. #include "DropScrollBar.h"
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CDropWnd window
  55. class CDropWnd : public CWnd
  56. {
  57. // Construction
  58. public:
  59. CDropWnd( CWnd* pComboParent, list<LIST_ITEM> &itemlist, DWORD dwACBStyle );
  60. // Attributes
  61. public:
  62. CDropListBox* GetListBoxPtr() { return m_listbox; }
  63. CDropScrollBar* GetScrollBarPtr() { return m_scrollbar; }
  64. // Operations
  65. public:
  66. list<LIST_ITEM>& GetList() { return m_list; }
  67. // Overrides
  68. // ClassWizard generated virtual function overrides
  69. //{{AFX_VIRTUAL(CDropWnd)
  70. public:
  71. //virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd,
  72. // UINT nID, CCreateContext* pContext = NULL);
  73. virtual BOOL DestroyWindow();
  74. protected:
  75. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  76. //}}AFX_VIRTUAL
  77. // Implementation
  78. public:
  79. virtual ~CDropWnd();
  80. // Generated message map functions
  81. protected:
  82. //{{AFX_MSG(CDropWnd)
  83. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  84. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  85. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  86. afx_msg void OnSize(UINT nType, int cx, int cy);
  87. afx_msg void OnPaint();
  88. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  89. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  90. //}}AFX_MSG
  91. afx_msg LONG OnSetCapture( WPARAM wParam, LPARAM lParam );
  92. afx_msg LONG OnReleaseCapture( WPARAM wParam, LPARAM lParam );
  93. //+++
  94. #if (_MSC_VER > 1200)
  95. afx_msg void OnActivateApp(BOOL bActive, DWORD dwThreadID);
  96. #else
  97. afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
  98. #endif
  99. DECLARE_MESSAGE_MAP()
  100. private:
  101. int m_nMaxX; //+++
  102. int m_nMaxY; //+++
  103. CDropListBox* m_listbox;
  104. CRect m_rcList;
  105. CDropScrollBar* m_scrollbar;
  106. CRect m_rcScroll;
  107. CRect m_rcSizeHandle;
  108. CWnd* m_pComboParent;
  109. CFont* m_pListFont;
  110. list<LIST_ITEM> m_list;
  111. list<LIST_ITEM>::iterator m_iter;
  112. bool m_bResizing;
  113. CPoint m_ptLastResize;
  114. int m_nMouseDiffX;
  115. int m_nMouseDiffY;
  116. DWORD m_dwACBStyle;
  117. };
  118. /////////////////////////////////////////////////////////////////////////////
  119. //{{AFX_INSERT_LOCATION}}
  120. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  121. #endif //DROPWND_H