#if !defined(AFX_TOOLBAREXCTRL_H__0223C89F_6CAA_4C80_BDF9_3672B21CD2D1__INCLUDED_)
#define AFX_TOOLBAREXCTRL_H__0223C89F_6CAA_4C80_BDF9_3672B21CD2D1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
#include <afxtempl.h>
#define BT_EX_ENABLED 1
#define BT_EX_DISABLED 0
#define BT_EX_HOT 2
#define BT_EX_BUTTON 1
#define BT_EX_SEPARATOR 2
typedef struct _BUTTONEX {
HICON icon;
int idCommand;
BYTE fsState;
BYTE fsStyle;
LPSTR tooltip;
} ButtonEx;
class CToolBarExCtrl : public CStatic
{
public:
CToolBarExCtrl();
public:
public:
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
public:
ButtonEx* GetButton(int nIndex, int commandId);
void EnableButton(int nId, bool bEnable);
void SetBackGroundColor(COLORREF color);
void RemoveButton(int nIndex, int commandId);
void AddSeparator();
void AddButton(HICON icon,int commandId, LPCTSTR text);
void SetButtonSize(CSize size);
void SetButtonSpacing(CSize spacing);
virtual ~CToolBarExCtrl();
protected:
afx_msg void OnPaint();
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
DECLARE_MESSAGE_MAP()
private:
int m_pushedButton;
int m_hotButton;
CToolTipCtrl m_ToolTip;
COLORREF m_backGroundColor;
CArray <ButtonEx,ButtonEx&> buttons;
CArray <CRect,CRect> rects;
CSize m_buttonSize;
CSize m_buttonSpacing;
};
#endif