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 |
|
|
|
23 |
class CLCDStreamingText: public CLCDCollection
|
|
|
24 |
{
|
|
|
25 |
|
|
|
26 |
public:
|
|
|
27 |
CLCDStreamingText();
|
|
|
28 |
virtual ~CLCDStreamingText();
|
|
|
29 |
|
|
|
30 |
// CLCDBase
|
|
|
31 |
virtual HRESULT Initialize(void);
|
|
|
32 |
virtual void ResetUpdate(void);
|
|
|
33 |
virtual void Show(BOOL bShow);
|
|
|
34 |
virtual void SetOrigin(POINT pt);
|
|
|
35 |
virtual void SetOrigin(int nX, int nY);
|
|
|
36 |
|
|
|
37 |
void SetText(LPCTSTR szText);
|
242 |
cycrow |
38 |
void SetText ( const std::wstring &sszText);
|
79 |
cycrow |
39 |
void SetGapText(LPCTSTR szGapText);
|
|
|
40 |
void SetStartDelay(DWORD dwMilliseconds);
|
|
|
41 |
void SetSpeed(DWORD dwSpeed);
|
|
|
42 |
void SetScrollingStep(DWORD dwStepInPixels);
|
|
|
43 |
void SetAlignment(int nAlignment = DT_LEFT);
|
|
|
44 |
void SetFont(LOGFONT& lf);
|
|
|
45 |
void SetFontFaceName(LPCTSTR szFontName);
|
|
|
46 |
void SetFontPointSize(int nSize);
|
|
|
47 |
void SetFontWeight(int nPointSize);
|
|
|
48 |
HFONT GetFont();
|
|
|
49 |
|
|
|
50 |
enum { DEFAULT_DPI = 96, DEFAULT_POINTSIZE = 8 };
|
|
|
51 |
|
|
|
52 |
protected:
|
|
|
53 |
virtual void OnUpdate(DWORD dwTimestamp);
|
|
|
54 |
virtual void OnDraw(CLCDGfx &rGfx);
|
|
|
55 |
|
|
|
56 |
private:
|
|
|
57 |
int AddText(LPCTSTR szText);
|
|
|
58 |
void RemoveText(int nIndex);
|
|
|
59 |
void RemoveAllText();
|
|
|
60 |
|
|
|
61 |
private:
|
|
|
62 |
BOOL RecalcTextBoxes(CLCDGfx &rGfx);
|
|
|
63 |
void RecalcTextBoxOrigins();
|
|
|
64 |
void ApplyOrigins(int nOffset);
|
|
|
65 |
|
|
|
66 |
enum eSCROLL_STATES { STATE_DELAY, STATE_SCROLL};
|
|
|
67 |
|
|
|
68 |
DWORD m_dwEllapsedTime; // ellapsed time in state
|
|
|
69 |
DWORD m_dwStartDelay; // milliseconds
|
|
|
70 |
DWORD m_dwSpeed; // pixels/second
|
|
|
71 |
DWORD m_dwStepInPixels; // Number of pixels to shift
|
|
|
72 |
DWORD m_dwLastUpdate; // milliseconds
|
|
|
73 |
|
|
|
74 |
eSCROLL_STATES m_eState;
|
|
|
75 |
BOOL m_bRecalcExtent;
|
|
|
76 |
|
|
|
77 |
CLCDText* m_pQueueHead;
|
|
|
78 |
|
|
|
79 |
#ifdef UNICODE
|
|
|
80 |
std::wstring m_sText;
|
|
|
81 |
std::wstring m_sGapText;
|
|
|
82 |
#else
|
|
|
83 |
std::string m_sText;
|
|
|
84 |
std::string m_sGapText;
|
|
|
85 |
#endif
|
|
|
86 |
|
|
|
87 |
HFONT m_hFont;
|
|
|
88 |
int m_nTextAlignment;
|
|
|
89 |
float m_fFractDistance;
|
|
|
90 |
};
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
#endif // !_LCDSTREAMINGTEXT_H_INCLUDED_
|
|
|
94 |
|
|
|
95 |
//** end of LCDStreamingText.h *******************************************
|