123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264 |
- #pragma once
- #include "XCell.h"
- #include "AutoCompl.h"
- const int MAX_ROWS = 256;
- const int MAX_COLS = 128;
- #include "TreeComboBox.h"
- class XTableTreeComboBox : public CTreeComboBox
- {
- // Construction
- public:
- XTableTreeComboBox();
- // Attributes
- public:
- void SetCtrlData(DWORD dwData);
- DWORD GetCtrlData();
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(XTableTreeComboBox)
- public:
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- //}}AFX_VIRTUAL
- // Implementation
- public:
- virtual ~XTableTreeComboBox();
- // Generated message map functions
- protected:
- //{{AFX_MSG(XTableTreeComboBox)
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- afx_msg void OnCloseup();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- private:
- DWORD m_dwData;
- BOOL m_bExchange;
- };
- class XTableComboBox : public CComboBox
- {
- // Construction
- public:
- XTableComboBox();
- // Attributes
- public:
- void SetCtrlData(DWORD dwData);
- DWORD GetCtrlData();
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(XTableComboBox)
- public:
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- //}}AFX_VIRTUAL
- // Implementation
- public:
- virtual ~XTableComboBox();
- // Generated message map functions
- protected:
- //{{AFX_MSG(XTableComboBox)
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- afx_msg void OnCloseup();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- private:
- DWORD m_dwData;
- BOOL m_bExchange;
- };
- class XTableEdit : public CEdit
- {
- // Construction
- public:
- XTableEdit();
- // Attributes
- public:
- void SetCtrlData(DWORD dwData);
- DWORD GetCtrlData();
- // Operations
- public:
- // Overrides
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(XTableEdit)
- public:
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- //}}AFX_VIRTUAL
- // Implementation
- public:
- virtual ~XTableEdit();
- // Generated message map functions
- protected:
- //{{AFX_MSG(XTableEdit)
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- private:
- DWORD m_dwData;
- BOOL m_bExchange;
- };
- // XTable
- class XTable : public CWnd
- {
- DECLARE_DYNAMIC(XTable)
- CArray<CStringArray, CStringArray>*m_pClientArray;
- CArray<CStringArray, CStringArray>*pTxtypearray;
- CArray<CStringArray, CStringArray>*m_pListArray;
- friend class XCell;
- CAutoComplete m_acCombo;
- XTableComboBox m_combobox;
- XTableComboBox m_combobox2;
- int m_nCurShow;
- int m_nticks;
- CStringArray m_datearray;
- CArray<int,int>m_daterowposarray;
- int m_mode;
- CString m_id;
- public:
- XTable(int rows = 0, int cols = 0);
- virtual ~XTable();
- BOOL m_bFocusFrame;
- BOOL Create(const RECT& rect, CWnd* parent, UINT nID,
- DWORD dwStyle = WS_CHILD | WS_BORDER | WS_TABSTOP | WS_VISIBLE);
- int ToXML (CMarkup& markup);
- int FromXML (CMarkup& markup);
- public:
- XCell* cells;
- int* rowHeight;
- int* colWidth;
- int rows;
- int cols;
- int focusRow;
- int focusCol;
- XCell defaultCell;
- int defaultHeight;
- int defaultWidth;
- public:
- int SetRows(int rows);
- int GetRows();
- int SetCols(int cols);
- int GetCols();
- int SetRowHeight(int row, int height);
- int GetRowHeight(int row);
- int SetColWidth(int col, int width);
- int GetColWidth(int col);
- int GetRowsHeight(int startRow, int endRow);
- int GetColsWidth(int startCol, int endCol);
- int AppendRow() {return SetRows(GetRows() + 1);}
- int AppendCol() {return SetCols(GetCols() + 1);}
- int deleteRow() {return SetRows(GetRows() - 1);}
- int deleteCol() {return SetCols(GetCols() - 1);}
- int JoinCells (int startRow, int startCol, int endRow, int endCol);
- int UnjoinCells (int row, int col);
- int SetCells(int row, int col, XCell& cell);
- XCell* GetCells(int row, int col);
- int SetText(int row, int col, CString str);
- CString GetText(int row, int col);
- int SetTextColor(int row, int col, COLORREF color);
- COLORREF GetTextColor(int row, int col);
- int SetTextFont(int row, int col, CFont& font);
- CFont* GetTextFont(int row, int col);
- int SetTextFontSize(int row, int col, int size);
- int GetTextFontSize(int row, int col);
- int SetBackColor(int row, int col, COLORREF color);
- COLORREF GetBackColor(int row, int col);
- int SetBackMode(int row, int col, int mode);
- int GetBackMode(int row, int col);
- int SetOverlap (int row, int col, bool enable);
- bool GetOverlap (int row, int col);
- int SetAlignment (int row, int col, int align);
- int GetAlignment (int row, int col);
- int SetWordbreak (int row, int col, bool enable);
- bool GetWordbreak (int row, int col);
-
- public:
- int Draw(CDC* pDC);
- RECT GetRect(int row, int col);
- bool HitTest (CPoint point, int& row, int& col);
- int Test ();
- int Test2 ();
- protected:
- DECLARE_MESSAGE_MAP()
- public:
- void AddName(int row, int col, CString str);
- void ModeChange(int mode);
- CString GetWeek(CString date);
- BOOL IsDateRow(int row);
- void OtherDate();
- void DeleteCur();
- void Save(int row);
- void Save2(int row);
- void CalRowHeight();
- afx_msg void OnPaint();
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- virtual void OnDraw(CDC* pDC);
- static BOOL RegisterWindowClass();
- afx_msg BOOL OnEraseBkgnd(CDC* pDC);
- afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
- afx_msg void OnEditEnd(WPARAM ,LPARAM lParam = FALSE);
- void ShowEdit(BOOL bShow,int nItem,int nIndex,CRect rc = CRect(0,0,0,0));
- void ShowSearchClientComboBox(BOOL bShow,int nItem,int nIndex,CRect rc = CRect(0,0,0,0));
- void ShowSearchClientComboBoxTime(BOOL bShow,int nItem,int nIndex,int type,CRect rc = CRect(0,0,0,0));
- XTableEdit m_edit;
- int m_nItem;
- int m_nSub;
- };
|