umbrello API Documentation

umlviewcanvas.cpp

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2002-2007                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 // own header
00013 #include "umlviewcanvas.h"
00014 
00015 // qt/kde includes
00016 #include <qpainter.h>
00017 
00018 // app includes
00019 #include "umlview.h"
00020 
00021 
00022 UMLViewCanvas::UMLViewCanvas( UMLView * pView ) : QCanvas( pView ) {
00023     m_pView = pView;
00024 }
00025 
00026 UMLViewCanvas::~UMLViewCanvas() {}
00027 
00028 void UMLViewCanvas::drawBackground( QPainter & painter, const QRect & clip ) {
00029     QCanvas::drawBackground( painter, clip );
00030     if( m_pView -> getShowSnapGrid() ) {
00031         painter.setPen( Qt::gray );
00032         int gridX = m_pView -> getSnapX();
00033         int gridY = m_pView -> getSnapY();
00034         int numX = width() / gridX;
00035         int numY = height() / gridY;
00036         for( int x = 0; x <= numX; x++ )
00037             for( int y = 0; y < numY; y++ )
00038                 painter.drawPoint( x * gridX, y * gridY );
00039     }
00040 }
00041 
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:01 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003