aboutsummaryrefslogtreecommitdiff
path: root/plugins/HotExamples.hpp
blob: 9bca74ad10d2adb1c2956035e13209d4e7b00185 (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
#pragma once

#include "Page.hpp"

namespace QuickMedia {
    void hot_examples_front_page_fill(BodyItems &body_items);

    class HotExamplesLanguageSelectPage : public Page {
    public:
        HotExamplesLanguageSelectPage(Program *program) : Page(program) {}
        const char* get_title() const override { return "Select language"; }
        PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
        bool submit_is_async() const override { return false; }
    };

    class HotExamplesSearchPage : public Page {
    public:
        HotExamplesSearchPage(Program *program, const std::string &language) : Page(program), language(language) {}
        const char* get_title() const override { return "Select result"; }
        bool search_is_filter() override { return false; }
        SearchResult search(const std::string &str, BodyItems &result_items) override;
        PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
    private:
        std::string language;
    };

    class HotExamplesCodeExamplesPage : public Page {
    public:
        HotExamplesCodeExamplesPage(Program *program, std::string title) : Page(program), title(std::move(title)) {}
        const char* get_title() const override { return title.c_str(); }
        PluginResult submit(const SubmitArgs &args, std::vector<Tab>&) override { (void)args; return PluginResult::OK; }
        bool submit_is_async() const override { return false; }
    private:
        std::string title;
    };
}