
/*	Copyright (C) G. Jespersen
	See Licence.txt.*/

#if !defined(AFX_DSLAVLISTVIEW_H__3A6E7FC6_D916_4BCF_88B5_A543966A338C__INCLUDED_)
#define AFX_DSLAVLISTVIEW_H__3A6E7FC6_D916_4BCF_88B5_A543966A338C__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// DsLavListView.h : header file
//

#include <afxcview.h> // CListView
#include "DsLavSplitterView.h"

// Foreward
class CDsLavTreeView;


/////////////////////////////////////////////////////////////////////////////
// CDsLavListView view

class CDsLavListView : public CListView //CListView CView
{
protected:
	CDsLavListView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CDsLavListView)

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CDsLavListView)
	public:
	virtual void OnInitialUpdate();
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	virtual void OnDraw(CDC* pDC);
	//}}AFX_VIRTUAL

	// Generated message map functions
protected:
	//{{AFX_MSG(CDsLavListView)
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
	afx_msg void OnColumnclick(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	//}}AFX_MSG

	LRESULT OnSizeColumns(WPARAM wParam, LPARAM lParam);	// WM_USER_SIZE_COLUMNS

	DECLARE_MESSAGE_MAP()

// Attributes
public:
	// See DsLavSplitter
	CDsLavDoc* GetDocument();
	bool m_bInitialized;
	UINT m_numberOfListViewColumns;
	BOOL m_bColWidthSet;

// Operations
public:
	void InitializeListView();
	void SetListData();
	void UpdateColumnWidths();
	BOOL GetColWidths(int & col1, int & col2, int & col3, int & col4, int & col5);
	void AddNewItem(UINT index, CDsLavDoc* pLavDoc);
	void RemoveSelections();
private:
	void OnContextMenuMulti(CWnd* pWnd, CPoint point);

protected:
	CDsLavTreeView * GetTreeViewPtr();

	// Drag and Drop:
	//
	// Single sel drag and drop.
	int		m_iDragListIndex;
	BOOL	m_bDragging;
	BOOL	m_bDragInTreeCtrl;
	BOOL	m_bDragable;
	CImageList  m_imageList;
	CImageList* m_pImageList;
	HTREEITEM	m_hDragTreeItem;

	// Multi sel drag and drop.
	void OnBegindragMulti(NMHDR* pNMHDR, LRESULT* pResult);
	CImageList * CreateMultiDragImage();
	CDWordArray m_iDragListIndexAr;

	// Tree topic expansion.
	int		m_nDelayInterval;
	int		m_nScrollMargin;
	int		m_nScrollInterval;
	BOOL	IsTreeViewItemExpanded(HTREEITEM hItem, CTreeCtrl & treeCtrl);

private:
	BOOL m_redrawVid;

	// List Media Data to display.
	CMediaArray m_mediaAr;
	// Child TopicAr.
	CTopicArray m_childTopicsAr;

//	// Child topic Names and Nodes.
//	CStringArray m_childTopicNamesAr;
//	CNodesArArray m_childTopicNodesAr;

private:
	CPlayer * GetPlayer();

	// Selection
	int	m_curSelIndex;

	// List font.
	CFont m_font;

///////////////////////
// CListCtrl handling:
public:

///////////////////
// Implementation
protected:
	virtual ~CDsLavListView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif


};
// See DsLavSplitter
#ifndef _DEBUG  // debug version in DsLavListView.cpp
inline CDsLavDoc* CDsLavListView::GetDocument()
   { return (CDsLavDoc*)m_pDocument; }
#endif

////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_DSLAVLISTVIEW_H__3A6E7FC6_D916_4BCF_88B5_A543966A338C__INCLUDED_)
