summaryrefslogtreecommitdiff
path: root/Widgets/Size.h
blob: 6fd8a21f6f254f8fe6d58327937a5f8cabfeaeac (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
#pragma once

class Size {
public:
    Size() { }
    Size(int w, int h) : m_width(w), m_height(h) { }

    bool is_empty() const { return !m_width || !m_height; }

    int width() const { return m_width; }
    int height() const { return m_height; }

    void setWidth(int w) { m_width = w; }
    void setHeight(int h) { m_height = h; }

    bool operator==(const Size& other) const
    {
        return m_width == other.m_width &&
               m_height == other.m_height;
    }

private:
    int m_width { 0 };
    int m_height { 0 };
};