]> Shamusworld >> Repos - architektonas/blob - src/base/rs_staticgraphicview.cpp
Final round of dialogs/forms needing to be converted from Qt3 to 4
[architektonas] / src / base / rs_staticgraphicview.cpp
1 // rs_staticgraphicview.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  06/02/2010  Added this text. :-)
13 //
14
15 #include "rs_staticgraphicview.h"
16
17 #include "drawing.h"
18
19 /**
20  * Constructor.
21  *
22  * @param w Width
23  * @param h Height
24  */
25 //RS_StaticGraphicView::RS_StaticGraphicView(int w, int h, RS_Painter * p): /*painter(p),*/ width(w),
26 RS_StaticGraphicView::RS_StaticGraphicView(int w, int h, PaintInterface * p): /*painter(p),*/ width(w), height(h)
27 {
28         setBackground(RS_Color(255, 255, 255));
29         painter = p;
30         setBorders(5, 5, 5, 5);
31 }
32
33 /**
34  * Destructor
35  */
36 RS_StaticGraphicView::~RS_StaticGraphicView()
37 {
38 }
39
40 /**
41  * @return width of widget.
42  */
43 int RS_StaticGraphicView::getWidth()
44 {
45         return width;
46 }
47
48 /**
49  * @return height of widget.
50  */
51 int RS_StaticGraphicView::getHeight()
52 {
53         return height;
54 }
55
56 /**
57  * Creates a new painter for the buffer of this widget and returns a
58  * pointer to it. The class variable 'painter' also
59  * points to that object.
60  */
61 //RS_Painter * RS_StaticGraphicView::createPainter()
62 PaintInterface * RS_StaticGraphicView::createPainter()
63 {
64         return painter;
65 }
66
67 /**
68  * Creates a new painter for this widget and returns a
69  * pointer to it. The class variable 'painter' also
70  * points to that object.
71  */
72 //RS_Painter * RS_StaticGraphicView::createDirectPainter()
73 PaintInterface * RS_StaticGraphicView::createDirectPainter()
74 {
75         return createPainter();
76 }
77
78 /**
79  * Deletes the painter.
80  */
81 void RS_StaticGraphicView::destroyPainter()
82 {
83 }
84
85 /**
86  * Handles paint events by redrawing the graphic in this view.
87  */
88 void RS_StaticGraphicView::paint()
89 {
90         RS_DEBUG->print("RS_StaticGraphicView::paint begin");
91         drawIt();
92         RS_DEBUG->print("RS_StaticGraphicView::paint end");
93 }