1
// DasherWidgetInterface.h
3
/////////////////////////////////////////////////////////////////////////////
5
// Copyright (c) 2002 Iain Murray
7
/////////////////////////////////////////////////////////////////////////////
9
#ifndef __DasherWidgetInterface_h__
10
#define __DasherWidgetInterface_h__
13
#include "DasherTypes.h"
16
namespace Dasher {class CDasherWidgetInterface;}
17
class Dasher::CDasherWidgetInterface
20
//! Signal to the core that the model should be started
22
//! Call this function before providing input coordinates and whenever
23
//! reinitialising Dasher
24
virtual void Start()=0;
26
// Times in milliseconds are required so Dasher runs at the correct speed.
27
//! Signal an input location
29
//! Signal an input event. This may be the current location of the
30
//! mouse or a stylus tap, for example
31
//! \param MouseX The mouse X coordinate, in screen coordinates
32
//! \param MouseY The mouse Y coordinate, in screen coordinates
33
//! \param Time Time in milliseconds, required to keep Dasher running
34
//! at the correct speed
35
virtual void TapOn(int MouseX, int MouseY, unsigned long Time)=0;
37
//! Draw the mouse position
39
//! Gives a coordinate that the mouse position should be shown at
40
//! \param MouseX The mouse X coordinate, in screen coordinates
41
//! \param MouseY The mouse Y coordinate, in screen coordinates
42
virtual void DrawMousePos(int MouseX, int MouseY)=0;
44
//! Signal a location that should be jumped to
46
//! Signal a location that should be jumped to. Mostly useful for
47
//! button or keyboard input.
48
//! \param MouseX The mouse X coordinate, in screen coordinates
49
//! \param MouseY The mouse Y coordinate, in screen coordinates
50
virtual void GoTo(int MouseX, int MouseY)=0;
52
//! Show the area that would be zoomed in on with these coordinates
54
//! Draw the area that would be zoomed in on if a GoTo was executed
56
//! \param MouseX The mouse X coordinate, in screen coordinates
57
//! \param MouseY The mouse Y coordinate, in screen coordinates
58
virtual void DrawGoTo(int MouseX, int MouseY)=0;
60
//! Signal an input event and pause the simulation
61
virtual void PauseAt(int MouseX, int MouseY)=0;
63
//! Signal that we have stopped for some reason
64
virtual void Halt()=0;
66
//! Unpause the simulation.
68
//! \param Time should be in milliscones and should be consistent with
69
//! previous time values
70
virtual void Unpause(unsigned long Time)=0;
72
//! Signal that the core should redraw the screen
73
virtual void Redraw()=0;
75
//! Signal that the core should rerender the screen without displaying it
76
virtual void Render()=0;
78
// The widgets need to tell the engine when they have been affected
79
// by external interaction
81
//! Signal the core that a change has occured to the screen. (Unneeded)
82
virtual void ChangeScreen()=0;
84
//! Signal the core that a change has occued to the editbox. (Unneeded)
85
virtual void ChangeEdit()=0;
87
// These are needed so widgets know how to render the alphabet.
88
// All strings are encoded in UTF-8.
90
//! Request the number of symbols in the current alphabet
91
virtual unsigned int GetNumberSymbols()=0;
93
//! Request the text that should be displayed on the Dasher canvas
95
//! Note - the returned string is in UTF-8 encoding.
96
//! \param Symbol the symbol that is to be displayed
97
virtual const std::string& GetDisplayText(Dasher::symbol Symbol)=0;
99
//! Request the text that should be entered into the edit box
101
//! Note - the returned string is in UTF-8 encoding.
102
//! \param Symbol the symbol that is to be displayed
103
virtual const std::string& GetEditText(Dasher::symbol Symbol)=0;
105
//! Request the foreground colour for the text to be drawn on the canvas
106
//! \param Symbol the symbol that is to be displayed
107
virtual int GetTextColour(Dasher::symbol Symbol)=0;
109
//! Request the default screen orientation for the current alphabet
111
//! (Eg, left to right for English, right to left for Hebrew)
112
virtual Opts::ScreenOrientations GetAlphabetOrientation()=0;
114
//! Returns the codepage for the current alphabet
115
virtual Opts::AlphabetTypes GetAlphabetType()=0;
117
//! Provides a fully qualified path to the training file for the alphabet
118
virtual const std::string& GetTrainFile()=0; // Returns a fully-qualified path to file:
119
// UserLocation + TrainFile
122
#endif /* #ifndef __DasherWidgetInterface_h__ */