Commit 7c3f2e1743782b32005a87cdd6094148010af2ec
1 parent
5f9c25d6
feat<central_clearing_system>:中央结算新增下单页面
Showing
9 changed files
with
1665 additions
and
0 deletions
Too many changes to show.
To preserve performance only 9 of 28 files are displayed.
central_clearing_system/ETradeClient.rc
@@ -100,6 +100,14 @@ BEGIN | @@ -100,6 +100,14 @@ BEGIN | ||
100 | END | 100 | END |
101 | END | 101 | END |
102 | 102 | ||
103 | +IDR_MENU1 MENU | ||
104 | +BEGIN | ||
105 | + POPUP "列表右键菜单" | ||
106 | + BEGIN | ||
107 | + MENUITEM "删除", ID_POPMENU_DELETE | ||
108 | + END | ||
109 | +END | ||
110 | + | ||
103 | 111 | ||
104 | ///////////////////////////////////////////////////////////////////////////// | 112 | ///////////////////////////////////////////////////////////////////////////// |
105 | // | 113 | // |
@@ -120,6 +128,11 @@ BEGIN | @@ -120,6 +128,11 @@ BEGIN | ||
120 | VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT | 128 | VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT, NOINVERT |
121 | END | 129 | END |
122 | 130 | ||
131 | +IDR_ACCELERATOR_ORDER ACCELERATORS | ||
132 | +BEGIN | ||
133 | + VK_TAB, ID_ACCELERATOR_TAB, VIRTKEY, NOINVERT | ||
134 | +END | ||
135 | + | ||
123 | 136 | ||
124 | ///////////////////////////////////////////////////////////////////////////// | 137 | ///////////////////////////////////////////////////////////////////////////// |
125 | // | 138 | // |
@@ -187,6 +200,33 @@ BEGIN | @@ -187,6 +200,33 @@ BEGIN | ||
187 | CONTROL "新中新电子读卡器",IDC_RADIO_XINZHONGXIN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,174,186,71,10 | 200 | CONTROL "新中新电子读卡器",IDC_RADIO_XINZHONGXIN,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,174,186,71,10 |
188 | END | 201 | END |
189 | 202 | ||
203 | +IDD_DIALOG_PLACE_ORDER DIALOGEX 0, 0, 324, 238 | ||
204 | +STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | ||
205 | +CAPTION "结算下单" | ||
206 | +FONT 12, "微软雅黑", 400, 0, 0x86 | ||
207 | +BEGIN | ||
208 | + CONTROL "Custom3",IDC_GRID_PRODUCT,"MFCGridCtrl",WS_TABSTOP,0,153,324,39 | ||
209 | + LTEXT "货 主",IDC_STATIC_OWNER,1,19,25,14 | ||
210 | + EDITTEXT IDC_EDIT_NAME,91,18,44,14,ES_MULTILINE | ES_AUTOHSCROLL | ||
211 | + LTEXT "商 品",IDC_STATIC_COMM,2,33,26,12 | ||
212 | + EDITTEXT IDC_EDIT_CARD,29,18,53,15,ES_MULTILINE | ES_AUTOHSCROLL | ||
213 | + EDITTEXT IDC_EDIT_COMM_NUM,29,36,53,15,ES_MULTILINE | ES_AUTOHSCROLL | ||
214 | + EDITTEXT IDC_EDIT_COMM_NAME,92,37,44,13,ES_MULTILINE | ES_AUTOHSCROLL | ||
215 | + LTEXT "单 位",IDC_STATIC_UNIT,1,54,26,12 | ||
216 | + EDITTEXT IDC_EDIT_UNIT,30,55,15,14,ES_MULTILINE | ES_AUTOHSCROLL | ||
217 | + LTEXT "斤",IDC_STATIC_REAL_UNIT,47,56,26,12 | ||
218 | + LTEXT "件 重",IDC_STATIC_HEAVY,91,53,30,14 | ||
219 | + EDITTEXT IDC_EDIT_HEAVY,114,53,44,13,ES_MULTILINE | ES_AUTOHSCROLL | ||
220 | + LTEXT "单 价",IDC_STATIC_PRICE,2,70,26,12 | ||
221 | + EDITTEXT IDC_EDIT_PRICE,30,70,53,15,ES_MULTILINE | ES_AUTOHSCROLL | ||
222 | + LTEXT "数 量",IDC_STATIC_COUNT,92,70,30,14 | ||
223 | + EDITTEXT IDC_EDIT_COUNT,114,69,44,13,ES_MULTILINE | ES_AUTOHSCROLL | ||
224 | + PUSHBUTTON "去支付(&S)",IDC_BUTTON_PAY,270,10,50,14 | ||
225 | + LTEXT "合计:",IDC_STATIC_HEJI,246,227,20,8 | ||
226 | + LTEXT "",IDC_STATIC_TOTAL_MONEY,289,227,8,8 | ||
227 | + LTEXT "",IDC_STATIC_ERROR,182,67,119,16 | ||
228 | +END | ||
229 | + | ||
190 | 230 | ||
191 | ///////////////////////////////////////////////////////////////////////////// | 231 | ///////////////////////////////////////////////////////////////////////////// |
192 | // | 232 | // |
@@ -255,6 +295,13 @@ BEGIN | @@ -255,6 +295,13 @@ BEGIN | ||
255 | TOPMARGIN, 7 | 295 | TOPMARGIN, 7 |
256 | BOTTOMMARGIN, 248 | 296 | BOTTOMMARGIN, 248 |
257 | END | 297 | END |
298 | + | ||
299 | + IDD_DIALOG_PLACE_ORDER, DIALOG | ||
300 | + BEGIN | ||
301 | + MOCKUP, 1, 50, -25, -30, "C:\Users\WangGY\Desktop\TIM图片20180918183513.png" | ||
302 | + RIGHTMARGIN, 320 | ||
303 | + HORZGUIDE, 67 | ||
304 | + END | ||
258 | END | 305 | END |
259 | #endif // APSTUDIO_INVOKED | 306 | #endif // APSTUDIO_INVOKED |
260 | 307 |
central_clearing_system/ETradeClient.vcxproj
@@ -128,13 +128,23 @@ | @@ -128,13 +128,23 @@ | ||
128 | <ClInclude Include="ETradeClient\hardware\password_machine.h" /> | 128 | <ClInclude Include="ETradeClient\hardware\password_machine.h" /> |
129 | <ClInclude Include="ETradeClient\hardware\pin_pad.h" /> | 129 | <ClInclude Include="ETradeClient\hardware\pin_pad.h" /> |
130 | <ClInclude Include="ETradeClient\hardware\SynPublic.h" /> | 130 | <ClInclude Include="ETradeClient\hardware\SynPublic.h" /> |
131 | + <ClInclude Include="ETradeClient\mfc_ui\CellRange.h" /> | ||
131 | <ClInclude Include="ETradeClient\mfc_ui\ETradeClient.h" /> | 132 | <ClInclude Include="ETradeClient\mfc_ui\ETradeClient.h" /> |
132 | <ClInclude Include="ETradeClient\mfc_ui\ETradeClientView.h" /> | 133 | <ClInclude Include="ETradeClient\mfc_ui\ETradeClientView.h" /> |
134 | + <ClInclude Include="ETradeClient\mfc_ui\etrade_edit_control.h" /> | ||
135 | + <ClInclude Include="ETradeClient\mfc_ui\GridCell.h" /> | ||
136 | + <ClInclude Include="ETradeClient\mfc_ui\GridCellBase.h" /> | ||
137 | + <ClInclude Include="ETradeClient\mfc_ui\GridCtrl.h" /> | ||
138 | + <ClInclude Include="ETradeClient\mfc_ui\GridDropTarget.h" /> | ||
139 | + <ClInclude Include="ETradeClient\mfc_ui\GridMemDC.h" /> | ||
140 | + <ClInclude Include="ETradeClient\mfc_ui\InPlaceEdit.h" /> | ||
133 | <ClInclude Include="ETradeClient\mfc_ui\LoginDialog.h" /> | 141 | <ClInclude Include="ETradeClient\mfc_ui\LoginDialog.h" /> |
134 | <ClInclude Include="ETradeClient\mfc_ui\LoginEdit.h" /> | 142 | <ClInclude Include="ETradeClient\mfc_ui\LoginEdit.h" /> |
135 | <ClInclude Include="ETradeClient\mfc_ui\MainFrm.h" /> | 143 | <ClInclude Include="ETradeClient\mfc_ui\MainFrm.h" /> |
144 | + <ClInclude Include="ETradeClient\mfc_ui\place_order_dlg.h" /> | ||
136 | <ClInclude Include="ETradeClient\mfc_ui\PopupBrowserDlgView.h" /> | 145 | <ClInclude Include="ETradeClient\mfc_ui\PopupBrowserDlgView.h" /> |
137 | <ClInclude Include="ETradeClient\mfc_ui\ConfigDialog.h" /> | 146 | <ClInclude Include="ETradeClient\mfc_ui\ConfigDialog.h" /> |
147 | + <ClInclude Include="ETradeClient\mfc_ui\TitleTip.h" /> | ||
138 | <ClInclude Include="ETradeClient\utility\application_config.h" /> | 148 | <ClInclude Include="ETradeClient\utility\application_config.h" /> |
139 | <ClInclude Include="ETradeClient\utility\DLBmpManager.h" /> | 149 | <ClInclude Include="ETradeClient\utility\DLBmpManager.h" /> |
140 | <ClInclude Include="ETradeClient\utility\DLDes.h" /> | 150 | <ClInclude Include="ETradeClient\utility\DLDes.h" /> |
@@ -171,11 +181,19 @@ | @@ -171,11 +181,19 @@ | ||
171 | <ClCompile Include="ETradeClient\hardware\pin_pad.cpp" /> | 181 | <ClCompile Include="ETradeClient\hardware\pin_pad.cpp" /> |
172 | <ClCompile Include="ETradeClient\mfc_ui\ETradeClient.cpp" /> | 182 | <ClCompile Include="ETradeClient\mfc_ui\ETradeClient.cpp" /> |
173 | <ClCompile Include="ETradeClient\mfc_ui\ETradeClientView.cpp" /> | 183 | <ClCompile Include="ETradeClient\mfc_ui\ETradeClientView.cpp" /> |
184 | + <ClCompile Include="ETradeClient\mfc_ui\etrade_edit_control.cpp" /> | ||
185 | + <ClCompile Include="ETradeClient\mfc_ui\GridCell.cpp" /> | ||
186 | + <ClCompile Include="ETradeClient\mfc_ui\GridCellBase.cpp" /> | ||
187 | + <ClCompile Include="ETradeClient\mfc_ui\GridCtrl.cpp" /> | ||
188 | + <ClCompile Include="ETradeClient\mfc_ui\GridDropTarget.cpp" /> | ||
189 | + <ClCompile Include="ETradeClient\mfc_ui\InPlaceEdit.cpp" /> | ||
174 | <ClCompile Include="ETradeClient\mfc_ui\LoginDialog.cpp" /> | 190 | <ClCompile Include="ETradeClient\mfc_ui\LoginDialog.cpp" /> |
175 | <ClCompile Include="ETradeClient\mfc_ui\LoginEdit.cpp" /> | 191 | <ClCompile Include="ETradeClient\mfc_ui\LoginEdit.cpp" /> |
176 | <ClCompile Include="ETradeClient\mfc_ui\MainFrm.cpp" /> | 192 | <ClCompile Include="ETradeClient\mfc_ui\MainFrm.cpp" /> |
193 | + <ClCompile Include="ETradeClient\mfc_ui\place_order_dlg.cpp" /> | ||
177 | <ClCompile Include="ETradeClient\mfc_ui\PopupBrowserDlgView.cpp" /> | 194 | <ClCompile Include="ETradeClient\mfc_ui\PopupBrowserDlgView.cpp" /> |
178 | <ClCompile Include="ETradeClient\mfc_ui\ConfigDialog.cpp" /> | 195 | <ClCompile Include="ETradeClient\mfc_ui\ConfigDialog.cpp" /> |
196 | + <ClCompile Include="ETradeClient\mfc_ui\TitleTip.cpp" /> | ||
179 | <ClCompile Include="ETradeClient\utility\application_config.cpp" /> | 197 | <ClCompile Include="ETradeClient\utility\application_config.cpp" /> |
180 | <ClCompile Include="ETradeClient\utility\DLBmpManager.cpp" /> | 198 | <ClCompile Include="ETradeClient\utility\DLBmpManager.cpp" /> |
181 | <ClCompile Include="ETradeClient\utility\logging.cpp" /> | 199 | <ClCompile Include="ETradeClient\utility\logging.cpp" /> |
central_clearing_system/ETradeClient.vcxproj.filters
@@ -180,6 +180,36 @@ | @@ -180,6 +180,36 @@ | ||
180 | <ClInclude Include="ETradeClient\utility\DLDes.h"> | 180 | <ClInclude Include="ETradeClient\utility\DLDes.h"> |
181 | <Filter>Header Files\utility</Filter> | 181 | <Filter>Header Files\utility</Filter> |
182 | </ClInclude> | 182 | </ClInclude> |
183 | + <ClInclude Include="ETradeClient\mfc_ui\place_order_dlg.h"> | ||
184 | + <Filter>Header Files\mfc_ui</Filter> | ||
185 | + </ClInclude> | ||
186 | + <ClInclude Include="ETradeClient\mfc_ui\TitleTip.h"> | ||
187 | + <Filter>Source Files\mfc_ui</Filter> | ||
188 | + </ClInclude> | ||
189 | + <ClInclude Include="ETradeClient\mfc_ui\CellRange.h"> | ||
190 | + <Filter>Header Files\mfc_ui</Filter> | ||
191 | + </ClInclude> | ||
192 | + <ClInclude Include="ETradeClient\mfc_ui\GridCell.h"> | ||
193 | + <Filter>Header Files\mfc_ui</Filter> | ||
194 | + </ClInclude> | ||
195 | + <ClInclude Include="ETradeClient\mfc_ui\GridCellBase.h"> | ||
196 | + <Filter>Header Files\mfc_ui</Filter> | ||
197 | + </ClInclude> | ||
198 | + <ClInclude Include="ETradeClient\mfc_ui\GridDropTarget.h"> | ||
199 | + <Filter>Header Files\mfc_ui</Filter> | ||
200 | + </ClInclude> | ||
201 | + <ClInclude Include="ETradeClient\mfc_ui\GridCtrl.h"> | ||
202 | + <Filter>Header Files\mfc_ui</Filter> | ||
203 | + </ClInclude> | ||
204 | + <ClInclude Include="ETradeClient\mfc_ui\InPlaceEdit.h"> | ||
205 | + <Filter>Header Files\mfc_ui</Filter> | ||
206 | + </ClInclude> | ||
207 | + <ClInclude Include="ETradeClient\mfc_ui\GridMemDC.h"> | ||
208 | + <Filter>Header Files\mfc_ui</Filter> | ||
209 | + </ClInclude> | ||
210 | + <ClInclude Include="ETradeClient\mfc_ui\etrade_edit_control.h"> | ||
211 | + <Filter>Header Files\mfc_ui</Filter> | ||
212 | + </ClInclude> | ||
183 | </ItemGroup> | 213 | </ItemGroup> |
184 | <ItemGroup> | 214 | <ItemGroup> |
185 | <ClCompile Include="stdafx.cpp"> | 215 | <ClCompile Include="stdafx.cpp"> |
@@ -284,6 +314,30 @@ | @@ -284,6 +314,30 @@ | ||
284 | <ClCompile Include="ETradeClient\utility\DLBmpManager.cpp"> | 314 | <ClCompile Include="ETradeClient\utility\DLBmpManager.cpp"> |
285 | <Filter>Source Files\utility</Filter> | 315 | <Filter>Source Files\utility</Filter> |
286 | </ClCompile> | 316 | </ClCompile> |
317 | + <ClCompile Include="ETradeClient\mfc_ui\place_order_dlg.cpp"> | ||
318 | + <Filter>Source Files\mfc_ui</Filter> | ||
319 | + </ClCompile> | ||
320 | + <ClCompile Include="ETradeClient\mfc_ui\GridCell.cpp"> | ||
321 | + <Filter>Source Files\mfc_ui</Filter> | ||
322 | + </ClCompile> | ||
323 | + <ClCompile Include="ETradeClient\mfc_ui\GridCellBase.cpp"> | ||
324 | + <Filter>Source Files\mfc_ui</Filter> | ||
325 | + </ClCompile> | ||
326 | + <ClCompile Include="ETradeClient\mfc_ui\GridCtrl.cpp"> | ||
327 | + <Filter>Source Files\mfc_ui</Filter> | ||
328 | + </ClCompile> | ||
329 | + <ClCompile Include="ETradeClient\mfc_ui\GridDropTarget.cpp"> | ||
330 | + <Filter>Source Files\mfc_ui</Filter> | ||
331 | + </ClCompile> | ||
332 | + <ClCompile Include="ETradeClient\mfc_ui\InPlaceEdit.cpp"> | ||
333 | + <Filter>Source Files\mfc_ui</Filter> | ||
334 | + </ClCompile> | ||
335 | + <ClCompile Include="ETradeClient\mfc_ui\TitleTip.cpp"> | ||
336 | + <Filter>Source Files\mfc_ui</Filter> | ||
337 | + </ClCompile> | ||
338 | + <ClCompile Include="ETradeClient\mfc_ui\etrade_edit_control.cpp"> | ||
339 | + <Filter>Source Files\mfc_ui</Filter> | ||
340 | + </ClCompile> | ||
287 | </ItemGroup> | 341 | </ItemGroup> |
288 | <ItemGroup> | 342 | <ItemGroup> |
289 | <ResourceCompile Include="ETradeClient.rc"> | 343 | <ResourceCompile Include="ETradeClient.rc"> |
central_clearing_system/ETradeClient/mfc_ui/CellRange.h
0 → 100644
1 | +/////////////////////////////////////////////////////////////////////// | ||
2 | +// CellRange.h: header file | ||
3 | +// | ||
4 | +// MFC Grid Control - interface for the CCellRange class. | ||
5 | +// | ||
6 | +// Written by Chris Maunder <cmaunder@mail.com> | ||
7 | +// Copyright (c) 1998-2002. All Rights Reserved. | ||
8 | +// | ||
9 | +// This code may be used in compiled form in any way you desire. This | ||
10 | +// file may be redistributed unmodified by any means PROVIDING it is | ||
11 | +// not sold for profit without the authors written consent, and | ||
12 | +// providing that this notice and the authors name and all copyright | ||
13 | +// notices remains intact. | ||
14 | +// | ||
15 | +// An email letting me know how you are using it would be nice as well. | ||
16 | +// | ||
17 | +// This file is provided "as is" with no expressed or implied warranty. | ||
18 | +// The author accepts no liability for any damage/loss of business that | ||
19 | +// this product may cause. | ||
20 | +// | ||
21 | +// For use with CGridCtrl v2.20+ | ||
22 | +// | ||
23 | +////////////////////////////////////////////////////////////////////// | ||
24 | + | ||
25 | +#if !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_) | ||
26 | +#define AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_ | ||
27 | + | ||
28 | +#if _MSC_VER >= 1000 | ||
29 | +#pragma once | ||
30 | +#endif // _MSC_VER >= 1000 | ||
31 | + | ||
32 | +// The code contained in this file is based on the original | ||
33 | +// WorldCom Grid control written by Joe Willcoxson, | ||
34 | +// mailto:chinajoe@aol.com | ||
35 | +// http://users.aol.com/chinajoe | ||
36 | + | ||
37 | +class CCellID | ||
38 | +{ | ||
39 | +// Attributes | ||
40 | +public: | ||
41 | + int row, col; | ||
42 | + | ||
43 | +// Operations | ||
44 | +public: | ||
45 | + explicit CCellID(int nRow = -1, int nCol = -1) : row(nRow), col(nCol) {} | ||
46 | + | ||
47 | + int IsValid() const { return (row >= 0 && col >= 0); } | ||
48 | + int operator==(const CCellID& rhs) const { return (row == rhs.row && col == rhs.col); } | ||
49 | + int operator!=(const CCellID& rhs) const { return !operator==(rhs); } | ||
50 | +}; | ||
51 | + | ||
52 | +class CCellRange | ||
53 | +{ | ||
54 | +public: | ||
55 | + | ||
56 | + CCellRange(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1) | ||
57 | + { | ||
58 | + Set(nMinRow, nMinCol, nMaxRow, nMaxCol); | ||
59 | + } | ||
60 | + | ||
61 | + void Set(int nMinRow = -1, int nMinCol = -1, int nMaxRow = -1, int nMaxCol = -1); | ||
62 | + | ||
63 | + int IsValid() const; | ||
64 | + int InRange(int row, int col) const; | ||
65 | + int InRange(const CCellID& cellID) const; | ||
66 | + int Count() { return (m_nMaxRow - m_nMinRow + 1) * (m_nMaxCol - m_nMinCol + 1); } | ||
67 | + | ||
68 | + CCellID GetTopLeft() const; | ||
69 | + CCellRange Intersect(const CCellRange& rhs) const; | ||
70 | + | ||
71 | + int GetMinRow() const {return m_nMinRow;} | ||
72 | + void SetMinRow(int minRow) {m_nMinRow = minRow;} | ||
73 | + | ||
74 | + int GetMinCol() const {return m_nMinCol;} | ||
75 | + void SetMinCol(int minCol) {m_nMinCol = minCol;} | ||
76 | + | ||
77 | + int GetMaxRow() const {return m_nMaxRow;} | ||
78 | + void SetMaxRow(int maxRow) {m_nMaxRow = maxRow;} | ||
79 | + | ||
80 | + int GetMaxCol() const {return m_nMaxCol;} | ||
81 | + void SetMaxCol(int maxCol) {m_nMaxCol = maxCol;} | ||
82 | + | ||
83 | + int GetRowSpan() const {return m_nMaxRow - m_nMinRow + 1;} | ||
84 | + int GetColSpan() const {return m_nMaxCol - m_nMinCol + 1;} | ||
85 | + | ||
86 | + void operator=(const CCellRange& rhs); | ||
87 | + int operator==(const CCellRange& rhs); | ||
88 | + int operator!=(const CCellRange& rhs); | ||
89 | + | ||
90 | +protected: | ||
91 | + int m_nMinRow; | ||
92 | + int m_nMinCol; | ||
93 | + int m_nMaxRow; | ||
94 | + int m_nMaxCol; | ||
95 | +}; | ||
96 | + | ||
97 | +inline void CCellRange::Set(int minRow, int minCol, int maxRow, int maxCol) | ||
98 | +{ | ||
99 | + m_nMinRow = minRow; | ||
100 | + m_nMinCol = minCol; | ||
101 | + m_nMaxRow = maxRow; | ||
102 | + m_nMaxCol = maxCol; | ||
103 | +} | ||
104 | + | ||
105 | +inline void CCellRange::operator=(const CCellRange& rhs) | ||
106 | +{ | ||
107 | + if (this != &rhs) Set(rhs.m_nMinRow, rhs.m_nMinCol, rhs.m_nMaxRow, rhs.m_nMaxCol); | ||
108 | +} | ||
109 | + | ||
110 | +inline int CCellRange::operator==(const CCellRange& rhs) | ||
111 | +{ | ||
112 | + return ((m_nMinRow == rhs.m_nMinRow) && (m_nMinCol == rhs.m_nMinCol) && | ||
113 | + (m_nMaxRow == rhs.m_nMaxRow) && (m_nMaxCol == rhs.m_nMaxCol)); | ||
114 | +} | ||
115 | + | ||
116 | +inline int CCellRange::operator!=(const CCellRange& rhs) | ||
117 | +{ | ||
118 | + return !operator==(rhs); | ||
119 | +} | ||
120 | + | ||
121 | +inline int CCellRange::IsValid() const | ||
122 | +{ | ||
123 | + return (m_nMinRow >= 0 && m_nMinCol >= 0 && m_nMaxRow >= 0 && m_nMaxCol >= 0 && | ||
124 | + m_nMinRow <= m_nMaxRow && m_nMinCol <= m_nMaxCol); | ||
125 | +} | ||
126 | + | ||
127 | +inline int CCellRange::InRange(int row, int col) const | ||
128 | +{ | ||
129 | + return (row >= m_nMinRow && row <= m_nMaxRow && col >= m_nMinCol && col <= m_nMaxCol); | ||
130 | +} | ||
131 | + | ||
132 | +inline int CCellRange::InRange(const CCellID& cellID) const | ||
133 | +{ | ||
134 | + return InRange(cellID.row, cellID.col); | ||
135 | +} | ||
136 | + | ||
137 | +inline CCellID CCellRange::GetTopLeft() const | ||
138 | +{ | ||
139 | + return CCellID(m_nMinRow, m_nMinCol); | ||
140 | +} | ||
141 | + | ||
142 | +inline CCellRange CCellRange::Intersect(const CCellRange& rhs) const | ||
143 | +{ | ||
144 | + return CCellRange(max(m_nMinRow,rhs.m_nMinRow), max(m_nMinCol,rhs.m_nMinCol), | ||
145 | + min(m_nMaxRow,rhs.m_nMaxRow), min(m_nMaxCol,rhs.m_nMaxCol)); | ||
146 | +} | ||
147 | + | ||
148 | +#endif // !defined(AFX_CELLRANGE_H__F86EF761_725A_11D1_ABBA_00A0243D1382__INCLUDED_) |
central_clearing_system/ETradeClient/mfc_ui/ETradeClient.cpp
@@ -18,6 +18,10 @@ | @@ -18,6 +18,10 @@ | ||
18 | #include "./ExLib/mfc/dbghelp.h" | 18 | #include "./ExLib/mfc/dbghelp.h" |
19 | #include "./ETradeClient/utility/win_msg_define.h" | 19 | #include "./ETradeClient/utility/win_msg_define.h" |
20 | 20 | ||
21 | +//for test | ||
22 | +#include "place_order_dlg.h" | ||
23 | +// | ||
24 | + | ||
21 | #ifdef _DEBUG | 25 | #ifdef _DEBUG |
22 | #define new DEBUG_NEW | 26 | #define new DEBUG_NEW |
23 | #endif | 27 | #endif |
@@ -187,6 +191,14 @@ BOOL CETradeClientApp::InitInstance() | @@ -187,6 +191,14 @@ BOOL CETradeClientApp::InitInstance() | ||
187 | // such as the name of your company or organization | 191 | // such as the name of your company or organization |
188 | SetRegistryKey(APP_ID); | 192 | SetRegistryKey(APP_ID); |
189 | 193 | ||
194 | + //for test | ||
195 | + PlaceOrderDlg dlg; | ||
196 | + if (dlg.DoModal()) | ||
197 | + { | ||
198 | + return FALSE; | ||
199 | + } | ||
200 | + // | ||
201 | + | ||
190 | // First, do login job. | 202 | // First, do login job. |
191 | if (!CLoginDialog(L"欢迎使用中央结算系统!").Launch()) | 203 | if (!CLoginDialog(L"欢迎使用中央结算系统!").Launch()) |
192 | { | 204 | { |
central_clearing_system/ETradeClient/mfc_ui/GridCell.cpp
0 → 100644
1 | +// GridCell.cpp : implementation file | ||
2 | +// | ||
3 | +// MFC Grid Control - Main grid cell class | ||
4 | +// | ||
5 | +// Provides the implementation for the "default" cell type of the | ||
6 | +// grid control. Adds in cell editing. | ||
7 | +// | ||
8 | +// Written by Chris Maunder <chris@codeproject.com> | ||
9 | +// Copyright (c) 1998-2005. All Rights Reserved. | ||
10 | +// | ||
11 | +// This code may be used in compiled form in any way you desire. This | ||
12 | +// file may be redistributed unmodified by any means PROVIDING it is | ||
13 | +// not sold for profit without the authors written consent, and | ||
14 | +// providing that this notice and the authors name and all copyright | ||
15 | +// notices remains intact. | ||
16 | +// | ||
17 | +// An email letting me know how you are using it would be nice as well. | ||
18 | +// | ||
19 | +// This file is provided "as is" with no expressed or implied warranty. | ||
20 | +// The author accepts no liability for any damage/loss of business that | ||
21 | +// this product may cause. | ||
22 | +// | ||
23 | +// For use with CGridCtrl v2.20+ | ||
24 | +// | ||
25 | +// History: | ||
26 | +// Eric Woodruff - 20 Feb 2000 - Added PrintCell() plus other minor changes | ||
27 | +// Ken Bertelson - 12 Apr 2000 - Split CGridCell into CGridCell and CGridCellBase | ||
28 | +// <kenbertelson@hotmail.com> | ||
29 | +// C Maunder - 17 Jun 2000 - Font handling optimsed, Added CGridDefaultCell | ||
30 | +// | ||
31 | +///////////////////////////////////////////////////////////////////////////// | ||
32 | + | ||
33 | +#include "stdafx.h" | ||
34 | +#include "GridCell.h" | ||
35 | +#include "InPlaceEdit.h" | ||
36 | +#include "GridCtrl.h" | ||
37 | + | ||
38 | +#ifdef _DEBUG | ||
39 | +#define new DEBUG_NEW | ||
40 | +#undef THIS_FILE | ||
41 | +static char THIS_FILE[] = __FILE__; | ||
42 | +#endif | ||
43 | + | ||
44 | +IMPLEMENT_DYNCREATE(CGridCell, CGridCellBase) | ||
45 | +IMPLEMENT_DYNCREATE(CGridDefaultCell, CGridCell) | ||
46 | + | ||
47 | +///////////////////////////////////////////////////////////////////////////// | ||
48 | +// GridCell | ||
49 | + | ||
50 | +CGridCell::CGridCell() | ||
51 | +{ | ||
52 | + m_plfFont = NULL; | ||
53 | + CGridCell::Reset(); | ||
54 | +} | ||
55 | + | ||
56 | +CGridCell::~CGridCell() | ||
57 | +{ | ||
58 | + delete m_plfFont; | ||
59 | +} | ||
60 | + | ||
61 | +///////////////////////////////////////////////////////////////////////////// | ||
62 | +// GridCell Attributes | ||
63 | + | ||
64 | +void CGridCell::operator=(const CGridCell& cell) | ||
65 | +{ | ||
66 | + if (this != &cell) CGridCellBase::operator=(cell); | ||
67 | +} | ||
68 | + | ||
69 | +void CGridCell::Reset() | ||
70 | +{ | ||
71 | + CGridCellBase::Reset(); | ||
72 | + | ||
73 | + m_strText.Empty(); | ||
74 | + m_nImage = -1; | ||
75 | + m_lParam = NULL; // BUG FIX J. Bloggs 20/10/03 | ||
76 | + m_pGrid = NULL; | ||
77 | + m_bEditing = FALSE; | ||
78 | + m_pEditWnd = NULL; | ||
79 | + | ||
80 | + m_nFormat = (DWORD)-1; // Use default from CGridDefaultCell | ||
81 | + m_crBkClr = CLR_DEFAULT; // Background colour (or CLR_DEFAULT) | ||
82 | + m_crFgClr = CLR_DEFAULT; // Forground colour (or CLR_DEFAULT) | ||
83 | + m_nMargin = (UINT)-1; // Use default from CGridDefaultCell | ||
84 | + | ||
85 | + delete m_plfFont; | ||
86 | + m_plfFont = NULL; // Cell font | ||
87 | +} | ||
88 | + | ||
89 | +void CGridCell::SetFont(const LOGFONT* plf) | ||
90 | +{ | ||
91 | + if (plf == NULL) | ||
92 | + { | ||
93 | + delete m_plfFont; | ||
94 | + m_plfFont = NULL; | ||
95 | + } | ||
96 | + else | ||
97 | + { | ||
98 | + if (!m_plfFont) | ||
99 | + m_plfFont = new LOGFONT; | ||
100 | + if (m_plfFont) | ||
101 | + memcpy(m_plfFont, plf, sizeof(LOGFONT)); | ||
102 | + } | ||
103 | +} | ||
104 | + | ||
105 | +LOGFONT* CGridCell::GetFont() const | ||
106 | +{ | ||
107 | + if (m_plfFont == NULL) | ||
108 | + { | ||
109 | + CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell(); | ||
110 | + if (!pDefaultCell) | ||
111 | + return NULL; | ||
112 | + | ||
113 | + return pDefaultCell->GetFont(); | ||
114 | + } | ||
115 | + | ||
116 | + return m_plfFont; | ||
117 | +} | ||
118 | + | ||
119 | +CFont* CGridCell::GetFontObject() const | ||
120 | +{ | ||
121 | + // If the default font is specified, use the default cell implementation | ||
122 | + if (m_plfFont == NULL) | ||
123 | + { | ||
124 | + CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell(); | ||
125 | + if (!pDefaultCell) | ||
126 | + return NULL; | ||
127 | + | ||
128 | + return pDefaultCell->GetFontObject(); | ||
129 | + } | ||
130 | + else | ||
131 | + { | ||
132 | + static CFont Font; | ||
133 | + Font.DeleteObject(); | ||
134 | + Font.CreateFontIndirect(m_plfFont); | ||
135 | + return &Font; | ||
136 | + } | ||
137 | +} | ||
138 | + | ||
139 | +DWORD CGridCell::GetFormat() const | ||
140 | +{ | ||
141 | + if (m_nFormat == (DWORD)-1) | ||
142 | + { | ||
143 | + CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell(); | ||
144 | + if (!pDefaultCell) | ||
145 | + return 0; | ||
146 | + | ||
147 | + return pDefaultCell->GetFormat(); | ||
148 | + } | ||
149 | + | ||
150 | + return m_nFormat; | ||
151 | +} | ||
152 | + | ||
153 | +UINT CGridCell::GetMargin() const | ||
154 | +{ | ||
155 | + if (m_nMargin == (UINT)-1) | ||
156 | + { | ||
157 | + CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell(); | ||
158 | + if (!pDefaultCell) | ||
159 | + return 0; | ||
160 | + | ||
161 | + return pDefaultCell->GetMargin(); | ||
162 | + } | ||
163 | + | ||
164 | + return m_nMargin; | ||
165 | +} | ||
166 | + | ||
167 | +///////////////////////////////////////////////////////////////////////////// | ||
168 | +// GridCell Operations | ||
169 | + | ||
170 | +BOOL CGridCell::Edit(int nRow, int nCol, CRect rect, CPoint /* point */, UINT nID, UINT nChar) | ||
171 | +{ | ||
172 | + if ( m_bEditing ) | ||
173 | + { | ||
174 | + if (m_pEditWnd) | ||
175 | + m_pEditWnd->SendMessage ( WM_CHAR, nChar ); | ||
176 | + } | ||
177 | + else | ||
178 | + { | ||
179 | + DWORD dwStyle = ES_LEFT; | ||
180 | + if (GetFormat() & DT_RIGHT) | ||
181 | + dwStyle = ES_RIGHT; | ||
182 | + else if (GetFormat() & DT_CENTER) | ||
183 | + dwStyle = ES_CENTER; | ||
184 | + | ||
185 | + m_bEditing = TRUE; | ||
186 | + | ||
187 | + // InPlaceEdit auto-deletes itself | ||
188 | + CGridCtrl* pGrid = GetGrid(); | ||
189 | + m_pEditWnd = new CInPlaceEdit(pGrid, rect, dwStyle, nID, nRow, nCol, GetText(), nChar); | ||
190 | + } | ||
191 | + return TRUE; | ||
192 | +} | ||
193 | + | ||
194 | +void CGridCell::EndEdit() | ||
195 | +{ | ||
196 | + if (m_pEditWnd) | ||
197 | + ((CInPlaceEdit*)m_pEditWnd)->EndEdit(); | ||
198 | +} | ||
199 | + | ||
200 | +void CGridCell::OnEndEdit() | ||
201 | +{ | ||
202 | + m_bEditing = FALSE; | ||
203 | + m_pEditWnd = NULL; | ||
204 | +} | ||
205 | + | ||
206 | +///////////////////////////////////////////////////////////////////////////// | ||
207 | +// CGridDefaultCell | ||
208 | + | ||
209 | +CGridDefaultCell::CGridDefaultCell() | ||
210 | +{ | ||
211 | +#ifdef _WIN32_WCE | ||
212 | + m_nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX; | ||
213 | +#else | ||
214 | + m_nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX | DT_END_ELLIPSIS; | ||
215 | +#endif | ||
216 | + m_crFgClr = CLR_DEFAULT; | ||
217 | + m_crBkClr = CLR_DEFAULT; | ||
218 | + m_Size = CSize(30,10); | ||
219 | + m_dwStyle = 0; | ||
220 | + | ||
221 | +#ifdef _WIN32_WCE | ||
222 | + LOGFONT lf; | ||
223 | + GetObject(GetStockObject(SYSTEM_FONT), sizeof(LOGFONT), &lf); | ||
224 | + SetFont(&lf); | ||
225 | +#else // not CE | ||
226 | + | ||
227 | + NONCLIENTMETRICS ncm; | ||
228 | +#if defined(_MSC_VER) && (_MSC_VER < 1300) | ||
229 | + ncm.cbSize = sizeof(NONCLIENTMETRICS); // NONCLIENTMETRICS has an extra element after VC6 | ||
230 | +#else | ||
231 | + // Check the operating system's version | ||
232 | + OSVERSIONINFOEX osvi; | ||
233 | + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); | ||
234 | + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); | ||
235 | + if( !GetVersionEx((OSVERSIONINFO *) &osvi)) | ||
236 | + { | ||
237 | + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); | ||
238 | + GetVersionEx ((OSVERSIONINFO *)&osvi); | ||
239 | + } | ||
240 | + | ||
241 | + if (osvi.dwMajorVersion > 5) | ||
242 | + ncm.cbSize = sizeof(NONCLIENTMETRICS); | ||
243 | + else | ||
244 | + ncm.cbSize = sizeof(NONCLIENTMETRICS) - sizeof(ncm.iPaddedBorderWidth); | ||
245 | +#endif | ||
246 | + VERIFY(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0)); | ||
247 | + | ||
248 | + SetFont(&(ncm.lfMessageFont)); | ||
249 | +#endif | ||
250 | +} | ||
251 | + | ||
252 | +CGridDefaultCell::~CGridDefaultCell() | ||
253 | +{ | ||
254 | + m_Font.DeleteObject(); | ||
255 | +} | ||
256 | + | ||
257 | +void CGridDefaultCell::SetFont(const LOGFONT* plf) | ||
258 | +{ | ||
259 | + ASSERT(plf); | ||
260 | + | ||
261 | + if (!plf) return; | ||
262 | + | ||
263 | + m_Font.DeleteObject(); | ||
264 | + m_Font.CreateFontIndirect(plf); | ||
265 | + | ||
266 | + CGridCell::SetFont(plf); | ||
267 | + | ||
268 | + // Get the font size and hence the default cell size | ||
269 | + CDC* pDC = CDC::FromHandle(::GetDC(NULL)); | ||
270 | + if (pDC) | ||
271 | + { | ||
272 | + CFont* pOldFont = pDC->SelectObject(&m_Font); | ||
273 | + | ||
274 | + SetMargin(pDC->GetTextExtent(_T(" "), 1).cx); | ||
275 | + m_Size = pDC->GetTextExtent(_T(" XXXXXXXXXXXX "), 14); | ||
276 | + m_Size.cy = (m_Size.cy * 3) / 2; | ||
277 | + | ||
278 | + pDC->SelectObject(pOldFont); | ||
279 | + ReleaseDC(NULL, pDC->GetSafeHdc()); | ||
280 | + } | ||
281 | + else | ||
282 | + { | ||
283 | + SetMargin(3); | ||
284 | + m_Size = CSize(40,16); | ||
285 | + } | ||
286 | +} | ||
287 | + | ||
288 | +LOGFONT* CGridDefaultCell::GetFont() const | ||
289 | +{ | ||
290 | + ASSERT(m_plfFont); // This is the default - it CAN'T be NULL! | ||
291 | + return m_plfFont; | ||
292 | +} | ||
293 | + | ||
294 | +CFont* CGridDefaultCell::GetFontObject() const | ||
295 | +{ | ||
296 | + ASSERT(m_Font.GetSafeHandle()); | ||
297 | + return (CFont*) &m_Font; | ||
298 | +} |
central_clearing_system/ETradeClient/mfc_ui/GridCell.h
0 → 100644
1 | +///////////////////////////////////////////////////////////////////////////// | ||
2 | +// GridCell.h : header file | ||
3 | +// | ||
4 | +// MFC Grid Control - Grid cell class header file | ||
5 | +// | ||
6 | +// Written by Chris Maunder <chris@codeproject.com> | ||
7 | +// Copyright (c) 1998-2005. All Rights Reserved. | ||
8 | +// | ||
9 | +// This code may be used in compiled form in any way you desire. This | ||
10 | +// file may be redistributed unmodified by any means PROVIDING it is | ||
11 | +// not sold for profit without the authors written consent, and | ||
12 | +// providing that this notice and the authors name and all copyright | ||
13 | +// notices remains intact. | ||
14 | +// | ||
15 | +// An email letting me know how you are using it would be nice as well. | ||
16 | +// | ||
17 | +// This file is provided "as is" with no expressed or implied warranty. | ||
18 | +// The author accepts no liability for any damage/loss of business that | ||
19 | +// this product may cause. | ||
20 | +// | ||
21 | +// For use with CGridCtrl v2.20+ | ||
22 | +// | ||
23 | +////////////////////////////////////////////////////////////////////// | ||
24 | + | ||
25 | +#if !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_) | ||
26 | +#define AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_ | ||
27 | + | ||
28 | +#if _MSC_VER >= 1000 | ||
29 | +#pragma once | ||
30 | +#endif // _MSC_VER >= 1000 | ||
31 | + | ||
32 | +class CGridCtrl; | ||
33 | +#include "GridCellBase.h" | ||
34 | + | ||
35 | +// Each cell contains one of these. Fields "row" and "column" are not stored since we | ||
36 | +// will usually have acces to them in other ways, and they are an extra 8 bytes per | ||
37 | +// cell that is probably unnecessary. | ||
38 | + | ||
39 | +class CGridCell : public CGridCellBase | ||
40 | +{ | ||
41 | + friend class CGridCtrl; | ||
42 | + DECLARE_DYNCREATE(CGridCell) | ||
43 | + | ||
44 | +// Construction/Destruction | ||
45 | +public: | ||
46 | + CGridCell(); | ||
47 | + virtual ~CGridCell(); | ||
48 | + | ||
49 | +// Attributes | ||
50 | +public: | ||
51 | + void operator=(const CGridCell& cell); | ||
52 | + | ||
53 | + virtual void SetText(LPCTSTR szText) { m_strText = szText; } | ||
54 | + virtual void SetImage(int nImage) { m_nImage = nImage; } | ||
55 | + virtual void SetData(LPARAM lParam) { m_lParam = lParam; } | ||
56 | + virtual void SetGrid(CGridCtrl* pGrid) { m_pGrid = pGrid; } | ||
57 | + // virtual void SetState(const DWORD nState); - use base class version | ||
58 | + virtual void SetFormat(DWORD nFormat) { m_nFormat = nFormat; } | ||
59 | + virtual void SetTextClr(COLORREF clr) { m_crFgClr = clr; } | ||
60 | + virtual void SetBackClr(COLORREF clr) { m_crBkClr = clr; } | ||
61 | + virtual void SetFont(const LOGFONT* plf); | ||
62 | + virtual void SetMargin(UINT nMargin) { m_nMargin = nMargin; } | ||
63 | + virtual CWnd* GetEditWnd() const { return m_pEditWnd; } | ||
64 | + virtual void SetCoords(int /*nRow*/, int /*nCol*/) {} // don't need to know the row and | ||
65 | + // column for base implementation | ||
66 | + | ||
67 | + virtual LPCTSTR GetText() const { return (m_strText.IsEmpty())? _T("") : LPCTSTR(m_strText); } | ||
68 | + virtual int GetImage() const { return m_nImage; } | ||
69 | + virtual LPARAM GetData() const { return m_lParam; } | ||
70 | + virtual CGridCtrl* GetGrid() const { return m_pGrid; } | ||
71 | + // virtual DWORD GetState() const - use base class | ||
72 | + virtual DWORD GetFormat() const; | ||
73 | + virtual COLORREF GetTextClr() const { return m_crFgClr; } // TODO: change to use default cell | ||
74 | + virtual COLORREF GetBackClr() const { return m_crBkClr; } | ||
75 | + virtual LOGFONT* GetFont() const; | ||
76 | + virtual CFont* GetFontObject() const; | ||
77 | + virtual UINT GetMargin() const; | ||
78 | + | ||
79 | + virtual BOOL IsEditing() const { return m_bEditing; } | ||
80 | + virtual BOOL IsDefaultFont() const { return (m_plfFont == NULL); } | ||
81 | + virtual void Reset(); | ||
82 | + | ||
83 | +// editing cells | ||
84 | +public: | ||
85 | + virtual BOOL Edit(int nRow, int nCol, CRect rect, CPoint point, UINT nID, UINT nChar); | ||
86 | + virtual void EndEdit(); | ||
87 | +protected: | ||
88 | + virtual void OnEndEdit(); | ||
89 | + | ||
90 | +protected: | ||
91 | + CString m_strText; // Cell text (or binary data if you wish...) | ||
92 | + LPARAM m_lParam; // 32-bit value to associate with item | ||
93 | + int m_nImage; // Index of the list view item’s icon | ||
94 | + DWORD m_nFormat; | ||
95 | + COLORREF m_crFgClr; | ||
96 | + COLORREF m_crBkClr; | ||
97 | + LOGFONT* m_plfFont; | ||
98 | + UINT m_nMargin; | ||
99 | + | ||
100 | + BOOL m_bEditing; // Cell being edited? | ||
101 | + | ||
102 | + CGridCtrl* m_pGrid; // Parent grid control | ||
103 | + CWnd* m_pEditWnd; | ||
104 | +}; | ||
105 | + | ||
106 | +// This class is for storing grid default values. It's a little heavy weight, so | ||
107 | +// don't use it in bulk | ||
108 | +class CGridDefaultCell : public CGridCell | ||
109 | +{ | ||
110 | + DECLARE_DYNCREATE(CGridDefaultCell) | ||
111 | + | ||
112 | +// Construction/Destruction | ||
113 | +public: | ||
114 | + CGridDefaultCell(); | ||
115 | + virtual ~CGridDefaultCell(); | ||
116 | + | ||
117 | +public: | ||
118 | + virtual DWORD GetStyle() const { return m_dwStyle; } | ||
119 | + virtual void SetStyle(DWORD dwStyle) { m_dwStyle = dwStyle; } | ||
120 | + virtual int GetWidth() const { return m_Size.cx; } | ||
121 | + virtual int GetHeight() const { return m_Size.cy; } | ||
122 | + virtual void SetWidth(int nWidth) { m_Size.cx = nWidth; } | ||
123 | + virtual void SetHeight(int nHeight) { m_Size.cy = nHeight; } | ||
124 | + | ||
125 | + // Disable these properties | ||
126 | + virtual void SetData(LPARAM /*lParam*/) { ASSERT(FALSE); } | ||
127 | + virtual void SetState(DWORD /*nState*/) { ASSERT(FALSE); } | ||
128 | + virtual DWORD GetState() const { return CGridCell::GetState()|GVIS_READONLY; } | ||
129 | + virtual void SetCoords( int /*row*/, int /*col*/) { ASSERT(FALSE); } | ||
130 | + virtual void SetFont(const LOGFONT* /*plf*/); | ||
131 | + virtual LOGFONT* GetFont() const; | ||
132 | + virtual CFont* GetFontObject() const; | ||
133 | + | ||
134 | +protected: | ||
135 | + CSize m_Size; // Default Size | ||
136 | + CFont m_Font; // Cached font | ||
137 | + DWORD m_dwStyle; // Cell Style - unused | ||
138 | +}; | ||
139 | + | ||
140 | +//{{AFX_INSERT_LOCATION}} | ||
141 | +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. | ||
142 | + | ||
143 | +#endif // !defined(AFX_GRIDCELL_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_) |
central_clearing_system/ETradeClient/mfc_ui/GridCellBase.cpp
0 → 100644
1 | +// GridCellBase.cpp : implementation file | ||
2 | +// | ||
3 | +// MFC Grid Control - Main grid cell base class | ||
4 | +// | ||
5 | +// Provides the implementation for the base cell type of the | ||
6 | +// grid control. No data is stored (except for state) but default | ||
7 | +// implementations of drawing, printingetc provided. MUST be derived | ||
8 | +// from to be used. | ||
9 | +// | ||
10 | +// Written by Chris Maunder <chris@codeproject.com> | ||
11 | +// Copyright (c) 1998-2005. All Rights Reserved. | ||
12 | +// | ||
13 | +// This code may be used in compiled form in any way you desire. This | ||
14 | +// file may be redistributed unmodified by any means PROVIDING it is | ||
15 | +// not sold for profit without the authors written consent, and | ||
16 | +// providing that this notice and the authors name and all copyright | ||
17 | +// notices remains intact. | ||
18 | +// | ||
19 | +// An email letting me know how you are using it would be nice as well. | ||
20 | +// | ||
21 | +// This file is provided "as is" with no expressed or implied warranty. | ||
22 | +// The author accepts no liability for any damage/loss of business that | ||
23 | +// this product may cause. | ||
24 | +// | ||
25 | +// For use with CGridCtrl v2.22+ | ||
26 | +// | ||
27 | +// History: | ||
28 | +// Ken Bertelson - 12 Apr 2000 - Split CGridCell into CGridCell and CGridCellBase | ||
29 | +// C Maunder - 19 May 2000 - Fixed sort arrow drawing (Ivan Ilinov) | ||
30 | +// C Maunder - 29 Aug 2000 - operator= checks for NULL font before setting (Martin Richter) | ||
31 | +// C Maunder - 15 Oct 2000 - GetTextExtent fixed (Martin Richter) | ||
32 | +// C Maunder - 1 Jan 2001 - Added ValidateEdit | ||
33 | +// Yogurt - 13 Mar 2004 - GetCellExtent fixed | ||
34 | +// | ||
35 | +// NOTES: Each grid cell should take care of it's own drawing, though the Draw() | ||
36 | +// method takes an "erase background" paramter that is called if the grid | ||
37 | +// decides to draw the entire grid background in on hit. Certain ambient | ||
38 | +// properties such as the default font to use, and hints on how to draw | ||
39 | +// fixed cells should be fetched from the parent grid. The grid trusts the | ||
40 | +// cells will behave in a certain way, and the cells trust the grid will | ||
41 | +// supply accurate information. | ||
42 | +// | ||
43 | +///////////////////////////////////////////////////////////////////////////// | ||
44 | + | ||
45 | +#include "stdafx.h" | ||
46 | +#include "GridCtrl.h" | ||
47 | +#include "GridCellBase.h" | ||
48 | + | ||
49 | +#ifdef _DEBUG | ||
50 | +#define new DEBUG_NEW | ||
51 | +#undef THIS_FILE | ||
52 | +static char THIS_FILE[] = __FILE__; | ||
53 | +#endif | ||
54 | + | ||
55 | +IMPLEMENT_DYNAMIC(CGridCellBase, CObject) | ||
56 | + | ||
57 | +///////////////////////////////////////////////////////////////////////////// | ||
58 | +// GridCellBase | ||
59 | + | ||
60 | +CGridCellBase::CGridCellBase() | ||
61 | +{ | ||
62 | + Reset(); | ||
63 | +} | ||
64 | + | ||
65 | +CGridCellBase::~CGridCellBase() | ||
66 | +{ | ||
67 | +} | ||
68 | + | ||
69 | +///////////////////////////////////////////////////////////////////////////// | ||
70 | +// GridCellBase Operations | ||
71 | + | ||
72 | +void CGridCellBase::Reset() | ||
73 | +{ | ||
74 | + m_nState = 0; | ||
75 | +} | ||
76 | + | ||
77 | +void CGridCellBase::operator=(const CGridCellBase& cell) | ||
78 | +{ | ||
79 | + if (this == &cell) return; | ||
80 | + | ||
81 | + SetGrid(cell.GetGrid()); // do first in case of dependencies | ||
82 | + | ||
83 | + SetText(cell.GetText()); | ||
84 | + SetImage(cell.GetImage()); | ||
85 | + SetData(cell.GetData()); | ||
86 | + SetState(cell.GetState()); | ||
87 | + SetFormat(cell.GetFormat()); | ||
88 | + SetTextClr(cell.GetTextClr()); | ||
89 | + SetBackClr(cell.GetBackClr()); | ||
90 | + SetFont(cell.IsDefaultFont()? NULL : cell.GetFont()); | ||
91 | + SetMargin(cell.GetMargin()); | ||
92 | +} | ||
93 | + | ||
94 | +///////////////////////////////////////////////////////////////////////////// | ||
95 | +// CGridCellBase Attributes | ||
96 | + | ||
97 | +// Returns a pointer to a cell that holds default values for this particular type of cell | ||
98 | +CGridCellBase* CGridCellBase::GetDefaultCell() const | ||
99 | +{ | ||
100 | + if (GetGrid()) | ||
101 | + return GetGrid()->GetDefaultCell(IsFixedRow(), IsFixedCol()); | ||
102 | + return NULL; | ||
103 | +} | ||
104 | + | ||
105 | + | ||
106 | +///////////////////////////////////////////////////////////////////////////// | ||
107 | +// CGridCellBase Operations | ||
108 | + | ||
109 | +// EFW - Various changes to make it draw cells better when using alternate | ||
110 | +// color schemes. Also removed printing references as that's now done | ||
111 | +// by PrintCell() and fixed the sort marker so that it doesn't draw out | ||
112 | +// of bounds. | ||
113 | +BOOL CGridCellBase::Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd /*=TRUE*/) | ||
114 | +{ | ||
115 | + // Note - all through this function we totally brutalise 'rect'. Do not | ||
116 | + // depend on it's value being that which was passed in. | ||
117 | + | ||
118 | + CGridCtrl* pGrid = GetGrid(); | ||
119 | + ASSERT(pGrid); | ||
120 | + | ||
121 | + if (!pGrid || !pDC) | ||
122 | + return FALSE; | ||
123 | + | ||
124 | + if( rect.Width() <= 0 || rect.Height() <= 0) // prevents imagelist item from drawing even | ||
125 | + return FALSE; // though cell is hidden | ||
126 | + | ||
127 | + //TRACE3("Drawing %scell %d, %d\n", IsFixed()? _T("Fixed ") : _T(""), nRow, nCol); | ||
128 | + | ||
129 | + int nSavedDC = pDC->SaveDC(); | ||
130 | + pDC->SetBkMode(TRANSPARENT); | ||
131 | + | ||
132 | + // Get the default cell implementation for this kind of cell. We use it if this cell | ||
133 | + // has anything marked as "default" | ||
134 | + CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell(); | ||
135 | + if (!pDefaultCell) | ||
136 | + return FALSE; | ||
137 | + | ||
138 | + // Set up text and background colours | ||
139 | + COLORREF TextClr, TextBkClr; | ||
140 | + | ||
141 | + TextClr = (GetTextClr() == CLR_DEFAULT)? pDefaultCell->GetTextClr() : GetTextClr(); | ||
142 | + if (GetBackClr() == CLR_DEFAULT) | ||
143 | + TextBkClr = pDefaultCell->GetBackClr(); | ||
144 | + else | ||
145 | + { | ||
146 | + bEraseBkgnd = TRUE; | ||
147 | + TextBkClr = GetBackClr(); | ||
148 | + } | ||
149 | + | ||
150 | + // Draw cell background and highlighting (if necessary) | ||
151 | + if ( IsFocused() || IsDropHighlighted() ) | ||
152 | + { | ||
153 | + // Always draw even in list mode so that we can tell where the | ||
154 | + // cursor is at. Use the highlight colors though. | ||
155 | + if(GetState() & GVIS_SELECTED) | ||
156 | + { | ||
157 | + TextBkClr = ::GetSysColor(COLOR_HIGHLIGHT); | ||
158 | + TextClr = ::GetSysColor(COLOR_HIGHLIGHTTEXT); | ||
159 | + bEraseBkgnd = TRUE; | ||
160 | + } | ||
161 | + | ||
162 | + rect.right++; rect.bottom++; // FillRect doesn't draw RHS or bottom | ||
163 | + if (bEraseBkgnd) | ||
164 | + { | ||
165 | + TRY | ||
166 | + { | ||
167 | + CBrush brush(TextBkClr); | ||
168 | + pDC->FillRect(rect, &brush); | ||
169 | + } | ||
170 | + CATCH(CResourceException, e) | ||
171 | + { | ||
172 | + //e->ReportError(); | ||
173 | + } | ||
174 | + END_CATCH | ||
175 | + } | ||
176 | + | ||
177 | + // Don't adjust frame rect if no grid lines so that the | ||
178 | + // whole cell is enclosed. | ||
179 | + if(pGrid->GetGridLines() != GVL_NONE) | ||
180 | + { | ||
181 | + rect.right--; | ||
182 | + rect.bottom--; | ||
183 | + } | ||
184 | + | ||
185 | + if (pGrid->GetFrameFocusCell()) | ||
186 | + { | ||
187 | + // Use same color as text to outline the cell so that it shows | ||
188 | + // up if the background is black. | ||
189 | + TRY | ||
190 | + { | ||
191 | + CBrush brush(TextClr); | ||
192 | + pDC->FrameRect(rect, &brush); | ||
193 | + } | ||
194 | + CATCH(CResourceException, e) | ||
195 | + { | ||
196 | + //e->ReportError(); | ||
197 | + } | ||
198 | + END_CATCH | ||
199 | + } | ||
200 | + pDC->SetTextColor(TextClr); | ||
201 | + | ||
202 | + // Adjust rect after frame draw if no grid lines | ||
203 | + if(pGrid->GetGridLines() == GVL_NONE) | ||
204 | + { | ||
205 | + rect.right--; | ||
206 | + rect.bottom--; | ||
207 | + } | ||
208 | + | ||
209 | + //rect.DeflateRect(0,1,1,1); - Removed by Yogurt | ||
210 | + } | ||
211 | + else if ((GetState() & GVIS_SELECTED)) | ||
212 | + { | ||
213 | + rect.right++; rect.bottom++; // FillRect doesn't draw RHS or bottom | ||
214 | + pDC->FillSolidRect(rect, ::GetSysColor(COLOR_HIGHLIGHT)); | ||
215 | + rect.right--; rect.bottom--; | ||
216 | + pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT)); | ||
217 | + } | ||
218 | + else | ||
219 | + { | ||
220 | + if (bEraseBkgnd) | ||
221 | + { | ||
222 | + rect.right++; rect.bottom++; // FillRect doesn't draw RHS or bottom | ||
223 | + CBrush brush(TextBkClr); | ||
224 | + pDC->FillRect(rect, &brush); | ||
225 | + rect.right--; rect.bottom--; | ||
226 | + } | ||
227 | + pDC->SetTextColor(TextClr); | ||
228 | + } | ||
229 | + | ||
230 | + // Draw lines only when wanted | ||
231 | + if (IsFixed() && pGrid->GetGridLines() != GVL_NONE) | ||
232 | + { | ||
233 | + CCellID FocusCell = pGrid->GetFocusCell(); | ||
234 | + | ||
235 | + // As above, always show current location even in list mode so | ||
236 | + // that we know where the cursor is at. | ||
237 | + BOOL bHiliteFixed = pGrid->GetTrackFocusCell() && pGrid->IsValid(FocusCell) && | ||
238 | + (FocusCell.row == nRow || FocusCell.col == nCol); | ||
239 | + | ||
240 | + // If this fixed cell is on the same row/col as the focus cell, | ||
241 | + // highlight it. | ||
242 | + if (bHiliteFixed) | ||
243 | + { | ||
244 | + rect.right++; rect.bottom++; | ||
245 | + pDC->DrawEdge(rect, BDR_SUNKENINNER /*EDGE_RAISED*/, BF_RECT); | ||
246 | + rect.DeflateRect(1,1); | ||
247 | + } | ||
248 | + else | ||
249 | + { | ||
250 | + CPen lightpen(PS_SOLID, 1, ::GetSysColor(COLOR_3DHIGHLIGHT)), | ||
251 | + darkpen(PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW)), | ||
252 | + *pOldPen = pDC->GetCurrentPen(); | ||
253 | + | ||
254 | + pDC->SelectObject(&lightpen); | ||
255 | + pDC->MoveTo(rect.right, rect.top); | ||
256 | + pDC->LineTo(rect.left, rect.top); | ||
257 | + pDC->LineTo(rect.left, rect.bottom); | ||
258 | + | ||
259 | + pDC->SelectObject(&darkpen); | ||
260 | + pDC->MoveTo(rect.right, rect.top); | ||
261 | + pDC->LineTo(rect.right, rect.bottom); | ||
262 | + pDC->LineTo(rect.left, rect.bottom); | ||
263 | + | ||
264 | + pDC->SelectObject(pOldPen); | ||
265 | + rect.DeflateRect(1,1); | ||
266 | + } | ||
267 | + } | ||
268 | + | ||
269 | + // Draw Text and image | ||
270 | +#if !defined(_WIN32_WCE_NO_PRINTING) && !defined(GRIDCONTROL_NO_PRINTING) | ||
271 | + if (!pDC->m_bPrinting) | ||
272 | +#endif | ||
273 | + { | ||
274 | + CFont *pFont = GetFontObject(); | ||
275 | + ASSERT(pFont); | ||
276 | + if (pFont) | ||
277 | + pDC->SelectObject(pFont); | ||
278 | + } | ||
279 | + | ||
280 | + //rect.DeflateRect(GetMargin(), 0); - changed by Yogurt | ||
281 | + rect.DeflateRect(GetMargin(), GetMargin()); | ||
282 | + rect.right++; | ||
283 | + rect.bottom++; | ||
284 | + | ||
285 | + if (pGrid->GetImageList() && GetImage() >= 0) | ||
286 | + { | ||
287 | + IMAGEINFO Info; | ||
288 | + if (pGrid->GetImageList()->GetImageInfo(GetImage(), &Info)) | ||
289 | + { | ||
290 | + // would like to use a clipping region but seems to have issue | ||
291 | + // working with CMemDC directly. Instead, don't display image | ||
292 | + // if any part of it cut-off | ||
293 | + // | ||
294 | + // CRgn rgn; | ||
295 | + // rgn.CreateRectRgnIndirect(rect); | ||
296 | + // pDC->SelectClipRgn(&rgn); | ||
297 | + // rgn.DeleteObject(); | ||
298 | + | ||
299 | + /* | ||
300 | + // removed by Yogurt | ||
301 | + int nImageWidth = Info.rcImage.right-Info.rcImage.left+1; | ||
302 | + int nImageHeight = Info.rcImage.bottom-Info.rcImage.top+1; | ||
303 | + if( nImageWidth + rect.left <= rect.right + (int)(2*GetMargin()) | ||
304 | + && nImageHeight + rect.top <= rect.bottom + (int)(2*GetMargin()) ) | ||
305 | + { | ||
306 | + pGrid->GetImageList()->Draw(pDC, GetImage(), rect.TopLeft(), ILD_NORMAL); | ||
307 | + } | ||
308 | + */ | ||
309 | + // Added by Yogurt | ||
310 | + int nImageWidth = Info.rcImage.right-Info.rcImage.left; | ||
311 | + int nImageHeight = Info.rcImage.bottom-Info.rcImage.top; | ||
312 | + if ((nImageWidth + rect.left <= rect.right) && (nImageHeight + rect.top <= rect.bottom)) | ||
313 | + pGrid->GetImageList()->Draw(pDC, GetImage(), rect.TopLeft(), ILD_NORMAL); | ||
314 | + | ||
315 | + //rect.left += nImageWidth+GetMargin(); | ||
316 | + } | ||
317 | + } | ||
318 | + | ||
319 | + // Draw sort arrow | ||
320 | + if (pGrid->GetSortColumn() == nCol && nRow == 0) | ||
321 | + { | ||
322 | + CSize size = pDC->GetTextExtent(_T("M")); | ||
323 | + int nOffset = 2; | ||
324 | + | ||
325 | + // Base the size of the triangle on the smaller of the column | ||
326 | + // height or text height with a slight offset top and bottom. | ||
327 | + // Otherwise, it can get drawn outside the bounds of the cell. | ||
328 | + size.cy -= (nOffset * 2); | ||
329 | + | ||
330 | + if (size.cy >= rect.Height()) | ||
331 | + size.cy = rect.Height() - (nOffset * 2); | ||
332 | + | ||
333 | + size.cx = size.cy; // Make the dimensions square | ||
334 | + | ||
335 | + // Kludge for vertical text | ||
336 | + BOOL bVertical = (GetFont()->lfEscapement == 900); | ||
337 | + | ||
338 | + // Only draw if it'll fit! | ||
339 | + //if (size.cx + rect.left < rect.right + (int)(2*GetMargin())) - changed / Yogurt | ||
340 | + if (size.cx + rect.left < rect.right) | ||
341 | + { | ||
342 | + int nTriangleBase = rect.bottom - nOffset - size.cy; // Triangle bottom right | ||
343 | + //int nTriangleBase = (rect.top + rect.bottom - size.cy)/2; // Triangle middle right | ||
344 | + //int nTriangleBase = rect.top + nOffset; // Triangle top right | ||
345 | + | ||
346 | + //int nTriangleLeft = rect.right - size.cx; // Triangle RHS | ||
347 | + //int nTriangleLeft = (rect.right + rect.left - size.cx)/2; // Triangle middle | ||
348 | + //int nTriangleLeft = rect.left; // Triangle LHS | ||
349 | + | ||
350 | + int nTriangleLeft; | ||
351 | + if (bVertical) | ||
352 | + nTriangleLeft = (rect.right + rect.left - size.cx)/2; // Triangle middle | ||
353 | + else | ||
354 | + nTriangleLeft = rect.right - size.cx; // Triangle RHS | ||
355 | + | ||
356 | + CPen penShadow(PS_SOLID, 0, ::GetSysColor(COLOR_3DSHADOW)); | ||
357 | + CPen penLight(PS_SOLID, 0, ::GetSysColor(COLOR_3DHILIGHT)); | ||
358 | + if (pGrid->GetSortAscending()) | ||
359 | + { | ||
360 | + // Draw triangle pointing upwards | ||
361 | + CPen *pOldPen = (CPen*) pDC->SelectObject(&penLight); | ||
362 | + pDC->MoveTo( nTriangleLeft + 1, nTriangleBase + size.cy + 1); | ||
363 | + pDC->LineTo( nTriangleLeft + (size.cx / 2) + 1, nTriangleBase + 1 ); | ||
364 | + pDC->LineTo( nTriangleLeft + size.cx + 1, nTriangleBase + size.cy + 1); | ||
365 | + pDC->LineTo( nTriangleLeft + 1, nTriangleBase + size.cy + 1); | ||
366 | + | ||
367 | + pDC->SelectObject(&penShadow); | ||
368 | + pDC->MoveTo( nTriangleLeft, nTriangleBase + size.cy ); | ||
369 | + pDC->LineTo( nTriangleLeft + (size.cx / 2), nTriangleBase ); | ||
370 | + pDC->LineTo( nTriangleLeft + size.cx, nTriangleBase + size.cy ); | ||
371 | + pDC->LineTo( nTriangleLeft, nTriangleBase + size.cy ); | ||
372 | + pDC->SelectObject(pOldPen); | ||
373 | + } | ||
374 | + else | ||
375 | + { | ||
376 | + // Draw triangle pointing downwards | ||
377 | + CPen *pOldPen = (CPen*) pDC->SelectObject(&penLight); | ||
378 | + pDC->MoveTo( nTriangleLeft + 1, nTriangleBase + 1 ); | ||
379 | + pDC->LineTo( nTriangleLeft + (size.cx / 2) + 1, nTriangleBase + size.cy + 1 ); | ||
380 | + pDC->LineTo( nTriangleLeft + size.cx + 1, nTriangleBase + 1 ); | ||
381 | + pDC->LineTo( nTriangleLeft + 1, nTriangleBase + 1 ); | ||
382 | + | ||
383 | + pDC->SelectObject(&penShadow); | ||
384 | + pDC->MoveTo( nTriangleLeft, nTriangleBase ); | ||
385 | + pDC->LineTo( nTriangleLeft + (size.cx / 2), nTriangleBase + size.cy ); | ||
386 | + pDC->LineTo( nTriangleLeft + size.cx, nTriangleBase ); | ||
387 | + pDC->LineTo( nTriangleLeft, nTriangleBase ); | ||
388 | + pDC->SelectObject(pOldPen); | ||
389 | + } | ||
390 | + | ||
391 | + if (!bVertical) | ||
392 | + rect.right -= size.cy; | ||
393 | + } | ||
394 | + } | ||
395 | + | ||
396 | + // We want to see '&' characters so use DT_NOPREFIX | ||
397 | + GetTextRect(rect); | ||
398 | + rect.right++; | ||
399 | + rect.bottom++; | ||
400 | + | ||
401 | + DrawText(pDC->m_hDC, GetText(), -1, rect, GetFormat() | DT_NOPREFIX); | ||
402 | + | ||
403 | + pDC->RestoreDC(nSavedDC); | ||
404 | + | ||
405 | + return TRUE; | ||
406 | +} | ||
407 | + | ||
408 | +///////////////////////////////////////////////////////////////////////////// | ||
409 | +// CGridCellBase Mouse and Cursor events | ||
410 | + | ||
411 | +// Not yet implemented | ||
412 | +void CGridCellBase::OnMouseEnter() | ||
413 | +{ | ||
414 | + TRACE0("Mouse entered cell\n"); | ||
415 | +} | ||
416 | + | ||
417 | +void CGridCellBase::OnMouseOver() | ||
418 | +{ | ||
419 | + //TRACE0("Mouse over cell\n"); | ||
420 | +} | ||
421 | + | ||
422 | +// Not Yet Implemented | ||
423 | +void CGridCellBase::OnMouseLeave() | ||
424 | +{ | ||
425 | + TRACE0("Mouse left cell\n"); | ||
426 | +} | ||
427 | + | ||
428 | +void CGridCellBase::OnClick( CPoint PointCellRelative) | ||
429 | +{ | ||
430 | + UNUSED_ALWAYS(PointCellRelative); | ||
431 | + TRACE2("Mouse Left btn up in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y); | ||
432 | +} | ||
433 | + | ||
434 | +void CGridCellBase::OnClickDown( CPoint PointCellRelative) | ||
435 | +{ | ||
436 | + UNUSED_ALWAYS(PointCellRelative); | ||
437 | + TRACE2("Mouse Left btn down in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y); | ||
438 | +} | ||
439 | + | ||
440 | +void CGridCellBase::OnRClick( CPoint PointCellRelative) | ||
441 | +{ | ||
442 | + UNUSED_ALWAYS(PointCellRelative); | ||
443 | + TRACE2("Mouse right-clicked in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y); | ||
444 | +} | ||
445 | + | ||
446 | +void CGridCellBase::OnDblClick( CPoint PointCellRelative) | ||
447 | +{ | ||
448 | + UNUSED_ALWAYS(PointCellRelative); | ||
449 | + TRACE2("Mouse double-clicked in cell at x=%i y=%i\n", PointCellRelative.x, PointCellRelative.y); | ||
450 | +} | ||
451 | + | ||
452 | +// Return TRUE if you set the cursor | ||
453 | +BOOL CGridCellBase::OnSetCursor() | ||
454 | +{ | ||
455 | +#ifndef _WIN32_WCE_NO_CURSOR | ||
456 | + SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW)); | ||
457 | +#endif | ||
458 | + return TRUE; | ||
459 | +} | ||
460 | + | ||
461 | +///////////////////////////////////////////////////////////////////////////// | ||
462 | +// CGridCellBase editing | ||
463 | + | ||
464 | +void CGridCellBase::OnEndEdit() | ||
465 | +{ | ||
466 | + ASSERT( FALSE); | ||
467 | +} | ||
468 | + | ||
469 | +BOOL CGridCellBase::ValidateEdit(LPCTSTR str) | ||
470 | +{ | ||
471 | + UNUSED_ALWAYS(str); | ||
472 | + return TRUE; | ||
473 | +} | ||
474 | + | ||
475 | +///////////////////////////////////////////////////////////////////////////// | ||
476 | +// CGridCellBase Sizing | ||
477 | + | ||
478 | +BOOL CGridCellBase::GetTextRect( LPRECT pRect) // i/o: i=dims of cell rect; o=dims of text rect | ||
479 | +{ | ||
480 | + if (GetImage() >= 0) | ||
481 | + { | ||
482 | + IMAGEINFO Info; | ||
483 | + | ||
484 | + CGridCtrl* pGrid = GetGrid(); | ||
485 | + CImageList* pImageList = pGrid->GetImageList(); | ||
486 | + | ||
487 | + if (pImageList && pImageList->GetImageInfo( GetImage(), &Info)) | ||
488 | + { | ||
489 | + int nImageWidth = Info.rcImage.right-Info.rcImage.left+1; | ||
490 | + pRect->left += nImageWidth + GetMargin(); | ||
491 | + } | ||
492 | + } | ||
493 | + | ||
494 | + return TRUE; | ||
495 | +} | ||
496 | + | ||
497 | +// By default this uses the selected font (which is a bigger font) | ||
498 | +CSize CGridCellBase::GetTextExtent(LPCTSTR szText, CDC* pDC /*= NULL*/) | ||
499 | +{ | ||
500 | + CGridCtrl* pGrid = GetGrid(); | ||
501 | + ASSERT(pGrid); | ||
502 | + | ||
503 | + BOOL bReleaseDC = FALSE; | ||
504 | + if (pDC == NULL || szText == NULL) | ||
505 | + { | ||
506 | + if (szText) | ||
507 | + pDC = pGrid->GetDC(); | ||
508 | + if (pDC == NULL || szText == NULL) | ||
509 | + { | ||
510 | + CGridDefaultCell* pDefCell = (CGridDefaultCell*) GetDefaultCell(); | ||
511 | + ASSERT(pDefCell); | ||
512 | + return CSize(pDefCell->GetWidth(), pDefCell->GetHeight()); | ||
513 | + } | ||
514 | + bReleaseDC = TRUE; | ||
515 | + } | ||
516 | + | ||
517 | + CFont *pOldFont = NULL, | ||
518 | + *pFont = GetFontObject(); | ||
519 | + if (pFont) | ||
520 | + pOldFont = pDC->SelectObject(pFont); | ||
521 | + | ||
522 | + CSize size; | ||
523 | + int nFormat = GetFormat(); | ||
524 | + | ||
525 | + // If the cell is a multiline cell, then use the width of the cell | ||
526 | + // to get the height | ||
527 | + if ((nFormat & DT_WORDBREAK) && !(nFormat & DT_SINGLELINE)) | ||
528 | + { | ||
529 | + CString str = szText; | ||
530 | + int nMaxWidth = 0; | ||
531 | + while (TRUE) | ||
532 | + { | ||
533 | + int nPos = str.Find(_T('\n')); | ||
534 | + CString TempStr = (nPos < 0)? str : str.Left(nPos); | ||
535 | + int nTempWidth = pDC->GetTextExtent(TempStr).cx; | ||
536 | + if (nTempWidth > nMaxWidth) | ||
537 | + nMaxWidth = nTempWidth; | ||
538 | + | ||
539 | + if (nPos < 0) | ||
540 | + break; | ||
541 | + str = str.Mid(nPos + 1); // Bug fix by Thomas Steinborn | ||
542 | + } | ||
543 | + | ||
544 | + CRect rect; | ||
545 | + rect.SetRect(0,0, nMaxWidth+1, 0); | ||
546 | + pDC->DrawText(szText, -1, rect, nFormat | DT_CALCRECT); | ||
547 | + size = rect.Size(); | ||
548 | + } | ||
549 | + else | ||
550 | + size = pDC->GetTextExtent(szText, (int)_tcslen(szText)); | ||
551 | + | ||
552 | + // Removed by Yogurt | ||
553 | + //TEXTMETRIC tm; | ||
554 | + //pDC->GetTextMetrics(&tm); | ||
555 | + //size.cx += (tm.tmOverhang); | ||
556 | + | ||
557 | + if (pOldFont) | ||
558 | + pDC->SelectObject(pOldFont); | ||
559 | + | ||
560 | + size += CSize(2*GetMargin(), 2*GetMargin()); | ||
561 | + | ||
562 | + // Kludge for vertical text | ||
563 | + LOGFONT *pLF = GetFont(); | ||
564 | + if (pLF->lfEscapement == 900 || pLF->lfEscapement == -900) | ||
565 | + { | ||
566 | + int nTemp = size.cx; | ||
567 | + size.cx = size.cy; | ||
568 | + size.cy = nTemp; | ||
569 | + size += CSize(0, 4*GetMargin()); | ||
570 | + } | ||
571 | + | ||
572 | + if (bReleaseDC) | ||
573 | + pGrid->ReleaseDC(pDC); | ||
574 | + | ||
575 | + return size; | ||
576 | +} | ||
577 | + | ||
578 | + | ||
579 | +CSize CGridCellBase::GetCellExtent(CDC* pDC) | ||
580 | +{ | ||
581 | + CSize size = GetTextExtent(GetText(), pDC); | ||
582 | + CSize ImageSize(0,0); | ||
583 | + | ||
584 | + int nImage = GetImage(); | ||
585 | + if (nImage >= 0) | ||
586 | + { | ||
587 | + CGridCtrl* pGrid = GetGrid(); | ||
588 | + ASSERT(pGrid); | ||
589 | + IMAGEINFO Info; | ||
590 | + if (pGrid->GetImageList() && pGrid->GetImageList()->GetImageInfo(nImage, &Info)) | ||
591 | + { | ||
592 | + ImageSize = CSize(Info.rcImage.right-Info.rcImage.left, | ||
593 | + Info.rcImage.bottom-Info.rcImage.top); | ||
594 | + if (size.cx > 2*(int)GetMargin ()) | ||
595 | + ImageSize.cx += GetMargin(); | ||
596 | + ImageSize.cy += 2*(int)GetMargin (); | ||
597 | + } | ||
598 | + } | ||
599 | + size.cx += ImageSize.cx + 1; | ||
600 | + size.cy = max(size.cy, ImageSize.cy) + 1; | ||
601 | + if (IsFixed()) | ||
602 | + { | ||
603 | + size.cx++; | ||
604 | + size.cy++; | ||
605 | + } | ||
606 | + return size; | ||
607 | +} | ||
608 | + | ||
609 | +// EFW - Added to print cells so that grids that use different colors are | ||
610 | +// printed correctly. | ||
611 | +BOOL CGridCellBase::PrintCell(CDC* pDC, int /*nRow*/, int /*nCol*/, CRect rect) | ||
612 | +{ | ||
613 | +#if defined(_WIN32_WCE_NO_PRINTING) || defined(GRIDCONTROL_NO_PRINTING) | ||
614 | + return FALSE; | ||
615 | +#else | ||
616 | + COLORREF crFG, crBG; | ||
617 | + GV_ITEM Item; | ||
618 | + | ||
619 | + CGridCtrl* pGrid = GetGrid(); | ||
620 | + if (!pGrid || !pDC) | ||
621 | + return FALSE; | ||
622 | + | ||
623 | + if( rect.Width() <= 0 | ||
624 | + || rect.Height() <= 0) // prevents imagelist item from drawing even | ||
625 | + return FALSE; // though cell is hidden | ||
626 | + | ||
627 | + int nSavedDC = pDC->SaveDC(); | ||
628 | + | ||
629 | + pDC->SetBkMode(TRANSPARENT); | ||
630 | + | ||
631 | + if (pGrid->GetShadedPrintOut()) | ||
632 | + { | ||
633 | + // Get the default cell implementation for this kind of cell. We use it if this cell | ||
634 | + // has anything marked as "default" | ||
635 | + CGridDefaultCell *pDefaultCell = (CGridDefaultCell*) GetDefaultCell(); | ||
636 | + if (!pDefaultCell) | ||
637 | + return FALSE; | ||
638 | + | ||
639 | + // Use custom color if it doesn't match the default color and the | ||
640 | + // default grid background color. If not, leave it alone. | ||
641 | + if(IsFixed()) | ||
642 | + crBG = (GetBackClr() != CLR_DEFAULT) ? GetBackClr() : pDefaultCell->GetBackClr(); | ||
643 | + else | ||
644 | + crBG = (GetBackClr() != CLR_DEFAULT && GetBackClr() != pDefaultCell->GetBackClr()) ? | ||
645 | + GetBackClr() : CLR_DEFAULT; | ||
646 | + | ||
647 | + // Use custom color if the background is different or if it doesn't | ||
648 | + // match the default color and the default grid text color. | ||
649 | + if(IsFixed()) | ||
650 | + crFG = (GetBackClr() != CLR_DEFAULT) ? GetTextClr() : pDefaultCell->GetTextClr(); | ||
651 | + else | ||
652 | + crFG = (GetBackClr() != CLR_DEFAULT) ? GetTextClr() : pDefaultCell->GetTextClr(); | ||
653 | + | ||
654 | + // If not printing on a color printer, adjust the foreground color | ||
655 | + // to a gray scale if the background color isn't used so that all | ||
656 | + // colors will be visible. If not, some colors turn to solid black | ||
657 | + // or white when printed and may not show up. This may be caused by | ||
658 | + // coarse dithering by the printer driver too (see image note below). | ||
659 | + if(pDC->GetDeviceCaps(NUMCOLORS) == 2 && crBG == CLR_DEFAULT) | ||
660 | + crFG = RGB(GetRValue(crFG) * 0.30, GetGValue(crFG) * 0.59, | ||
661 | + GetBValue(crFG) * 0.11); | ||
662 | + | ||
663 | + // Only erase the background if the color is not the default | ||
664 | + // grid background color. | ||
665 | + if(crBG != CLR_DEFAULT) | ||
666 | + { | ||
667 | + CBrush brush(crBG); | ||
668 | + rect.right++; rect.bottom++; | ||
669 | + pDC->FillRect(rect, &brush); | ||
670 | + rect.right--; rect.bottom--; | ||
671 | + } | ||
672 | + } | ||
673 | + else | ||
674 | + { | ||
675 | + crBG = CLR_DEFAULT; | ||
676 | + crFG = RGB(0, 0, 0); | ||
677 | + } | ||
678 | + | ||
679 | + pDC->SetTextColor(crFG); | ||
680 | + | ||
681 | + CFont *pFont = GetFontObject(); | ||
682 | + if (pFont) | ||
683 | + pDC->SelectObject(pFont); | ||
684 | + | ||
685 | + /* | ||
686 | + // *************************************************** | ||
687 | + // Disabled - if you need this functionality then you'll need to rewrite. | ||
688 | + // Create the appropriate font and select into DC. | ||
689 | + CFont Font; | ||
690 | + // Bold the fixed cells if not shading the print out. Use italic | ||
691 | + // font it it is enabled. | ||
692 | + const LOGFONT* plfFont = GetFont(); | ||
693 | + if(IsFixed() && !pGrid->GetShadedPrintOut()) | ||
694 | + { | ||
695 | + Font.CreateFont(plfFont->lfHeight, 0, 0, 0, FW_BOLD, plfFont->lfItalic, 0, 0, | ||
696 | + ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, | ||
697 | +#ifndef _WIN32_WCE | ||
698 | + PROOF_QUALITY, | ||
699 | +#else | ||
700 | + DEFAULT_QUALITY, | ||
701 | +#endif | ||
702 | + VARIABLE_PITCH | FF_SWISS, plfFont->lfFaceName); | ||
703 | + } | ||
704 | + else | ||
705 | + Font.CreateFontIndirect(plfFont); | ||
706 | + | ||
707 | + pDC->SelectObject(&Font); | ||
708 | + // *************************************************** | ||
709 | + */ | ||
710 | + | ||
711 | + // Draw lines only when wanted on fixed cells. Normal cell grid lines | ||
712 | + // are handled in OnPrint. | ||
713 | + if(pGrid->GetGridLines() != GVL_NONE && IsFixed()) | ||
714 | + { | ||
715 | + CPen lightpen(PS_SOLID, 1, ::GetSysColor(COLOR_3DHIGHLIGHT)), | ||
716 | + darkpen(PS_SOLID, 1, ::GetSysColor(COLOR_3DDKSHADOW)), | ||
717 | + *pOldPen = pDC->GetCurrentPen(); | ||
718 | + | ||
719 | + pDC->SelectObject(&lightpen); | ||
720 | + pDC->MoveTo(rect.right, rect.top); | ||
721 | + pDC->LineTo(rect.left, rect.top); | ||
722 | + pDC->LineTo(rect.left, rect.bottom); | ||
723 | + | ||
724 | + pDC->SelectObject(&darkpen); | ||
725 | + pDC->MoveTo(rect.right, rect.top); | ||
726 | + pDC->LineTo(rect.right, rect.bottom); | ||
727 | + pDC->LineTo(rect.left, rect.bottom); | ||
728 | + | ||
729 | + rect.DeflateRect(1,1); | ||
730 | + pDC->SelectObject(pOldPen); | ||
731 | + } | ||
732 | + | ||
733 | + rect.DeflateRect(GetMargin(), 0); | ||
734 | + | ||
735 | + if(pGrid->GetImageList() && GetImage() >= 0) | ||
736 | + { | ||
737 | + // NOTE: If your printed images look like fuzzy garbage, check the | ||
738 | + // settings on your printer driver. If it's using coarse | ||
739 | + // dithering and/or vector graphics, they may print wrong. | ||
740 | + // Changing to fine dithering and raster graphics makes them | ||
741 | + // print properly. My HP 4L had that problem. | ||
742 | + | ||
743 | + IMAGEINFO Info; | ||
744 | + if(pGrid->GetImageList()->GetImageInfo(GetImage(), &Info)) | ||
745 | + { | ||
746 | + int nImageWidth = Info.rcImage.right-Info.rcImage.left; | ||
747 | + pGrid->GetImageList()->Draw(pDC, GetImage(), rect.TopLeft(), ILD_NORMAL); | ||
748 | + rect.left += nImageWidth+GetMargin(); | ||
749 | + } | ||
750 | + } | ||
751 | + | ||
752 | + // Draw without clipping so as not to lose text when printed for real | ||
753 | + // DT_NOCLIP removed 01.01.01. Slower, but who cares - we are printing! | ||
754 | + DrawText(pDC->m_hDC, GetText(), -1, rect, | ||
755 | + GetFormat() | /*DT_NOCLIP | */ DT_NOPREFIX); | ||
756 | + | ||
757 | + pDC->RestoreDC(nSavedDC); | ||
758 | + | ||
759 | + return TRUE; | ||
760 | +#endif | ||
761 | +} | ||
762 | + | ||
763 | +/***************************************************************************** | ||
764 | +Callable by derived classes, only | ||
765 | +*****************************************************************************/ | ||
766 | +LRESULT CGridCellBase::SendMessageToParent(int nRow, int nCol, int nMessage) | ||
767 | +{ | ||
768 | + CGridCtrl* pGrid = GetGrid(); | ||
769 | + if( pGrid) | ||
770 | + return pGrid->SendMessageToParent(nRow, nCol, nMessage); | ||
771 | + else | ||
772 | + return 0; | ||
773 | +} | ||
0 | \ No newline at end of file | 774 | \ No newline at end of file |
central_clearing_system/ETradeClient/mfc_ui/GridCellBase.h
0 → 100644
1 | +///////////////////////////////////////////////////////////////////////////// | ||
2 | +// GridCellBase.h : header file | ||
3 | +// | ||
4 | +// MFC Grid Control - Grid cell base class header file | ||
5 | +// | ||
6 | +// Written by Chris Maunder <chris@codeproject.com> | ||
7 | +// Copyright (c) 1998-2005. All Rights Reserved. | ||
8 | +// | ||
9 | +// This code may be used in compiled form in any way you desire. This | ||
10 | +// file may be redistributed unmodified by any means PROVIDING it is | ||
11 | +// not sold for profit without the authors written consent, and | ||
12 | +// providing that this notice and the authors name and all copyright | ||
13 | +// notices remains intact. | ||
14 | +// | ||
15 | +// An email letting me know how you are using it would be nice as well. | ||
16 | +// | ||
17 | +// This file is provided "as is" with no expressed or implied warranty. | ||
18 | +// The author accepts no liability for any damage/loss of business that | ||
19 | +// this product may cause. | ||
20 | +// | ||
21 | +// For use with CGridCtrl v2.22+ | ||
22 | +// | ||
23 | +////////////////////////////////////////////////////////////////////// | ||
24 | + | ||
25 | +#if !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_) | ||
26 | +#define AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_ | ||
27 | + | ||
28 | +#if _MSC_VER >= 1000 | ||
29 | +#pragma once | ||
30 | +#endif // _MSC_VER >= 1000 | ||
31 | + | ||
32 | +class CGridCtrl; | ||
33 | + | ||
34 | +// Cell states | ||
35 | +#define GVIS_FOCUSED 0x0001 | ||
36 | +#define GVIS_SELECTED 0x0002 | ||
37 | +#define GVIS_DROPHILITED 0x0004 | ||
38 | +#define GVIS_READONLY 0x0008 | ||
39 | +#define GVIS_FIXED 0x0010 | ||
40 | +#define GVIS_FIXEDROW 0x0020 | ||
41 | +#define GVIS_FIXEDCOL 0x0040 | ||
42 | +#define GVIS_MODIFIED 0x0080 | ||
43 | + | ||
44 | +// Cell data mask | ||
45 | +#define GVIF_TEXT LVIF_TEXT | ||
46 | +#define GVIF_IMAGE LVIF_IMAGE | ||
47 | +#define GVIF_PARAM LVIF_PARAM | ||
48 | +#define GVIF_STATE LVIF_STATE | ||
49 | +#define GVIF_BKCLR (GVIF_STATE<<1) | ||
50 | +#define GVIF_FGCLR (GVIF_STATE<<2) | ||
51 | +#define GVIF_FORMAT (GVIF_STATE<<3) | ||
52 | +#define GVIF_FONT (GVIF_STATE<<4) | ||
53 | +#define GVIF_MARGIN (GVIF_STATE<<5) | ||
54 | +#define GVIF_ALL (GVIF_TEXT|GVIF_IMAGE|GVIF_PARAM|GVIF_STATE|GVIF_BKCLR|GVIF_FGCLR| \ | ||
55 | + GVIF_FORMAT|GVIF_FONT|GVIF_MARGIN) | ||
56 | + | ||
57 | +// Used for Get/SetItem calls. | ||
58 | +typedef struct _GV_ITEM { | ||
59 | + int row,col; // Row and Column of item | ||
60 | + UINT mask; // Mask for use in getting/setting cell data | ||
61 | + UINT nState; // cell state (focus/hilighted etc) | ||
62 | + DWORD nFormat; // Format of cell | ||
63 | + int iImage; // index of the list view item’s icon | ||
64 | + COLORREF crBkClr; // Background colour (or CLR_DEFAULT) | ||
65 | + COLORREF crFgClr; // Forground colour (or CLR_DEFAULT) | ||
66 | + LPARAM lParam; // 32-bit value to associate with item | ||
67 | + LOGFONT lfFont; // Cell font | ||
68 | + UINT nMargin; // Internal cell margin | ||
69 | + CString strText; // Text in cell | ||
70 | +} GV_ITEM; | ||
71 | + | ||
72 | + | ||
73 | +// Each cell contains one of these. Fields "row" and "column" are not stored since we | ||
74 | +// will usually have acces to them in other ways, and they are an extra 8 bytes per | ||
75 | +// cell that is probably unnecessary. | ||
76 | + | ||
77 | +class CGridCellBase : public CObject | ||
78 | +{ | ||
79 | + friend class CGridCtrl; | ||
80 | + DECLARE_DYNAMIC(CGridCellBase) | ||
81 | + | ||
82 | +// Construction/Destruction | ||
83 | +public: | ||
84 | + CGridCellBase(); | ||
85 | + virtual ~CGridCellBase(); | ||
86 | + | ||
87 | +// Attributes | ||
88 | +public: | ||
89 | + virtual void SetText(LPCTSTR /* szText */) = 0 ; | ||
90 | + virtual void SetImage(int /* nImage */) = 0 ; | ||
91 | + virtual void SetData(LPARAM /* lParam */) = 0 ; | ||
92 | + virtual void SetState(DWORD nState) { m_nState = nState; } | ||
93 | + virtual void SetFormat(DWORD /* nFormat */) = 0 ; | ||
94 | + virtual void SetTextClr(COLORREF /* clr */) = 0 ; | ||
95 | + virtual void SetBackClr(COLORREF /* clr */) = 0 ; | ||
96 | + virtual void SetFont(const LOGFONT* /* plf */) = 0 ; | ||
97 | + virtual void SetMargin( UINT /* nMargin */) = 0 ; | ||
98 | + virtual void SetGrid(CGridCtrl* /* pGrid */) = 0 ; | ||
99 | + virtual void SetCoords( int /* nRow */, int /* nCol */) = 0 ; | ||
100 | + | ||
101 | + virtual LPCTSTR GetText() const = 0 ; | ||
102 | + virtual LPCTSTR GetTipText() const { return GetText(); } // may override TitleTip return | ||
103 | + virtual int GetImage() const = 0 ; | ||
104 | + virtual LPARAM GetData() const = 0 ; | ||
105 | + virtual DWORD GetState() const { return m_nState; } | ||
106 | + virtual DWORD GetFormat() const = 0 ; | ||
107 | + virtual COLORREF GetTextClr() const = 0 ; | ||
108 | + virtual COLORREF GetBackClr() const = 0 ; | ||
109 | + virtual LOGFONT * GetFont() const = 0 ; | ||
110 | + virtual CFont * GetFontObject() const = 0 ; | ||
111 | + virtual CGridCtrl* GetGrid() const = 0 ; | ||
112 | + virtual CWnd * GetEditWnd() const = 0 ; | ||
113 | + virtual UINT GetMargin() const = 0 ; | ||
114 | + | ||
115 | + virtual CGridCellBase* GetDefaultCell() const; | ||
116 | + | ||
117 | + virtual BOOL IsDefaultFont() const = 0 ; | ||
118 | + virtual BOOL IsEditing() const = 0 ; | ||
119 | + virtual BOOL IsFocused() const { return (m_nState & GVIS_FOCUSED); } | ||
120 | + virtual BOOL IsFixed() const { return (m_nState & GVIS_FIXED); } | ||
121 | + virtual BOOL IsFixedCol() const { return (m_nState & GVIS_FIXEDCOL); } | ||
122 | + virtual BOOL IsFixedRow() const { return (m_nState & GVIS_FIXEDROW); } | ||
123 | + virtual BOOL IsSelected() const { return (m_nState & GVIS_SELECTED); } | ||
124 | + virtual BOOL IsReadOnly() const { return (m_nState & GVIS_READONLY); } | ||
125 | + virtual BOOL IsModified() const { return (m_nState & GVIS_MODIFIED); } | ||
126 | + virtual BOOL IsDropHighlighted() const { return (m_nState & GVIS_DROPHILITED); } | ||
127 | + | ||
128 | +// Operators | ||
129 | +public: | ||
130 | + virtual void operator=(const CGridCellBase& cell); | ||
131 | + | ||
132 | +// Operations | ||
133 | +public: | ||
134 | + virtual void Reset(); | ||
135 | + | ||
136 | + virtual BOOL Draw(CDC* pDC, int nRow, int nCol, CRect rect, BOOL bEraseBkgnd = TRUE); | ||
137 | + virtual BOOL GetTextRect( LPRECT pRect); // i/o: i=dims of cell rect; o=dims of text rect | ||
138 | + virtual BOOL GetTipTextRect( LPRECT pRect) { return GetTextRect( pRect); } // may override for btns, etc. | ||
139 | + virtual CSize GetTextExtent(LPCTSTR str, CDC* pDC = NULL); | ||
140 | + virtual CSize GetCellExtent(CDC* pDC); | ||
141 | + | ||
142 | + // Editing | ||
143 | + virtual BOOL Edit( int /* nRow */, int /* nCol */, CRect /* rect */, CPoint /* point */, | ||
144 | + UINT /* nID */, UINT /* nChar */) { ASSERT( FALSE); return FALSE;} | ||
145 | + virtual BOOL ValidateEdit(LPCTSTR str); | ||
146 | + virtual void EndEdit() {} | ||
147 | + | ||
148 | + // EFW - Added to print cells properly | ||
149 | + virtual BOOL PrintCell(CDC* pDC, int nRow, int nCol, CRect rect); | ||
150 | + | ||
151 | + // add additional protected grid members required of cells | ||
152 | + LRESULT SendMessageToParent(int nRow, int nCol, int nMessage); | ||
153 | + | ||
154 | +protected: | ||
155 | + virtual void OnEndEdit(); | ||
156 | + virtual void OnMouseEnter(); | ||
157 | + virtual void OnMouseOver(); | ||
158 | + virtual void OnMouseLeave(); | ||
159 | + virtual void OnClick( CPoint PointCellRelative); | ||
160 | + virtual void OnClickDown( CPoint PointCellRelative); | ||
161 | + virtual void OnRClick( CPoint PointCellRelative); | ||
162 | + virtual void OnDblClick( CPoint PointCellRelative); | ||
163 | + virtual BOOL OnSetCursor(); | ||
164 | + | ||
165 | +protected: | ||
166 | + DWORD m_nState; // Cell state (selected/focus etc) | ||
167 | +}; | ||
168 | + | ||
169 | +//{{AFX_INSERT_LOCATION}} | ||
170 | +// Microsoft Developer Studio will insert additional declarations immediately before the previous line. | ||
171 | + | ||
172 | +#endif // !defined(AFX_GRIDCELLBASE_H__519FA702_722C_11D1_ABBA_00A0243D1382__INCLUDED_) |