124 lines
3.8 KiB
C++
124 lines
3.8 KiB
C++
#if !defined(AFX_SLIDESTATIC_H__17674E4A_09D0_4AB7_BE12_52CE49DCE167__INCLUDED_)
|
|
#define AFX_SLIDESTATIC_H__17674E4A_09D0_4AB7_BE12_52CE49DCE167__INCLUDED_
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif // _MSC_VER > 1000
|
|
// SlideStatic.h : header file
|
|
//
|
|
|
|
#include "Resource.h"
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CSlideStatic window
|
|
class TKStruct {
|
|
public:
|
|
CString csTKFile, csKind, csItem, csDrawing; //类别,名称,内部图名
|
|
TKStruct(const TCHAR *TKFile, const TCHAR *kind, const TCHAR *item, const TCHAR *drawing):
|
|
csTKFile(TKFile), csKind(kind), csItem(item), csDrawing(drawing) {}
|
|
|
|
TKStruct(const TKStruct &src):csTKFile(src.csTKFile), csKind(src.csKind), csItem(src.csItem), csDrawing(src.csDrawing){}
|
|
static int SortByItem(const TKStruct *p1, const TKStruct *p2){
|
|
TKStruct *pp1 = (TKStruct *)p1,
|
|
*pp2 = (TKStruct *)p2;
|
|
return _tcscmp(pp1->csItem, pp2->csItem);
|
|
}
|
|
static int SortByDrawing(const TKStruct *p1, const TKStruct *p2){
|
|
TKStruct *pp1 = (TKStruct *)p1,
|
|
*pp2 = (TKStruct *)p2;
|
|
return _tcscmp(pp1->csDrawing, pp2->csDrawing);
|
|
}
|
|
};
|
|
|
|
class CSlideStatic : public CStatic
|
|
{
|
|
// Construction
|
|
public:
|
|
CSlideStatic();
|
|
virtual ~CSlideStatic();
|
|
|
|
// Attributes
|
|
public:
|
|
BOOL m_bMouseDown, m_bRMouseDown;//判断鼠标是否是本对话框按下去的
|
|
|
|
// Operations
|
|
public:
|
|
BOOL SetupImage(BOOL bReload = TRUE); //显示图像
|
|
void SetupNthImage(int index, CImageDC* pImageDC);
|
|
BOOL GoPage(int destPage);
|
|
void Wash(); //刷新背景
|
|
int CurPage();
|
|
|
|
int GetTotalRecords();//取得当前链表的节点个数
|
|
int PageSize() {
|
|
return (m_nPageColumn * m_nPageRow);
|
|
}
|
|
void GetImageRect(int nindex, CRect& rcImage);
|
|
BOOL IsSelected(int index);
|
|
BOOL IsValid(int);
|
|
int TotalPages() { // 0--not ready, >0--OK
|
|
int len = GetTotalRecords();
|
|
return (len>0 ? ((len-1)/PageSize()+1) : 0);
|
|
}
|
|
int CurImage() { //0 ~ pageSize, -1 --not ready
|
|
return (IsCurrentValid() ? (m_nIndex-CurPage() * PageSize()) : -1);
|
|
}
|
|
BOOL IsCurrentValid() { return (m_nIndex >= 0 && m_nIndex<GetTotalRecords()); }
|
|
void SwapFlipImage(int from_image, int to_image);
|
|
|
|
void SetPageSize(int nRow, int nColumn);
|
|
int GetPageIndex(CPoint & pt);
|
|
void ClearBkColor(); //取消所有选中反色
|
|
BOOL SelectIndex(int selindex);
|
|
BOOL SelectPageIndex(int selindex);
|
|
|
|
void SetTKInfo(const TCHAR* szTKAllName, const TCHAR* szTKType, BOOL bReset = TRUE);
|
|
void SetTKWInfo(const TCHAR* szTKWAllName, const TCHAR* szTKType);
|
|
void SetSort();
|
|
void Reset();
|
|
|
|
DList<TKStruct> m_lstBlk; //当前的构件列表
|
|
int m_nIndex; // 当前项
|
|
DList<int> m_lstSelected;
|
|
BOOL m_bSort; // 排序
|
|
BOOL m_bMultiSel; // 允许多选
|
|
BOOL m_bIsJpgShow;
|
|
// Overrides
|
|
// ClassWizard generated virtual function overrides
|
|
//{{AFX_VIRTUAL(CSlideStatic)
|
|
//}}AFX_VIRTUAL
|
|
|
|
// Implementation
|
|
protected:
|
|
DList<CImageDC> m_lstImage;
|
|
|
|
int m_nPageRow; // 行数
|
|
int m_nPageColumn; // 列数
|
|
|
|
|
|
// Generated message map functions
|
|
protected:
|
|
//{{AFX_MSG(CSlideStatic)
|
|
afx_msg void OnPaint();
|
|
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
|
|
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
|
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
|
//}}AFX_MSG
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
};
|
|
|
|
inline BOOL CSlideStatic::IsValid(int nIndex)
|
|
{
|
|
if(nIndex < 0 || nIndex >= GetTotalRecords())
|
|
return FALSE;
|
|
return TRUE;
|
|
}
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
//{{AFX_INSERT_LOCATION}}
|
|
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
|
|
|
#endif // !defined(AFX_SLIDESTATIC_H__17674E4A_09D0_4AB7_BE12_52CE49DCE167__INCLUDED_)
|