summaryrefslogtreecommitdiff
path: root/widgetbutton.cpp
blob: 04ae4621406e80a0fc9e5c0f7924686b22b18471 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include <skygi/skygi.h>

#include "widgetbutton.h"

CButton::CButton() {
	Icon = NULL;
	Foreground = NULL;
	Background = NULL;
	BackgroundBlit = NULL;
	PressedDIB = NULL;
	TextColor = 0;
}

HRESULT CButton::Create(HANDLE parent, char * text, int x, int y, int width, int height, int style, unsigned int ID) {
	this->hWnd = GI_WidgetButtonCreate(parent, text, x, y, width, height, style, ID);
	this->SetText(text);
	if (this->hWnd) {
		return S_OK;
	}
	return E_HANDLE;
}

HRESULT CButton::Enable() {
	return GI_WidgetButtonEnable(this->hWnd);
}

HRESULT CButton::Disable() {
	return GI_WidgetButtonDisable(this->hWnd);
}

HRESULT CButton::OwnerDraw(char bOwnerDraw, void * pCookie) {
	return GI_WidgetButtonOwnerDraw(this->hWnd, bOwnerDraw, pCookie);
}

HRESULT CButton::SetText(char * text) {
	strncpy(this->Text, text, strlen(this->Text));
	return GI_WidgetButtonSet(this->hWnd, text);
}

char * CButton::GetText() {
	return this->Text;
}

HRESULT CButton::SetBackground(DIB * dib) {
	this->Background = dib;
	return GI_WidgetButtonSetBackground(this->hWnd, dib);
}

DIB * CButton::GetBackground() {
	return this->Background;
}

HRESULT CButton::SetBackgroundBlit(int bPressed, sBlit * pBlit) {
	this->BackgroundBlit = pBlit;
	return GI_WidgetButtonSetBackgroundBlit(this->hWnd, bPressed, pBlit);
}

sBlit * CButton::GetBackgroundBlit() {
	return this->BackgroundBlit;
}

HRESULT CButton::SetForeground(DIB * dib) {
	this->Foreground = dib;
	return GI_WidgetButtonSetDIB(this->hWnd, dib);
}

DIB * CButton::GetForeground() {
	return this->Foreground;
}

HRESULT CButton::SetIcon(s_gi_icon * icon) {
	this->Icon = icon;
	return GI_WidgetButtonSetIcon(this->hWnd, icon);
}

s_gi_icon * CButton::GetIcon() {
	return this->Icon;
}

HRESULT CButton::SetPressedDIB(DIB * dib) {
	this->PressedDIB = dib;
	return GI_WidgetButtonSetPressedDIB(this->hWnd, dib);
}

DIB * CButton::GetPressedDIB() {
	return this->PressedDIB;
}

HRESULT CButton::SetStyle(unsigned int flags) {
	return GI_WidgetButtonSetStyle(this->hWnd, flags);
}

HRESULT CButton::SetTextColor(COLOR color) {
	this->TextColor = color;
	return GI_WidgetButtonSetTextColor(this->hWnd, color);
}

COLOR CButton::GetTextColor() {
	return this->TextColor;
}

HRESULT	CButton::UseParentBackground(char use) {
	return GI_WidgetButtonUseParentBackground(this->hWnd, use);
}