Subversion Repositories spk

Rev

Rev 79 | Details | Compare with Previous | 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
 
123 cycrow 20
typedef std::vector <CLCDManager*> LCD_MGR_LIST;
79 cycrow 21
typedef LCD_MGR_LIST::iterator LCD_MGR_LIST_ITER;
22
 
23
class CLCDOutput : public CLCDManager
24
{
25
 
26
public:
27
    CLCDOutput();
28
    virtual ~CLCDOutput();
29
 
30
    void AddScreen(CLCDManager* pScreen);
31
 
32
    void LockScreen(CLCDManager* pScreen);
33
    void UnlockScreen();
34
    BOOL IsLocked();
35
 
36
    BOOL IsOpened();
37
    void SetAsForeground(BOOL bSetAsForeground);
38
 
39
    void SetScreenPriority(DWORD priority);
40
    DWORD GetScreenPriority();
41
 
42
    HRESULT Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow = FALSE);
43
 
44
    // returns TRUE if a new display was enumerated
45
    BOOL HasHardwareChanged(void);
46
 
47
    // CLCDBase
48
    virtual HRESULT Initialize();
49
    virtual HRESULT Draw();
50
    virtual void Update(DWORD dwTimestamp);
51
    virtual void Shutdown(void);
52
 
53
    // CLCDManager
54
    lgLcdBitmap160x43x1 *GetLCDScreen(void);
55
    BITMAPINFO *GetBitmapInfo(void);
56
 
57
protected:
58
    void ActivateScreen(CLCDManager* pScreen);
59
    void ReadButtons();
60
    void HandleButtonState(DWORD dwButtonState, DWORD dwButton);
61
    void HandleErrorFromAPI(DWORD dwRes);
62
    void CloseAndDisconnect();
63
 
64
    virtual void OnLCDButtonDown(int nButton);
65
    virtual void OnLCDButtonUp(int nButton);
66
 
67
protected:
68
    virtual void OnScreenExpired(CLCDManager* pScreen);
69
    virtual void OnClosingDevice(int hDevice);
70
    virtual void OnDisconnecting(int hConnection);
71
 
72
protected:
73
    CLCDManager* m_pActiveScreen;
74
 
75
    // list 
76
    LCD_MGR_LIST m_LCDMgrList;
77
 
78
    void EnumerateDevices();
79
    int m_hConnection;
80
    int m_hDevice;
81
    DWORD m_nPriority;
82
    BOOL m_bLocked, m_bDisplayLocked;
83
    DWORD m_dwButtonState;
84
    BOOL m_bSetAsForeground;
85
 
86
    lgLcdConnectContext m_lcdConnectCtx;
87
};
88
 
89
#endif // !_CLCDOUTPUT_H_INCLUDED_ 
90
 
91
//** end of CLCDOutput.h *************************************************