Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

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
	BOOL m_bDisplayIcons;
// Construction

// Attributes

// Operations
	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
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
//	virtual void PreSubclassWindow();

// Implementation
	virtual ~CWindowTabCtrl();

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

	CViewManager*  m_pViewManager;      // ptr back to the ViewManager

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


// CWindowTabCtrl inlines

inline CFont* CWindowTabCtrl::GetTabFont(BOOL bSelFont)
	if (bSelFont)
		return &m_SelFont;
		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;


// 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.


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


About the Author

Paul Selormey
Japan Japan
Electrical/Mobile Communication Engineer. Currently developing GIS, Visualization and Industrial Automation software in Japan.

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