-
Notifications
You must be signed in to change notification settings - Fork 35
/
button.h
53 lines (44 loc) · 1.43 KB
/
button.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
51
52
53
/**
* 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_focus_pubm.h"
#include "internals/base_native_ctrl_pubm.h"
#include "internals/base_text_pubm.h"
#include "internals/styler.h"
#include "wnd.h"
namespace wl {
// Wrapper to native button control.
class button final :
public wnd,
public _wli::base_native_ctrl_pubm<button>,
public _wli::base_focus_pubm<button>,
public _wli::base_text_pubm<button>
{
private:
HWND _hWnd = nullptr;
_wli::base_native_ctrl _baseNativeCtrl{_hWnd};
public:
// Wraps window style changes done by Get/SetWindowLongPtr.
_wli::styler<button> style{this};
button() noexcept :
wnd(_hWnd), base_native_ctrl_pubm(_baseNativeCtrl),
base_focus_pubm(_hWnd), base_text_pubm(_hWnd) { }
button(button&&) = default;
button& operator=(button&&) = default; // movable only
button& create(HWND hParent, int ctrlId,
const wchar_t* caption, POINT pos, SIZE size = {75, 23})
{
this->_baseNativeCtrl.create(hParent, ctrlId, caption, pos, size, L"Button");
return *this;
}
button& create(const wnd* parent, int ctrlId,
const wchar_t* caption, POINT pos, SIZE size = {75, 23})
{
return this->create(parent->hwnd(), ctrlId, caption, pos, size);
}
};
}//namespace wl