CustomComboWnd.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright (c) 2002-2012 Croteam Ltd.
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of version 2 of the GNU General Public License as published by
  4. the Free Software Foundation
  5. This program is distributed in the hope that it will be useful,
  6. but WITHOUT ANY WARRANTY; without even the implied warranty of
  7. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  8. GNU General Public License for more details.
  9. You should have received a copy of the GNU General Public License along
  10. with this program; if not, write to the Free Software Foundation, Inc.,
  11. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
  12. #if !defined(AFX_CUSTOMCOMBOWND_H__6C892711_24F7_4340_8D42_6AA0869A266B__INCLUDED_)
  13. #define AFX_CUSTOMCOMBOWND_H__6C892711_24F7_4340_8D42_6AA0869A266B__INCLUDED_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif // _MSC_VER > 1000
  17. // CustomComboWnd.h : header file
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. // CCustomComboWnd window
  21. class CComboLine
  22. {
  23. public:
  24. CTFileName cl_fnmTexture;
  25. PIXaabbox2D cl_boxIcon;
  26. CTString cl_strText;
  27. ULONG cl_ulValue;
  28. COLOR cl_colText;
  29. };
  30. class CCustomComboWnd : public CWnd
  31. {
  32. // Construction
  33. public:
  34. CCustomComboWnd();
  35. // Attributes
  36. public:
  37. CDynamicContainer<CComboLine> m_dcComboLines;
  38. CDrawPort *m_pDrawPort;
  39. CViewPort *m_pViewPort;
  40. int m_iTimerID;
  41. void (*m_pOnSelect)(INDEX iSelected);
  42. FLOAT *m_pfResult;
  43. // Operations
  44. public:
  45. // calculate given line box in pixels
  46. PIXaabbox2D GetLineBBox( INDEX iLine);
  47. void RenderOneLine( INDEX iLine, PIXaabbox2D rectLine, CDrawPort *pdp, COLOR colFill);
  48. void GetComboLineSize(PIX &pixMaxWidth, PIX &pixMaxHeight);
  49. BOOL Initialize(FLOAT *pfResult, void (*pOnSelect)(INDEX iSelected),
  50. PIX pixX, PIX pixY, BOOL bDown=FALSE);
  51. INDEX InsertItem( CTString strText, CTFileName fnIcons=CTString(""),
  52. MEXaabbox2D boxIcon=MEXaabbox2D( MEX2D(0,0), MEX2D(0,0)));
  53. void SetItemValue(INDEX iItem, ULONG ulValue);
  54. void SetItemColor(INDEX iItem, COLOR col);
  55. // Overrides
  56. // ClassWizard generated virtual function overrides
  57. //{{AFX_VIRTUAL(CCustomComboWnd)
  58. public:
  59. virtual BOOL PreTranslateMessage(MSG* pMsg);
  60. //}}AFX_VIRTUAL
  61. // Implementation
  62. public:
  63. virtual ~CCustomComboWnd();
  64. // Generated message map functions
  65. protected:
  66. //{{AFX_MSG(CCustomComboWnd)
  67. afx_msg void OnPaint();
  68. afx_msg void OnKillFocus(CWnd* pNewWnd);
  69. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  70. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  71. afx_msg void OnDestroy();
  72. afx_msg void OnTimer(UINT nIDEvent);
  73. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  74. //}}AFX_MSG
  75. DECLARE_MESSAGE_MAP()
  76. };
  77. /////////////////////////////////////////////////////////////////////////////
  78. //{{AFX_INSERT_LOCATION}}
  79. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  80. #endif // !defined(AFX_CUSTOMCOMBOWND_H__6C892711_24F7_4340_8D42_6AA0869A266B__INCLUDED_)