1 #ifndef _CANVAS_WIDGET_H_
2 #define _CANVAS_WIDGET_H_
29 #ifdef COMPILE_DCC_CANVAS
38 class DccCanvasWidget;
40 #define KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE 1
41 #define KVI_CANVAS_RTTI_CONTROL_TYPE_LINE 2
42 #define KVI_CANVAS_RTTI_CONTROL_TYPE_POLYGON 4
44 #define KVI_CANVAS_RTTI_CONTROL_TYPE_MASK 255
46 #define KVI_CANVAS_RTTI_RECTANGLE (KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE | (1 << 8))
47 #define KVI_CANVAS_RTTI_RICHTEXT (KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE | (2 << 8))
48 #define KVI_CANVAS_RTTI_LINE (KVI_CANVAS_RTTI_CONTROL_TYPE_LINE | (3 << 8))
49 #define KVI_CANVAS_RTTI_ELLIPSE (KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE | (4 << 8))
50 #define KVI_CANVAS_RTTI_CHORD (KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE | (5 << 8))
51 #define KVI_CANVAS_RTTI_PIE (KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE | (6 << 8))
52 #define KVI_CANVAS_RTTI_POLYGON (KVI_CANVAS_RTTI_CONTROL_TYPE_POLYGON | (7 << 8))
54 #define KVI_CANVAS_RTTI_CONTROL_TYPE(__item) (__item->rtti() & KVI_CANVAS_RTTI_CONTROL_TYPE_MASK)
56 class KviCanvasPolygon :
public QCanvasPolygon
59 KviCanvasPolygon(QCanvas *
c,
int x,
int y, QPointArray & pnts,
double dScaleFactor);
60 virtual ~KviCanvasPolygon();
63 QMap<QString, QVariant> m_properties;
64 double m_dScaleFactor;
68 virtual void draw(QPainter &
p);
69 double scaleFactor() {
return m_dScaleFactor; };
70 void setScaleFactor(
double dScaleFactor);
72 const QPointArray & internalPoints() {
return m_points; };
73 void setInternalPoints(
const QPointArray & pnts);
74 QMap<QString, QVariant> * properties() {
return &m_properties; };
75 virtual void setProperty(
const QString & property,
const QVariant & val);
76 virtual int rtti()
const;
79 class KviCanvasRectangleItem :
public QCanvasRectangle
81 friend class KviCanvasRectangle;
82 friend class KviCanvasRichText;
83 friend class KviCanvasEllipticItem;
86 KviCanvasRectangleItem(QCanvas *
c,
int x,
int y,
int w,
int h);
89 virtual ~KviCanvasRectangleItem();
92 QMap<QString, QVariant> m_properties;
95 int right() {
return ((
int)
x()) + width(); };
96 int bottom() {
return ((
int)
y()) + height(); };
97 QMap<QString, QVariant> * properties() {
return &m_properties; };
98 virtual void setProperty(
const QString & property,
const QVariant & val);
101 void drawSelection(QPainter &
p);
104 class KviCanvasEllipticItem :
public KviCanvasRectangleItem
106 friend class KviCanvasEllipse;
107 friend class KviCanvasChord;
108 friend class KviCanvasPie;
111 KviCanvasEllipticItem(QCanvas *
c,
int x,
int y,
int w,
int h);
112 ~KviCanvasEllipticItem();
115 virtual void setProperty(
const QString & property,
const QVariant & val);
116 virtual void draw(QPainter &
p);
117 virtual void drawContent(QPainter &
p);
118 virtual int rtti()
const;
121 class KviCanvasEllipse :
public KviCanvasEllipticItem
124 KviCanvasEllipse(QCanvas *
c,
int x,
int y,
int w,
int h);
128 virtual void drawContent(QPainter &
p);
129 virtual int rtti()
const;
132 class KviCanvasPie :
public KviCanvasEllipticItem
135 KviCanvasPie(QCanvas *
c,
int x,
int y,
int w,
int h);
139 virtual void drawContent(QPainter &
p);
140 virtual int rtti()
const;
143 class KviCanvasChord :
public KviCanvasEllipticItem
146 KviCanvasChord(QCanvas *
c,
int x,
int y,
int w,
int h);
150 virtual void drawContent(QPainter &
p);
151 virtual int rtti()
const;
154 class KviCanvasLine :
public QCanvasLine
157 KviCanvasLine(QCanvas *
c,
int x1,
int y1,
int x2,
int y2);
158 virtual ~KviCanvasLine();
161 QMap<QString, QVariant> m_properties;
164 QMap<QString, QVariant> * properties() {
return &m_properties; };
165 virtual void setProperty(
const QString & property,
const QVariant & val);
167 virtual void draw(QPainter &
p);
168 virtual int rtti()
const;
171 class KviCanvasRectangle :
public KviCanvasRectangleItem
174 KviCanvasRectangle(QCanvas *
c,
int x,
int y,
int w,
int h);
175 ~KviCanvasRectangle();
178 virtual void draw(QPainter &
p);
179 virtual void setProperty(
const QString & property,
const QVariant & val);
180 virtual int rtti()
const;
183 class KviCanvasRichText :
public KviCanvasRectangleItem
186 KviCanvasRichText(QCanvas *
c,
int x,
int y,
int w,
int h);
187 ~KviCanvasRichText();
190 virtual void draw(QPainter &
p);
191 virtual int rtti()
const;
194 class KviCanvasView :
public QCanvasView
198 KviCanvasView(QCanvas *
c, DccCanvasWidget * cw, QWidget * par);
238 DccCanvasWidget * m_pCanvasWidget;
242 ObjectType m_objectToInsert;
245 QCanvasItem * m_pSelectedItem;
249 double m_dragScaleFactor;
250 unsigned int m_dragPointIndex;
251 QPointArray m_dragPointArray;
254 void beginDragRectangle(KviCanvasRectangleItem * it,
const QPoint &
p,
bool bInitial =
false);
255 void dragRectangle(KviCanvasRectangleItem * it,
const QPoint &
p);
257 void beginDragLine(KviCanvasLine * it,
const QPoint &
p,
bool bInitial =
false);
258 void dragLine(KviCanvasLine * it,
const QPoint &
p);
260 void beginDragPolygon(KviCanvasPolygon * it,
const QPoint &
p,
bool bShift =
false,
bool bCtrl =
false);
261 void dragPolygon(KviCanvasPolygon * it,
const QPoint &
p);
263 void setItemSelected(QCanvasItem * it);
264 void clearSelection();
265 void insertObjectAt(
const QPoint & pnt, ObjectType
o);
266 virtual void contentsMousePressEvent(QMouseEvent *
e);
267 virtual void contentsMouseMoveEvent(QMouseEvent *
e);
268 virtual void contentsMouseReleaseEvent(QMouseEvent *
e);
270 void insertRectangle();
271 void insertRichText();
275 void insertEllipse();
276 void insertPolygonTriangle();
277 void insertPolygonRectangle();
278 void insertPolygonPentagon();
279 void insertPolygonHexagon();
280 void propertyChanged(
const QString &
s,
const QVariant &
v);
283 class KviVariantTableItem :
public QTableItem
286 KviVariantTableItem(QTable *
t,
const QVariant & property);
287 ~KviVariantTableItem();
293 virtual QWidget * createEditor()
const;
294 virtual void setContentFromEditor(QWidget *
w);
295 QVariant & property() {
return m_property; };
296 virtual void paint(QPainter *
p,
const QColorGroup & cg,
const QRect & cr,
bool selected);
299 class KviCanvasItemPropertiesWidget :
public QTable
303 KviCanvasItemPropertiesWidget(QWidget * par);
304 ~KviCanvasItemPropertiesWidget();
307 void editItem(QCanvasItem * it);
309 void cellEdited(
int row,
int col);
311 void propertyChanged(
const QString &
s,
const QVariant &
v);
314 class DccCanvasWidget :
public QWidget
316 friend class KviCanvasView;
319 DccCanvasWidget(QWidget * par);
323 QSplitter * m_pSplitter;
325 QMenuBar * m_pMenuBar;
326 KviCanvasView * m_pCanvasView;
327 QLabel * m_pStatusLabel;
328 KviCanvasItemPropertiesWidget * m_pPropertiesWidget;
331 virtual void resizeEvent(QResizeEvent *);
335 #endif //_CANVAS_WIDGET_H_
char s char s char s s s s s char char c s *s c s s s d c s *s d c d d d d c
Definition: KviIrcNumericCodes.h:391
State
Definition: NotifierSettings.h:61
#define e
Definition: detector.cpp:69
#define h
Definition: detector.cpp:72
char s char s s
Definition: KviIrcNumericCodes.h:391
QHashIterator< int, QFile * > t(getDict)
#define o
Definition: detector.cpp:79
#define w
Definition: detector.cpp:87
#define x
Definition: detector.cpp:88
#define y
Definition: detector.cpp:89
#define v
Definition: detector.cpp:86
#define p
Definition: detector.cpp:80