PickUnitDialog.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program 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. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #if !defined(AFX_PICKUNITDIALOG_H__B4C16E7D_FEED_472B_95FC_496D4C9006F5__INCLUDED_)
  19. #define AFX_PICKUNITDIALOG_H__B4C16E7D_FEED_472B_95FC_496D4C9006F5__INCLUDED_
  20. #if _MSC_VER > 1000
  21. #pragma once
  22. #endif // _MSC_VER > 1000
  23. // PickUnitDialog.h : header file
  24. //
  25. #include "Common/AsciiString.h"
  26. #include "Common/ThingSort.h"
  27. #define BUILD_PICK_PANEL_SECTION "PickUnitWindow"
  28. class MapObject;
  29. class ThingTemplate;
  30. /////////////////////////////////////////////////////////////////////////////
  31. // PickUnitDialog dialog
  32. class PickUnitDialog : public CDialog
  33. {
  34. protected:
  35. enum { NAME_MAX_LEN = 64 };
  36. void addObject( MapObject *mapObject, const char *pPath, Int index, HTREEITEM parent );
  37. HTREEITEM findOrAdd(HTREEITEM parent, const char *pLabel);
  38. Int m_currentObjectIndex;
  39. char m_currentObjectName[NAME_MAX_LEN];
  40. CTreeCtrl m_objectTreeView;
  41. MapObject *m_objectsList;
  42. Bool m_allowable[ES_NUM_SORTING_TYPES];
  43. Bool m_factionOnly;
  44. // Construction
  45. public:
  46. PickUnitDialog(CWnd* pParent = NULL); // standard constructor
  47. PickUnitDialog(UINT id, CWnd* pParent = NULL); // standard constructor
  48. ~PickUnitDialog(void); ///< standard destructor
  49. // Dialog Data
  50. //{{AFX_DATA(PickUnitDialog)
  51. enum { IDD = IDD_PICKUNIT };
  52. // NOTE: the ClassWizard will add data members here
  53. //}}AFX_DATA
  54. // Overrides
  55. // ClassWizard generated virtual function overrides
  56. //{{AFX_VIRTUAL(PickUnitDialog)
  57. protected:
  58. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  59. virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  60. //}}AFX_VIRTUAL
  61. // Implementation
  62. protected:
  63. // Generated message map functions
  64. //{{AFX_MSG(PickUnitDialog)
  65. virtual BOOL OnInitDialog();
  66. afx_msg void OnMove(int x, int y);
  67. //}}AFX_MSG
  68. DECLARE_MESSAGE_MAP()
  69. public:
  70. AsciiString getPickedUnit(void);
  71. Bool IsAllowableType(EditorSortingType sort, Bool isBuildable);
  72. void SetAllowableType(EditorSortingType sort);
  73. const ThingTemplate* getPickedThing(void);
  74. void SetFactionOnly(Bool faction) {m_factionOnly = faction;}
  75. void SetupAsPanel(void);
  76. };
  77. class ReplaceUnitDialog : public PickUnitDialog
  78. {
  79. public:
  80. ReplaceUnitDialog(CWnd* pParent = NULL); // standard constructor
  81. void setMissing(AsciiString name) {m_missingName = name;};
  82. protected:
  83. // Generated message map functions
  84. //{{AFX_MSG(ReplaceUnitDialog)
  85. virtual BOOL OnInitDialog();
  86. //}}AFX_MSG
  87. DECLARE_MESSAGE_MAP()
  88. private:
  89. AsciiString m_missingName;
  90. enum { IDD = IDD_REPLACEUNIT };
  91. };
  92. //{{AFX_INSERT_LOCATION}}
  93. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  94. #endif // !defined(AFX_PICKUNITDIALOG_H__B4C16E7D_FEED_472B_95FC_496D4C9006F5__INCLUDED_)