-
Notifications
You must be signed in to change notification settings - Fork 0
/
button.h
49 lines (35 loc) · 1.1 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
#pragma once
#include "bitmap.h"
// Button
enum ButtonState {
BUTTON_STATE_NORMAL,
BUTTON_STATE_DOWN,
BUTTON_STATE_OVER,
};
class ButtonStyle {
public:
COLORREF borderColor;
COLORREF bgColor;
COLORREF textColor;
Bitmap bitmap;
ButtonStyle() : borderColor(CLR_NONE), bgColor(RGB(255, 255, 255)), textColor(RGB(0, 0, 0)) {}
ButtonStyle(COLORREF _bgColor, COLORREF _textColor, const Bitmap &_bitmap, COLORREF _borderColor = CLR_NONE)
: borderColor(_borderColor), bgColor(_bgColor), textColor(_textColor), bitmap(_bitmap) {}
ButtonStyle(COLORREF _bgColor, COLORREF _textColor, COLORREF _borderColor = CLR_NONE)
: borderColor(_borderColor), bgColor(_bgColor), textColor(_textColor) {}
};
class Button : public CButton {
DECLARE_DYNAMIC(Button)
public:
Button();
virtual ~Button();
void SetStyle(ButtonState state, const ButtonStyle &style);
protected:
ButtonStyle styles_[3];
bool mouseOn_;
DECLARE_MESSAGE_MAP()
virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
public:
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnMouseLeave();
};