summaryrefslogtreecommitdiff
path: root/inputmethods/dasher/DasherView.h
Unidiff
Diffstat (limited to 'inputmethods/dasher/DasherView.h') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dasher/DasherView.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/inputmethods/dasher/DasherView.h b/inputmethods/dasher/DasherView.h
new file mode 100644
index 0000000..81cc24e
--- a/dev/null
+++ b/inputmethods/dasher/DasherView.h
@@ -0,0 +1,99 @@
1// DasherView.h
2//
3/////////////////////////////////////////////////////////////////////////////
4//
5// Copyright (c) 2001-2002 David Ward
6//
7/////////////////////////////////////////////////////////////////////////////
8
9
10//////////////////////////////////////////////////////////////////////
11// DasherView.h: interface for the DasherView class.
12// Copyright 2002 David Ward
13//////////////////////////////////////////////////////////////////////
14
15#ifndef __DasherView_h_
16#define __DasherView_h_
17
18#include "MSVC_Unannoy.h"
19#include "DasherScreen.h"
20#include "DasherModel.h"
21
22// CDasherView is an abstract view class
23// The implentation must provide several functions - defined here as pure virtual functions
24// See the CDasherViewSquare class for an example
25
26namespace Dasher {class CDasherView;}
27class Dasher::CDasherView
28{
29public:
30 CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight);
31 ~CDasherView() {}
32
33 void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation);
34
35 // TODO Sort this out
36 void FlushAt(int mousex,int mousey);
37
38 // renders Dasher
39 inline void Render();
40
41 // translates the screen coordinates to Dasher coordinates and calls
42 // dashermodel.TapOnDisplay
43 virtual void TapOnDisplay(int mousex, int mousey, unsigned long Time)=0;
44
45 virtual void ChangeScreen(CDasherScreen* NewScreen)
46 {
47 m_Screen=NewScreen;
48
49 // DJW - removed floating point stuff
50 //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth();
51 }
52
53 virtual void DrawMouse(int mousex, int mousey)=0;
54 virtual void DrawKeyboard()=0;
55
56 // Return references to the model and the screen:
57 CDasherModel& DasherModel() {return m_DasherModel;}
58 CDasherScreen& Screen() {return *m_Screen;}
59
60 void Display() {m_Screen->Display();}
61
62 // Toggle advanced colour mode
63 void SetColourMode(bool colourmode) {ColourMode=colourmode;}
64
65protected:
66 // Orientation of Dasher Screen
67 inline void MapScreen(int* DrawX, int* DrawY);
68 inline void UnMapScreen(int* DrawX, int* DrawY);
69
70private:
71 CDasherScreen* m_Screen; // provides the graphics (text, lines, rectangles):
72 CDasherModel& m_DasherModel; // Model view represents
73
74 // Pure virtuals to implement
75 virtual void Crosshair(myint sx)=0; // Tells m_Screen to draw a crosshair - or other static decoration
76 virtual int RenderNode(const symbol Character, const int Color, Opts::ColorSchemes ColorScheme,
77 myint y1, myint y2, int& mostleft, bool& force, bool text)=0;
78
79 // Responsible for all the Render_node calls
80 int RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text);
81
82 // Displays some nodes inside one parent node. Used to group capital letters, accents, punctuation etc.
83 void RenderGroups(CDasherNode* Render, myint y1, myint y2, bool text);
84
85 // Orientation of Dasher Screen
86 Dasher::Opts::ScreenOrientations ScreenOrientation;
87
88 // Advanced colour mode
89 bool ColourMode;
90
91 // DJW - removed floating point stuff
92 //double XYScale;
93};
94
95
96#include "DasherView.inl"
97
98
99#endif /* #ifndef __DasherView_h_ */