www.pudn.com > ToolBar_ATL.rar > ToolBarView.h


// ToolBarView.h: interface for the CToolBarView class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_TOOLBARVIEW_H__224875F3_AAD6_4A44_8099_7C15CB57E10D__INCLUDED_) 
#define AFX_TOOLBARVIEW_H__224875F3_AAD6_4A44_8099_7C15CB57E10D__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "ToolBarDoc.h" 
#include "picholder.h" 
//#include  
#include  
 
#define MASK_COLOR RGB(0xCC,0xCC,0xCC) 
 
//#pragma comment(lib,"WININET.LIB") 
#pragma comment(lib,"comctl32.lib")  
class CToolBarView   
{ 
public: 
	void SetPara(HWND hWnd, HINSTANCE hInstance); 
	void HideToolTips(); 
	void ShowToolTips(LPSTR lptStr); 
	void PrepareLayer0(HDC aDC); 
	void SetRectBar(RECT& aRect); 
	void SetBarHeight(int newValue, BOOL bReDraw=FALSE); 
	void SetBarWidth(int newValue, BOOL bReDraw=FALSE); 
	void CalCoor(); 
	int SearchBtnIndex(POINT point); 
	void ReDraw(HDC aDC, BOOL bReDrawAll=FALSE); 
	CToolBarView(CToolBarDoc* pDoc); 
	virtual ~CToolBarView(); 
private: 
	void DrawIcon(HDC aDC, int cx, int cy, LPPICTUREDISP aPicDisp, BOOL bEnabled); 
	void InitToolTips(); 
	CToolBarDoc *m_pDoc;		//A pointer to document class which includes the buttons status. 
 
	HDC m_hMemDC;				//Basic memory DC to drow button. 
	HBITMAP m_hMemBitmap;		//Bitmap accompanied to the above DC. 
 
	//There are 3 layers to draw toolbar. 
	//1st layer(bottom layer): Gradient change background. 
	//2nd layer(middle layer): Background of hover button. 
	//3rd layer(Top layer): Button icons. 
	HDC m_hMemDcBkg;			//Memory DC to save toolbar background. 
	HBITMAP m_hBitmapBkg;		//Bitmap accompanied to the above DC. 
 
	HDC m_hMemDcCover;			//Memory DC used to resume previous hover button.		 
	HBITMAP m_hBitmapCover;		//Bitmap accompanied to the above DC. 
 
	HBRUSH m_BrushHover;		//The brush to draw backgound of hover button. 
	HBRUSH m_BrushDown;			//The brush to draw background of normal button. 
 
	COLORREF m_StartColor;		//Bottom color of toolbar background. 
	COLORREF m_EndColor;		//Top color of toolbar background. 
 
	//--Layer 0: Toolbar background. 
	int m_BarWidth;				//Width of toolbar. 
	int m_BarHeight;			//Height of toolbar. 
	RECT m_RectBar;				//Rectangle of toolbar. 
	//--Layer 1: Hover rectangle. 
	int m_HoverRectWidth;		//Hover rectangle width. 
	int m_HoverRectHeight;		//Hover rectangle width. 
	//--Layer 2: Icons. 
	int m_IconWidth;			//Icon width to draw. 
	int m_IconHeight;			//Icon height to draw. 
 
	//Define a rectangle area that contains the buttons. 
	int m_BtnsStartX;			//Start X positon of buttons area. 
	int m_BtnsEndX;				//End X positon of buttons area. 
	int m_BtnsStartY;			//Start Y positon of buttons area. 
	int m_BtnsEndY;				//End Y positon of buttons area. 
	 
	CPictureHolder m_picHolder;	//Class to deal with picture. 
	HWND m_hWnd;				//Handle of toolbar. 
	HINSTANCE m_hInstance;		//Handle of instance. 
	HWND m_hWndToolTips;		//Handle of ToolTips. 
	TOOLINFO m_ToolInfo;		//Tooltips information. 
}; 
 
#endif // !defined(AFX_TOOLBARVIEW_H__224875F3_AAD6_4A44_8099_7C15CB57E10D__INCLUDED_)