Ability to define Real as long double
[ipdf/code.git] / src / view.h
1 #ifndef _VIEW_H
2 #define _VIEW_H
3
4 #include "ipdf.h"
5 #include "document.h"
6 #include "graphicsbuffer.h"
7
8 namespace IPDF
9 {
10         class View
11         {
12                 public:
13                         View(Document & document, const Rect & bounds = Rect(0,0,1,1), const Colour & colour = Colour(0.f,0.f,0.f,1.f)) 
14                                 : m_document(document), m_bounds(bounds), m_colour(colour), m_use_gpu_transform(false), m_bounds_dirty(true)
15                         {
16                                 Debug("View Created - Bounds => {%s}", m_bounds.Str().c_str());
17                         }
18                         virtual ~View() {}
19
20                         void Render();
21                         
22                         void Translate(Real x, Real y);
23                         void ScaleAroundPoint(Real x, Real y, Real scaleAmt);
24                         
25                         Rect TransformToViewCoords(const Rect& inp) const;
26                         
27                         const Rect& GetBounds() const { return m_bounds; }
28                         
29                         const bool UsingGPUTransform() const { return m_use_gpu_transform; }
30                         void ToggleGPUTransform() { m_use_gpu_transform = (!m_use_gpu_transform); m_bounds_dirty = true; }
31                 
32                 private:
33                         void ReRender();
34                         void DrawGrid();
35                         bool m_use_gpu_transform;
36                         bool m_bounds_dirty;
37                         GraphicsBuffer m_vertex_buffer;
38                         GraphicsBuffer m_index_buffer;
39                         Document & m_document;
40                         Rect m_bounds;
41                         Colour m_colour;
42                         uint32_t m_rendered_filled;
43                         uint32_t m_rendered_outline;
44         };
45 }
46
47 #endif //_VIEW_H

UCC git Repository :: git.ucc.asn.au