forked from mpc-hc/mpc-hc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLCDIcon.cpp
More file actions
86 lines (69 loc) · 2.37 KB
/
LCDIcon.cpp
File metadata and controls
86 lines (69 loc) · 2.37 KB
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
//************************************************************************
// The Logitech LCD SDK, including all acompanying documentation,
// is protected by intellectual property laws. All use of the Logitech
// LCD SDK is subject to the License Agreement found in the
// "Logitech LCD SDK License Agreement" file and in the Reference Manual.
// All rights not expressly granted by Logitech are reserved.
//************************************************************************
//************************************************************************
//
// LCDIcon.cpp
//
// The CLCDIcon class draws icons onto the lcd.
//
// Logitech LCD SDK
//
// Copyright 2010 Logitech Inc.
//************************************************************************
#include "LCDUI.h"
//************************************************************************
//
// CLCDIcon::CLCDIcon
//
//************************************************************************
CLCDIcon::CLCDIcon(void)
: m_hIcon(NULL),
m_nIconWidth(16),
m_nIconHeight(16)
{
}
//************************************************************************
//
// CLCDIcon::CLCDIcon
//
//************************************************************************
CLCDIcon::~CLCDIcon(void)
{
}
//************************************************************************
//
// CLCDIcon::SetIcon
//
//************************************************************************
void CLCDIcon::SetIcon(HICON hIcon, int nWidth /* = 16 */, int nHeight /* = 16 */)
{
m_hIcon = hIcon;
m_nIconWidth = nWidth;
m_nIconHeight = nHeight;
}
//************************************************************************
//
// CLCDIcon::OnDraw
//
//************************************************************************
void CLCDIcon::OnDraw(CLCDGfxBase &rGfx)
{
if (m_hIcon)
{
int nOldBkMode = SetBkMode(rGfx.GetHDC(), TRANSPARENT);
DrawIconEx(rGfx.GetHDC(), 0, 0, m_hIcon,
m_nIconWidth, m_nIconHeight, 0, NULL, DI_NORMAL);
if (m_bInverted)
{
RECT rBoundary = { 0, 0, m_nIconWidth, m_nIconHeight};
InvertRect(rGfx.GetHDC(), &rBoundary);
}
SetBkMode(rGfx.GetHDC(), nOldBkMode);
}
}
//** end of LCDIcon.cpp **************************************************