#pragma once

#include "LocalComboBox.h"
#include "LocalTreeCtrl.h"
#include "LocalListCtrl.h"

#ifndef _USE_XTREME_TOOLKITPRO
#include "PTxSCP.h"
#endif // !_USE_XTREME_TOOLKITPRO
#include "WebBrowser2.h"
#include "PictureEx.h"

#include "TextProgressCtrl.h"
#include "HCButton.h"


// CLocalView 폼 뷰입니다.

class CLocalView : public CView
{
protected:
	CLocalView();           // 동적 만들기에 사용되는 protected 생성자입니다.
	DECLARE_DYNCREATE(CLocalView)

public:
	virtual ~CLocalView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	int  m_cxSplitter;
	BOOL m_bDragSplitter;

	UINT m_nTimer;

	long m_nUploadMenuId;
	long m_nPasteMenuId;

	CString m_sSelectedPath;

	CWnd*           m_pwndPrevFocused;
#ifndef _USE_XTREME_TOOLKITPRO
	IPTxShListItem* m_pitemPrev;
#endif // !_USE_XTREME_TOOLKITPRO
	VARIANT_BOOL    m_bPrevItemSelected;

	BOOL m_bIgnoreEvent;

public:
	CXTCaption    m_capToolBar;
	CPictureEx    m_stcAdvert;
	CHCButton     m_btnToolBar;
	CXTButton     m_btnUpload;
	CXTButton     m_btnDownload;
	CXTButton     m_btnNewFolder;
	CXTButton     m_btnDelete;

	CBitmapButton  m_capTitleIcon;
	CXTCaption     m_capTitle;
	CLocalTreeCtrl m_tree;
	CStatic        m_capAddr;
	CLocalComboBox m_cboAddr;
	CXTButton      m_btnGoAddr;
	CXTButton      m_btnUpAddr;
	CXTButton      m_btnListStyle;
	CLocalListCtrl m_list;

	CXTCaption        m_capStatus;
	CTextProgressCtrl m_prgStatusSpace;
	CStatic           m_stcStatusSpace;
	CStatic           m_stcStatusObject;
	CStatic           m_stcStatusMsg;
	CStatic           m_stcSeparator1;
	CStatic           m_stcSeparator2;

	long    m_nSelectedCount;
	__int64 m_nSelectedBytes;
	long    m_nSelectedFiles;
	long    m_nSelectedSecialObj;
	long    m_nTotalCount;
	__int64 m_nTotalBytes;

#ifndef _USE_XTREME_TOOLKITPRO
	IPTxShTreeNode* m_pnodeRoot;
#endif // !_USE_XTREME_TOOLKITPRO

	bool m_bUpdating;

protected:
	void RedrawControl(int cx, int cy);

	BOOL SetPath(CString sFolder);

	void InvertTracker(int x);

#ifndef _USE_XTREME_TOOLKITPRO
	DECLARE_EVENTSINK_MAP()
	void OnMouseDownLocalCombo(short aButton, short aShift, float ax, float ay);
	void OnAfterSelChangeLocalTree(LPDISPATCH aSelectedNode);
	void OnBeforeShellMenuPopupLocalTree(LPDISPATCH aMenu, LPDISPATCH aSelectedNode, long aNextCustomMenuId, BOOL* aCancelMenu);
	void OnAfterShellMenuSelectionLocalTree(LPDISPATCH aSelectedNode, long aSelectedMenuId, BOOL* aCancelDefaultBehaviour);
	void OnOleDragOverLocalTree(LPDISPATCH AData, long* aEffect, short* aButton, short* aShift, float ax, float ay, short aState);
	void OnOleDragDropLocalTree(LPDISPATCH AData, long* aEffect, short* aButton, short* aShift, float ax, float ay);
	void OnMouseDownLocalTree(short aButton, short aShift, float ax, float ay);
	void OnFolderChangedLocalList();
	void OnAfterFillLocalList();
	void OnBeforeSelectionChangeLocalList(LPDISPATCH aItem, BOOL* aCancel);
	void OnItemContextMenuLocalList(LPDISPATCH aItem, float ax, float ay, BOOL* aCancelDefaultMenu);
	void OnBeforeShellMenuPopupLocalList(LPDISPATCH aMenu, LPDISPATCH aSelectedItems, long aNextCustomMenuId, BOOL* aCancelMenu);
	void OnAfterShellMenuSelectionLocalList(LPDISPATCH aSelectedItems, long aSelectedMenuItemId, BOOL* aCancelDefaultBehaviour);
	void OnOleDragOverLocalList(LPDISPATCH AData, long* aEffect, short* aButton, short* aShift, float ax, float ay, short aState);
	void OnOleDragDropLocalList(LPDISPATCH AData, long* aEffect, short* aButton, short* aShift, float ax, float ay);
	void OnMouseUpLocalList(short aButton, short aShift, float ax, float ay);
#endif // !_USE_XTREME_TOOLKITPRO

public:
	void RedrawFocus();
	void RedrawControlEx();
	void ApplyListStyle();

	BOOL GetSelectedObject(CStringArray &saObject);

	CString GetSelectedPath();
	BOOL IsSelected();
	BOOL IsSpecialObjectSelected();

	void RefreshItem();

	void StartDrag();
	void EndDrag();

	BOOL CopyClipboard(COleDataObject& odo, CString sTargetPath, BOOL bErase = FALSE);

	void DeleteFile();

protected:
	virtual void OnDraw(CDC* pDC);  // 이 뷰를 그리기 위해 재정의되었습니다.
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);

public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnLocalAdvert();
	afx_msg void OnLocalBtnToolbar();
	afx_msg void OnLocalBtnUpload();
	afx_msg void OnLocalBtnDownload();
	afx_msg void OnLocalBtnNewFolder();
	afx_msg void OnLocalBtnDelete();
	afx_msg void OnLocalTitle();
//	afx_msg void OnLocalBtnGoAddr();
	afx_msg void OnLocalBtnUpAddr();
	afx_msg void OnLocalBtnListStyle();

	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnListNewfolder();
	afx_msg void OnListRefresh();
	afx_msg void OnListType0();
	afx_msg void OnListType1();
	afx_msg void OnListType2();
	afx_msg void OnListType3();
	afx_msg void OnListType4();
	afx_msg void OnListSort1();
	afx_msg void OnListSort2();
	afx_msg void OnListSort3();
	afx_msg void OnListSort4();
	afx_msg void OnListPaste();
	afx_msg void OnListAll();

	DECLARE_MESSAGE_MAP()
};


