| 79 | cycrow | 1 | //************************************************************************
 | 
        
           |  |  | 2 | //
 | 
        
           |  |  | 3 | // LCDStreamingText.h
 | 
        
           |  |  | 4 | //
 | 
        
           |  |  | 5 | // The CLCDStreamingText class draws streaming text onto the LCD.
 | 
        
           |  |  | 6 | // Streaming text is a single line of text that is repeatedly streamed
 | 
        
           |  |  | 7 | // horizontally across the LCD.
 | 
        
           |  |  | 8 | // 
 | 
        
           |  |  | 9 | // Logitech LCD SDK
 | 
        
           |  |  | 10 | //
 | 
        
           |  |  | 11 | // Copyright 2005 Logitech Inc.
 | 
        
           |  |  | 12 | //************************************************************************
 | 
        
           |  |  | 13 |   | 
        
           |  |  | 14 | #ifndef _LCDSTREAMINGTEXT_H_INCLUDED_ 
 | 
        
           |  |  | 15 | #define _LCDSTREAMINGTEXT_H_INCLUDED_ 
 | 
        
           |  |  | 16 |   | 
        
           |  |  | 17 | #include "LCDBase.h"
 | 
        
           |  |  | 18 | #include "LCDCollection.h"
 | 
        
           |  |  | 19 | #include "LCDText.h"
 | 
        
           |  |  | 20 |   | 
        
           |  |  | 21 | #include <string>
 | 
        
           |  |  | 22 | using namespace std;
 | 
        
           |  |  | 23 |   | 
        
           |  |  | 24 | class CLCDStreamingText: public CLCDCollection
 | 
        
           |  |  | 25 | {
 | 
        
           |  |  | 26 |   | 
        
           |  |  | 27 | public:
 | 
        
           |  |  | 28 |     CLCDStreamingText();
 | 
        
           |  |  | 29 |     virtual ~CLCDStreamingText();
 | 
        
           |  |  | 30 |   | 
        
           |  |  | 31 |     // CLCDBase
 | 
        
           |  |  | 32 |     virtual HRESULT Initialize(void);
 | 
        
           |  |  | 33 |     virtual void ResetUpdate(void);
 | 
        
           |  |  | 34 |     virtual void Show(BOOL bShow);
 | 
        
           |  |  | 35 |     virtual void SetOrigin(POINT pt);
 | 
        
           |  |  | 36 |     virtual void SetOrigin(int nX, int nY);
 | 
        
           |  |  | 37 |   | 
        
           |  |  | 38 |     void SetText(LPCTSTR szText);
 | 
        
           |  |  | 39 |     void SetText ( const std::string &sszText);
 | 
        
           |  |  | 40 |     void SetGapText(LPCTSTR szGapText);
 | 
        
           |  |  | 41 |     void SetStartDelay(DWORD dwMilliseconds);
 | 
        
           |  |  | 42 |     void SetSpeed(DWORD dwSpeed);
 | 
        
           |  |  | 43 | 	void SetScrollingStep(DWORD dwStepInPixels);
 | 
        
           |  |  | 44 |     void SetAlignment(int nAlignment = DT_LEFT);
 | 
        
           |  |  | 45 |     void SetFont(LOGFONT& lf);
 | 
        
           |  |  | 46 |     void SetFontFaceName(LPCTSTR szFontName);
 | 
        
           |  |  | 47 |     void SetFontPointSize(int nSize);
 | 
        
           |  |  | 48 |     void SetFontWeight(int nPointSize);
 | 
        
           |  |  | 49 |     HFONT GetFont();
 | 
        
           |  |  | 50 |   | 
        
           |  |  | 51 |     enum { DEFAULT_DPI = 96, DEFAULT_POINTSIZE = 8 };
 | 
        
           |  |  | 52 |   | 
        
           |  |  | 53 | protected:
 | 
        
           |  |  | 54 |     virtual void OnUpdate(DWORD dwTimestamp);
 | 
        
           |  |  | 55 |     virtual void OnDraw(CLCDGfx &rGfx);
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 | private:
 | 
        
           |  |  | 58 |     int AddText(LPCTSTR szText);
 | 
        
           |  |  | 59 |     void RemoveText(int nIndex);
 | 
        
           |  |  | 60 |     void RemoveAllText();
 | 
        
           |  |  | 61 |   | 
        
           |  |  | 62 | private:
 | 
        
           |  |  | 63 |     BOOL RecalcTextBoxes(CLCDGfx &rGfx);
 | 
        
           |  |  | 64 |     void RecalcTextBoxOrigins();
 | 
        
           |  |  | 65 |     void ApplyOrigins(int nOffset);
 | 
        
           |  |  | 66 |   | 
        
           |  |  | 67 |     enum eSCROLL_STATES { STATE_DELAY, STATE_SCROLL};
 | 
        
           |  |  | 68 |   | 
        
           |  |  | 69 |     DWORD m_dwEllapsedTime; // ellapsed time in state
 | 
        
           |  |  | 70 |     DWORD m_dwStartDelay;   // milliseconds
 | 
        
           |  |  | 71 |     DWORD m_dwSpeed;        // pixels/second
 | 
        
           |  |  | 72 | 	DWORD m_dwStepInPixels; // Number of pixels to shift
 | 
        
           |  |  | 73 |     DWORD m_dwLastUpdate;   // milliseconds
 | 
        
           |  |  | 74 |   | 
        
           |  |  | 75 |     eSCROLL_STATES m_eState;
 | 
        
           |  |  | 76 |     BOOL m_bRecalcExtent;
 | 
        
           |  |  | 77 |   | 
        
           |  |  | 78 |     CLCDText* m_pQueueHead;
 | 
        
           |  |  | 79 |   | 
        
           |  |  | 80 | #ifdef UNICODE
 | 
        
           |  |  | 81 |     std::wstring m_sText;
 | 
        
           |  |  | 82 |     std::wstring m_sGapText;
 | 
        
           |  |  | 83 | #else
 | 
        
           |  |  | 84 |     std::string m_sText;
 | 
        
           |  |  | 85 |     std::string m_sGapText;
 | 
        
           |  |  | 86 | #endif
 | 
        
           |  |  | 87 |   | 
        
           |  |  | 88 |     HFONT m_hFont;
 | 
        
           |  |  | 89 |     int m_nTextAlignment;
 | 
        
           |  |  | 90 |     float m_fFractDistance;
 | 
        
           |  |  | 91 | };
 | 
        
           |  |  | 92 |   | 
        
           |  |  | 93 |   | 
        
           |  |  | 94 | #endif // !_LCDSTREAMINGTEXT_H_INCLUDED_ 
 | 
        
           |  |  | 95 |   | 
        
           |  |  | 96 | //** end of LCDStreamingText.h *******************************************
 |