~openhommdev/openhomm/gui

« back to all changes in this revision

Viewing changes to src/gui/hrWidget.hpp

  • Committer: Roman Fomin
  • Date: 2010-02-19 13:39:11 UTC
  • Revision ID: rfomin@gmail.com-20100219133911-hx8u6wxar0m7dtvz
missing files added

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// openhomm - open source clone of Heroes of Might and Magic III
 
2
// Copyright (C) 2009-2010 openhomm developers team (see AUTHORS)
 
3
//
 
4
// This program is free software: you can redistribute it and/or modify
 
5
// it under the terms of the GNU General Public License as published by
 
6
// the Free Software Foundation, either version 3 of the License, or
 
7
// (at your option) any later version.
 
8
//
 
9
// This program is distributed in the hope that it will be useful,
 
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
// GNU General Public License for more details.
 
13
//
 
14
// You should have received a copy of the GNU General Public License
 
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
16
//
 
17
#pragma once
 
18
 
 
19
#include "hrGraphicsItem.hpp"
 
20
 
 
21
class hrWidget : public QObject
 
22
{
 
23
    Q_OBJECT
 
24
public:
 
25
    hrWidget(QObject * parent = 0);
 
26
 
 
27
    Q_PROPERTY(int x READ getX WRITE setX)
 
28
    void setX(int x);
 
29
    int getX() const;
 
30
 
 
31
    Q_PROPERTY(int y READ getY WRITE setY)
 
32
    void setY(int y);
 
33
    int getY() const;
 
34
 
 
35
    Q_PROPERTY(bool topLeft READ isTopLeft WRITE setTopLeft)
 
36
    void setTopLeft(bool flag = false);
 
37
    bool isTopLeft() const;
 
38
 
 
39
    Q_PROPERTY(bool topRight READ isTopRight WRITE setTopRight)
 
40
    void setTopRight(bool flag = false);
 
41
    bool isTopRight() const;
 
42
 
 
43
    Q_PROPERTY(bool bottomLeft READ isBottomLeft WRITE setBottomLeft)
 
44
    void setBottomLeft(bool flag = false);
 
45
    bool isBottomLeft() const;
 
46
 
 
47
    Q_PROPERTY(bool bottomRight READ isBottomRight WRITE setBottomRight)
 
48
    void setBottomRight(bool flag = false);
 
49
    bool isBottomRight() const;
 
50
 
 
51
    QRect getRect();
 
52
    void setSize(QSize s);
 
53
    QVectorIterator<hrGraphicsItem> getItems() const;
 
54
    void addItem(hrGraphicsItem item);
 
55
    hrGraphicsItem& modifyItem(int num);
 
56
    void clearItems();
 
57
 
 
58
private:
 
59
    enum
 
60
    {
 
61
        topLeft = 0x1,
 
62
        topRight = 0x2,
 
63
        bottomLeft = 0x4,
 
64
        bottomRight = 0x8
 
65
    };
 
66
    int corner;
 
67
    QRect rect;
 
68
    int x;
 
69
    int y;
 
70
    QVector<hrGraphicsItem> items;
 
71
};