Browser.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. // Browser.h : header file
  13. //
  14. #ifndef BROWSER_H
  15. #define BROWSER_H 1
  16. #define VIRTUAL_TREE_VERSION "V008"
  17. #define DIRECTORY_SHORTCT_CT 10
  18. // Constants defining borders, tree and scroll bar sizes
  19. #define H_BORDER 8
  20. #define V_BORDER 8
  21. #define CLOSED_TREE 40
  22. #define OPEN_TREE 200
  23. class CBrowser : public CDialogBar
  24. {
  25. // Construction
  26. public:
  27. CBrowser();
  28. BOOL Create( CWnd* pParentWnd, UINT nIDTemplate, UINT nStyle,
  29. UINT nID, BOOL = TRUE);
  30. // Attributes
  31. public:
  32. CTString m_astrVTreeBuffer[DIRECTORY_SHORTCT_CT][32];
  33. INDEX m_aiSubDirectoriesCt[DIRECTORY_SHORTCT_CT];
  34. CSize m_Size;
  35. SLONG m_TreeHeight;
  36. PIXaabbox2D m_boxBrowseWnd;
  37. PIXaabbox2D m_boxTreeWnd;
  38. CBrowseWindow m_BrowseWindow;
  39. CImageList m_IconsImageList;
  40. CVirtualTreeCtrl m_TreeCtrl;
  41. CVirtualTreeNode m_VirtualTree; // Internal virtual tree structure list head
  42. BOOL m_bVirtualTreeChanged;
  43. // Operations
  44. void AddDirectoryRecursiv(CVirtualTreeNode *pOneDirectory, HTREEITEM hParent);
  45. void LoadVirtualTree_t( CTFileName fnVirtulTree, CVirtualTreeNode *pvtnRoot);
  46. // separate subdirectory names along current path
  47. INDEX GetSelectedDirectory( CTString strArray[]);
  48. // selects sub directory using given path
  49. void SelectVirtualDirectory( CTString strArray[], INDEX iSubDirsCt);
  50. HTREEITEM GetVirtualDirectoryItem( CTString strArray[], INDEX iSubDirsCt);
  51. // functions for finding items inside virtal tree
  52. void SelectItemDirectory( CTFileName fnItemFileName);
  53. CVirtualTreeNode *FindItemDirectory( CVirtualTreeNode *pvtnInDirectory, CTFileName fnItem);
  54. void SaveVirtualTree(CTFileName fnSave, CVirtualTreeNode *pvtn);
  55. void DeleteDirectory(void);
  56. CVirtualTreeNode *GetSelectedDirectory(void);
  57. void OpenSelectedDirectory(void);
  58. void CloseSelectedDirectory(void);
  59. void OnLoadVirtualTreeInternal(CTFileName fnVirtulTree, CVirtualTreeNode *pvtnRoot);
  60. CTFileName GetIOFileName(CTString strTitle, BOOL bSave);
  61. // Overrides
  62. // ClassWizard generated virtual function overrides
  63. //{{AFX_VIRTUAL(CBrowser)
  64. //}}AFX_VIRTUAL
  65. // Implementation
  66. public:
  67. virtual CSize CalcDynamicLayout( int nLength, DWORD dwMode );
  68. void OnUpdateVirtualTreeControl(void);
  69. // Generated message map functions
  70. //protected:
  71. //{{AFX_MSG(CBrowser)
  72. afx_msg void OnCreateDirectory();
  73. afx_msg void OnDeleteDirectory();
  74. afx_msg void OnSaveVirtualTree();
  75. afx_msg void OnLoadVirtualTree();
  76. afx_msg void OnRenameDirectory();
  77. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  78. afx_msg void OnSaveAsVirtualTree();
  79. afx_msg void OnImportVirtualTree();
  80. afx_msg void OnExportVirtualTree();
  81. afx_msg void OnUpdateImportVirtualTree(CCmdUI* pCmdUI);
  82. afx_msg void OnUpdateExportVirtualTree(CCmdUI* pCmdUI);
  83. afx_msg void OnDumpVt();
  84. //}}AFX_MSG
  85. DECLARE_MESSAGE_MAP()
  86. };
  87. /////////////////////////////////////////////////////////////////////
  88. #endif // BROWSER_H