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

« back to all changes in this revision

Viewing changes to Src/DasherCore/DasherWidgetInterface.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
// DasherWidgetInterface.h
 
2
//
 
3
/////////////////////////////////////////////////////////////////////////////
 
4
//
 
5
// Copyright (c) 2002 Iain Murray
 
6
//
 
7
/////////////////////////////////////////////////////////////////////////////
 
8
 
 
9
#ifndef __DasherWidgetInterface_h__
 
10
#define __DasherWidgetInterface_h__
 
11
 
 
12
 
 
13
#include "DasherTypes.h"
 
14
#include <string>
 
15
 
 
16
namespace Dasher {class CDasherWidgetInterface;}
 
17
class Dasher::CDasherWidgetInterface
 
18
{
 
19
public:
 
20
        //! Signal to the core that the model should be started
 
21
        //
 
22
        //! Call this function before providing input coordinates and whenever
 
23
        //! reinitialising Dasher
 
24
        virtual void Start()=0;
 
25
        
 
26
        // Times in milliseconds are required so Dasher runs at the correct speed.
 
27
        //! Signal an input location
 
28
        //
 
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;
 
36
 
 
37
        //! Draw the mouse position
 
38
        //
 
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;
 
43
        
 
44
        //! Signal a location that should be jumped to
 
45
        //
 
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;
 
51
 
 
52
        //! Show the area that would be zoomed in on with these coordinates
 
53
        //
 
54
        //! Draw the area that would be zoomed in on if a GoTo was executed
 
55
        //! on this location
 
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;
 
59
 
 
60
        //! Signal an input event and pause the simulation
 
61
        virtual void PauseAt(int MouseX, int MouseY)=0;
 
62
 
 
63
        //! Signal that we have stopped for some reason
 
64
        virtual void Halt()=0;
 
65
        
 
66
        //! Unpause the simulation.
 
67
        //
 
68
        //! \param Time should be in milliscones and should be consistent with
 
69
        //! previous time values
 
70
        virtual void Unpause(unsigned long Time)=0;
 
71
 
 
72
        //! Signal that the core should redraw the screen
 
73
        virtual void Redraw()=0;
 
74
        
 
75
        //! Signal that the core should rerender the screen without displaying it
 
76
        virtual void Render()=0;
 
77
 
 
78
        // The widgets need to tell the engine when they have been affected
 
79
        // by external interaction
 
80
        
 
81
        //! Signal the core that a change has occured to the screen. (Unneeded)
 
82
        virtual void ChangeScreen()=0;
 
83
 
 
84
        //! Signal the core that a change has occued to the editbox. (Unneeded)
 
85
        virtual void ChangeEdit()=0;
 
86
        
 
87
        // These are needed so widgets know how to render the alphabet.
 
88
        // All strings are encoded in UTF-8.
 
89
 
 
90
        //! Request the number of symbols in the current alphabet
 
91
        virtual unsigned int GetNumberSymbols()=0;
 
92
        
 
93
        //! Request the text that should be displayed on the Dasher canvas
 
94
        //
 
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;
 
98
 
 
99
        //! Request the text that should be entered into the edit box
 
100
        //
 
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;
 
104
 
 
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;
 
108
 
 
109
        //! Request the default screen orientation for the current alphabet
 
110
        //
 
111
        //! (Eg, left to right for English, right to left for Hebrew)
 
112
        virtual Opts::ScreenOrientations GetAlphabetOrientation()=0;
 
113
 
 
114
        //! Returns the codepage for the current alphabet
 
115
        virtual Opts::AlphabetTypes GetAlphabetType()=0;
 
116
 
 
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
 
120
};
 
121
 
 
122
#endif /* #ifndef __DasherWidgetInterface_h__ */