summaryrefslogtreecommitdiffstats
path: root/Examples/WhisperDesktop/CircleIndicator.h
blob: 492524d75a6afb6b52f7e55dbfe9ac919fb43c2c (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
#pragma once
#include "Utils/miscUtils.h"
#include "Utils/WTL/atlcrack.h"

// This control renders a black circle, and in the active state, the circle is filled with a bright color.
class CircleIndicator: public CWindowImpl<CircleIndicator>
{
public:
	static ATL::CWndClassInfo& GetWndClassInfo();

	BEGIN_MSG_MAP( CircleIndicator )
		MSG_WM_PAINT( onPaint )
		MSG_WM_DESTROY( onDestroy )
	END_MSG_MAP()

	// Class registration
	static HRESULT registerClass();

	void setActive( bool nowActive );

	void setActiveColor( uint32_t col )
	{
		activeColor = col;
	}
	CircleIndicator();

private:
	bool isActive = false;
	uint32_t activeColor;
	int fontHeight = 0;
	CFont font;
	HRESULT createFont( int height );

	void onDestroy();
	void onPaint( CDCHandle dc );
};