Counter Strike : Global Offensive Source Code
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.

133 lines
3.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef TEXTUREWINDOW_H
  7. #define TEXTUREWINDOW_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "IEditorTexture.h"
  12. #include "UtlVector.h"
  13. struct TextureWindowTex_t
  14. {
  15. IEditorTexture *pTex;
  16. int nUsageCount;
  17. };
  18. class TextureWindowTexList : public CUtlVector<TextureWindowTex_t>
  19. {
  20. public:
  21. inline int Find(IEditorTexture *pTex)
  22. {
  23. for (int i = 0; i < Count(); i++)
  24. {
  25. if (Element(i).pTex == pTex)
  26. {
  27. return i;
  28. }
  29. }
  30. return -1;
  31. }
  32. };
  33. class CTextureWindow : public CWnd
  34. {
  35. public:
  36. CTextureWindow();
  37. virtual ~CTextureWindow();
  38. void Create(CWnd *pParentWnd, RECT& rect);
  39. struct TWENUMPOS
  40. {
  41. IEditorTexture *pTex;
  42. RECT texrect;
  43. int cur_x, cur_y;
  44. RECT clientrect;
  45. int largest_y;
  46. int iTexIndex;
  47. int nUsageCount; // The number of times this texture is used in the map. Only set in "Used Textures Only" mode.
  48. };
  49. enum
  50. {
  51. TYPEFILTER_OPAQUE = 0x1,
  52. TYPEFILTER_TRANSLUCENT = 0x2,
  53. TYPEFILTER_SELFILLUM = 0x4,
  54. TYPEFILTER_ENVMASK = 0x8,
  55. TYPEFILTER_ALL = (TYPEFILTER_OPAQUE|TYPEFILTER_TRANSLUCENT|TYPEFILTER_SELFILLUM|TYPEFILTER_ENVMASK),
  56. };
  57. void EnableUpdate(bool bEnable);
  58. void UpdateScrollSizes();
  59. BOOL EnumTexturePositions(TWENUMPOS *pTE, BOOL bStart = FALSE);
  60. void SetDisplaySize(int iSize);
  61. void HighlightCurTexture(CDC *pDC = NULL);
  62. void SetNameFilter(LPCTSTR pszFilter);
  63. void SetKeywords(const char *pszKeywords);
  64. void SetTextureFormat(TEXTUREFORMAT eTextureFormat);
  65. void SelectTexture(LPCTSTR pszTexture, BOOL bAllowRedraw = TRUE);
  66. void SetSpecificList(TextureWindowTexList *pList);
  67. void SetTypeFilter( int filter, bool enable );
  68. void ShowErrors( bool enable ) { m_bShowErrors = true; }
  69. // ClassWizard generated virtual function overrides
  70. //{{AFX_VIRTUAL(CTextureWindow)
  71. //}}AFX_VIRTUAL
  72. char szCurTexture[128];
  73. protected:
  74. bool MatchKeywords(const char *pszSearch, char **pszKeyword, int nKeywords);
  75. int total_x;
  76. int total_y;
  77. int iDisplaySize;
  78. int iTexNameCharWidth;
  79. BOOL bFirstPaint;
  80. CFont TexFont;
  81. TextureWindowTexList *m_pSpecificList;
  82. CRect rectHighlight;
  83. int m_nTypeFilter;
  84. char m_szFilter[128]; // Name filter, space, comma, or semicolon delimited.
  85. int m_nFilters; // The number of names that were parsed out of the name filter.
  86. char *m_Filters[64]; // The individual name filters.
  87. char m_szKeywords[128]; // Keyword filter, space, comma, or semicolon delimited.
  88. int m_nKeywords; // The number of keywords that were parsed out of the name filter.
  89. char *m_Keyword[64]; // The individual keywords.
  90. bool m_bEnableUpdate; // Locks GUI updates to control repaints.
  91. bool m_bShowErrors;
  92. TEXTUREFORMAT m_eTextureFormat;
  93. //{{AFX_MSG(CTextureWindow)
  94. afx_msg void OnPaint();
  95. afx_msg void OnSize(UINT nType, int cx, int cy);
  96. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  97. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  98. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  99. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  100. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  101. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  102. afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint point);
  103. //}}AFX_MSG
  104. DECLARE_MESSAGE_MAP()
  105. };
  106. #endif // TEXTUREWINDOW_H