Files
envi-code/SourceCode/Code2026/tg_shs/inc/TArch/CaptionButton.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

98 lines
2.8 KiB
C++

// CaptionButton.h: Schnittstelle f黵 die Klasse CCaptionButton.
//
//////////////////////////////////////////////////////////////////////
/*!
\class CCaptionButton
* \date 04/2004
* \author <b> Thomas Latuske </b>
////////////////////////////////////////////////////////////////////
*/
#include <afxtempl.h>
#include "windows.h"
#ifndef DECLARE_USER_MESSAGE
#define DECLARE_USER_MESSAGE(name) \
const UINT name = ::RegisterWindowMessage(name##_MSG);
#endif
#define WMU_HITCAPBUTTON_MSG _T("WMU_HITCAPBUTTON--{46CB2AA1-EB38-48ab-A4EC-D7C1D5D15648}")
#if !defined(AFX_CAPTIONBUTTON_H__8579D0A0_FD12_4476_8235_526DCF123FD9__INCLUDED_)
#define AFX_CAPTIONBUTTON_H__8579D0A0_FD12_4476_8235_526DCF123FD9__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//#define WMU_HITCAPBUTTON WM_APP + 15
extern const UINT WMU_HITCAPBUTTON;
class TARCH_EXP CCapToolTip:public CToolTipCtrl
{
public:
BOOL AddToolTip( UINT nID, LPRECT lpRect, LPCTSTR lpszText );
};
class CCapBtnWnd;
class TARCH_EXP CCaptionButton :public CWnd
{
public:
CCapBtnWnd *m_pParent;
CString m_sTip;
CRect m_rc; // caption/button rectangle
UINT m_idBmpUp; // bitmap ID
UINT m_idBmpDown; // bitmap ID
UINT m_uiBtnCount; // No. of buttons
BOOL m_bCheckBtn; // check button TRUE/FALSE
BOOL m_bBtnChecked; // button is checked TRUE/FALSE
BOOL m_bHighLight; // mouse hovers over a button TRUE/FALSE
BOOL m_bEnable; // button is enabled TRUE/FALSE
COLORADJUSTMENT *m_CAdj; // structure to adjust the color of the bitmap
TRACKMOUSEEVENT m_TME;
public:
CCaptionButton(const TCHAR*sTip,UINT ID_Bmp_up, UINT ID_Bmp_down, BOOL bCheckBtn/*= FALSE*/);
virtual ~CCaptionButton();
void SetChecked(bool bCheck){m_bBtnChecked=bCheck;}//ok
UINT GetIndex()const{return m_uiBtnCount;}
void SetIndex(UINT i){m_uiBtnCount=i;}//ok
void SetParent(CCapBtnWnd*pParent);
BOOL EnableButton(BOOL bEnable);
HWND GetHWnd()const;
void CalcCapRect();
BOOL PaintBmpCheckBtn();
BOOL ButtonHitTest( CPoint point, BOOL bHover = FALSE);
};
class TARCH_EXP CCapBtnWnd
{
protected:
HWND m_hWndCap; // Handle of the window that receives the button
WNDPROC m_pWndProcOld;
BOOL m_bActive; // state of the window/dialogue
DualList<CCaptionButton*> m_lstBtn;
public:
CCapToolTip m_ctrlTip;
public:
CCapBtnWnd();
virtual ~CCapBtnWnd();
HWND GetHWnd()const{return m_hWndCap;}//ok
void Hook(HWND hWnd);
void AddCapBtn(CCaptionButton*pBtn);
bool IsHooked()const{return m_pWndProcOld!=NULL;}//ok
void UnHook();
BOOL IsWindowActive(BOOL &bActive);
LRESULT HookProc(UINT message, WPARAM wParam, LPARAM lParam);
};
inline void CCaptionButton::SetParent(CCapBtnWnd*pParent){m_pParent=pParent;}//ok
inline HWND CCaptionButton::GetHWnd()const{return m_pParent->GetHWnd();}//ok
#endif // !defined(AFX_CAPTIONBUTTON_H__8579D0A0_FD12_4476_8235_526DCF123FD9__INCLUDED_)