-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatusBar.cpp
More file actions
102 lines (93 loc) · 2.63 KB
/
StatusBar.cpp
File metadata and controls
102 lines (93 loc) · 2.63 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* Copyright (C) 2011-2024 MicroSIP (http://www.microsip.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "StdAfx.h"
#include "StatusBar.h"
#include "global.h"
// StatusBar
IMPLEMENT_DYNAMIC(StatusBar, CStatusBar)
StatusBar::StatusBar()
{
CStatusBar::CStatusBar();
}
StatusBar::~StatusBar()
{
}
BEGIN_MESSAGE_MAP(StatusBar, CStatusBar)
//{{AFX_MSG_MAP(StatusBar)
ON_MESSAGE(WM_IDLEUPDATECMDUI, OnIdleUpdateCmdUI)
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
ON_WM_ERASEBKGND()
ON_WM_PAINT()
END_MESSAGE_MAP()
LRESULT StatusBar::OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam)
{
if (IsWindowVisible())
{
CFrameWnd* pParent = (CFrameWnd*)GetParent();
if (pParent)
OnUpdateCmdUI(pParent, (BOOL)wParam);
}
return 0L;
}
void StatusBar::OnLButtonUp(UINT nFlags, CPoint point)
{
}
void StatusBar::OnMouseMove(UINT nFlags, CPoint point)
{
}
// ===== DARK MODE =====
BOOL StatusBar::OnEraseBkgnd(CDC* pDC)
{
CRect rect;
GetClientRect(&rect);
pDC->FillSolidRect(&rect, RGB(20, 20, 20));
return TRUE;
}
void StatusBar::OnPaint()
{
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
dc.FillSolidRect(&rect, RGB(20, 20, 20));
dc.SetTextColor(RGB(180, 20, 90));
dc.SetBkMode(TRANSPARENT);
int nCount = GetCount();
for (int i = 0; i < nCount; i++) {
CRect paneRect;
GetItemRect(i, &paneRect);
CString text;
UINT nID, nStyle;
int nWidth;
GetPaneInfo(i, nID, nStyle, nWidth);
GetPaneText(i, text);
if (i == 0) {
// ícone
HICON hIcon = GetStatusBarCtrl().GetIcon(i);
if (hIcon) {
::DrawIconEx(dc.m_hDC, paneRect.left + 2,
paneRect.top + (paneRect.Height() - 16) / 2,
hIcon, 16, 16, 0, NULL, DI_NORMAL);
paneRect.left += 20;
}
}
dc.DrawText(text, &paneRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
}
}
// ===== FIM DARK MODE =====