summaryrefslogtreecommitdiff
path: root/plugins/HistoryStats/src/bandctrl.cpp
blob: 2240b1f55c836d2d56b399e9c192f75845976c44 (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
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
#include "stdafx.h"
#include "bandctrl.h"

/*
 * BandCtrl
 */

void BandCtrl::setLayout(int nLayout)
{
	SendMessage(m_hBandWnd, BCM_SETLAYOUT, nLayout, 0);
}

HANDLE BandCtrl::addButton(DWORD dwFlags, HICON hIcon, INT_PTR dwData, const wchar_t *szTooltip, const wchar_t *szText)
{
	BCBUTTON bcb;

	bcb.dwFlags = dwFlags | BCF_ICON | BCF_DATA | (szTooltip ? BCF_TOOLTIP : 0) | (szText ? BCF_TEXT : 0);
	bcb.hIcon = hIcon;
	bcb.dwData = dwData;
	bcb.m_szTooltip = szTooltip;
	bcb.m_szText = szText;

	return reinterpret_cast<HANDLE>(SendMessage(m_hBandWnd, BCM_ADDBUTTON, 0, reinterpret_cast<LPARAM>(&bcb)));
}

bool BandCtrl::isButtonChecked(HANDLE hButton)
{
	return bool_(SendMessage(m_hBandWnd, BCM_ISBUTTONCHECKED, reinterpret_cast<WPARAM>(hButton), 0));
}

void BandCtrl::checkButton(HANDLE hButton, bool bCheck)
{
	SendMessage(m_hBandWnd, BCM_CHECKBUTTON, reinterpret_cast<WPARAM>(hButton), BOOL_(bCheck));
}

DWORD BandCtrl::getButtonData(HANDLE hButton)
{
	return SendMessage(m_hBandWnd, BCM_GETBUTTONDATA, reinterpret_cast<WPARAM>(hButton), 0);
}

void BandCtrl::setButtonData(HANDLE hButton, INT_PTR dwData)
{
	SendMessage(m_hBandWnd, BCM_SETBUTTONDATA, reinterpret_cast<WPARAM>(hButton), dwData);
}

bool BandCtrl::isButtonVisisble(HANDLE hButton)
{
	return bool_(SendMessage(m_hBandWnd, BCM_ISBUTTONVISIBLE, reinterpret_cast<WPARAM>(hButton), 0));
}

void BandCtrl::showButton(HANDLE hButton, bool bShow)
{
	SendMessage(m_hBandWnd, BCM_SHOWBUTTON, reinterpret_cast<WPARAM>(hButton), BOOL_(bShow));
}

RECT BandCtrl::getButtonRect(HANDLE hButton)
{
	RECT rButton;

	SendMessage(m_hBandWnd, BCM_GETBUTTONRECT, reinterpret_cast<WPARAM>(hButton), reinterpret_cast<LPARAM>(&rButton));

	return rButton;
}

bool BandCtrl::isButtonEnabled(HANDLE hButton)
{
	return bool_(SendMessage(m_hBandWnd, BCM_ISBUTTONENABLED, reinterpret_cast<WPARAM>(hButton), 0));
}

void BandCtrl::enableButton(HANDLE hButton, bool bEnable)
{
	SendMessage(m_hBandWnd, BCM_ENABLEBUTTON, reinterpret_cast<WPARAM>(hButton), BOOL_(bEnable));
}