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

ATL Splitter ActiveX control

, 16 Nov 1999 CPOL
A port of my splitter ActiveX control with MFC to ATL.
atlsplitter.zip
ReleaseMinDependency
SplitterATLControl.dll
splitter.bmp
Splitter.rgs
SplitterATLControl.def
SplitterATLControl.dsp
SplitterATLControl.dsw
SplitterATLControl.plg
SplitterATLControl.tlb
SplitterATLControlps.def
SplitterATLControlps.mk
SplitterPropPage.rgs
// Splitter.cpp : Implementation of CSplitter

#include "stdafx.h"
#include "SplitterATLControl.h"
#include "Splitter.h"

#define CX_BORDER   1
#define CY_BORDER   1


/////////////////////////////////////////////////////////////////////////////
// Helper functions
void FillSolidRect(HDC hdc, const RECT& rect, COLORREF clr)
{
	SetBkColor(hdc, clr);
	ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
}

void FillSolidRect(HDC hdc, int x, int y, int cx, int cy, COLORREF clr)
{
	RECT rect;
	rect.left=x;
	rect.top=y;
	rect.right=x + cx;
	rect.bottom=y + cy;
	FillSolidRect(hdc, rect, clr);
}

void Draw3dRect(HDC hdc, int x, int y, int cx, int cy,
	COLORREF clrTopLeft, COLORREF clrBottomRight)
{
	FillSolidRect(hdc, x, y, cx - 1, 1, clrTopLeft);
	FillSolidRect(hdc, x, y, 1, cy - 1, clrTopLeft);
	FillSolidRect(hdc, x + cx, y, -1, cy, clrBottomRight);
	FillSolidRect(hdc, x, y + cy, cx, -1, clrBottomRight);
}

void Draw3dRect(HDC hdc, const RECT& rect,
	COLORREF clrTopLeft, COLORREF clrBottomRight)
{
	Draw3dRect(hdc,
				rect.left,
				rect.top,
				rect.right-rect.left,
				rect.bottom-rect.top,
				clrTopLeft,
				clrBottomRight);
}

#define HIMETRIC_INCH   2540    // HIMETRIC units per inch

void DPtoHIMETRIC(HDC hdc, LPSIZE lpSize)
{
	int nMapMode;
	if ((nMapMode = GetMapMode(hdc)) < MM_ISOTROPIC && nMapMode != MM_TEXT)
	{
		// when using a constrained map mode, map against physical inch
		SetMapMode(hdc,MM_HIMETRIC);
		DPtoLP(hdc,(POINT*)lpSize,1);
		SetMapMode(hdc,nMapMode);
	}
	else
	{
		// map against logical inch for non-constrained mapping modes
		int cxPerInch, cyPerInch;
		cxPerInch = GetDeviceCaps(hdc,LOGPIXELSX);
		cyPerInch = GetDeviceCaps(hdc,LOGPIXELSY);
		
		lpSize->cx = MulDiv(lpSize->cx, HIMETRIC_INCH, cxPerInch);
		lpSize->cy = MulDiv(lpSize->cy, HIMETRIC_INCH, cyPerInch);
	}
}

void DeflateRect(RECT& rect,SIZE sz)
{
	rect.left+=sz.cx;
	rect.top+=sz.cy;
	rect.right-=sz.cx;
	rect.bottom-=sz.cy;
}


HWND GetContainerWindow(IOleClientSitePtr pClientSite)
{
	IOleWindowPtr pWindow;
	if(SUCCEEDED(pClientSite->QueryInterface(IID_IOleWindow,(void**)&pWindow)))
	{
		HWND wnd=NULL;
		pWindow->GetWindow(&wnd);
		return wnd;
	}

	IOleInPlaceSitePtr pIPSite=pClientSite;

	IOleInPlaceFramePtr pFrame;
	IOleInPlaceUIWindowPtr pDoc;
	RECT rcPosRect,rcClipRect;
	OLEINPLACEFRAMEINFO FrameInfo;
	FrameInfo.cb=sizeof(OLEINPLACEFRAMEINFO);

	if(SUCCEEDED(pIPSite->GetWindowContext(&pFrame,&pDoc,&rcPosRect,&rcClipRect,&FrameInfo)))
	{
		HWND hwnd=NULL;
		if(pDoc)
			pDoc->GetWindow(&hwnd);

		if(!hwnd)
		{
			if(pFrame)
				pFrame->GetWindow(&hwnd);
		}

		return hwnd;
	}

	return NULL;
}


/////////////////////////////////////////////////////////////////////////////
// CControlInfoArray
int CControlInfoArray::IndexOf(const BSTR strName)
{
	for(int i=0; i<size(); i++)
	{
		if(at(i).m_strName==strName)
			return i;
	}

	return -1;
}

/////////////////////////////////////////////////////////////////////////////
// CHiddenWindow
LRESULT CHiddenWindow::OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	KillTimer(wParam);
	if(m_pSplitter)
		m_pSplitter->AdjustControlsToPanes();
	bHandled=TRUE;
	return 0;
}

/////////////////////////////////////////////////////////////////////////////
// CSplitter
STDMETHODIMP CSplitter::InterfaceSupportsErrorInfo(REFIID riid)
{
	static const IID* arr[] = 
	{
		&IID_ISplitter,
	};
	for (int i=0; i<sizeof(arr)/sizeof(arr[0]); i++)
	{
		if (InlineIsEqualGUID(*arr[i], riid))
			return S_OK;
	}
	return S_FALSE;
}

void CSplitter::CalcSplitterRectBySplitterPercentPosition(float fltPercentPosition,
														  RECT& rectSplitter,
														  const RECT& rectControl)
{
	if(m_bSplitterIsVertical)
	{
		rectSplitter.top=rectControl.top;
		rectSplitter.bottom=rectControl.bottom;

		double xPossibleLeft=double(rectControl.left)+double(m_SplitterWidth)/2.;
		double xPossibleRight=double(rectControl.right)-double(m_SplitterWidth)/2.;

		int nOffset=double(xPossibleRight-xPossibleLeft)*fltPercentPosition/100.;
		rectSplitter.left=rectControl.left+nOffset;
		rectSplitter.right=rectSplitter.left+m_SplitterWidth;
	}
	else
	{
		rectSplitter.left=rectControl.left;
		rectSplitter.right=rectControl.right;
		
		double yPossibleTop=double(rectControl.top)+double(m_SplitterHeight)/2.;
		double yPossibleBottom=double(rectControl.bottom)-double(m_SplitterHeight)/2.;

		int nOffset=double(yPossibleBottom-yPossibleTop)*fltPercentPosition/100.;
		
		rectSplitter.top=rectControl.top+nOffset;
		rectSplitter.bottom=rectSplitter.top+m_SplitterHeight;
	}
}


float CSplitter::CalcSplitterPercentPositionBySplitterRect(const RECT& rect,
														   const RECT& rectControl)
{
	if(m_bSplitterIsVertical)
	{
		double xRectMiddle=double(rect.left+rect.right)/2.;
		double xPossibleLeft=double(rectControl.left)+double(m_SplitterWidth)/2.;
		double xPossibleRight=double(rectControl.right)-double(m_SplitterWidth)/2.;

		return (xRectMiddle-xPossibleLeft)*100/(xPossibleRight-xPossibleLeft);
	}
	else
	{
		double yRectMiddle=double(rect.top+rect.bottom)/2.;
		double yPossibleTop=double(rectControl.top)+double(m_SplitterHeight)/2.;
		double yPossibleBottom=double(rectControl.bottom)-double(m_SplitterHeight)/2.;

		return (yRectMiddle-yPossibleTop)*100/(yPossibleBottom-yPossibleTop);
	}
}



void CSplitter::GetRects(RECT& rectFirstPane,
						 RECT& rectSecondPane,
						 RECT& rectSplitter,
						 const RECT& rectControl)
{
	CalcSplitterRectBySplitterPercentPosition(m_fltSplitterPercentPosition,
											rectSplitter,
											rectControl);
	if(m_bSplitterIsVertical)
	{
		CopyRect(&rectFirstPane,&rectControl);
		rectFirstPane.right=rectSplitter.left;
		
		CopyRect(&rectSecondPane,&rectControl);
		rectSecondPane.left=rectSplitter.right;
	}
	else
	{
		CopyRect(&rectFirstPane,&rectControl);
		rectFirstPane.bottom=rectSplitter.top;
		
		CopyRect(&rectSecondPane,&rectControl);
		rectSecondPane.top=rectSplitter.bottom;
	}
}


HRESULT CSplitter::OnDraw(ATL_DRAWINFO& di)
{
	RECT& rc = *(RECT*)di.prcBounds;

	m_SplitterWidth=GetSystemMetrics(SM_CXFRAME)*di.ZoomNum.cx/di.ZoomDen.cx;
	m_SplitterHeight=GetSystemMetrics(SM_CYFRAME)*di.ZoomNum.cy/di.ZoomDen.cy;

	RECT rectFirstPane,rectSecondPane,rectSplitter;
	GetRects(rectFirstPane,rectSecondPane,rectSplitter,rc);
	
	COLORREF clrBtnFace=GetSysColor(COLOR_BTNFACE);
	COLORREF clrBtnShadow=GetSysColor(COLOR_BTNSHADOW);
	COLORREF clrBtnHighlight=GetSysColor(COLOR_BTNHIGHLIGHT);
	COLORREF clrWindow=GetSysColor(COLOR_WINDOW);
	COLORREF clrWindowFrame=GetSysColor(COLOR_WINDOWFRAME);
	
	FillSolidRect(di.hdcDraw, rc, clrBtnFace);

	Draw3dRect(di.hdcDraw, rectFirstPane, clrBtnShadow, clrBtnHighlight);
	InflateRect(&rectFirstPane, -CX_BORDER, -CY_BORDER);
	Draw3dRect(di.hdcDraw, rectFirstPane, clrWindowFrame, clrBtnFace);
	InflateRect(&rectFirstPane, -CX_BORDER, -CY_BORDER);

	Draw3dRect(di.hdcDraw, rectSecondPane, clrBtnShadow, clrBtnHighlight);
	InflateRect(&rectSecondPane, -CX_BORDER, -CY_BORDER);
	Draw3dRect(di.hdcDraw, rectSecondPane, clrWindowFrame, clrBtnFace);
	InflateRect(&rectSecondPane, -CX_BORDER, -CY_BORDER);

	
	return S_OK;
}

HBRUSH CSplitter::GetHalftoneBrush()
{
	if (m_hbrHalftone==NULL)
	{
		WORD grayPattern[8];
		for (int i = 0; i < 8; i++)
			grayPattern[i] = (WORD)(0x5555 << (i & 1));

		HBITMAP grayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern);
		if (grayBitmap != NULL)
		{
			m_hbrHalftone = ::CreatePatternBrush(grayBitmap);
			DeleteObject(grayBitmap);
		}
	}

	return m_hbrHalftone;
}

void CSplitter::InvertTracker(const RECT& rect)
{
	HWND hwndContainer=GetContainerWindow(m_spClientSite);
	
	DWORD dwOldStyle=::GetWindowLong(hwndContainer,GWL_STYLE);
	::SetWindowLong(hwndContainer,GWL_STYLE,dwOldStyle&~WS_CLIPCHILDREN);
	
	// pat-blt without clip children on
	HDC hdc=::GetDC(hwndContainer);
	
	// invert the brush pattern (looks just like frame window sizing)
	HBRUSH hbrHalbtone = GetHalftoneBrush();
	HBRUSH hOldBrush = NULL;
	if (hbrHalbtone != NULL)
		hOldBrush = (HBRUSH)SelectObject(hdc, hbrHalbtone);
	::PatBlt(hdc,
				rect.left, 
				rect.top, 
				rect.right-rect.left, 
				rect.bottom-rect.top, 
				PATINVERT);

	if (hOldBrush != NULL)
		SelectObject(hdc, hOldBrush);
	::ReleaseDC(hwndContainer,hdc);

	::SetWindowLong(hwndContainer,GWL_STYLE,dwOldStyle);
}



//Returns the extended name of the control, which has been asigned
//to it by the container (form)
//pDispatch is the interface provided by the container's site object
CComBSTR CSplitter::GetExtendedName(IDispatchPtr pDispatch)
{
	CComVariant var;
	DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0};
	
	HRESULT hr = E_FAIL; 

	hr=pDispatch->Invoke(DISPID_AMBIENT_DISPLAYNAME,IID_NULL,LOCALE_USER_DEFAULT,DISPATCH_PROPERTYGET |	DISPATCH_METHOD,&dispparamsNoArgs,&var, NULL, NULL);

	if(FAILED(hr))
	{
		DISPID dispID=0;
		LPWSTR lpName[1] = { (WCHAR *)L"Name" };
        hr = pDispatch->GetIDsOfNames(IID_NULL, lpName, 1,LOCALE_SYSTEM_DEFAULT, &dispID);

		if(SUCCEEDED(hr))
			hr=pDispatch->Invoke(dispID,IID_NULL,LOCALE_USER_DEFAULT,DISPATCH_PROPERTYGET |	DISPATCH_METHOD,&dispparamsNoArgs,&var, NULL, NULL);
			
	}

	CComBSTR strResult;
	if(FAILED(hr))
		strResult=_T("");
	else
		strResult=var.bstrVal;
	
	return strResult;
}


void CSplitter::GetOtherControlsOnTheContainer()
{
	m_arrayControls.clear();

	if(m_spClientSite==NULL)
		return;

	CComBSTR strOurName=GetExtendedName((IDispatch*)m_spAmbientDispatch);

	IOleContainerPtr	pOleContainer;
	IEnumUnknownPtr		pEnumUnk;
		
	if(FAILED(m_spClientSite->GetContainer(&pOleContainer))) 
		 return;

	if(FAILED(pOleContainer->EnumObjects(OLECONTF_EMBEDDINGS |OLECONTF_OTHERS,&pEnumUnk))) 
		return;

	IUnknownPtr					pUnk;
	HRESULT						hr = E_FAIL;
	
	while(pEnumUnk->Next(1,&pUnk,NULL) == S_OK) 
	{
		IOleObjectPtr pOleObject;
		hr = pUnk->QueryInterface(IID_IOleObject,(void**)&pOleObject);

		if(SUCCEEDED(hr)) 
		{
			//ActiveX control
			IOleClientSitePtr pClientSite;
			pOleObject->GetClientSite(&pClientSite);
		
			IDispatchPtr pAmbientDispatch;	
			pClientSite->QueryInterface(IID_IDispatch,(void**)&pAmbientDispatch);

			if(pAmbientDispatch)
			{
				CControlInfo info;
				info.m_strName=GetExtendedName(pAmbientDispatch);
				if(info.m_strName.Length()!=0 && !(strOurName==info.m_strName))
				{
					info.m_pOleObject=pOleObject;
					m_arrayControls.push_back(info);
				}
			}
		}

		pUnk=NULL;
	}
}




void CSplitter::PlaceControlOnPane(const BSTR strControlName,const RECT& rectPane)
{
	int nPos=m_arrayControls.IndexOf(strControlName);
	if(nPos!=-1)
	{
		IOleObjectPtr pOleObject=m_arrayControls[nPos].m_pOleObject;
		
		IOleClientSitePtr pSite;
		pOleObject->GetClientSite(&pSite);
		IOleInPlaceSitePtr pIPSite=pSite;
		pIPSite->OnPosRectChange(&rectPane);

		SIZE size;
		size.cx=rectPane.right-rectPane.left;
		size.cy=rectPane.bottom-rectPane.top;
			
		HWND hwndContainer=GetContainerWindow(m_spClientSite);
		HDC hdc=::GetDC(hwndContainer);
		DPtoHIMETRIC(hdc, &size);
		::ReleaseDC(hwndContainer,hdc);
		pOleObject->SetExtent(DVASPECT_CONTENT,&size);
	}
}

void CSplitter::AdjustControlsToPanes()
{
	BOOL bUserMode;
	if(FAILED(GetAmbientUserMode(bUserMode)) || ! bUserMode)
		return;

	GetOtherControlsOnTheContainer();

	RECT rectFirstPane,rectSecondPane,rectSplitter;
	GetRects(rectFirstPane,rectSecondPane,rectSplitter,m_rcPos);

	SIZE sz={ CX_BORDER,CY_BORDER };
	DeflateRect(rectFirstPane,sz);
	DeflateRect(rectSecondPane,sz);

	PlaceControlOnPane(m_strFirstControlName,rectFirstPane);
	PlaceControlOnPane(m_strSecondControlName,rectSecondPane);
}

void CSplitter::DelayAdjustControlsToPanes()
{
	if(!m_wndHidden.m_hWnd)
	{
		RECT rect;
		rect.left=rect.top=rect.right=rect.bottom=0;
		m_wndHidden.Create(GetContainerWindow(m_spClientSite),rect);
	}

	::SetTimer(m_wndHidden.m_hWnd,1,55,NULL);
}

STDMETHODIMP CSplitter::OnAmbientPropertyChange(DISPID dispid)
{
	if(dispid==DISPID_AMBIENT_USERMODE)
		DelayAdjustControlsToPanes();
	return S_OK;
}

STDMETHODIMP CSplitter::SetObjectRects(LPCRECT prcPos,LPCRECT prcClip)
{
	HRESULT hr=IOleInPlaceObjectWindowlessImpl<CSplitter>::SetObjectRects(prcPos,prcClip);
	if(SUCCEEDED(hr))
		DelayAdjustControlsToPanes();
	return hr;
}

STDMETHODIMP CSplitter::GetPredefinedStrings(DISPID dispID, CALPOLESTR *pCaStringsOut,CADWORD *pCaCookiesOut)
{
	ATLTRACE2(atlTraceControls,2,_T("IPerPropertyBrowsingImpl::GetPredefinedStrings\n"));
	if (pCaStringsOut == NULL || pCaCookiesOut == NULL)
		return E_POINTER;
	
	pCaStringsOut->cElems = 0;
	pCaStringsOut->pElems = NULL;
	pCaCookiesOut->cElems = 0;
	pCaCookiesOut->pElems = NULL;

	if(dispID==DISPID_FIRST_CONTROL_NAME|| dispID==DISPID_SECOND_CONTROL_NAME)
	{
		GetOtherControlsOnTheContainer();

		if(m_arrayControls.size()>0)
		{
			pCaStringsOut->cElems=pCaCookiesOut->cElems=m_arrayControls.size();
			pCaStringsOut->pElems=(LPOLESTR*)CoTaskMemAlloc(pCaStringsOut->cElems*sizeof(LPOLESTR));
			pCaCookiesOut->pElems=(DWORD*)CoTaskMemAlloc(pCaCookiesOut->cElems*sizeof(DWORD));
			for(int i=0; i<m_arrayControls.size(); i++)
			{
				pCaCookiesOut->pElems[i]=i;

				CControlInfo& ci=m_arrayControls[i];
				pCaStringsOut->pElems[i]=(LPOLESTR)CoTaskMemAlloc((ci.m_strName.Length()+1)*sizeof(OLECHAR));
				wcscpy(pCaStringsOut->pElems[i],ci.m_strName.m_str);
			}
		}
	}

	return S_OK;
}


STDMETHODIMP CSplitter::GetPredefinedValue(DISPID dispID, DWORD dwCookie, VARIANT* pVarOut)
{
	if(dispID==DISPID_FIRST_CONTROL_NAME || dispID==DISPID_SECOND_CONTROL_NAME)
	{
		if(dwCookie>=0 && dwCookie<m_arrayControls.size())
		{
			V_VT(pVarOut)=VT_BSTR;
			V_BSTR(pVarOut)=m_arrayControls[dwCookie].m_strName.Copy();
			return S_OK;
		}
	}

	return E_FAIL;
}


POINT CSplitter::GetMouseCursorPosInContainerCoords()
{
	POINT ptCursor;
	GetCursorPos(&ptCursor);

	::ScreenToClient(GetContainerWindow(m_spClientSite),&ptCursor);
	return ptCursor;
}


LRESULT CSplitter::OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	POINT ptMouse=GetMouseCursorPosInContainerCoords();
	
	RECT rectFirstPane,rectSecondPane,rectSplitter;
	GetRects(rectFirstPane,rectSecondPane,rectSplitter,m_rcPos);

	if(PtInRect(&rectSplitter,ptMouse))
	{
		if(m_bWndLess)
			m_spInPlaceSite->SetCapture(TRUE);
		else
			SetCapture();

		m_sizeTrackingOffset.cx=ptMouse.x-rectSplitter.left;
		m_sizeTrackingOffset.cy=ptMouse.y-rectSplitter.top;
		m_bTracking=TRUE;
		CopyRect(&m_rectTracking,&rectSplitter);
		InvertTracker(m_rectTracking);
	}

	bHandled=TRUE;
	return 0;
}



LRESULT CSplitter::OnLButtonUP(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if(m_bTracking)
	{
		m_bTracking=FALSE;

		if(m_bWndLess)
			m_spInPlaceSite->SetCapture(FALSE);
		else
			ReleaseCapture();

		POINT ptMouse=GetMouseCursorPosInContainerCoords();

		InvertTracker(m_rectTracking);

		RECT rectTrackingNew;
		CalcNewTrackingRect(ptMouse,&rectTrackingNew);

		m_fltSplitterPercentPosition=CalcSplitterPercentPositionBySplitterRect(rectTrackingNew,m_rcPos);
		
		FireOnChanged(DISPID_SPLITTER_PERCENT_POSITION);
		FireViewChange();
		DelayAdjustControlsToPanes();
	}

	bHandled=TRUE;	

	return 0;
}

LRESULT CSplitter::OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	if(m_bTracking)
	{
		POINT ptMouse=GetMouseCursorPosInContainerCoords();

		RECT rectTrackingNew;
		CalcNewTrackingRect(ptMouse,&rectTrackingNew);

		//WM_MOUSEMOVE is sent even when mouse has not been moved
		if(memcmp(&rectTrackingNew,&m_rectTracking,sizeof(RECT)))
		{
			InvertTracker(m_rectTracking);
			CopyRect(&m_rectTracking,&rectTrackingNew);
			InvertTracker(m_rectTracking);
		}
	}

	bHandled=TRUE;
	return 0;
}

void CSplitter::CalcNewTrackingRect(POINT ptMouse,RECT* pRectResult)
{
	CopyRect(pRectResult,&m_rectTracking);

	if(m_bSplitterIsVertical)
	{
		int nNewLeft=ptMouse.x-m_sizeTrackingOffset.cx;
		OffsetRect(pRectResult,nNewLeft-m_rectTracking.left,0);
	}
	else
	{
		int nNewTop=ptMouse.y-m_sizeTrackingOffset.cy;
		OffsetRect(pRectResult,0,nNewTop-m_rectTracking.top);
	}

	float fltPP=CalcSplitterPercentPositionBySplitterRect(*pRectResult,m_rcPos);
	if(fltPP<0)
		fltPP=0;
	else if(fltPP>100)
		fltPP=100;
	
	CalcSplitterRectBySplitterPercentPosition(fltPP,*pRectResult,m_rcPos);
}





LRESULT CSplitter::OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	BOOL bChangeCursor=FALSE;
	if(m_bTracking)
		bChangeCursor=TRUE;
	else
	{
		POINT ptCursor=GetMouseCursorPosInContainerCoords();

		RECT rectFirstPane,rectSecondPane,rectSplitter;
		GetRects(rectFirstPane,rectSecondPane,rectSplitter,m_rcPos);
		if(::PtInRect(&rectSplitter,ptCursor))
			bChangeCursor=TRUE;
	}

	HCURSOR hc=LoadCursor(NULL,IDC_ARROW);
	if(bChangeCursor)
	{
		if(m_bSplitterIsVertical)
			hc=LoadCursor(NULL,IDC_SIZEWE);
		else
			hc=LoadCursor(NULL,IDC_SIZENS);
	}
	
	SetCursor(hc);
	bHandled=TRUE;
	return 0;
}






STDMETHODIMP CSplitter::get_SplitterPercentPosition(float *pVal)
{
	// TODO: Add your implementation code here
	*pVal=m_fltSplitterPercentPosition;
	return S_OK;
}

STDMETHODIMP CSplitter::put_SplitterPercentPosition(float newVal)
{
	// TODO: Add your implementation code here
	if(newVal>=0 && newVal<=100)
	{
		m_fltSplitterPercentPosition=newVal;
		FireViewChange();
		return S_OK;
	}
	else
		return Error(IDS_INVALID_SPLITTER_POSITION);
}



STDMETHODIMP CSplitter::get_SplitterIsVertical(BOOL *pVal)
{
	// TODO: Add your implementation code here
	*pVal=m_bSplitterIsVertical;
	return S_OK;
}

STDMETHODIMP CSplitter::put_SplitterIsVertical(BOOL newVal)
{
	// TODO: Add your implementation code here
	m_bSplitterIsVertical=newVal;
	FireViewChange();
	DelayAdjustControlsToPanes();
	return S_OK;
}

STDMETHODIMP CSplitter::get_FirstControlName(BSTR *pVal)
{
	// TODO: Add your implementation code here
	*pVal=m_strFirstControlName.Copy();
	return S_OK;
}

STDMETHODIMP CSplitter::put_FirstControlName(BSTR newVal)
{
	// TODO: Add your implementation code here
	m_strFirstControlName=newVal;
	return S_OK;
}

STDMETHODIMP CSplitter::get_SecondControlName(BSTR *pVal)
{
	// TODO: Add your implementation code here
	*pVal=m_strSecondControlName.Copy();
	return S_OK;
}

STDMETHODIMP CSplitter::put_SecondControlName(BSTR newVal)
{
	// TODO: Add your implementation code here
	m_strSecondControlName=newVal;
	return S_OK;
}

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 The Code Project Open License (CPOL)

Share

About the Author

Andrew Garbuzov

United States United States
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411023.1 | Last Updated 17 Nov 1999
Article Copyright 1999 by Andrew Garbuzov
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid