Return to Appendix B.

ESWINDOW.CPP
// Matt Streeter
// 2/27/00
// ESWINDOW.CPP
// Implementation of class TESWindow; base class for all TES... window classes.
// Copyright Matt Streeter, 2000.  All rights reserved

#include "eswindow.h"

TColor TESWindow::mBackgroundColor(0,0,96);
TBrush TESWindow::mBackgroundFillBrush(TESWindow::mBackgroundColor);
TColor TESWindow::mTextColor(255,255,255);

TESWindow::TESWindow(TWindow *pParent,char *pTitle)
	:TFrameWindow(pParent, pTitle), TWindow(pParent, pTitle)
{
}

DEFINE_RESPONSE_TABLE1(TESWindow,TFrameWindow)
	EV_WM_CTLCOLOR,
#if(USE_PRETTY_BUTTONS)
	EV_WM_MOUSEMOVE,
#endif
END_RESPONSE_TABLE;

LPSTR TESWindow::GetClassName()
{
	return("ESWindow");
}

void TESWindow::GetWindowClass(WNDCLASS& WndClass)
{
	TWindow::GetWindowClass(WndClass);
	WndClass.hbrBackground=(HBRUSH)(mBackgroundFillBrush);
}

void TESWindow::ChildrenIdleAction(long lIdleCount)
{
	TWindow *pFirst=GetFirstChild();
	TWindow *pChild=pFirst;
	do
	{
		pChild->IdleAction(lIdleCount);
		pChild=pChild->Next();
	}while(pChild!=pFirst);
}

//
// Provide a background color & brush for child controls to use
//
HBRUSH TESWindow::EvCtlColor(HDC hDC, HWND /*hWndChild*/, UINT ctlType)
{
	if(ctlType==CTLCOLOR_EDIT)
	{
		TDC dc(hDC);
		dc.SetBkColor(mBackgroundColor);
		dc.SetTextColor(TColor(255,255,255));
		return (mBackgroundFillBrush);
	}
	else
	{
		TDC dc(hDC);
		dc.SetBkColor(::GetSysColor(COLOR_BTNFACE));
		static TBrush Brush(::GetSysColor(COLOR_BTNFACE));
		return(Brush);
	}
}

#if(USE_PRETTY_BUTTONS)

void TESWindow::EvMouseMove(uint modKeys, TPoint& point)
{
	TWindow *pFirst=GetFirstChild();
	TWindow *pChild=pFirst;
	do
	{
		if(TESButton::IsESButton((TESButton*)pChild))
		{
			ClientToScreen(point);
			((TESButton*)pChild)->EvParentMouseMove(modKeys,point);
		}
		pChild=pChild->Next();
	}while(pChild!=pFirst);
}

void TESWindow::EvChildMouseMove(uint modKeys,TPoint& point)
{
	TWindow *pFirst=GetFirstChild();
	TWindow *pChild=pFirst;
	do
	{
		if(TESButton::IsESButton((TESButton*)pChild))
		{
			((TESButton*)pChild)->EvParentMouseMove(modKeys,point);
		}
		pChild=pChild->Next();
	}while(pChild!=pFirst);
}

#endif

Return to Appendix B.