Click here to Skip to main content
15,885,546 members
Articles / Desktop Programming / MFC

The Diffraction Grating Calculator

Rate me:
Please Sign up or sign in to vote.
4.40/5 (5 votes)
30 Oct 2010GPL38 min read 41.3K   678   6  
An MFC Windows program related to Concave Diffraction Gratings using VTK libraries.
/*
 *
 *	ChartCursor.cpp
 *
 *	Written by C�dric Moonen (cedric_moonen@hotmail.com)
 *
 *
 *
 *	This code may be used for any non-commercial and commercial purposes in a compiled form.
 *	The code may be redistributed as long as it remains unmodified and providing that the 
 *	author name and this disclaimer remain intact. The sources can be modified WITH the author 
 *	consent only.
 *	
 *	This code is provided without any garanties. I cannot be held responsible for the damage or
 *	the loss of time it causes. Use it at your own risks
 *
 *	An e-mail to notify me that you are using this code is appreciated also.
 *
 *
 */

#include "stdafx.h"
#include "ChartCursor.h"
#include "ChartCtrl.h"

unsigned CChartCursor::m_uNextFreeId = 0;

CChartCursor::CChartCursor(CChartCtrl* pParent)
 : m_colCursor(RGB(0,0,0)), m_pParentCtrl(pParent), m_uCursorId(0),
   m_lstListeners()
{
	m_uCursorId = m_uNextFreeId;
	m_uNextFreeId++;
}

CChartCursor::~CChartCursor()
{
}

void CChartCursor::SetColor(COLORREF cursorColor)  
{ 
	m_colCursor = cursorColor; 
	m_pParentCtrl->RefreshCtrl();
}

void CChartCursor::RegisterListener(CChartCursorListener* pListener)
{
	m_lstListeners.push_back(pListener);
}

void CChartCursor::CursorMoved(double newXValue, double newYValue)
{
	TListenerList::iterator iter = m_lstListeners.begin();
	for (iter; iter!=m_lstListeners.end(); iter++)
		(*iter)->OnCursorMoved(this, newXValue, newYValue);
}

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 GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Italy Italy
Senior Software Developer in C/C++ and Oracle.
Ex-physicist holding a Ph.D. on x-ray lasers.

Comments and Discussions