www.pudn.com > BitMapToolBar.rar > ToolBarEx.h


#if !defined(AFX_TOOLBAREX_H__1202DAA2_4D71_4C92_9799_DB0694298C85__INCLUDED_) 
#define AFX_TOOLBAREX_H__1202DAA2_4D71_4C92_9799_DB0694298C85__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
// 
// ToolBarEx.h : header file 
// 
 
#define IM_TRANSPARENT	true 
#define IM_STRECH		false 
 
///////////////////////////////////////////////////////////////////////////// 
// CToolBarEx window 
 
class CToolBarEx : public CToolBar 
{ 
// Construction 
public: 
	CToolBarEx();			// Class constructor. 
	virtual ~CToolBarEx();	// Destructor. 
 
	// Creator method. 
	BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle, DWORD dwStyle, UINT BkBitMapId, UINT TbBitMapId, UINT NBButtons, bool strechBackGround ); 
	 
	bool all_frame;	// Apply the bitmap on the complete parent frame, 
					// or only the toolbar itself. 
	 
	COLORREF MaskColor;	// Background color of the buton image. 
	bool ImageStyle;	// Button image style as streched or transparent background. 
	 
private: 
	bool button_flat;		// Display flat button or not. 
 
	BITMAP bk_bm;			// Background bitmap. 
	CBitmap bmpBackground;	// "" 
	BITMAP bmt;				// Toolbar bitmap. 
	CBitmap bmptoolbar;		// "" 
	CBitmap BkSave;			// "" 
	int nbButtons;			// Nb buttons (not including separators) into the toolbar bitmap. 
 
	CRect ToolBar_rect;		// Size of the toolbar control. 
	CRect Frame_rect;		// Size of the parent frame. 
 
	bool DrawGripper;		// Indicate if the gripper is to be drawn. 
 
	UINT id, style;			// Button's info... 
	int index;				// "" 
	CRect button_rect;		// "" 
	CRect current_button_rect; 
	 
	int image_pos;			// Position of the button bitmap. 
	int image_len;			// Nb of buttons into the bitmap. 
	CPoint dest_pt;			// Destination button's center point. 
	CPoint mousePosition;	// Mouse position over the toolbar. 
	bool StrechBackGround; 
	short currentHit; 
	bool init; 
	CDC dcMemSave;			// To save the background. 
	bool button_down;		// Indicate a button down/up. 
 
	void DrawBackGround();	// Draw the toolbar control background. 
	void DrawButtonEdge();	// Draw the button's edge. 
	 
	// Generated message map functions 
protected: 
	//{{AFX_MSG(CToolBarEx) 
	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); 
	//}}AFX_MSG 
 
	DECLARE_MESSAGE_MAP() 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
 
//{{AFX_INSERT_LOCATION}} 
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. 
 
#endif // !defined(AFX_TOOLBAREX_H__1202DAA2_4D71_4C92_9799_DB0694298C85__INCLUDED_)