~aleteoryx/muditaos

ref: dbde0666df9a46deae6d7f0a52a85fa0c3ffa286 muditaos/module-apps/windows/OptionWindow.hpp -rw-r--r-- 1.2 KiB
dbde0666 — Piotr Tanski [EGD-3289] Changed fonts of message snippet and its prefix. (#1058) 5 years ago
                                                                                
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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "../Application.hpp"
#include "AppWindow.hpp"
#include "PageLayout.hpp"
#include <functional>
#include "OptionsWindowOption.hpp"

namespace gui
{
    class OptionWindow : public AppWindow
    {

      protected:
        PageLayout *body = nullptr;
        std::list<Option> options;
        void addOptions(std::list<Option> &options);
        void addOptions(std::list<Option> &&options);

      public:
        OptionWindow(app::Application *app, const std::string &name);
        OptionWindow(app::Application *app, const std::string &name, std::list<Option> options);
        ~OptionWindow() override;

        void addOptionLabel(const UTF8 &text, std::function<bool(Item &)> activatedCallback, Arrow arrow);
        void setOptions(std::list<Option> options)
        {
            this->options = std::move(options);
        }
        void clearOptions();

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void rebuild() override;
        void buildInterface() override;
        void destroyInterface() override;
    };
}; // namespace gui