Click here to Skip to main content
13,295,243 members (71,264 online)
Click here to Skip to main content


82 bookmarked
Posted 31 Jan 2000

Automatic Tab Bar for MDI Frameworks

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

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

#include <afxcoll.h>
#include "WindowTabCtrl.h"

// Support for different control bar implementations
#ifndef CCBaseControlBar
#define CCBaseControlBar  CControlBar 

// CViewManager window

class CViewManager : public CCBaseControlBar

    CSize    m_sizeMin;
    CSize    m_sizeFloat;
	CSize    m_sizeDefault;
	CSize    m_sizeMRU;
	int      m_nLMargin;
	UINT     m_nDockID;
	BOOL     m_bWin2000;  // for the double-stripped gripper

// Construction

// Attributes

// Operations
    virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
        CSize sizeDefault, UINT nID,
        DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
	void OnActivateView(const BOOL bActivate, CMDIChildWnd* pView);
	int  GetWindowNum();
	void SetViewName(const TCHAR* cs, CMDIChildWnd* pView);
	void RemoveAll();
	void RemoveView(CMDIChildWnd* pView);
	void AddView(const TCHAR* csName, CMDIChildWnd* pView);

	CMDIChildWnd* GetTabInfo(int nTab, TCHAR* pszLabel = NULL) const;
	void SetWin2000(BOOL bWin2000);
	BOOL GetWin2000() const;

// Overrides
	virtual void DoPaint(CDC* pDC);
	virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
	virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
	virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
	// ClassWizard generated virtual function overrides

// Implementation
	virtual ~CViewManager();
	BOOL CreateViewManager(CMDIFrameWnd* pMDIFrameWnd, UINT uID);
	CWindowTabCtrl m_ViewTabCtrl;
    CImageList     m_ViewTabImages;
	BOOL           m_bClosing;

	// Generated message map functions

	void DrawGripper(CDC* pDC);

	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg int  OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
	afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
    BOOL OnViewManagerToolTip(NMHDR* pTTTStruct, LRESULT* pResult);

// CViewManager inlines

inline void CViewManager::SetWin2000(BOOL bWin2000)
	m_bWin2000 = bWin2000;

inline BOOL CViewManager::GetWin2000()	const
	return m_bWin2000;


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

#endif // !defined(AFX_VIEWMANAGER_H__2A1E6B81_0BC9_11D3_933D_0000F0510AC9__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
Systems Engineer

You may also be interested in...

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