Advertisement
Zgragselus

FileDialog.h

Dec 20th, 2023
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // FileDialog.h
  4. //
  5. // Defines class for file dialog and its operations. Allows to show open/close file dialog and
  6. // return whether any file was selected, and if it was - then which file.
  7. //
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9.  
  10. #ifndef __FILE_DIALOG__H__
  11. #define __FILE_DIALOG__H__
  12.  
  13. ///////////////////////////////////////////////////////////////////////////////////////////////////
  14. // Header section
  15.  
  16. #include <Windows.h>
  17. #include "Engine.h"
  18. #include "Core/Log/Log.h"
  19.  
  20. ///////////////////////////////////////////////////////////////////////////////////////////////////
  21. // Class & Structures definition
  22.  
  23. namespace Engine
  24. {
  25.     class ENGINE_API FileDialog
  26.     {
  27.     public:
  28.         /// <summary>Specifies type of file dialog</summary>
  29.         enum class Type
  30.         {
  31.             /// <summary>Open file dialog</summary>
  32.             OPEN_FILE_DIALOG,
  33.  
  34.             /// <summary>Save file dialog</summary>
  35.             SAVE_FILE_DIALOG
  36.         };
  37.  
  38.         /// <summary>Open and show file dialog</summary>
  39.         /// <param name="log">Log for storing errors</param>
  40.         /// <param name="title">Title for dialog</param>
  41.         /// <param name="filter">Filter for specific file formats (Windows format - e.g. Image\0*.bmp\0All Files\0*.*\0</param>
  42.         /// <param name="type">Dialog type (Open, Save, ...)</param>
  43.         /// <param name="filename">Resulting filename</param>
  44.         /// <return>True if file selected, false otherwise</return>
  45.         static bool Show(Log* log, const std::string& title, const char* filter, Type type, std::string& filename);
  46.     };
  47. }
  48.  
  49. ///////////////////////////////////////////////////////////////////////////////////////////////////
  50. // EOH
  51.  
  52. #endif
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement