diff options
Diffstat (limited to 'src/T2DLL/T2DlgItemTable.h')
-rw-r--r-- | src/T2DLL/T2DlgItemTable.h | 90 |
1 files changed, 59 insertions, 31 deletions
diff --git a/src/T2DLL/T2DlgItemTable.h b/src/T2DLL/T2DlgItemTable.h index 577fb52..5b294cf 100644 --- a/src/T2DLL/T2DlgItemTable.h +++ b/src/T2DLL/T2DlgItemTable.h @@ -3,21 +3,25 @@ #include "LListener.h" #include "T2DlgItem.h" -class DLL_EXPORT T2DlgItemTable : public T2DlgItem, public LListener { +class AFX_EXT_CLASS T2DlgItemTable : public T2DlgItem, public LListener { public: enum ScrollerStyle { - ScrollerStyle_0 + ShowIfNeeded, + AlwaysHide, + AlwaysShow, + Attached, + AttachedNoUpdates }; - T2DlgItemTable(T2TowerDoc*, T2ImageObj*, CPalette*); - T2DlgItemTable(int, int, int, int, int, T2TowerDoc*, T2ImageObj*, CPalette*); + 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 int Create(const char*, unsigned long, const RECT&, CWnd*, unsigned int); - virtual void InsertRows(int, unsigned int, void*); - virtual void InsertCols(int, unsigned int, void*); - virtual void RemoveRows(int, unsigned int); - virtual void RemoveCols(int, unsigned int); + 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*); @@ -26,39 +30,39 @@ public: virtual void ToggleCell(const TableCellT&); virtual void ClearSelectedCells(); - void GetTableSize(unsigned int&, unsigned int&) const; - int IsMultiSelectable() const; - void EnableMultiSelect(int); - int IsValidCell(const TableCellT&) const; - int EqualCell(const TableCellT&, const TableCellT&) const; + 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); - int IsSelected(const TableCellT&) const; + BOOL IsSelected(const TableCellT&) const; void GetSelectedCell(TableCellT&) const; virtual void ListenToMessage(unsigned int, void*); T2DlgItemHScr* GetHScroller() const; T2DlgItemVScr* GetVScroller() const; - void AttachHScroller(T2DlgItemHScr*, int); - void AttachVScroller(T2DlgItemVScr*, int); - void SetHScrollerStyle(ScrollerStyle); - void SetVScrollerStyle(ScrollerStyle); + void AttachHScroller(T2DlgItemHScr* scroller, BOOL flag); + void AttachVScroller(T2DlgItemVScr* scroller, BOOL flag); + void SetHScrollerStyle(ScrollerStyle style); + void SetVScrollerStyle(ScrollerStyle style); protected: - virtual int OnCommand(unsigned int, long); - virtual int OnT2DlgItemEraseBkgnd(CDC*); + 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 int OnT2DlgItemCreate(CREATESTRUCT*); + virtual BOOL OnT2DlgItemCreate(CREATESTRUCT*); virtual void OnT2Size(unsigned int, int, int); - virtual void ClickSelf(const POINT&, unsigned 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 int FetchLocalCellFrame(const TableCellT&, RECT&); + virtual BOOL FetchLocalCellFrame(const TableCellT&, RECT&); virtual void FetchCellHitBy(const POINT&, TableCellT&); int FetchCellDataIndex(const TableCellT&); @@ -66,16 +70,40 @@ protected: void ViewToClient(POINT*, int); void ClientToView(POINT*, int); void DoScroll(); - int IsOwnHScroller() const; - int IsOwnVScroller() const; + 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, int, int, int, int); - int Resized(); + void InitTable(int rows, int cols, int rowHeight, int colWidth, int cellDataSize); + BOOL Resized(); }; -class DLL_EXPORT TableCellIterator { +class AFX_EXT_CLASS TableCellIterator { public: - TableCellIterator(const TableCellT&, const TableCellT&); - int Next(TableCellT&); + TableCellIterator(const TableCellT& start, const TableCellT& end); + BOOL Next(TableCellT& newCurrent); + +protected: + UINT mCurrentRow; + UINT mCurrentCol; + UINT mLastRow; + UINT mFirstCol; + UINT mLastCol; }; |