summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint/Guide.h
blob: 6de1e5b59c10194d9c252121afd6e0e32fdc3536 (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
/*
 * Copyright (c) 2021, Tobias Christiansen <tobyase@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>

namespace PixelPaint {

class Guide : public RefCounted<Guide> {
public:
    enum class Orientation {
        Unset,
        Vertical,
        Horizontal,
    };

    Guide(Orientation orientation, float offset)
        : m_orientation(orientation)
        , m_offset(offset)
    {
    }

    static NonnullRefPtr<Guide> construct(Orientation orientation, float offset)
    {
        return make_ref_counted<Guide>(orientation, offset);
    };

    Orientation orientation() const { return m_orientation; }
    float offset() const { return m_offset; }

    void set_offset(float offset) { m_offset = offset; }
    void set_orientation(Orientation orientation) { m_orientation = orientation; }

private:
    Orientation m_orientation;
    float m_offset { 0.0 };
};

};