1 #ifndef _FTGL_Demo_FTGLCtrl_h_
2 #define _FTGL_Demo_FTGLCtrl_h_
3 
4 #include <CtrlLib/CtrlLib.h>
5 #include <GLCtrl/GLCtrl.h>
6 
7 #include <FTGL/ftgl.h>
8 
9 #include "TrackBall.h"
10 
11 using namespace Upp;
12 
13 class FTGLCtrl : public GLCtrl
14 {
15 	private:
16 
17 		TrackBall trackBall;
18 
19 		typedef enum { FTGL_BITMAP, FTGL_PIXMAP, FTGL_OUTLINE, FTGL_POLYGON, FTGL_EXTRUDE, FTGL_TEXTURE, NumStyles } Styles;
20 		typedef enum { EDITING = 1, INTERACTIVE } Modes;
21 
22 		Modes mode;
23 
24 		Vector<String> fontFiles;
25 		int currentFont;
26 
27 		// array containing all fonts
28 		Array<FTFont> fonts;
29 		int totalFonts;
30 		One<FTPixmapFont> infoFont;
31 
32 		Array<FTLayout> layouts;
33 		int currentLayout;
hasLayout(void)34 		bool hasLayout(void) { return currentLayout >= 0 && currentLayout < layouts.GetCount(); }
35 
36 		// displayed string
37 		String myString;
38 
39 		void SetUpLighting();
40 		void SetUpFonts(int numFontFiles);
41 		void RenderFontmetrics();
42 		void RenderFontInfo();
43 		void SetCamera();
44 		void Paint0(void);
45 
GetStyle()46 		int GetStyle() { return currentFont % NumStyles; }
GetFace()47 		int GetFace()  { return currentFont / NumStyles; }
48 
49 		float OX;
50 		float OY;
51 
52 		float initialLineLength;
53 
54 	protected:
55 		virtual void GLPaint();
56 
57 		virtual Image MouseEvent(int event, Point p, int zdelta, dword keyflags);
58 		virtual bool Key(dword key, int count);
59 
60 		virtual void Layout();
61 
62 	public:
63 		typedef FTGLCtrl CLASSNAME;
64 
65 		void SetFontFiles(Vector<String> const &files);
66 
67 		FTGLCtrl();
68 };
69 
70 #endif
71