~ubuntu-branches/ubuntu/warty/dasher/warty

« back to all changes in this revision

Viewing changes to Src/DasherCore/DasherView.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2003-06-05 11:10:04 UTC
  • Revision ID: james.westby@ubuntu.com-20030605111004-kqiutbrlvs7td9ic
Tags: upstream-3.2.10
ImportĀ upstreamĀ versionĀ 3.2.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "../Common/MSVC_Unannoy.h"
 
19
#include "DasherScreen.h"
 
20
#include "DasherModel.h"
 
21
#include "LanguageModel.h"
 
22
 
 
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
 
26
 
 
27
namespace Dasher {class CDasherView;}
 
28
class Dasher::CDasherView
 
29
{
 
30
public:
 
31
        CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, CLanguageModel* LanguageModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight, bool ColourMode=0);
 
32
        virtual ~CDasherView() {}               
 
33
        
 
34
        void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation);
 
35
        
 
36
        // renders Dasher
 
37
        inline void Render();
 
38
        
 
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
 
43
        // dashermodel.GoTo
 
44
        virtual void GoTo(int mousex, int mousey)=0;
 
45
        
 
46
        virtual void ChangeScreen(CDasherScreen* NewScreen)
 
47
        {
 
48
                m_Screen=NewScreen;
 
49
                
 
50
                // DJW - removed floating point stuff
 
51
                //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth();
 
52
        }
 
53
 
 
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;
 
58
 
 
59
        // Return references to the model and the screen:
 
60
        CDasherModel& DasherModel() {return m_DasherModel;}
 
61
        CDasherScreen& Screen() {return *m_Screen;}
 
62
 
 
63
        void Display() {m_Screen->Display();}
 
64
 
 
65
        // Toggle advanced colour mode
 
66
        void SetColourMode(bool colourmode) {ColourMode=colourmode;}
 
67
 
 
68
        // Toggle keyboard control mode
 
69
        void SetKeyControl(bool keyboardcontrol) {KeyControl=keyboardcontrol;}
 
70
 
 
71
protected:
 
72
        // Orientation of Dasher Screen
 
73
        inline void MapScreen(int* DrawX, int* DrawY);
 
74
        inline void UnMapScreen(int* DrawX, int* DrawY);
 
75
 
 
76
        // Keyboard control is on
 
77
        bool KeyControl;
 
78
 
 
79
        // Orientation of Dasher Screen
 
80
        Dasher::Opts::ScreenOrientations ScreenOrientation;
 
81
 
 
82
        // Advanced colour mode
 
83
        bool ColourMode;
 
84
 
 
85
private:
 
86
        CDasherScreen* m_Screen;      // provides the graphics (text, lines, rectangles):
 
87
        CDasherModel& m_DasherModel; // Model view represents
 
88
 
 
89
        CLanguageModel* m_LanguageModel;
 
90
        
 
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;
 
95
        
 
96
        // Responsible for all the Render_node calls
 
97
        int RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text);
 
98
        
 
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);
 
101
        
 
102
};
 
103
 
 
104
 
 
105
#include "DasherView.inl"
 
106
 
 
107
 
 
108
#endif /* #ifndef __DasherView_h_ */