]> Shamusworld >> Repos - architektonas/blob - src/base/rs_staticgraphicview.cpp
Initial import
[architektonas] / src / base / rs_staticgraphicview.cpp
1 /*****************************************************************************
2 **  $Id: rs_staticgraphicview.cpp 1686 2003-08-25 22:50:31Z andrew $
3 **
4 **  This is part of the QCad Qt GUI
5 **  Copyright (C) 2001 Andrew Mustun
6 **
7 **  This program is free software; you can redistribute it and/or modify
8 **  it under the terms of the GNU General Public License (version 2) as
9 **  published by the Free Software Foundation.
10 **
11 **  This program is distributed in the hope that it will be useful,
12 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 **  GNU General Public License for more details.
15 **
16 **  You should have received a copy of the GNU General Public License
17 **  along with this program; if not, write to the Free Software
18 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 ******************************************************************************/
20
21 #include "rs_staticgraphicview.h"
22
23 #include "rs_graphic.h"
24
25 /**
26  * Constructor.
27  *
28  * @param w Width
29  * @param h Height
30  */
31 //RS_StaticGraphicView::RS_StaticGraphicView(int w, int h, RS_Painter * p): /*painter(p),*/ width(w),
32 RS_StaticGraphicView::RS_StaticGraphicView(int w, int h, PaintInterface * p): /*painter(p),*/ width(w), height(h)
33 {
34         setBackground(RS_Color(255, 255, 255));
35         painter = p;
36         setBorders(5, 5, 5, 5);
37 }
38
39 /**
40  * Destructor
41  */
42 RS_StaticGraphicView::~RS_StaticGraphicView()
43 {
44 }
45
46 /**
47  * @return width of widget.
48  */
49 int RS_StaticGraphicView::getWidth()
50 {
51         return width;
52 }
53
54 /**
55  * @return height of widget.
56  */
57 int RS_StaticGraphicView::getHeight()
58 {
59         return height;
60 }
61
62 /**
63  * Creates a new painter for the buffer of this widget and returns a
64  * pointer to it. The class variable 'painter' also
65  * points to that object.
66  */
67 //RS_Painter * RS_StaticGraphicView::createPainter()
68 PaintInterface * RS_StaticGraphicView::createPainter()
69 {
70         return painter;
71 }
72
73 /**
74  * Creates a new painter for this widget and returns a
75  * pointer to it. The class variable 'painter' also
76  * points to that object.
77  */
78 //RS_Painter * RS_StaticGraphicView::createDirectPainter()
79 PaintInterface * RS_StaticGraphicView::createDirectPainter()
80 {
81         return createPainter();
82 }
83
84 /**
85  * Deletes the painter.
86  */
87 void RS_StaticGraphicView::destroyPainter()
88 {
89 }
90
91 /**
92  * Handles paint events by redrawing the graphic in this view.
93  */
94 void RS_StaticGraphicView::paint()
95 {
96         RS_DEBUG->print("RS_StaticGraphicView::paint begin");
97         drawIt();
98         RS_DEBUG->print("RS_StaticGraphicView::paint end");
99 }