StageView.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
  17. If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
  18. ===========================================================================
  19. */
  20. #pragma once
  21. #include <afxcview.h>
  22. #include <afxole.h>
  23. #include "MaterialEditor.h"
  24. #include "ToggleListView.h"
  25. #include "MaterialView.h"
  26. #include "MaterialPropTreeView.h"
  27. /**
  28. * View that handles managing the material stages.
  29. */
  30. class StageView : public ToggleListView, public MaterialView
  31. {
  32. public:
  33. virtual ~StageView();
  34. /**
  35. * Defines the type of stages
  36. */
  37. enum {
  38. STAGE_TYPE_MATERIAL,
  39. STAGE_TYPE_STAGE,
  40. STAGE_TYPE_SPECIAL_MAP_STAGE
  41. };
  42. //Associates a property view with this stage view
  43. void SetMaterialPropertyView(MaterialPropTreeView* propView) { m_propView = propView; };
  44. //MaterialView Interface
  45. virtual void MV_OnMaterialSelectionChange(MaterialDoc* pMaterial);
  46. virtual void MV_OnMaterialStageAdd(MaterialDoc* pMaterial, int stageNum);
  47. virtual void MV_OnMaterialStageDelete(MaterialDoc* pMaterial, int stageNum);
  48. virtual void MV_OnMaterialStageMove(MaterialDoc* pMaterial, int from, int to);
  49. virtual void MV_OnMaterialAttributeChanged(MaterialDoc* pMaterial, int stage, const char* attribName);
  50. virtual void MV_OnMaterialSaved(MaterialDoc* pMaterial);
  51. //Edit Operation Tests
  52. bool CanCopy();
  53. bool CanPaste();
  54. bool CanCut();
  55. bool CanDelete();
  56. bool CanRename();
  57. //Refresh the stage list
  58. void RefreshStageList();
  59. protected:
  60. StageView();
  61. DECLARE_DYNCREATE(StageView)
  62. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  63. afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult);
  64. afx_msg void OnLvnDeleteallitems(NMHDR *pNMHDR, LRESULT *pResult);
  65. afx_msg void OnLvnBegindrag(NMHDR *pNMHDR, LRESULT *pResult);
  66. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  67. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  68. afx_msg void OnNMRclick(NMHDR *pNMHDR, LRESULT *pResult);
  69. afx_msg void OnRenameStage();
  70. afx_msg void OnDeleteStage();
  71. afx_msg void OnDeleteAllStages();
  72. afx_msg void OnAddStage();
  73. afx_msg void OnAddBumpmapStage();
  74. afx_msg void OnAddDiffuseStage();
  75. afx_msg void OnAddSpecualarStage();
  76. afx_msg void OnCopy();
  77. afx_msg void OnPaste();
  78. afx_msg void OnLvnBeginlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
  79. afx_msg void OnLvnEndlabeledit(NMHDR *pNMHDR, LRESULT *pResult);
  80. afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
  81. DECLARE_MESSAGE_MAP()
  82. //Overrides
  83. virtual BOOL PreTranslateMessage(MSG* pMsg);
  84. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  85. //Toggle List View Interface
  86. virtual void OnStateChanged(int index, int toggleState);
  87. void PopupMenu(CPoint* pt);
  88. void DropItemOnList();
  89. protected:
  90. MaterialPropTreeView* m_propView;
  91. MaterialDoc* currentMaterial;
  92. //Manual handing of the row dragging
  93. CImageList* dragImage;
  94. bool bDragging;
  95. int dragIndex;
  96. int dropIndex;
  97. CWnd* dropWnd;
  98. CPoint dropPoint;
  99. bool internalChange;
  100. };