aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/tests/libsample/pen.h
blob: 6f528f0f9a030ab08db6d6503e2c2f8a67e67146 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef PEN_H
#define PEN_H

#include "libsamplemacros.h"
#include "samplenamespace.h"

class LIBSAMPLE_API Color
{
public:
    Color() = default;
    Color(SampleNamespace::InValue arg);
    Color(unsigned int arg);

    bool isNull() const;

private:
    bool m_null = true;
};

class LIBSAMPLE_API Brush
{
public:
    enum Style { Solid, Cross };

    explicit Brush(const Color &c = {});

    operator bool() const;

    Style style() const;
    void setStyle(Style newStyle);

    const Color &color() const;
    void setColor(const Color &newColor);

private:
    Style m_style = Solid;
    Color m_color;
};

class LIBSAMPLE_API Pen
{
public:
    enum { EmptyCtor, EnumCtor, ColorCtor, CopyCtor };

    enum  RenderHints { None = 0, Antialiasing = 0x1, TextAntialiasing = 0x2 };

    Pen();
    Pen(SampleNamespace::Option option);
    Pen(const Color &color);
    Pen(const Pen &pen);
    Pen(Pen &&) noexcept;
    Pen &operator=(const Pen &pen);
    Pen &operator=(Pen &&) noexcept;
    ~Pen() = default;

    // PYSIDE-1325, default initializer
    void drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints = {});

    int ctorType();

    RenderHints getRenderHints() const;
    void setRenderHints(RenderHints h);

private:
    int m_ctor = EmptyCtor;
    RenderHints m_renderHints = None;
};

#endif