summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/umlviewcanvas.cpp
blob: e75d711b94a7653b258440eb2e37783ad5faee34 (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
/***************************************************************************
 *                                                                         *
 *   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) 2002-2007                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

// own header
#include "umlviewcanvas.h"

// qt/kde includes
#include <tqpainter.h>

// app includes
#include "umlview.h"


UMLViewCanvas::UMLViewCanvas( UMLView * pView ) : TQCanvas( pView ) {
    m_pView = pView;
}

UMLViewCanvas::~UMLViewCanvas() {}

void UMLViewCanvas::drawBackground( TQPainter & painter, const TQRect & clip ) {
    TQCanvas::drawBackground( painter, clip );
    if( m_pView -> getShowSnapGrid() ) {
        painter.setPen( TQt::gray );
        int gridX = m_pView -> getSnapX();
        int gridY = m_pView -> getSnapY();
        int numX = width() / gridX;
        int numY = height() / gridY;
        for( int x = 0; x <= numX; x++ )
            for( int y = 0; y < numY; y++ )
                painter.drawPoint( x * gridX, y * gridY );
    }
}