Subversion Repositories spk

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
79 cycrow 1
//************************************************************************
2
//
3
// LCDOutput.h
4
//
5
// The CLCDOutput class manages LCD hardware enumeration and screen
6
// management.
7
// 
8
// Logitech LCD SDK
9
//
10
// Copyright 2005 Logitech Inc.
11
//************************************************************************
12
 
13
#ifndef _CLCDOUTPUT_H_INCLUDED_ 
14
#define _CLCDOUTPUT_H_INCLUDED_ 
15
 
16
#include "LCDManager.h"
17
#include "lglcd.h"
18
#include "vector"
19
 
20
using namespace std;
21
 
22
typedef vector <CLCDManager*> LCD_MGR_LIST;
23
typedef LCD_MGR_LIST::iterator LCD_MGR_LIST_ITER;
24
 
25
class CLCDOutput : public CLCDManager
26
{
27
 
28
public:
29
    CLCDOutput();
30
    virtual ~CLCDOutput();
31
 
32
    void AddScreen(CLCDManager* pScreen);
33
 
34
    void LockScreen(CLCDManager* pScreen);
35
    void UnlockScreen();
36
    BOOL IsLocked();
37
 
38
    BOOL IsOpened();
39
    void SetAsForeground(BOOL bSetAsForeground);
40
 
41
    void SetScreenPriority(DWORD priority);
42
    DWORD GetScreenPriority();
43
 
44
    HRESULT Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow = FALSE);
45
 
46
    // returns TRUE if a new display was enumerated
47
    BOOL HasHardwareChanged(void);
48
 
49
    // CLCDBase
50
    virtual HRESULT Initialize();
51
    virtual HRESULT Draw();
52
    virtual void Update(DWORD dwTimestamp);
53
    virtual void Shutdown(void);
54
 
55
    // CLCDManager
56
    lgLcdBitmap160x43x1 *GetLCDScreen(void);
57
    BITMAPINFO *GetBitmapInfo(void);
58
 
59
protected:
60
    void ActivateScreen(CLCDManager* pScreen);
61
    void ReadButtons();
62
    void HandleButtonState(DWORD dwButtonState, DWORD dwButton);
63
    void HandleErrorFromAPI(DWORD dwRes);
64
    void CloseAndDisconnect();
65
 
66
    virtual void OnLCDButtonDown(int nButton);
67
    virtual void OnLCDButtonUp(int nButton);
68
 
69
protected:
70
    virtual void OnScreenExpired(CLCDManager* pScreen);
71
    virtual void OnClosingDevice(int hDevice);
72
    virtual void OnDisconnecting(int hConnection);
73
 
74
protected:
75
    CLCDManager* m_pActiveScreen;
76
 
77
    // list 
78
    LCD_MGR_LIST m_LCDMgrList;
79
 
80
    void EnumerateDevices();
81
    int m_hConnection;
82
    int m_hDevice;
83
    DWORD m_nPriority;
84
    BOOL m_bLocked, m_bDisplayLocked;
85
    DWORD m_dwButtonState;
86
    BOOL m_bSetAsForeground;
87
 
88
    lgLcdConnectContext m_lcdConnectCtx;
89
};
90
 
91
#endif // !_CLCDOUTPUT_H_INCLUDED_ 
92
 
93
//** end of CLCDOutput.h *************************************************