stereotypeicon.h 3.54 KB
Newer Older
1
/****************************************************************************
Jochen Becher's avatar
Jochen Becher committed
2
**
3 4
** Copyright (C) 2016 Jochen Becher
** Contact: https://www.qt.io/licensing/
Jochen Becher's avatar
Jochen Becher committed
5 6 7 8 9 10 11
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
12 13 14
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
Jochen Becher's avatar
Jochen Becher committed
15
**
16 17 18 19 20 21 22
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
Jochen Becher's avatar
Jochen Becher committed
23 24 25
**
****************************************************************************/

hjk's avatar
hjk committed
26
#pragma once
Jochen Becher's avatar
Jochen Becher committed
27 28 29 30 31 32 33 34 35 36 37 38 39

#include "iconshape.h"

#include <QString>
#include <QSet>
#include <QColor>

namespace qmt {

class QMT_EXPORT StereotypeIcon
{
public:
    enum Element {
40 41 42 43 44 45
        ElementAny,
        ElementPackage,
        ElementComponent,
        ElementClass,
        ElementDiagram,
        ElementItem
Jochen Becher's avatar
Jochen Becher committed
46 47 48
    };

    enum Display {
49 50 51 52 53
        DisplayNone,
        DisplayLabel,
        DisplayDecoration,
        DisplayIcon,
        DisplaySmart
Jochen Becher's avatar
Jochen Becher committed
54 55 56
    };

    enum SizeLock {
57 58 59 60 61
        LockNone,
        LockWidth,
        LockHeight,
        LockSize,
        LockRatio
Jochen Becher's avatar
Jochen Becher committed
62 63 64
    };

    enum TextAlignment {
65 66 67
        TextalignBelow,
        TextalignCenter,
        TextalignNone
Jochen Becher's avatar
Jochen Becher committed
68 69
    };

70
    QString id() const { return m_id; }
Jochen Becher's avatar
Jochen Becher committed
71
    void setId(const QString &id);
72
    QString title() const;
Jochen Becher's avatar
Jochen Becher committed
73
    void setTitle(const QString &title);
74
    QSet<Element> elements() const { return m_elements; }
Jochen Becher's avatar
Jochen Becher committed
75
    void setElements(const QSet<Element> &elements);
76
    QSet<QString> stereotypes() const { return m_stereotypes; }
Jochen Becher's avatar
Jochen Becher committed
77
    void setStereotypes(const QSet<QString> &stereotypes);
78
    qreal width() const { return m_width; }
Jochen Becher's avatar
Jochen Becher committed
79
    void setWidth(qreal width);
80
    qreal height() const { return m_height; }
Jochen Becher's avatar
Jochen Becher committed
81
    void setHeight(qreal height);
82
    bool hasMinWidth() const { return m_minWidth > 0; }
83
    qreal minWidth() const { return m_minWidth; }
84
    void setMinWidth(qreal minWidth);
85
    bool hasMinHeight() const { return m_minHeight > 0; }
86
    qreal minHeight() const { return m_minHeight; }
87
    void setMinHeight(qreal minHeight);
88
    SizeLock sizeLock() const { return m_sizeLock; }
89
    void setSizeLock(SizeLock sizeLock);
90
    Display display() const { return m_display; }
Jochen Becher's avatar
Jochen Becher committed
91
    void setDisplay(Display display);
92
    TextAlignment textAlignment() const { return m_textAlignment; }
93
    void setTextAlignment(TextAlignment textAlignment);
94
    QColor baseColor() const { return m_baseColor; }
95
    void setBaseColor(const QColor &baseColor);
96
    IconShape iconShape() const { return m_iconShape; }
97
    void setIconShape(const IconShape &iconShape);
Jochen Becher's avatar
Jochen Becher committed
98 99

private:
100 101 102 103
    QString m_id;
    QString m_title;
    QSet<Element> m_elements;
    QSet<QString> m_stereotypes;
104 105 106 107 108 109 110
    qreal m_width = 100.0;
    qreal m_height = 100.0;
    qreal m_minWidth = -1;
    qreal m_minHeight = -1;
    SizeLock m_sizeLock = LockNone;
    Display m_display = DisplaySmart;
    TextAlignment m_textAlignment = TextalignBelow;
111 112
    QColor m_baseColor;
    IconShape m_iconShape;
Jochen Becher's avatar
Jochen Becher committed
113 114 115
};

} // namespace qmt