author | unc0rr |
Sat, 24 Sep 2011 00:00:57 +0400 | |
changeset 5996 | 2c72fe81dd37 |
parent 4976 | 088d40d8aba2 |
permissions | -rw-r--r-- |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
4976 | 3 |
* Copyright (c) 2006-2011 Igor Ulyanov <iulyanov@gmail.com> |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
4 |
* |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
8 |
* |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
13 |
* |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
17 |
*/ |
2377 | 18 |
|
1455 | 19 |
#include <QFrame> |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
20 |
#include <QImage> |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
21 |
|
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
22 |
#ifndef _ITEM_NUM_INCLUDED |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
23 |
#define _ITEM_NUM_INCLUDED |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
24 |
|
1455 | 25 |
class ItemNum : public QFrame |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
26 |
{ |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
27 |
Q_OBJECT |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
28 |
|
640 | 29 |
public: |
30 |
void setInfinityState(bool value); |
|
4412
c9a78ba03679
added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents:
2377
diff
changeset
|
31 |
void setEnabled(bool value); |
681 | 32 |
unsigned char getItemsNum() const; |
33 |
void setItemsNum(const unsigned char num); |
|
640 | 34 |
|
1904 | 35 |
private: |
36 |
QImage m_im; |
|
4412
c9a78ba03679
added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents:
2377
diff
changeset
|
37 |
QImage m_img; |
1904 | 38 |
bool infinityState; |
4412
c9a78ba03679
added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents:
2377
diff
changeset
|
39 |
bool enabled; |
1904 | 40 |
|
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
41 |
protected: |
4412
c9a78ba03679
added disabling option to itemNum and grey images for that. also made default weapon sets uneditable and not deleteable.
Henek
parents:
2377
diff
changeset
|
42 |
ItemNum(const QImage& im, const QImage& img, QWidget * parent, unsigned char min=2, unsigned char max=8); |
643 | 43 |
virtual QSize sizeHint () const; |
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
44 |
virtual ~ItemNum()=0; |
1904 | 45 |
|
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
46 |
bool nonInteractive; |
624 | 47 |
unsigned char minItems; |
48 |
unsigned char maxItems; |
|
1904 | 49 |
unsigned char numItems; |
624 | 50 |
|
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
51 |
// from QWidget |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
52 |
virtual void mousePressEvent ( QMouseEvent * event ); |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
53 |
virtual void paintEvent(QPaintEvent* event); |
1904 | 54 |
|
612
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
55 |
// to be implemented in child |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
56 |
virtual void incItems()=0; |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
57 |
virtual void decItems()=0; |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
58 |
}; |
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
59 |
|
333d095319de
abstract class for items container (hedgehogs num, bullets, etc.)
displacer
parents:
diff
changeset
|
60 |
#endif // _ITEM_NUM_INCLUDED |