-
Notifications
You must be signed in to change notification settings - Fork 35
/
label.h
50 lines (41 loc) · 1.3 KB
/
label.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
49
50
/**
* Part of WinLamb - Win32 API Lambda Library
* https://github.com/rodrigocfd/winlamb
* Copyright 2017-present Rodrigo Cesar de Freitas Dias
* This library is released under the MIT License
*/
#pragma once
#include "internals/base_text_pubm.h"
#include "internals/base_native_ctrl_pubm.h"
#include "internals/styler.h"
#include "wnd.h"
namespace wl {
// Wrapper to native label control.
class label final :
public wnd,
public _wli::base_native_ctrl_pubm<label>,
public _wli::base_text_pubm<label>
{
private:
HWND _hWnd = nullptr;
_wli::base_native_ctrl _baseNativeCtrl{_hWnd};
public:
// Wraps window style changes done by Get/SetWindowLongPtr.
_wli::styler<label> style{this};
label() noexcept :
wnd(_hWnd), base_native_ctrl_pubm(_baseNativeCtrl), base_text_pubm(_hWnd) { }
label(label&&) = default;
label& operator=(label&&) = default; // movable only
label& create(HWND hParent, int ctrlId,
const wchar_t* caption, POINT pos, SIZE size)
{
this->_baseNativeCtrl.create(hParent, ctrlId, caption, pos, size, L"Static");
return *this;
}
label& create(const wnd* parent, int ctrlId,
const wchar_t* caption, POINT pos, SIZE size)
{
return this->create(parent->hwnd(), ctrlId, caption, pos, size);
}
};
}//namespace wl