📄 filedlgex.h
字号:
/////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002 by F.R.Wen
// All rights reserved
//
// If this code works, it was written by F.R.Wen
// If not, I don't know who wrote it
// You can distribute and use freely
//
// Send bug reports, bug fixes, enhancements, etc. to:
// frwen@sohu.com
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_CFILEDLGEX_H__6975A857_62DC_11D2_8BF2_00A0C9B05590__INCLUDED_)
#define AFX_CFILEDLGEX_H__6975A857_62DC_11D2_8BF2_00A0C9B05590__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include <afxtempl.h>
/////////////////////////////////////////////////////////////////////////////
// CFileDlgEx dialog
class CFileDlgEx : public CFileDialog
{
DECLARE_DYNAMIC(CFileDlgEx)
public:
//----------------
// Initialization:
//----------------
CFileDlgEx (LPCTSTR lpszCaption,
BOOL bOpenFileDialog = TRUE,
BOOL bNewPage = TRUE,
LPCTSTR lpszDefExt = NULL,
LPCTSTR lpszFileName = NULL,
DWORD dwFlags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
LPCTSTR lpszFilter = NULL,
CWnd* pParentWnd = NULL);
virtual ~CFileDlgEx ();
void SetDlgIcon (HICON hIconBig, HICON hIconSmall = NULL);
void SetNewImagesList (CImageList* pImagesNew)
{
m_pImagesNew = pImagesNew;
}
void SetLogoBitmap (CBitmap* pBmpLogo)
{
m_pBmpLogo = pBmpLogo;
}
void AddNewItem (LPCTSTR lpszName, LPCTSTR lpszExt, int iIconIndex);
//---------
// Results:
//---------
enum SelectedPage
{
FileDlgExNew,
FileDlgExOpen,
FileDlgExRecent
};
SelectedPage GetPage () const
{
return m_nPage;
}
const CString& GetRecentFilePath () const
{
ASSERT (m_nPage == FileDlgExRecent);
return m_strRecentFilePath;
}
int GetNewItemIndex () const
{
ASSERT (m_nPage == FileDlgExNew);
return m_iNewItemIndex;
}
virtual int DoModal();
protected:
//------------------------
// Internal notifications:
//------------------------
void OnTabSelchange ();
void OnItemDblClick ();
void CollectControls ();
void CollectRecentFiles ();
static LRESULT CALLBACK WindowProcNew(HWND hwnd,UINT message, WPARAM wParam, LPARAM lParam);
protected:
//{{AFX_MSG(CFileDlgEx)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
virtual void OnInitDone();
// Attributes:
public:
static WNDPROC m_wndProc;
protected:
CTabCtrl m_wndTab; // TabControl
CListCtrl m_wndNewList; // New document control list
CListCtrl m_wndRecentList; // Recent document control
CList<HWND, HWND> m_lstFDControls; // for all controls
CImageList* m_pImagesNew; // New document ICON list
CList<CString,CString> m_FileList; // recent file list
DWORD nNum; // number of recent files
CImageList m_pImagesRecent; // recent file ICON list
CObList m_lstNewItems; // New document ObjectList
BOOL m_bNewPage; // show or hide NewPage
SelectedPage m_nPage; // current select page
CString m_strCaption; // caption of the dialog
CString m_strRecentFilePath; // filename for RecentPage
int m_iNewItemIndex; // index of newitem
CBitmap* m_pBmpLogo; // logo bitmap
CRect m_rectLogo; // rect for display bitmap
HICON m_hIconBig; // icon for dialog
HICON m_hIconSmall;
int m_iLogoAreaHeight; // height of logo area
};
class CNewItemInfo : public CObject
{
friend class CFileDlgEx;
CNewItemInfo (LPCTSTR lpszName, LPCTSTR lpszExt, int iIconIndex)
{
m_strFileDescription = lpszName;
m_iIconIndex = iIconIndex;
m_strExtName = lpszExt;
}
CString m_strFileDescription;
CString m_strExtName;
int m_iIconIndex;
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CFileDlgEx_H__6975A857_62DC_11D2_8BF2_00A0C9B05590__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -