summaryrefslogtreecommitdiff
path: root/src/port/ui/ContentBrowser.h
blob: d4097a732a05f10872b1f9b0794a304b6729468a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <libultraship/libultraship.h>
#include "engine/tracks/Track.h"
#include "engine/AllActors.h"

namespace TrackEditor {
class ContentBrowserWindow : public Ship::GuiWindow {
public:
    using Ship::GuiWindow::GuiWindow;
    ~ContentBrowserWindow();

    std::vector<std::string> Content;

    bool Refresh = true;

    bool ActorContent = false;
    bool CustomContent = false;
    bool TrackContent = false;
protected:
    void InitElement() override {};
    void DrawElement() override;
    void UpdateElement() override {};
    void AddTrackContent(std::string search);
    void AddActorContent(std::string search);
    void AddCustomContent(std::string search);
    void FindContent();
    void FolderButton(const char* label, bool& contentFlag, const ImVec2& size = ImVec2(80, 32));
    ATrain* TrainWindow();

private:
    char mSearchBuffer[128] = "";  // Search bar for all tabs
    static std::string ToLower(const std::string& str) {
        std::string result = str;
        std::transform(result.begin(), result.end(), result.begin(),
                    [](unsigned char c){ return std::tolower(c); });
        return result;
    }
};
}