///////////////////////////////////////////////////////////////////////////////
//
// Implementation file for Data used by WAW
//
///////////////////////////////////////////////////////////////////////////////

#include <StdAfx.h>

#include "WAW_Main.hpp"
#include "WAW_Data.hpp"
#include "WAW_Strg.hpp"
#include "ErO.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


extern WAW_MainDialog * WAW_g_pclWatchWindow;


//***********************************************
// Constructor
//***********************************************
WAW_Data::WAW_Data( CString _csDataName, CString _csDataValue, WAW_tdstUserInfo * _pstUserInfo, void * _pvUserData )
{
	m_pri_csDataName  = _csDataName;
	m_pri_csDataValue = _csDataValue;
	m_pri_pstUserInfo = _pstUserInfo;
	m_pri_pvUserData  = _pvUserData;

	m_pri_bIsData = TRUE;
}


//***************************
// Destructor
//***************************
WAW_Data::~WAW_Data()
{}


WAW_Data * WAW_Data::m_pub_fn_pclGetParentData()
{
	ERROR_PREPARE_M( WAW_g_C_csModuleNameForError,
									 "Get the parent of a Data",
									 "WAW_Data::m_pub_fn_pclGetParentData",
									 E_ERROR_GRAVITY_FATAL,
									 "The pointer to CTreeCtrl is NULL" );
	CTreeCtrl * pclTreeCtrl = WAW_g_pclWatchWindow->m_pub_fn_pclGetTreeCtrl();
	ERROR_ASSERT( pclTreeCtrl != NULL );
	if( pclTreeCtrl == NULL ) return NULL;

	HTREEITEM hParentItem = pclTreeCtrl->GetParentItem( m_pri_hTreeItem );
	if( hParentItem == NULL ) return NULL;
	
	return (WAW_Data*)pclTreeCtrl->GetItemData( hParentItem );
}