1 /** 2 * Copyright Mikael H�gdahl - triyana@users.sourceforge.net 3 * 4 * This source is distributed under the terms of the Q Public License version 1.0, 5 * created by Trolltech (www.trolltech.com). 6 */ 7 8 #ifndef MHDC_h 9 #define MHDC_h 10 11 #include "MHPrice.h" 12 #include "MHVector.h" 13 14 15 16 /** 17 * Inherit from this object to implement REAL device context functions. Either for 18 * a gui toolkit or an image of some kind. 19 */ 20 class MHDC : public MH { 21 public: 22 enum COLORS { 23 BLUE = 0, 24 RED, 25 GREEN, 26 MAGENTA, 27 YELLOW, 28 CYAN, 29 GRAY, 30 BLACK, 31 WHITE, 32 END_COLORS, 33 }; 34 35 MHDC (); 36 virtual ~MHDC (); 37 BeginClip()38 virtual void BeginClip () {;} Class()39 const char* Class () {return "MHDC";} 40 virtual void Color (int color) = 0; 41 virtual void DrawLine (int x1, int y1, int x2, int y2) = 0; 42 virtual void DrawRect (int x1, int y1, int x2, int y2) = 0; 43 virtual void DrawText (const char* p, int x, int y, bool center = false) = 0; EndClip()44 virtual void EndClip () {;} 45 virtual int GetCharHeight() = 0; GetFontSize()46 int GetFontSize () {return aFontSize;} 47 virtual int GetHeight () = 0; 48 virtual int GetStringWidth (const char* pString) = 0; 49 virtual int GetWidth () = 0; QueryLeft(int x,int y,MHPrice * p)50 virtual bool QueryLeft (int x, int y, MHPrice* p) {return false;} QueryRight(int x,int y,MHPrice * p)51 virtual bool QueryRight (int x, int y, MHPrice* p) {return false;} 52 virtual void SetBrushColor (int Color) = 0; SetFontSize(int size)53 void SetFontSize (int size) {aFontSize = size;} 54 virtual void SetPenColor (int Color) = 0; 55 56 protected: 57 int aFontSize; 58 }; 59 60 #endif 61