97 lines
2.4 KiB
C++
97 lines
2.4 KiB
C++
#pragma once
|
|
|
|
#define MAX_STATUS_COUNT 5
|
|
|
|
#define TOUCH_BTN_LINE_COLOR RGB(10, 10, 10)
|
|
#define TOUCH_BTN_LINE_COLOR_DISABLE RGB(103, 103, 103)
|
|
#define TOUCH_BTN_GENERAL_COLOR_UP RGB(233, 233, 233)
|
|
#define TOUCH_BTN_GENERAL_COLOR_DOWN RGB(223, 223, 223)
|
|
#define TOUCH_BTN_GROUP_COLOR_DISABLE RGB(245, 245, 245)
|
|
#define TOUCH_BTN_GENERAL_COLOR_DISABLE RGB(90, 90, 90)
|
|
//#define TOUCH_BTN_PRESS_COLOR RGB(130, 255, 130)
|
|
#define TOUCH_BTN_PRESS_COLOR RGB(57, 119, 206)
|
|
#define TOUCH_BTN_ONAIR_COLOR RGB(200, 200, 0)
|
|
#define TOUCH_BTN_CHECK_BG_COLOR RGB(254, 254, 254)
|
|
|
|
#define TOUCH_BTN_PRESS_FONT_COLOR RGB(255, 255, 255)
|
|
#define TOUCH_BTN_GENERAL_FONT_COLOR RGB(0, 0, 0)
|
|
|
|
#define TOUCH_BTN_TYPE_GROUP 1
|
|
#define TOUCH_BTN_TYPE_LEVEL2 2
|
|
#define TOUCH_BTN_TYPE_LEVEL3 3
|
|
#define TOUCH_BTN_TYPE_LEVEL4 4
|
|
|
|
#define TOUCH_BTN_FLAG_STATE 0x0001
|
|
#define TOUCH_BTN_FLAG_CHECKABLE 0x0002
|
|
|
|
#define TOUCH_BTN_LONG_PRESS_MODE_GROUPING 1
|
|
#define TOUCH_BTN_LONG_PRESS_MODE_PRESSING 2
|
|
|
|
// CTouchButton
|
|
|
|
class CTouchButton : public CWnd
|
|
{
|
|
DECLARE_DYNAMIC(CTouchButton)
|
|
|
|
public:
|
|
static CxImage m_ciStatus[MAX_STATUS_COUNT]; // 0 : FIRE, 1 : RESQUE, 2 : EMERGENCY, 3 : MIC, 4 : TOUCHED
|
|
static CxImage m_ciCheck;
|
|
static BOOL m_bGlobalInit;
|
|
static INT32 m_iLongPressMode;
|
|
INT32 m_width;
|
|
INT32 m_height;
|
|
INT32 m_buttonUiStyle;
|
|
CDC* m_pMemDC;
|
|
CBitmap* m_pDCBitmap;
|
|
CPen* m_pDidLinePen;
|
|
CBrush* m_pFillBrush;
|
|
CFont* m_pFont;
|
|
CFont* m_pFontSub;
|
|
|
|
BOOL m_bCreated;
|
|
BOOL m_bVisible;
|
|
UINT64 m_pressTime;
|
|
BOOL m_bPressed;
|
|
BOOL m_bEnabled;
|
|
BOOL m_bChecked;
|
|
CString m_strName;
|
|
INT32 m_btnId;
|
|
UINT m_uiPressMessage;
|
|
INT32 m_iBtnType;
|
|
INT32 m_iBtnFlag;
|
|
BOOL m_bPressable;
|
|
|
|
INT32 m_iUnderNumber;
|
|
|
|
BOOL m_bStatus[MAX_STATUS_COUNT];
|
|
|
|
CTouchButton();
|
|
virtual ~CTouchButton();
|
|
|
|
void initialize(int x, int y, int total_width, int total_height, int ico_width, int ico_height, int id, CWnd *pParent = NULL);
|
|
void SetPressState(BOOL bPress) {
|
|
BOOL prevState = m_bPressed;
|
|
if(!m_bPressable)
|
|
return;
|
|
|
|
m_bPressed = bPress;
|
|
if(m_bPressed != prevState)
|
|
Invalidate(false);
|
|
}
|
|
|
|
BOOL isEnableButton();
|
|
|
|
protected:
|
|
DECLARE_MESSAGE_MAP()
|
|
public:
|
|
afx_msg void OnPaint();
|
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
|
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
|
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
|
};
|
|
|
|
|