#include "stdafx.h"
#include "objListBox.h"
#include "resource.h"
/////////////////////////////////////////////////////////////////////////////
// CObjListBox

CObjListBox::CObjListBox()
{
}

CObjListBox::~CObjListBox()
{
}


BEGIN_MESSAGE_MAP(CObjListBox, CListBox)
	//{{AFX_MSG_MAP(CObjListBox)
	ON_WM_LBUTTONDBLCLK()
	ON_WM_RBUTTONDOWN()
	ON_WM_LBUTTONUP()
	ON_WM_RBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CObjListBox message handlers

void CObjListBox::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	GetParent()->SendMessage(WM_LBUTTONDBLCLK,WPARAM(nFlags),MAKELPARAM(point.x,point.y));	
	CListBox::OnLButtonDblClk(nFlags, point);
}

void CObjListBox::OnRButtonDown(UINT nFlags, CPoint point) 
{
	BOOL outside;
	SetCurSel(ItemFromPoint(point,outside));

	GetParent()->SendMessage(WM_RBUTTONDOWN,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
	CListBox::OnRButtonDown(nFlags, point);
}

void CObjListBox::OnLButtonUp(UINT nFlags, CPoint point) 
{
	GetParent()->SendMessage(WM_LBUTTONUP,WPARAM(nFlags),MAKELPARAM(point.x,point.y));	
	CListBox::OnLButtonUp(nFlags, point);
}

BOOL CObjListBox::PreCreateWindow(CREATESTRUCT& cs) 
{
	cs.style |= LBS_WANTKEYBOARDINPUT;
	
	return CListBox::PreCreateWindow(cs);
}

int CObjListBox::VKeyToItem(UINT /*nKey*/,   // variable names removed to prevent compiler warning until used
                            UINT /*nIndex*/
                            ) 
{
	// TODO: Add your code to handle a particular virtual key
	// return -1 = default action
	// return -2 = no further action
	// return index = perform default action for keystroke on
	//                item specified by index
	
	return -2;
}

void CObjListBox::OnRButtonDblClk(UINT nFlags, CPoint point) 
{
	BOOL outside;
	SetCurSel(ItemFromPoint(point,outside));

	GetParent()->SendMessage(WM_RBUTTONDBLCLK,WPARAM(nFlags),MAKELPARAM(point.x,point.y));
	CListBox::OnRButtonDblClk(nFlags, point);
}
