diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/vgui_controls/PerforceFileList.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/vgui_controls/PerforceFileList.h')
| -rw-r--r-- | public/vgui_controls/PerforceFileList.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/public/vgui_controls/PerforceFileList.h b/public/vgui_controls/PerforceFileList.h new file mode 100644 index 0000000..148b005 --- /dev/null +++ b/public/vgui_controls/PerforceFileList.h @@ -0,0 +1,114 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Contains a list of files, determines their perforce status +// +// $NoKeywords: $ +//===========================================================================// + +#ifndef PERFORCEFILELIST_H +#define PERFORCEFILELIST_H + +#ifdef _WIN32 +#pragma once +#endif + +#include "tier1/utlstring.h" +#include "tier1/UtlStringMap.h" +#include "vgui_controls/ListPanel.h" + + +//----------------------------------------------------------------------------- +// Forward declarations +//----------------------------------------------------------------------------- +struct P4File_t; + +namespace vgui +{ + class ListPanel; +} + + +namespace vgui +{ + +//----------------------------------------------------------------------------- +// Contains a list of files, determines their perforce status +//----------------------------------------------------------------------------- +class PerforceFileList : public vgui::ListPanel +{ + DECLARE_CLASS_SIMPLE( PerforceFileList, ListPanel ); + +public: + // The context keyvalues are added to all messages sent by this dialog if they are specified + PerforceFileList( Panel *parent, const char *pPanelName ); + ~PerforceFileList(); + + // Add a file to the file list. Note that this file may exist on disk or not + // and it may exist in perforce or not. It's specified as a full path on disk though. + // In the case where a file doesn't exist on disk, but it does exist in perforce + // specify where that file would appear on disk. + // This function returns the itemID of the added file + // If you already know the file exists or is a directory (or not), specify that in the call. + // -1 means autodetect whether the file exists or is a directory + int AddFile( const char *pFullPath, int nFileExists = -1, int nIsDirectory = -1 ); + + // Is a file already in the list? + bool IsFileInList( const char *pFullPath ); + + // Find the item ID associated with a particular file + int FindFile( const char *pFullPath ); + + // Remove all files from the list + void RemoveAllFiles(); + + // Refresh perforce information + void Refresh(); + + // Refresh perforce information manually + void RefreshPerforceState( int nItemID, bool bFileExists, P4File_t *pFileInfo ); + + // Is a particular list item a directory? + bool IsDirectoryItem( int nItemID ); + + // Returns the file associated with a particular item ID + const char *GetFile( int nItemID ); + + // Toggle showing deleted files or not + void ShowDeletedFiles( bool bShowDeletedFiles ); + + // Inherited from vgui::EditablePanel + virtual void ApplySchemeSettings( IScheme *pScheme ); + virtual void OnMouseDoublePressed( MouseCode code ); + + /* + messages sent: + "ItemDoubleClicked" // Called when an item is double-clicked + */ + +protected: + struct DirectoryInfo_t + { + CUtlString m_ClientSpec; + CUtlVector< int > m_ItemIDs; + }; + + // Add a file to the file list. + int AddFileToFileList( const char *pFullPath, bool bExistsOnDisk ); + + // Add a directory to the file list. + int AddDirectoryToFileList( const char *pFullPath, bool bExistsOnDisk ); + + // Add a directory to the directory list, returns client spec + void AddItemToDirectoryList( const char *pFullPath, int nItemID, bool bIsDirectory ); + + // Used to look up directories -> client specs + CUtlStringMap< DirectoryInfo_t > m_Directories; + + // Show deleted files? + bool m_bShowDeletedFiles; +}; + + +} // namespace vgui + +#endif // PERFORCEFILELIST_H |