summaryrefslogtreecommitdiff
path: root/widgetbutton.h
blob: 259c2664d39f434f0fa4ac54855054503bc6e7b6 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef WIDGETBUTTON_H
#define WIDGETBUTTON_H

#include <skygi/skygi.h>

#include "widget.h"

//! A Button class

class CButton: public CWidget {
	public:
		/*! Constructor */
		CButton();
		
		/*!
			Create Button
			
			\param parent HANDLE of the parent window on which to draw
			\param name Name of the Button
			\param x Top left x coordinate
			\param y Top left y coordinate
			\param w Form width
			\param h Form height
			\param style Style flags\n
			WGF_NO_BORDER: Button has no border\n
			WGF_BORDER_ON_MOUSE_OVER: Buttons has border on mouseover
			\param ID ID sent to parent when Button is pressed (MSG_COMMAND)
			
			\return Success: S_OK\n
			Failure: E_HANDLE
		*/
		HRESULT	Create(HANDLE parent, char * name, int x, int y, int w, int h, int style, unsigned int ID);
		
		/*!
			Enable Button
		*/
		HRESULT	Enable();
		
		/*!
			Disable Button
		*/
		HRESULT	Disable();
		
		HRESULT	OwnerDraw(char bOwnerDraw, void * pCookie);
		
		/*!
			Change Text on Button
			
			\param text New text to display
		*/
		HRESULT	SetText(char * text);
		
		/*!
			Get Text on Button
			
			\return Text
		*/
		char *	GetText();
		
		/*!
			Set background bitmap
			
			\param dib Bitmap to draw
		*/
		HRESULT	SetBackground(DIB * dib);
		
		/*!
			Get background bitmap
			
			\return Pointer to background bitmap
		*/
		DIB *	GetBackground();
		
		HRESULT	SetBackgroundBlit(int bPressed, sBlit * pBlit);
		sBlit *	GetBackgroundBlit();
		
		/*!
			Set foreground bitmap
			
			\param dib Bitmap to draw
		*/
		HRESULT	SetForeground(DIB * dib);
		
		/*!
			Get foreground bitmap
			
			\return Pointer to foreground bitmap
		*/
		DIB *	GetForeground();
		
		
		HRESULT	SetIcon(s_gi_icon * icon);
		s_gi_icon *	GetIcon();
		
		/*!
			Set bitmap to be drawn when Button is clicked
			
			\param dib Bitmap to draw when Button is clicked
		*/
		HRESULT	SetPressedDIB(DIB * dib);
		
		/*!
			Get bitmap to be drawn when Button is clicked
			
			\return Pointer to bitmap
		*/
		DIB *	GetPressedDIB();
		
		
		HRESULT	SetStyle(unsigned int flags);
		HRESULT	SetTextColor(COLOR color);
		COLOR	GetTextColor();
		HRESULT	UseParentBackground(char use);
		friend class CTooltip;
	protected:
		char Text[64];
		s_gi_icon * Icon;
		DIB * Foreground;
		DIB * Background;
		sBlit * BackgroundBlit;
		DIB * PressedDIB;
		COLOR TextColor;
};

#endif