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.

146 lines
3.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #if !defined(AFX_FILESYSTEMOPENDLG_H__01CFDE04_321F_4F1E_94ED_933B2B32C193__INCLUDED_)
  9. #define AFX_FILESYSTEMOPENDLG_H__01CFDE04_321F_4F1E_94ED_933B2B32C193__INCLUDED_
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif // _MSC_VER > 1000
  13. // FileSystemOpenDlg.h : header file
  14. //
  15. #include "utlvector.h"
  16. #include "resource.h"
  17. #include "filesystem.h"
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CFileSystemOpenDlg dialog
  20. class CWindowAnchor
  21. {
  22. public:
  23. CWnd *m_pWnd;
  24. int m_Side; //0=left, 1=top, 2=right, 3=bottom
  25. int m_ParentSide; //which side to anchor to parent
  26. int m_OriginalDist; //original distance from the parent side
  27. };
  28. class CFileInfo
  29. {
  30. public:
  31. CFileInfo();
  32. ~CFileInfo();
  33. bool m_bIsDir;
  34. CString m_Name;
  35. CBitmap *m_pBitmap;
  36. };
  37. class CFileSystemOpenDlg : public CDialog
  38. {
  39. friend class CFileSystemOpenDialogWrapper;
  40. // Construction
  41. public:
  42. CFileSystemOpenDlg(CreateInterfaceFn factory, CWnd* pParent = NULL); // standard constructor
  43. // Dialog Data
  44. //{{AFX_DATA(CFileSystemOpenDlg)
  45. enum { IDD = IDD_FILESYSTEM_OPENDIALOG };
  46. CEdit m_FilenameLabel;
  47. CEdit m_FilenameControl;
  48. CEdit m_LookInLabel;
  49. CListCtrl m_FileList;
  50. //}}AFX_DATA
  51. void AddFileMask( const char *pMask );
  52. void SetInitialDir( const char *pDir, const char *pPathID = NULL );
  53. void SetFilterMdlAndJpgFiles( bool bFilter );
  54. CString GetFilename() const; // Get the filename they chose.
  55. // Overrides
  56. // ClassWizard generated virtual function overrides
  57. //{{AFX_VIRTUAL(CFileSystemOpenDlg)
  58. public:
  59. virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
  60. protected:
  61. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  62. //}}AFX_VIRTUAL
  63. private:
  64. enum GetEntriesMode_t
  65. {
  66. GETENTRIES_FILES_ONLY,
  67. GETENTRIES_DIRECTORIES_ONLY
  68. };
  69. void GetEntries( const char *pMask, CUtlVector<CString> &entries, GetEntriesMode_t mode );
  70. void PopulateListControl();
  71. int SetupLabelImage( CFileInfo *pInfo, CString name, bool bIsDir );
  72. void AddAnchor( int iDlgItem, int iSide, int anchorSide );
  73. void ProcessAnchor( CWindowAnchor *pAnchor );
  74. // Implementation
  75. protected:
  76. const char* GetPathID();
  77. friend int CALLBACK FileListSortCallback( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
  78. friend class CFilenameShortcut;
  79. CUtlVector<CWindowAnchor> m_Anchors;
  80. enum
  81. {
  82. PREVIEW_IMAGE_SIZE=96
  83. };
  84. IFileSystem *m_pFileSystem;
  85. // These are indexed by the lParam or userdata of each item in m_FileList.
  86. CUtlVector<CFileInfo> m_FileInfos;
  87. int m_iLabel_Folder;
  88. int m_iLabel_Mdl;
  89. int m_iLabel_File;
  90. CBitmap m_BitmapMdl;
  91. CBitmap m_BitmapFile;
  92. CBitmap m_BitmapFolder;
  93. CImageList m_ImageList;
  94. CString m_CurrentDir;
  95. CString m_Filename;
  96. CString m_PathIDString;
  97. CUtlVector<CString> m_FileMasks;
  98. // If this is true, then we get rid of .mdl files if there is a corresponding .jpg file.
  99. bool m_bFilterMdlAndJpgFiles;
  100. // Generated message map functions
  101. //{{AFX_MSG(CFileSystemOpenDlg)
  102. virtual void OnOK();
  103. virtual BOOL OnInitDialog();
  104. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  105. afx_msg void OnSize(UINT nType, int cx, int cy);
  106. afx_msg void OnDblclkFileList(NMHDR* pNMHDR, LRESULT* pResult);
  107. afx_msg void OnUpButton();
  108. afx_msg void OnItemchangedFileList(NMHDR* pNMHDR, LRESULT* pResult);
  109. //}}AFX_MSG
  110. DECLARE_MESSAGE_MAP()
  111. };
  112. //{{AFX_INSERT_LOCATION}}
  113. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  114. #endif // !defined(AFX_FILESYSTEMOPENDLG_H__01CFDE04_321F_4F1E_94ED_933B2B32C193__INCLUDED_)