Worldstone
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
FileBrowser.h
1 #pragma once
2 
3 #include <MpqArchive.h>
4 #include "SearchableListWidget.h"
5 
7 {
8 
9 public:
10  class IFileView
11  {
12  public:
13  IFileView(const WorldStone::MpqArchive::Path& _filePath) : filePath(std::move(_filePath)) {}
14  virtual ~IFileView();
15  virtual void display() { ImGui::Text("File:%s", filePath.c_str()); }
16  virtual void display(class SpriteRenderer&) { display(); }
17 
18  protected:
19  WorldStone::MpqArchive::Path filePath;
20  };
21 
22  ~FileBrowser();
23  void display(class SpriteRenderer&);
24  void displayMenuBar();
25 
26 private:
27  std::unique_ptr<IFileView> currentView;
28 
31  SearchableListWidget fileListWidget;
33 
36  WorldStone::IOBase::Path mpqDirectory;
37  WorldStone::MpqArchive currentArchive;
38 
39  static char const* const mpqFiles[];
40  static char const* const listFiles[];
42  void onFileSelected(const char* fileName);
43 };
An imgui ListBox associated to a search filter.
A wrapper to manage MPQ archives.
Definition: MpqArchive.h:17