Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DasherView.h

Go to the documentation of this file.
00001 // DasherView.h
00002 //
00004 //
00005 // Copyright (c) 2001-2002 David Ward
00006 //
00008 
00009 
00011 // DasherView.h: interface for the DasherView class.
00012 // Copyright 2002 David Ward
00014 
00015 #ifndef __DasherView_h_
00016 #define __DasherView_h_
00017 
00018 #include "MSVC_Unannoy.h"
00019 #include "DasherScreen.h"
00020 #include "DasherModel.h"
00021 
00022 // CDasherView is an abstract view class
00023 // The implentation must provide several functions - defined here as pure virtual functions
00024 // See the CDasherViewSquare class for an example
00025 
00026 namespace Dasher {class CDasherView;}
00027 class Dasher::CDasherView
00028 {
00029 public:
00030         CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight);
00031         virtual ~CDasherView() {}               
00032         
00033         void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation);
00034         
00035         // TODO Sort this out
00036         void FlushAt(int mousex,int mousey);
00037         
00038         // renders Dasher
00039         inline void Render();
00040         
00041         // translates the screen coordinates to Dasher coordinates and calls
00042         // dashermodel.TapOnDisplay
00043         virtual void TapOnDisplay(int mousex, int mousey, unsigned long Time)=0;
00044         
00045         virtual void ChangeScreen(CDasherScreen* NewScreen)
00046         {
00047                 m_Screen=NewScreen;
00048                 
00049                 // DJW - removed floating point stuff
00050                 //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth();
00051         }
00052 
00053         virtual void DrawMouse(int mousex, int mousey)=0;
00054         virtual void DrawKeyboard()=0;
00055 
00056         // Return references to the model and the screen:
00057         CDasherModel& DasherModel() {return m_DasherModel;}
00058         CDasherScreen& Screen() {return *m_Screen;}
00059 
00060         void Display() {m_Screen->Display();}
00061 
00062         // Toggle advanced colour mode
00063         void SetColourMode(bool colourmode) {ColourMode=colourmode;}
00064 
00065 protected:
00066         // Orientation of Dasher Screen
00067         inline void MapScreen(int* DrawX, int* DrawY);
00068         inline void UnMapScreen(int* DrawX, int* DrawY);
00069 
00070 private:
00071         CDasherScreen* m_Screen;      // provides the graphics (text, lines, rectangles):
00072         CDasherModel& m_DasherModel; // Model view represents
00073         
00074         // Pure virtuals to implement
00075         virtual void Crosshair(myint sx)=0; // Tells m_Screen to draw a crosshair - or other static decoration
00076         virtual int RenderNode(const symbol Character, const int Color, Opts::ColorSchemes ColorScheme,
00077                 myint y1, myint y2, int& mostleft, bool& force, bool text)=0;
00078         
00079         // Responsible for all the Render_node calls
00080         int RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text);
00081         
00082         // Displays some nodes inside one parent node. Used to group capital letters, accents, punctuation etc.
00083         void RenderGroups(CDasherNode* Render, myint y1, myint y2, bool text);
00084         
00085         // Orientation of Dasher Screen
00086         Dasher::Opts::ScreenOrientations ScreenOrientation;
00087 
00088         // Advanced colour mode
00089         bool ColourMode;
00090 
00091         // DJW - removed floating point stuff
00092         //double XYScale;
00093 };
00094 
00095 
00096 #include "DasherView.inl"
00097 
00098 
00099 #endif /* #ifndef __DasherView_h_ */

Generated on Sat Nov 5 16:16:00 2005 for OPIE by  doxygen 1.4.2