Serenity Operating System
1/*
2 * Copyright (c) 2020, the SerenityOS developers.
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include "Forward.h"
10#include <AK/DeprecatedString.h>
11#include <LibGUI/AbstractScrollableWidget.h>
12#include <LibGfx/Color.h>
13
14namespace Spreadsheet {
15
16struct Format {
17 Optional<Color> foreground_color;
18 Optional<Color> background_color;
19};
20
21struct ConditionalFormat : public Format {
22 DeprecatedString condition;
23};
24
25enum class FormatType {
26 Background = 0,
27 Foreground = 1
28};
29
30class ConditionView : public GUI::Widget {
31 C_OBJECT(ConditionView)
32public:
33 virtual ~ConditionView() override;
34
35private:
36 ConditionView(ConditionalFormat&);
37
38 ConditionalFormat& m_format;
39};
40
41class ConditionsView : public GUI::Widget {
42 C_OBJECT(ConditionsView)
43public:
44 virtual ~ConditionsView() override;
45
46 void set_formats(Vector<ConditionalFormat>*);
47
48 void add_format();
49 void remove_top();
50
51private:
52 ConditionsView();
53
54 Vector<ConditionalFormat>* m_formats { nullptr };
55 Vector<NonnullRefPtr<GUI::Widget>> m_widgets;
56};
57
58}