summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/boxwidget.cpp
blob: b85db40138052257c36d8433bfb0d9c02e1852cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   copyright (C) 2003-2006                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

// own header
#include "boxwidget.h"
// qt/kde includes
#include <tqevent.h>
#include <kdebug.h>

BoxWidget::BoxWidget(UMLView * view, Uml::IDType id)
        : UMLWidget(view, id) {
    setSize(100,80);
    UMLWidget::setBaseType( Uml::wt_Box );
    WidgetBase::m_bUsesDiagramLineColour = false;  // boxes be black
    WidgetBase::m_LineColour = TQColor("black");
    setZ(m_origZ = 0);
}

BoxWidget::~BoxWidget() {
}

void BoxWidget::draw(TQPainter& p, int offsetX, int offsetY) {
    UMLWidget::setPen(p);
    p.drawRect( offsetX, offsetY, width(), height() );

    if (m_bSelected) {
        drawSelected(&p, offsetX, offsetY);
    }
}

void BoxWidget::saveToXMI(TQDomDocument& qDoc, TQDomElement& qElement) {
    TQDomElement boxElement = qDoc.createElement("boxwidget");
    UMLWidget::saveToXMI(qDoc, boxElement);
    qElement.appendChild(boxElement);
}