Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LCDOutput.h « LCDUI « ui « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e5ca106fa6b6603e5d1d7bc753a2ae0422ec93c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//************************************************************************
//
// LCDOutput.h
//
// The CLCDOutput class manages LCD hardware enumeration and screen
// management.
//
// Logitech LCD SDK
//
// Copyright 2005 Logitech Inc.
//************************************************************************

#ifndef _CLCDOUTPUT_H_INCLUDED_
#define _CLCDOUTPUT_H_INCLUDED_

#include "LCDManager.h"
#include <lglcd/lglcd.h>
#include <vector>

using namespace std;

typedef vector <CLCDManager*> LCD_MGR_LIST;
typedef LCD_MGR_LIST::iterator LCD_MGR_LIST_ITER;

class CLCDOutput : public CLCDManager
{

public:
    CLCDOutput();
    virtual ~CLCDOutput();

    void AddScreen(CLCDManager* pScreen);

    void LockScreen(CLCDManager* pScreen);
    void UnlockScreen();
    BOOL IsLocked();

    BOOL IsOpened();
    void SetAsForeground(BOOL bSetAsForeground);
    BOOL AnyDeviceOfThisFamilyPresent(DWORD dwDeviceFamilyWanted, DWORD dwReserved1);
    void SetDeviceFamiliesSupported(DWORD dwDeviceFamiliesSupported, DWORD dwReserved1);

    void SetScreenPriority(DWORD priority);
    DWORD GetScreenPriority();

    INT GetDeviceHandle();

    HRESULT Initialize(lgLcdConnectContext* pContext, BOOL bUseWindow = FALSE);
    HRESULT Initialize(lgLcdConnectContextEx* pContextEx, BOOL bUseWindow = FALSE);

    // returns TRUE if a new display was enumerated
    BOOL HasHardwareChanged(void);

    // CLCDBase
    virtual HRESULT Initialize();
    virtual HRESULT Draw();
    virtual void Update(DWORD dwTimestamp);
    virtual void Shutdown(void);

    // CLCDManager
    lgLcdBitmap160x43x1 *GetLCDScreen(void);
    BITMAPINFO *GetBitmapInfo(void);

protected:
    void ActivateScreen(CLCDManager* pScreen);
    void ReadButtons();
    void HandleButtonState(DWORD dwButtonState, DWORD dwButton);
    void HandleErrorFromAPI(DWORD dwRes);
    void CloseAndDisconnect();

    virtual void OnLCDButtonDown(int nButton);
    virtual void OnLCDButtonUp(int nButton);

protected:
    virtual void OnScreenExpired(CLCDManager* pScreen);
    virtual void OnClosingDevice(int hDevice);
    virtual void OnDisconnecting(int hConnection);

protected:
    BOOL DoesBitmapNeedUpdate(lgLcdBitmap160x43x1* pCurrentBitmap);
    void ClearBitmap(lgLcdBitmap160x43x1* pCurrentBitmap);
    lgLcdBitmap160x43x1* m_pLastBitmap;
    BOOL m_bPriorityHasChanged;

protected:
    CLCDManager* m_pActiveScreen;

    // list
    LCD_MGR_LIST m_LCDMgrList;

    void EnumerateDevices();
    int m_hConnection;
    int m_hDevice;
    DWORD m_nPriority;
    BOOL m_bLocked, m_bDisplayLocked;
    DWORD m_dwButtonState;
    BOOL m_bSetAsForeground;

//    lgLcdConnectContext m_lcdConnectCtx;
    lgLcdConnectContextEx m_lcdConnectCtxEx;
    DWORD   m_dwDeviceFamiliesSupported;
    DWORD   m_dwDeviceFamiliesSupportedReserved1;
};

#endif // !_CLCDOUTPUT_H_INCLUDED_ 

//** end of CLCDOutput.h *************************************************