📄 gfxlistctrl.h
字号:
#if !defined(AFX_GFXLISTCTRL_H__31F5CEA8_E5CA_11D1_86E7_000000000000__INCLUDED_)
#define AFX_GFXLISTCTRL_H__31F5CEA8_E5CA_11D1_86E7_000000000000__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// GfxListCtrl.h : header file
//
#include "GfxHeaderCtrl.h"
#include "GfxListTip.h"
#include "GfxColumnManager.h"
#include "GfxCategoryManager.h"
#define WM_LISTEX_NOTIFY WM_USER+1
class LXHDREX;
class CGfxInCombo;
enum { fHighRowSelect = 1 << 0, fVertGrid = 1 << 1, fHorizGrid = 1 << 2, fAutoSort = 1 << 3,
fExInfo = 1 << 4, fSubItemImages = 1 << 5, fAllowMultiChange = 1 << 6, fAllowDivider = 1 << 7,
fCellToolTip = 1 << 8, fExInfoOnRow = 1 << 9, fExInfoOnCol = 1 << 10, fReturnDblClk = 1 << 11,
fReturnModify = 1 << 12, fScrollBarAlways = 1 << 13, fShowSelCell = 1 << 14
};
enum { fiBold = 1 << 0, fiItalic = 1 << 1, fiUnderline = 1 << 2 };
enum { fhComboBox = 1 << 0, fhComboBoxEx = 1 << 1, fhEdit = 1 << 2, fhNumeric = 1 << 3, fhValute = 1 << 4, fhSortAble = 1 << 5, fhImage = 1 << 6, fhNoSortArrow = 1 << 7, fhNoResizeColumn = 1 << 8, fhColumnHasImage = 1 << 9 };
enum { ptUseColor = 1 << 0, ptUseFonts = 1 << 1, ptListName = 1 << 2, ptPageNumbers = 1 << 3, ptPageDate = 1 << 4 };
/////////////////////////////////////////////////////////////////////////////
// CGfxListCtrl window
class CSortClass
{
public:
CSortClass(CListCtrl * _pWnd, const int _iCol, const bool _bIsNumeric, const bool _bIsValute = false);
virtual ~CSortClass();
int iCol;
CListCtrl * pWnd;
bool bIsNumeric, bIsValute;
void Sort(const bool bAsc);
static int CALLBACK CompareAsc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
static int CALLBACK CompareDes(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
static int CALLBACK CompareAscI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
static int CALLBACK CompareDesI(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
public:
class CSortItem
{
public:
virtual ~CSortItem();
CSortItem(const DWORD _dw, const CString &_txt);
CString txt;
DWORD dw;
};
class CSortItemInt
{
public:
CSortItemInt(const DWORD _dw, CString &_txt, bool bIsValute = false);
int iInt ;
DWORD dw;
};
};
enum { NTEX_ITEMINFO = 0, NTEX_COMBOREQUEST = 1, NTEX_SETTEXT = 2, NTEX_DIVIDER = 3, NTEX_AUTOPREVIEW = 4 };
class LXHDREX
{
public:
LXHDREX()
{
iNotifyCode = -1;
CtrlId = -1;
pComboArray = NULL;
dwMask = dwFlag = 0;
};
virtual ~LXHDREX() {};
enum { exBold = (1 << 0), exItalic = (1 << 1), exUnderline = (1 << 2), exHFont = (1 << 3),
exTextColor = (1 << 4), exBackColor = (1 << 5), exText = (1 << 6), exComboArray = (1 << 7)
};
/**
*
**/
int iNotifyCode;
/**
*真正处理此消息的控件ID(此处为列表控件的ID)
**/
int CtrlId;
/**
*iItem条目索引(行号)、iSubItem列的相关子项索引
**/
int iItem, iSubItem;
/**
*指定单元相关的32位应用程序数据
**/
DWORD dwItemData;
/**
*
**/
DWORD dwMask;
DWORD dwFlag;
COLORREF crText, crBack;
HFONT hfText;
CString csText;
/**
*组合框控件选项数组指针
**/
CStringArray * pComboArray;
};
class LXHDREX_DIV : public LXHDREX
{
public:
LXHDREX_DIV() { pDC = NULL; };
virtual ~LXHDREX_DIV() {};
LXHDREX_DIV(LXHDREX * pRex)
{
iNotifyCode = pRex->iNotifyCode;
CtrlId = pRex->CtrlId;
iItem = pRex->iItem;
iSubItem = pRex->iSubItem;
dwItemData = pRex->dwItemData;
pDC = NULL;
};
CDC * pDC;
CRect rcItem;
};
class CGfxListCtrl : public CListCtrl
{
// Construction
public:
CGfxListCtrl();
CGfxHeaderCtrl wndHeader;
CGfxColumnManager * pManager;
CGfxCategoryManager * pCategoryManager;
COLORREF m_clrText, crBackSel, m_clrTextBk, m_clrBkgnd, crCategoryBck, cr3dFace;
int iCtrlId;
int iSubItemFocus;
int m_cxClient;
int m_cxStateImageOffset;
int iItemHeight;
int iAutoPreviewHeight;
int iItemHeightCategory;
void SetItemHeight(const int iHeight, const bool bCategory = false);
void SetAutoPreviewHeight(const int iHeight = 0);
int GetAutoPreviewHeight() const;
int iInternal1;
CPen * gpn, *gcatpn;
CFont ftNormal, ftUnderline, ftBold, ftItalic;
CWnd * pReciper;
/**
* 获取列表控件中消息的接收者(一般为列表控件的父窗口)
**/
CWnd * GetReciper() const { return pReciper ? pReciper : GetParent(); };
// Database Bind Mode
public:
bool bDaoBind;
CDaoRecordset * pRecordSet;
bool BindDaoRecordset(CDaoRecordset * pSet);
bool FillRecordsetColumn();
bool FillDaoItems();
void OnDaoGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult);
void OnDaoGetTextCallback(int iIndex, int iSubItem, long lCode, CString &cs);
long GetExInfoCallback(LXHDREX * pLx);
// Printing support
public:
void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
void OnPrint(CDC* pDC, CPrintInfo* pInfo);
CFont pft, pfb, pfi, pfu;
int iPrintCountPerPage;
CRect rcMarginMM;
DWORD dwPrintFlag;
CString csPrintName;
void SetPrintFlag(const DWORD dwf);
void SetPrintName(const char * name);
void SetMargins(const int left, const int top, const int right, const int bottom);
// Bitmap background
public:
bool bBlendBitmap;
CPalette m_pal;
CBitmap m_bitmap;
int m_cxBitmap, m_cyBitmap;
CImageList cBackImage;
bool SetBkImage(UINT nIDResource);
bool SetBkImage(LPCTSTR lpszResourceName);
void SetBlendBitmap(const bool bBlend);
// Attributes
public:
enum { OFFSET_FIRST = 2, OFFSET_OTHER = 6 };
long (CWnd::*m_fpExInfoFun)(LXHDREX *);
void (CWnd::*m_fpGetTextCallback)(int , int, long, CString &);
void (CWnd::*m_fpCategoryFun)(CGfxCategoryManager * , long &);
void (CWnd::*m_fpDaoCategoryFun)(CGfxCategoryManager *);
void SetExInfoCallback(long (CWnd::*fpExInfoFun)(LXHDREX *));
void SetCategoryCallback(void (CWnd::*fpCategoryFun)(CGfxCategoryManager * , long &));
void SetGetTextCallback(void (CWnd::*fpGetTextCallback)(int , int, long, CString &));
void SetDaoCategoryCallback(void (CWnd::*fpDaoCategoryFun)(CGfxCategoryManager *));
DWORD dwFlag;
DWORD dwhCombo, dwhComboEx, dwhEdit, dwhNumeric, dwhValute, dwhImages;
DWORD wdhExInfoOnCol;
void SetNumeric(const int iCol);
void SetValute(const int iCol);
void SetEditCol(const int iCol);
void SetComboCol(const int iCol);
void SetComboExCol(const int iCol);
void SetExColRequest(const int iCol);
void DontDrawSortArrow(const int iCol);
bool NeedColExInfo(const int iCol) const;
CImageList * pItemImageList;
void SetItemImageList(CImageList * pList);
// Operations
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -