NCtrlSizeBar.cpp
上传用户:libwxy
上传日期:2007-01-02
资源大小:200k
文件大小:10k
源码类别:

工具条

开发平台:

Visual C++

  1. // NCtrlSizeBar.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "NGenericDockBar.h"
  5. #include "NCtrlSizeBar.h"
  6. #ifdef _DEBUG
  7. #undef THIS_FILE
  8. static char BASED_CODE THIS_FILE[] = __FILE__;
  9. #endif
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CListControlBar
  12. //
  13. // This is a sizeable control bar that has a list box on it.
  14. // It is designed to be created dynamically ie you can have more than one 
  15. // of them.
  16. #define IDC_LIST_CONTROL 100
  17. IMPLEMENT_DYNAMIC(CListControlBar, CNGenericDockBar);
  18. CListControlBar::CListControlBar() 
  19. {
  20. }
  21. CListControlBar::~CListControlBar()
  22. {
  23. }
  24. BEGIN_MESSAGE_MAP(CListControlBar, CNGenericDockBar)
  25. //{{AFX_MSG_MAP(CListControlBar)
  26. ON_WM_CREATE()
  27. ON_WM_RBUTTONUP()
  28. ON_NOTIFY(NM_CLICK, IDC_LIST_CONTROL, OnClickListControl)
  29. ON_NOTIFY(NM_DBLCLK, IDC_LIST_CONTROL, OnDblclkListControl)
  30. ON_NOTIFY(NM_KILLFOCUS, IDC_LIST_CONTROL, OnKillfocusListControl)
  31. ON_NOTIFY(NM_OUTOFMEMORY, IDC_LIST_CONTROL, OnOutofmemoryListControl)
  32. ON_NOTIFY(NM_RCLICK, IDC_LIST_CONTROL, OnRclickListControl)
  33. ON_NOTIFY(NM_RDBLCLK, IDC_LIST_CONTROL, OnRdblclkListControl)
  34. ON_NOTIFY(NM_RETURN, IDC_LIST_CONTROL, OnReturnListControl)
  35. ON_NOTIFY(NM_SETFOCUS, IDC_LIST_CONTROL, OnSetfocusListControl)
  36. ON_NOTIFY(LVN_BEGINDRAG, IDC_LIST_CONTROL, OnBegindragListControl)
  37. ON_NOTIFY(LVN_BEGINLABELEDIT, IDC_LIST_CONTROL, OnBeginlabeleditListControl)
  38. ON_NOTIFY(LVN_BEGINRDRAG, IDC_LIST_CONTROL, OnBeginrdragListControl)
  39. ON_NOTIFY(LVN_COLUMNCLICK, IDC_LIST_CONTROL, OnColumnclickListControl)
  40. ON_NOTIFY(LVN_DELETEALLITEMS, IDC_LIST_CONTROL, OnDeleteallitemsListControl)
  41. ON_NOTIFY(LVN_DELETEITEM, IDC_LIST_CONTROL, OnDeleteitemListControl)
  42. ON_NOTIFY(LVN_ENDLABELEDIT, IDC_LIST_CONTROL, OnEndlabeleditListControl)
  43. ON_NOTIFY(LVN_GETDISPINFO, IDC_LIST_CONTROL, OnGetdispinfoListControl)
  44. ON_NOTIFY(LVN_INSERTITEM, IDC_LIST_CONTROL, OnInsertitemListControl)
  45. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_CONTROL, OnItemchangedListControl)
  46. ON_NOTIFY(LVN_ITEMCHANGING, IDC_LIST_CONTROL, OnItemchangingListControl)
  47. ON_NOTIFY(LVN_KEYDOWN, IDC_LIST_CONTROL, OnKeydownListControl)
  48. ON_NOTIFY(LVN_SETDISPINFO, IDC_LIST_CONTROL, OnSetdispinfoListControl)
  49. ON_NOTIFY(HDN_ITEMCHANGED, IDC_LIST_CONTROL, OnItemchangedListControl)
  50. ON_NOTIFY(HDN_ITEMCHANGING, IDC_LIST_CONTROL, OnItemchangingListControl)
  51. ON_NOTIFY(HDN_TRACK, IDC_LIST_CONTROL, OnTrackListControl)
  52. ON_NOTIFY(HDN_ITEMCLICK, IDC_LIST_CONTROL, OnItemclickListControl)
  53. ON_NOTIFY(HDN_ITEMDBLCLICK, IDC_LIST_CONTROL, OnItemdblclickListControl)
  54. ON_NOTIFY(HDN_BEGINTRACK, IDC_LIST_CONTROL, OnBegintrackListControl)
  55. ON_NOTIFY(HDN_ENDTRACK, IDC_LIST_CONTROL, OnEndtrackListControl)
  56. ON_NOTIFY(HDN_DIVIDERDBLCLICK, IDC_LIST_CONTROL, OnDividerdblclickListControl)
  57. //}}AFX_MSG_MAP
  58. END_MESSAGE_MAP()
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CListControlBar message handlers
  61. //-------------------------------------------------------------------
  62. int CListControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  63. //-------------------------------------------------------------------
  64. {
  65. if (CNGenericDockBar::OnCreate(lpCreateStruct) == -1)
  66. {
  67. return -1;
  68. }
  69. CRect rect;
  70. GetClientRect(&rect);
  71. // create a list box to fill the client area with. Use CreateEx to add the
  72. // WS_EX_CLIENTEDGE style. 
  73. if (!m_ListCtrl.Create (LVS_ALIGNLEFT , rect , this , IDC_LIST_CONTROL))
  74. {
  75. TRACE(_T("Failed to create list Controln"));
  76. return -1;
  77. }
  78. m_ListCtrl.ModifyStyle (0 , WS_BORDER | WS_CHILD | WS_VISIBLE);
  79. m_ListCtrl.ModifyStyleEx (0 , WS_EX_CLIENTEDGE);
  80. return 0;
  81. }
  82. void CListControlBar::OnRButtonUp(UINT nFlags, CPoint point) 
  83. {
  84. // TODO: Add your message handler code here and/or call default
  85. // disable docking.
  86. CNGenericDockBar::OnRButtonUp(nFlags, point);
  87. }
  88. void CListControlBar::OnClickListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  89. {
  90. ClickListControl(pNMHDR);
  91. *pResult = 0;
  92. }
  93. void CListControlBar::ClickListControl(NMHDR* pNMHDR)
  94. {
  95. }
  96. void CListControlBar::OnDblclkListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  97. {
  98. DblclkListControl(pNMHDR);
  99. *pResult = 0;
  100. }
  101. void CListControlBar::DblclkListControl(NMHDR* pNMHDR)
  102. {
  103. }
  104. void CListControlBar::OnKillfocusListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  105. {
  106. KillfocusListControl(pNMHDR);
  107. *pResult = 0;
  108. }
  109. void CListControlBar::KillfocusListControl(NMHDR* pNMHDR)
  110. {
  111. }
  112. void CListControlBar::OnOutofmemoryListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  113. {
  114. OutofmemoryListControl(pNMHDR);
  115. *pResult = 0;
  116. }
  117. void CListControlBar::OutofmemoryListControl(NMHDR* pNMHDR)
  118. {
  119. }
  120. void CListControlBar::OnRclickListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  121. {
  122. RclickListControl(pNMHDR);
  123. *pResult = 0;
  124. }
  125. void CListControlBar::RclickListControl(NMHDR* pNMHDR)
  126. {
  127. }
  128. void CListControlBar::OnRdblclkListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  129. {
  130. RdblclkListControl(pNMHDR);
  131. *pResult = 0;
  132. }
  133. void CListControlBar::RdblclkListControl(NMHDR* pNMHDR)
  134. {
  135. }
  136. void CListControlBar::OnReturnListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  137. {
  138. ReturnListControl(pNMHDR);
  139. *pResult = 0;
  140. }
  141. void CListControlBar::ReturnListControl(NMHDR* pNMHDR)
  142. {
  143. }
  144. void CListControlBar::OnSetfocusListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  145. {
  146. SetfocusListControl(pNMHDR);
  147. *pResult = 0;
  148. }
  149. void CListControlBar::SetfocusListControl(NMHDR* pNMHDR)
  150. {
  151. }
  152. void CListControlBar::OnBegindragListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  153. {
  154. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  155. BegindragListControl(pNMListView);
  156. *pResult = 0;
  157. }
  158. void CListControlBar::BegindragListControl(NM_LISTVIEW* pNMListView)
  159. {
  160. }
  161. void CListControlBar::OnBeginlabeleditListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  162. {
  163. LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
  164. BeginlabeleditListControl(pDispInfo);
  165. *pResult = 0;
  166. }
  167. void CListControlBar::BeginlabeleditListControl(LV_DISPINFO* pDispInfo)
  168. {
  169. }
  170. void CListControlBar::OnBeginrdragListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  171. {
  172. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  173. BeginrdragListControl(pNMListView);
  174. *pResult = 0;
  175. }
  176. void CListControlBar::BeginrdragListControl(NM_LISTVIEW* pNMListView)
  177. {
  178. }
  179. void CListControlBar::OnColumnclickListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  180. {
  181. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  182. ColumnclickListControl(pNMListView);
  183. *pResult = 0;
  184. }
  185. void CListControlBar::ColumnclickListControl(NM_LISTVIEW* pNMListView)
  186. {
  187. }
  188. void CListControlBar::OnDeleteallitemsListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  189. {
  190. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  191. DeleteallitemsListControl(pNMListView);
  192. *pResult = 0;
  193. }
  194. void CListControlBar::DeleteallitemsListControl(NM_LISTVIEW* pNMListView)
  195. {
  196. }
  197. void CListControlBar::OnDeleteitemListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  198. {
  199. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  200. DeleteitemListControl(pNMListView);
  201. *pResult = 0;
  202. }
  203. void CListControlBar::DeleteitemListControl(NM_LISTVIEW* pNMListView)
  204. {
  205. }
  206. void CListControlBar::OnEndlabeleditListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  207. {
  208. LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
  209. EndlabeleditListControl(pDispInfo);
  210. *pResult = 0;
  211. }
  212. void CListControlBar::EndlabeleditListControl(LV_DISPINFO* pDispInfo)
  213. {
  214. }
  215. void CListControlBar::OnGetdispinfoListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  216. {
  217. LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
  218. GetdispinfoListControl(pDispInfo);
  219. *pResult = 0;
  220. }
  221. void CListControlBar::GetdispinfoListControl(LV_DISPINFO* pDispInfo)
  222. {
  223. }
  224. void CListControlBar::OnInsertitemListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  225. {
  226. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  227. InsertitemListControl(pNMListView);
  228. *pResult = 0;
  229. }
  230. void CListControlBar::InsertitemListControl(NM_LISTVIEW* pNMListView)
  231. {
  232. }
  233. void CListControlBar::OnItemchangedListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  234. {
  235. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  236. ItemchangedListControl(pNMListView);
  237. *pResult = 0;
  238. }
  239. void CListControlBar::ItemchangedListControl(NM_LISTVIEW* pNMListView)
  240. {
  241. }
  242. void CListControlBar::OnItemchangingListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  243. {
  244. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  245. ItemchangingListControl(pNMListView);
  246. *pResult = 0;
  247. }
  248. void CListControlBar::ItemchangingListControl(NM_LISTVIEW* pNMListView)
  249. {
  250. }
  251. void CListControlBar::OnKeydownListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  252. {
  253. LV_KEYDOWN* pLVKeyDow = (LV_KEYDOWN*)pNMHDR;
  254. KeydownListControl(pLVKeyDow);
  255. *pResult = 0;
  256. }
  257. void CListControlBar::KeydownListControl(LV_KEYDOWN* pLVKeyDow)
  258. {
  259. }
  260. void CListControlBar::OnSetdispinfoListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  261. {
  262. LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
  263. SetdispinfoListControl(pDispInfo);
  264. *pResult = 0;
  265. }
  266. void CListControlBar::SetdispinfoListControl(LV_DISPINFO* pDispInfo)
  267. {
  268. }
  269. void CListControlBar::OnTrackListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  270. {
  271. HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
  272. TrackListControl(phdn);
  273. *pResult = 0;
  274. }
  275. void CListControlBar::TrackListControl(HD_NOTIFY *phdn)
  276. {
  277. }
  278. void CListControlBar::OnItemclickListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  279. {
  280. HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
  281. ItemclickListControl(phdn);
  282. *pResult = 0;
  283. }
  284. void CListControlBar::ItemclickListControl(HD_NOTIFY *phdn)
  285. {
  286. }
  287. void CListControlBar::OnItemdblclickListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  288. {
  289. HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
  290. ItemdblclickListControl(phdn);
  291. *pResult = 0;
  292. }
  293. void CListControlBar::ItemdblclickListControl(HD_NOTIFY *phdn)
  294. {
  295. }
  296. void CListControlBar::OnBegintrackListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  297. {
  298. HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
  299. BegintrackListControl(phdn);
  300. *pResult = 0;
  301. }
  302. void CListControlBar::BegintrackListControl(HD_NOTIFY *phdn)
  303. {
  304. }
  305. void CListControlBar::OnEndtrackListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  306. {
  307. HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
  308. EndtrackListControl(phdn);
  309. *pResult = 0;
  310. }
  311. void CListControlBar::EndtrackListControl(HD_NOTIFY *phdn)
  312. {
  313. }
  314. void CListControlBar::OnDividerdblclickListControl(NMHDR* pNMHDR, LRESULT* pResult) 
  315. {
  316. HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
  317. DividerdblclickListControl(phdn);
  318. *pResult = 0;
  319. }
  320. void CListControlBar::DividerdblclickListControl(HD_NOTIFY *phdn)
  321. {
  322. }
  323. /*
  324. CSize CListControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
  325. {
  326. DWORD dwMode = LM_STRETCH;
  327. dwMode |= bHorz ? LM_HORZ : 0;
  328. return CalcLayout(dwMode);
  329. }
  330. */