Click here to Skip to main content
12,358,747 members (61,803 online)
Click here to Skip to main content

Stats

209.4K views
5.3K downloads
82 bookmarked
Posted

Automatic Tab Bar for MDI Frameworks

, 3 Jan 2003 Public Domain
A dockable bar containing a tabbed list of open windows
#if !defined(AFX_WINDOWTABCTRL_H__C67D43AA_F890_11D1_83BA_0000B43382FE__INCLUDED_)
#define AFX_WINDOWTABCTRL_H__C67D43AA_F890_11D1_83BA_0000B43382FE__INCLUDED_

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

// Forward declaration of classes
class CViewManager;

/////////////////////////////////////////////////////////////////////////////
// CWindowTabCtrl window

class CWindowTabCtrl : public CTabCtrl
{
private:
	BOOL m_bDisplayIcons;
// Construction
public:
	CWindowTabCtrl();

// Attributes
public:

// Operations
public:
	void SetFonts(CFont* pSelFont, CFont* pUnselFont);
	void SetFonts(CFont* pFont, BOOL bSelFont);
	void SetFonts(int nSelWeight = FW_SEMIBOLD, BOOL bSelItalic = FALSE,   
		BOOL bSelUnderline = FALSE, int nUnselWeight = FW_MEDIUM, 
		BOOL bUnselItalic = FALSE, BOOL bUnselUnderline = FALSE);

	CFont* GetTabFont(BOOL bSelFont);

	void SetColors(COLORREF bSelColor, COLORREF bUnselColor, COLORREF rcDocModified);
	COLORREF GetSelColor() const;
	COLORREF GetUnSelColor() const;
	COLORREF GetDocModifiedColor() const;

	void SetIconDisplay(BOOL bDisplayIt = TRUE);
	BOOL GetIconDisplay() const;

	void SetTabStyle(BOOL bButtons, BOOL bFlatButtons);
//	DWORD GetTabStyle;

	// For access to the private view manager member
	void SetViewManager(CViewManager* pViewManager)  { m_pViewManager = pViewManager; }
	CViewManager* GetViewManager() const  { return m_pViewManager; }

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CWindowTabCtrl)
	public:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	protected:
//	virtual void PreSubclassWindow();
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CWindowTabCtrl();

// Implementation
protected:
	COLORREF m_crSelColor, m_crUnselColor, m_crDocModified;
	CFont    m_SelFont,	   m_UnselFont;

	CViewManager*  m_pViewManager;      // ptr back to the ViewManager

	// Generated message map functions
protected:
	//{{AFX_MSG(CWindowTabCtrl)
	afx_msg void OnSelchange(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	//}}AFX_MSG

	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////
// CWindowTabCtrl inlines

inline CFont* CWindowTabCtrl::GetTabFont(BOOL bSelFont)
{
	if (bSelFont)
		return &m_SelFont;
	else
		return &m_UnselFont;
}

inline COLORREF CWindowTabCtrl::GetSelColor() const
{
	return m_crSelColor;
}

inline COLORREF CWindowTabCtrl::GetUnSelColor() const
{
	return m_crUnselColor;
}

inline COLORREF CWindowTabCtrl::GetDocModifiedColor() const
{
	return m_crDocModified;
}

inline BOOL CWindowTabCtrl::GetIconDisplay() const
{
	return m_bDisplayIcons;
}

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

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_WINDOWTABCTRL_H__C67D43AA_F890_11D1_83BA_0000B43382FE__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under A Public Domain dedication

Share

About the Author

Paul Selormey
Engineer
Japan Japan
Systems Engineer

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160621.1 | Last Updated 4 Jan 2003
Article Copyright 2000 by Paul Selormey
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid