summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet/ConditionalFormatting.h
blob: d6e324d91dc603b7961fad8dadc81f065d313f79 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (c) 2020, the SerenityOS developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include "Forward.h"
#include <AK/DeprecatedString.h>
#include <LibGUI/AbstractScrollableWidget.h>
#include <LibGfx/Color.h>

namespace Spreadsheet {

struct Format {
    Optional<Color> foreground_color;
    Optional<Color> background_color;
};

struct ConditionalFormat : public Format {
    DeprecatedString condition;
};

enum class FormatType {
    Background = 0,
    Foreground = 1
};

class ConditionView : public GUI::Widget {
    C_OBJECT(ConditionView)
public:
    virtual ~ConditionView() override;

private:
    ConditionView(ConditionalFormat&);

    ConditionalFormat& m_format;
};

class ConditionsView : public GUI::Widget {
    C_OBJECT(ConditionsView)
public:
    virtual ~ConditionsView() override;

    void set_formats(Vector<ConditionalFormat>*);

    void add_format();
    void remove_top();

private:
    ConditionsView();

    Vector<ConditionalFormat>* m_formats { nullptr };
    Vector<NonnullRefPtr<GUI::Widget>> m_widgets;
};

}