#if !defined(AFX_TABCTRLEX_H__A10F08A4_EB03_4BCF_8DA3_60971BDB94AE__INCLUDED_)
#define AFX_TABCTRLEX_H__A10F08A4_EB03_4BCF_8DA3_60971BDB94AE__INCLUDED_

#include "CrossDrawer.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// TabCtrlEx.h : header file
//
//

// WM_NOTIFY 
#define TCN_DELETEITEM            0
typedef struct _tagTCNMDeleteItem
{
    NMHDR    hdr;
    int        iDeleteItem;
} TCNMDELETEITEM;

/////////////////////////////////////////////////////////////////////////////
// CTabCtrlEx window

class CTabCtrlEx : public CTabCtrl
{
// Construction
public:
    CTabCtrlEx();
    virtual ~CTabCtrlEx();

// Attributes
public:

// Operations
public:

// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CTabCtrlEx)
    //}}AFX_VIRTUAL

// Implementation
public:

public:
    BOOL InsertItem(int nItem, LPCTSTR lpszItem);
    BOOL InsertItem(int nItem, LPCTSTR lpszItem, int nImage);
    BOOL DeleteItem(int iItem);
    BOOL DeleteAllItems();
    
    virtual void FireDeleteTabItemNotify(int iItem);
    
protected:
    void DrawDefaultTabItem(CDC* pDC);
    
private:
    BOOL _Init();
    CString _RepeatChar(CString str, int count);
    BOOL _CalcExpand(CDC* pDC);
    void _RefromatTabTitles();
    
    CRect _GetCrossRectInItem(int iIndex, const CSize& sizeBitmap);
    CRect _GetCrossRectInItem(const CRect& rcItem, const CSize& sizeBitmap, BOOL bCur);
    void _DrawCrossButton(CDC* pDC, int iItem);
    void _DrawCrossButton(CDC* pDC, const CRect& rcItem, BOOL bCur, int iCrossStatus);
    int _GetCrossButtonStatus(int iTab);
    
    HWND _GetAdjustCtrlHwnd();
    int _ValidTabItem(CPoint& point);
    
    LRESULT _DoOnMouseMove(UINT nFlags, CPoint point);
    
protected:
    CCrossDrawer    m_CrossDrawer;
    
    int                m_iExpandWith;
    int                m_iExpandTailSpace;
    CStringArray    m_astrOriginalTabTitles;
    
    CRect            m_rcCurCrossArea;
    int                m_iCurTabIndex;
    
    int                m_iSelTabIndex;
    CRect            m_rcSelCrossArea;
    BOOL            m_bMousePressed;
    BOOL            m_bTracking;
    BOOL            m_bHover;

    // Generated message map functions
protected:
    //{{AFX_MSG(CTabCtrlEx)
    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 LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam);
    afx_msg LRESULT OnMouseHover(WPARAM wParam, LPARAM lParam);
    afx_msg void OnPaint();
    //}}AFX_MSG

    DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TABCTRLEX_H__A10F08A4_EB03_4BCF_8DA3_60971BDB94AE__INCLUDED_)