1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
#ifndef T2DLL_T2DLGITEMTABLE_H
#define T2DLL_T2DLGITEMTABLE_H
#include "../common.h"
#include "LListener.h"
#include "T2DlgItem.h"
class AFX_CLASS_EXPORT T2DlgItemTable : public T2DlgItem, public LListener {
public:
enum ScrollerStyle {
ShowIfNeeded,
AlwaysHide,
AlwaysShow,
Attached,
AttachedNoUpdates
};
T2DlgItemTable(T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette);
T2DlgItemTable(int rows, int cols, int rowHeight, int colWidth, int cellDataSize, T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette);
virtual ~T2DlgItemTable();
virtual BOOL Create(const char* inWindowName, DWORD inStyle, const RECT& inRect, CWnd* inParentWnd, UINT inID);
virtual void InsertRows(int, UINT, void*);
virtual void InsertCols(int, UINT, void*);
virtual void RemoveRows(int, UINT);
virtual void RemoveCols(int, UINT);
virtual void SetRowHeight(int, unsigned int, unsigned int);
virtual void SetColWidth(int, unsigned int, unsigned int);
virtual void SetCellData(const TableCellT&, void*);
virtual void GetCellData(const TableCellT&, void*);
virtual void SelectCell(const TableCellT&);
virtual void ToggleCell(const TableCellT&);
virtual void ClearSelectedCells();
void GetTableSize(UINT& outRows, UINT& outCols) const;
BOOL IsMultiSelectable() const;
void EnableMultiSelect(BOOL);
BOOL IsValidCell(const TableCellT&) const;
BOOL EqualCell(const TableCellT&, const TableCellT&) const;
void SetCellDataSize(int);
BOOL IsSelected(const TableCellT&) const;
void GetSelectedCell(TableCellT&) const;
virtual void ListenToMessage(unsigned int, void*);
T2DlgItemHScr* GetHScroller() const;
T2DlgItemVScr* GetVScroller() const;
void AttachHScroller(T2DlgItemHScr* scroller, BOOL flag);
void AttachVScroller(T2DlgItemVScr* scroller, BOOL flag);
void SetHScrollerStyle(ScrollerStyle style);
void SetVScrollerStyle(ScrollerStyle style);
protected:
virtual BOOL OnCommand(UINT, long);
virtual BOOL OnT2DlgItemEraseBkgnd(CDC*);
virtual void OnT2DlgItemLButtonDown(UINT, CPoint);
virtual void OnT2DlgItemLButtonUp(UINT, CPoint);
virtual void OnT2DlgItemMouseMove(UINT, CPoint);
virtual BOOL OnT2DlgItemCreate(CREATESTRUCT*);
virtual void OnT2Size(unsigned int, int, int);
virtual void ClickSelf(const POINT&, UINT nFlags);
virtual void HiliteCells(CDC*, LArrayIterator&);
virtual void UnhiliteCells(CDC*, LArrayIterator&);
virtual void HiliteCell(CDC*, const TableCellT&);
virtual void UnhiliteCell(CDC*, const TableCellT&);
virtual void ClickCell(const TableCellT&, const POINT&);
virtual void DrawCell(CDC*, const TableCellT&);
virtual BOOL FetchLocalCellFrame(const TableCellT&, RECT&);
virtual void FetchCellHitBy(const POINT&, TableCellT&);
int FetchCellDataIndex(const TableCellT&);
void InvalidateCell(const TableCellT&);
void ViewToClient(POINT*, int);
void ClientToView(POINT*, int);
void DoScroll();
BOOL IsOwnHScroller() const;
BOOL IsOwnVScroller() const;
UINT mRows;
UINT mCols;
int mRowHeight;
int mColWidth;
LArray *mCellData;
TableCellT mClickedCell;
TableCellT mSelectedCell;
LArray *mMultiSelectedCells;
POINT mScrollOffset;
T2DlgItemHScr *mHScroller;
T2DlgItemVScr *mVScroller;
BOOL mShowHScroller;
BOOL mShowVScroller;
int mResizeCount;
ScrollerStyle mVScrollerStyle;
ScrollerStyle mHScrollerStyle;
private:
void InitTable(int rows, int cols, int rowHeight, int colWidth, int cellDataSize);
BOOL Resized();
};
class AFX_CLASS_EXPORT TableCellIterator {
public:
TableCellIterator(const TableCellT& start, const TableCellT& end);
BOOL Next(TableCellT& newCurrent);
protected:
UINT mCurrentRow;
UINT mCurrentCol;
UINT mLastRow;
UINT mFirstCol;
UINT mLastCol;
};
#endif
|