3
/////////////////////////////////////////////////////////////////////////////
5
// Copyright (c) 2001-2002 David Ward
7
/////////////////////////////////////////////////////////////////////////////
10
//////////////////////////////////////////////////////////////////////
11
// DasherView.h: interface for the DasherView class.
12
// Copyright 2002 David Ward
13
//////////////////////////////////////////////////////////////////////
15
#ifndef __DasherView_h_
16
#define __DasherView_h_
18
#include "../Common/MSVC_Unannoy.h"
19
#include "DasherScreen.h"
20
#include "DasherModel.h"
21
#include "LanguageModel.h"
23
// CDasherView is an abstract view class
24
// The implentation must provide several functions - defined here as pure virtual functions
25
// See the CDasherViewSquare class for an example
27
namespace Dasher {class CDasherView;}
28
class Dasher::CDasherView
31
CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, CLanguageModel* LanguageModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight, bool ColourMode=0);
32
virtual ~CDasherView() {}
34
void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation);
39
// translates the screen coordinates to Dasher coordinates and calls
40
// dashermodel.TapOnDisplay
41
virtual void TapOnDisplay(int mousex, int mousey, unsigned long Time)=0;
42
// translates the screen coordinates to Dasher coordinates and calls
44
virtual void GoTo(int mousex, int mousey)=0;
46
virtual void ChangeScreen(CDasherScreen* NewScreen)
50
// DJW - removed floating point stuff
51
//XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth();
54
virtual void DrawGoTo(int mousex, int mousey)=0;
55
virtual void DrawMouse(int mousex, int mousey)=0;
56
virtual void DrawMouseLine(int mousex, int mousey)=0;
57
virtual void DrawKeyboard()=0;
59
// Return references to the model and the screen:
60
CDasherModel& DasherModel() {return m_DasherModel;}
61
CDasherScreen& Screen() {return *m_Screen;}
63
void Display() {m_Screen->Display();}
65
// Toggle advanced colour mode
66
void SetColourMode(bool colourmode) {ColourMode=colourmode;}
68
// Toggle keyboard control mode
69
void SetKeyControl(bool keyboardcontrol) {KeyControl=keyboardcontrol;}
72
// Orientation of Dasher Screen
73
inline void MapScreen(int* DrawX, int* DrawY);
74
inline void UnMapScreen(int* DrawX, int* DrawY);
76
// Keyboard control is on
79
// Orientation of Dasher Screen
80
Dasher::Opts::ScreenOrientations ScreenOrientation;
82
// Advanced colour mode
86
CDasherScreen* m_Screen; // provides the graphics (text, lines, rectangles):
87
CDasherModel& m_DasherModel; // Model view represents
89
CLanguageModel* m_LanguageModel;
91
// Pure virtuals to implement
92
virtual void Crosshair(myint sx)=0; // Tells m_Screen to draw a crosshair - or other static decoration
93
virtual int RenderNode(const symbol Character, const int Color, Opts::ColorSchemes ColorScheme,
94
myint y1, myint y2, int& mostleft, bool& force, bool text, std::string displaytext)=0;
96
// Responsible for all the Render_node calls
97
int RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text);
99
// Displays some nodes inside one parent node. Used to group capital letters, accents, punctuation etc.
100
void RenderGroups(CDasherNode* Render, myint y1, myint y2, bool text);
105
#include "DasherView.inl"
108
#endif /* #ifndef __DasherView_h_ */