1 // Ryzom Core Studio - GUI Editor Plugin
3 // Copyright (C) 2010-2014 Laszlo KIS-ADAM (dfighter) <dfighter1985@gmail.com>
5 // This program is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Affero General Public License as
7 // published by the Free Software Foundation, either version 3 of the
8 // License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Affero General Public License for more details.
15 // You should have received a copy of the GNU Affero General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef EXPRESSION_NODE
20 #define EXPRESSION_NODE
22 #include <QGraphicsItem>
24 #include "expr_slot_info.h"
29 class ExpressionNode
: public QGraphicsItem
32 ExpressionNode( const QString
&name
, int slotCount
= 3, QGraphicsItem
*parent
= NULL
);
35 QRectF
boundingRect() const;
36 void paint( QPainter
*painter
, const QStyleOptionGraphicsItem
*option
, QWidget
*widget
);
38 void setLink( ExpressionLink
*link
, int slot
);
39 ExpressionLink
* link( int slot
) const;
41 QPointF
slotPos( int slot
) const;
43 int slotCount() const{ return m_slots
.count(); }
44 void changeSlotCount( int count
);
47 bool slotEmpty( int slot
) const;
49 void getSlots( QList
< SlotInfo
> &l
);
53 QString
name() const{ return m_name
; }
55 void setSlotNames( const QList
< QString
> &l
);
57 void setVariable( bool b
){ m_variable
= b
; }
58 bool variable() const{ return m_variable
; }
60 void setValue( const QString
&value
);
61 QString
getValue() const{ return m_value
; }
63 bool isValue() const{ return m_isValue
; }
64 void setIsValue( bool b
){ m_isValue
= b
; }
65 void setRoot( bool b
);
67 QString
build() const;
70 QVariant
itemChange( GraphicsItemChange change
, const QVariant
&value
);
74 void createSlots( int count
= 3 );
75 void paintSlots( QPainter
*painter
);
77 qreal m_w
; // node width
78 qreal m_h
; // node height
79 qreal m_hh
; // header height
81 QList
< NodeSlot
* > m_slots
;
82 QList
< ExpressionLink
* > m_links
;