Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. // ListBoxEx.h : header file
  9. //
  10. #ifndef _LISTBOXEX_H
  11. #define _LISTBOXEX_H
  12. #include <afxtempl.h>
  13. enum
  14. {
  15. lbdBool,
  16. lbdString,
  17. lbdInteger
  18. };
  19. enum
  20. {
  21. lbeYesNo,
  22. lbeOnOff,
  23. lbeString,
  24. lbeInteger,
  25. lbeTexture,
  26. lbeChoices
  27. };
  28. typedef struct
  29. {
  30. char szCaption[128]; // field named
  31. char *pszSaveCaption; // save caption to this, if supported
  32. int iDataType; // how to display (lbdxxx)
  33. int iEditType; // how to edit (lbexxx)
  34. int iDataValue; // int value for integer/bool fields
  35. char szDataString[128]; // str value for string fields
  36. PVOID pSaveTo;
  37. const char * pszHelp; // help text (ptr or NULL)
  38. int iRangeMin; // ranged value min (-1 if no range)
  39. int iRangeMax; // ranged value max (-1 if no range)
  40. CStringArray* pChoices; // choices, if lbdChoices
  41. } LBEXTITEMSTRUCT;
  42. // listboxex styles
  43. enum
  44. {
  45. LBES_EDITCAPTIONS = 0x01
  46. };
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CListBoxEx window
  49. class CListBoxEx : public CListBox
  50. {
  51. // Construction
  52. public:
  53. CListBoxEx();
  54. // Attributes
  55. public:
  56. int iCaptionWidthUnits;
  57. int iCaptionWidthPixels;
  58. int iItemHeight;
  59. CEdit EditCtrl;
  60. CComboBox ComboCtrl;
  61. DWORD dwStyle;
  62. BOOL bControlActive;
  63. BOOL bIgnoreChange;
  64. int iControlItem;
  65. void SetStyle(DWORD dwStyle);
  66. void AddItem(char * pszCaption, int iEditType, PVOID pData,
  67. int iRangeMin = -1, int iRangeMax = -1, const char * pszHelp = NULL);
  68. void SetItemChoices(int iItem, CStringArray * pChoices,
  69. int iDefaultChoice = 0);
  70. void GetItemText(int iItem, char *pszText);
  71. void CreateEditControl();
  72. void CreateComboControl();
  73. void DestroyControls();
  74. CArray<LBEXTITEMSTRUCT, LBEXTITEMSTRUCT&> Items;
  75. unsigned nItems;
  76. // Operations
  77. public:
  78. BOOL bActivateOnRelease;
  79. // Overrides
  80. // ClassWizard generated virtual function overrides
  81. //{{AFX_VIRTUAL(CListBoxEx)
  82. public:
  83. virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct);
  84. virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
  85. virtual int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct);
  86. //}}AFX_VIRTUAL
  87. // Implementation
  88. public:
  89. virtual ~CListBoxEx();
  90. // Generated message map functions
  91. protected:
  92. //{{AFX_MSG(CListBoxEx)
  93. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  94. afx_msg void OnSelchange();
  95. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  96. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  97. //}}AFX_MSG
  98. DECLARE_MESSAGE_MAP()
  99. };
  100. /////////////////////////////////////////////////////////////////////////////
  101. #endif // _LISTBOXEX_H