-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceContext.h
49 lines (37 loc) · 1.02 KB
/
DeviceContext.h
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
#pragma once
#include "Rect.h"
#include "Size.h"
#include "Point.h"
#include <string>
#include <vector>
namespace Wex
{
class DeviceContext
{
public:
DeviceContext() = default;
DeviceContext(HDC dc);
DeviceContext(const DeviceContext& rhs) = delete;
~DeviceContext() = default;
DeviceContext& operator=(const DeviceContext& rhs) = delete;
operator HDC() const;
HGDIOBJ Select(HGDIOBJ object);
void FillRect(const RECT& rect, HBRUSH brush);
void FillSolidRect(const RECT& rect, COLORREF color);
Rect MeasureString(const std::string& text, const RECT& rect);
Size GetTextSize();
void DrawText(const std::string& text, const RECT& rect);
COLORREF SetBackColor(COLORREF color);
COLORREF GetBackColor();
COLORREF SetTextColor(COLORREF color);
COLORREF GetTextColor();
Point MoveTo(const POINT& point);
void LineTo(const POINT& point);
Point DrawLine(const std::vector<POINT>& points);
protected:
void AssertValid() const;
HDC dc = nullptr;
private:
friend class DeviceContextTest;
};
}