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

Custom Tab Controls, Tabbed Frame and Tabbed MDI

, 13 Jul 2005
An extensible framework for creating customized tabs in ATL/WTL, with a VS.NET-like tab control implementation, tabbed frames, tabbed MDI, and more.
tabbingframework_demo.zip
TabbedSDISplitter
Release
TabbedSDISplitter.exe
res
Doc.ico
folder_c.ico
folder_o.ico
TabbedSDISplitter.exe.manifest
TabbedSDISplitter.ico
toolbar.bmp
TabbedSDISplitter.dsp
TabbedSDISplitter.dsw
TabDemo
Release
TabDemo.exe
res
error.ico
folder_closed.ico
folder_open.ico
info.ico
log.ico
TabDemo.exe.manifest
TabDemo.ico
TabDemodoc.ico
toolbar.bmp
warning.ico
TabDemo.dsp
TabDemo.dsw
TabbingFramework_ScreenShot.png
DockingDemo
DockingDemo.dsp
DockingDemo.dsw
Release
DockingDemo.exe
res
DockingDemo.exe.manifest
DockingDemo.ico
DockingDemodoc.ico
error.ico
folder_closed.ico
folder_open.ico
info.ico
log.ico
msdev_tab_icons.bmp
toolbar.bmp
warning.ico
include
Sergey Klimov
SimpleTabbedMDIDemo
Release
SimpleTabbedMDIDemo.exe
res
SimpleTabbedMDIDemo.exe.manifest
SimpleTabbedMDIDemo.ico
SimpleTabbedMDIDemodoc.ico
toolbar.bmp
SimpleTabbedMDIDemo.dsp
SimpleTabbedMDIDemo.dsw
tabbingframework_history.zip
tabbingframework_priorhistory.zip
tabbingframework_src.zip
// Copyright (c) 2002
// Sergey Klimov (kidd@ukr.net)
// WTL Docking windows
//
// This code is provided "as is", with absolutely no warranty expressed
// or implied. Any use is at your own risk.
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name is included. If
// the source code in  this file is used in any commercial application
// then a simple email woulod be nice.

#include "DockMisc.h"
#include "DockingBox.h"

namespace dockwins{

CDWSettings::CSettings CDWSettings::settings;

CDockingBoxMessage	CDockingBox::m_message;

#ifdef DF_AUTO_HIDE_FEATURES

COutlookLikeCaption ::CPinButton::CIcons COutlookLikeCaption ::CPinButton::m_icons;
CVC6LikeCaption::CPinButton::CIcons CVC6LikeCaption::CPinButton::m_icons;

#endif

void DrawEllipsisText(CDC& dc,LPCTSTR sText,int n,LPRECT prc,bool bHorizontal)
{
	assert(n>0);
	long width=bHorizontal ? prc->right - prc->left : prc->bottom - prc->top;
	CSize size;
	LPTSTR sTmp=0;
	bool bRes=(GetTextExtentPoint32(dc, sText, n,&size)!=FALSE);
	assert(bRes);
	if(width<size.cx)
	{
		LPCTSTR sEllipsis=_T("...");
		const int ellipsisLen=sizeof(sEllipsis)-1;
		sTmp=new TCHAR[ellipsisLen+n];
		::lstrcpy(sTmp,_T("..."));
		::lstrcpyn(sTmp+ellipsisLen,sText,n);
		bRes=(GetTextExtentExPoint(dc,sTmp,ellipsisLen+n,width,&n,NULL,&size)!=FALSE);
		if(bRes)
		{
			if(n<ellipsisLen+1)
				n=ellipsisLen+1;
			::lstrcpyn(sTmp,sText,n-ellipsisLen);
			::lstrcpyn(sTmp+(n-ellipsisLen),sEllipsis,ellipsisLen);
			sText=sTmp;
		}
	}	

//	UINT prevAlign=dc.SetTextAlign(TA_LEFT | TA_TOP | TA_NOUPDATECP);
	CPoint pt(prc->left,prc->top);
	if(bHorizontal)
		pt.y = (prc->bottom - prc->top-size.cy)/2+prc->top;
	else
		pt.x = prc->right-(prc->right - prc->left-size.cy)/2;
	dc.ExtTextOut(pt.x,pt.y,ETO_CLIPPED,prc,sText,n,NULL);
//	dc.SetTextAlign(prevAlign);
	delete [] sTmp;
}

}//namespace dockwins

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Daniel Bowen
Architect
United States United States
Daniel Bowen used to work as a Software Engineer for Evans & Sutherland in Salt Lake City, Utah working on the modeling tools for high end flight simulators. He then worked for the startup company WiLife Inc. in Draper, Utah working on the software portion of an easy to use and affordable digital video surveillance system. WiLife Inc. is now part of Logitech Inc.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141216.1 | Last Updated 14 Jul 2005
Article Copyright 2002 by Daniel Bowen
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid