MyToolBar.cpp 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. #include "stdafx.h"
  2. #include "MyToolBar.h"
  3. #include "YLGL.h"
  4. #ifdef _DEBUG
  5. #define new DEBUG_NEW
  6. #undef THIS_FILE
  7. static char THIS_FILE[] = __FILE__;
  8. #endif
  9. /////////////////////////////////////////////////////////////////////////////
  10. // MyToolBar
  11. MyToolBar::MyToolBar()
  12. {
  13. }
  14. MyToolBar::~MyToolBar()
  15. {
  16. }
  17. BEGIN_MESSAGE_MAP(MyToolBar, CToolBar)
  18. //{{AFX_MSG_MAP(MyToolBar)
  19. //}}AFX_MSG_MAP
  20. ON_MESSAGE(XTWM_OUTBAR_NOTIFY, OnOutbarNotify)
  21. END_MESSAGE_MAP()
  22. /////////////////////////////////////////////////////////////////////////////
  23. // MyToolBar message handlers
  24. void MyToolBar::Init()
  25. {
  26. CRect rc=g_rc;
  27. rc.right -=rc.left ;
  28. rc.bottom -=rc.top ;
  29. rc.left =rc.top =0;
  30. rc.right =rc.left +157;
  31. rc.bottom =rc.top+g_rc.Height()-53;
  32. if (!m_wndOutlookBar.Create(WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN, rc,this, 0, OBS_XT_DEFAULT))
  33. {
  34. TRACE0("Failed to create outlook bar.");
  35. return;
  36. }
  37. // Set the background and text color of the outlook bar.
  38. m_wndOutlookBar.SetBackColor(RGB(0x3a,0x6e,0xa5));
  39. m_wndOutlookBar.SetTextColor(RGB(0xff,0xff,0xff));
  40. // Add items to the outlook bar.
  41. InitializeOutlookBar();
  42. }
  43. static UINT nIcons[] =
  44. {
  45. IDI_ICON1, IDI_ICON3, IDI_ICON4, IDI_ICON7,
  46. IDI_ICON8, IDI_ICON2, IDI_ICON11, IDI_ICON6,
  47. IDI_ICON9, IDI_ICON10, IDI_ICON5
  48. };
  49. void MyToolBar::InitializeOutlookBar()
  50. {
  51. // Create the image lists used by the outlook bar.
  52. m_ImageSmall.Create (16, 16, ILC_COLOR16|ILC_MASK, 2, 1);
  53. m_ImageLarge.Create (32, 32, ILC_COLOR16|ILC_MASK, 2, 1);
  54. // initiailize the image lists.
  55. for (int i = 0; i < 11; ++i)
  56. {
  57. HICON hIcon = AfxGetApp()->LoadIcon(nIcons[i]);
  58. ASSERT(hIcon);
  59. m_ImageSmall.Add(hIcon);
  60. m_ImageLarge.Add(hIcon);
  61. }
  62. int iFolder; // index of the added folder
  63. // set the image lists for the outlook bar.
  64. m_wndOutlookBar.SetImageList(&m_ImageLarge, OBS_XT_LARGEICON);
  65. m_wndOutlookBar.SetImageList(&m_ImageSmall, OBS_XT_SMALLICON);
  66. // Add the first folder to the outlook bar.
  67. iFolder = m_wndOutlookBar.AddFolder(_T("门市流程"), 0);
  68. // Add items to the folder, syntax is folder, index, text, image, and item data.
  69. m_wndOutlookBar.InsertItem(iFolder, 1, _T("预约"), 0, NULL);
  70. m_wndOutlookBar.InsertItem(iFolder, 2, _T("拍照"), 1, NULL);
  71. // m_wndOutlookBar.InsertItem(iFolder, 3, _T("修片"), 2, NULL);
  72. // m_wndOutlookBar.InsertItem(iFolder, 4, _T("选片"), 3, NULL);
  73. // m_wndOutlookBar.InsertItem(iFolder, 5, _T("精修"), 4, NULL);
  74. // m_wndOutlookBar.InsertItem(iFolder, 6, _T("设计"), 5, NULL);
  75. // m_wndOutlookBar.InsertItem(iFolder, 7, _T("刻盘"), 6, NULL);
  76. // m_wndOutlookBar.InsertItem(iFolder, 8, _T("发片/取件"), 7, NULL);
  77. // Add the second folder to the outlook bar.
  78. iFolder = m_wndOutlookBar.AddFolder(_T("财务管理"), 1);
  79. // Add items to the folder, syntax is folder, index, text, image, and item data.
  80. m_wndOutlookBar.InsertItem(iFolder, 1, _T("订单收款"), 0, NULL);
  81. m_wndOutlookBar.InsertItem(iFolder, 2, _T("现金支出"), 1, NULL);
  82. m_wndOutlookBar.InsertItem(iFolder, 3, _T("其它收入"), 0, NULL);
  83. m_wndOutlookBar.InsertItem(iFolder, 4, _T("日财务表"), 3, NULL);
  84. m_wndOutlookBar.InsertItem(iFolder, 5, _T("工资管理"), 4, NULL);
  85. m_wndOutlookBar.InsertItem(iFolder, 6, _T("客人付款"), 5, NULL);
  86. iFolder = m_wndOutlookBar.AddFolder(_T("统计查询"), 2);
  87. // Add items to the folder, syntax is folder, index, text, image, and item data.
  88. m_wndOutlookBar.InsertItem(iFolder, 1, _T("日财务表"), 0, NULL);
  89. m_wndOutlookBar.InsertItem(iFolder, 2, _T("月财务表"), 1, NULL);
  90. m_wndOutlookBar.InsertItem(iFolder, 3, _T("年财务表"), 2, NULL);
  91. m_wndOutlookBar.InsertItem(iFolder, 4, _T("年财务图表"), 3, NULL);
  92. m_wndOutlookBar.InsertItem(iFolder, 5, _T("工资报表"), 4, NULL);
  93. m_wndOutlookBar.InsertItem(iFolder, 6, _T("员工业绩"), 5, NULL);
  94. // iFolder = m_wndOutlookBar.AddFolder(_T("短信群发"), 3);
  95. iFolder = m_wndOutlookBar.AddFolder(_T("短信管理"), 3); // 2014.05.19 Jeff
  96. // Add items to the folder, syntax is folder, index, text, image, and item data.
  97. m_wndOutlookBar.InsertItem(iFolder, 1, _T("短信群发"), 0, NULL);
  98. m_wndOutlookBar.InsertItem(iFolder, 2, _T("短信发送"), 1, NULL);
  99. m_wndOutlookBar.InsertItem(iFolder, 3, _T("员工短信"), 2, NULL);
  100. m_wndOutlookBar.InsertItem(iFolder, 4, _T("发送记录"), 3, NULL);
  101. m_wndOutlookBar.InsertItem(iFolder, 5, _T("短信设置"), 4, NULL);
  102. iFolder = m_wndOutlookBar.AddFolder(_T("会员管理"), 4);
  103. // Add items to the folder, syntax is folder, index, text, image, and item data.
  104. m_wndOutlookBar.InsertItem(iFolder, 1, _T("查看会员"), 0, NULL);
  105. m_wndOutlookBar.InsertItem(iFolder, 2, _T("积分设置"), 1, NULL);
  106. iFolder = m_wndOutlookBar.AddFolder(_T("礼服管理"), 5);
  107. // Add items to the folder, syntax is folder, index, text, image, and item data.
  108. m_wndOutlookBar.InsertItem(iFolder, 1, _T("礼服录入"), 0, NULL);
  109. m_wndOutlookBar.InsertItem(iFolder, 2, _T("礼服查看"), 1, NULL);
  110. m_wndOutlookBar.InsertItem(iFolder, 3, _T("图片欣赏"), 2, NULL);
  111. m_wndOutlookBar.InsertItem(iFolder, 4, _T("礼服出租"), 3, NULL);
  112. iFolder = m_wndOutlookBar.AddFolder(_T("库存管理"), 6);
  113. // Add items to the folder, syntax is folder, index, text, image, and item data.
  114. m_wndOutlookBar.InsertItem(iFolder, 1, _T("商品类别设置"), 0, NULL);
  115. m_wndOutlookBar.InsertItem(iFolder, 2, _T("商品名称设置"), 1, NULL);
  116. m_wndOutlookBar.InsertItem(iFolder, 3, _T("入库单"), 2, NULL);
  117. m_wndOutlookBar.InsertItem(iFolder, 4, _T("出库单"), 3, NULL);
  118. m_wndOutlookBar.InsertItem(iFolder, 5, _T("库存查询"), 4, NULL);
  119. m_wndOutlookBar.SetOwner(this);
  120. // Select the first folder in the bar.
  121. m_wndOutlookBar.SetSelFolder(0);
  122. }
  123. LRESULT MyToolBar::OnOutbarNotify(WPARAM wParam, LPARAM lParam)
  124. {
  125. int nBarAction = (int)wParam;
  126. // Cast the lParam to a XT_OUTBAR_INFO* struct pointer.
  127. XT_OUTBAR_INFO* pOBInfo = (XT_OUTBAR_INFO*)lParam;
  128. ASSERT(pOBInfo);
  129. switch (nBarAction)
  130. {
  131. case OBN_XT_ITEMCLICK:
  132. {
  133. CString strMsg=pOBInfo->lpszText;
  134. g_pMainWnd->OnOutbarNotify (strMsg);
  135. }
  136. break;
  137. }
  138. return TRUE;
  139. }
  140. void MyToolBar::SetSelFolder(int pos)
  141. {
  142. m_wndOutlookBar.SetSelFolder(pos);
  143. }
  144. BOOL MyToolBar::OnEraseBkgnd(CDC* pDC)
  145. {
  146. return 1;
  147. // TODO: Add your message handler code here and/or call default
  148. CRect rect;
  149. CBrush *pnewBrush=new CBrush(RGB(225,0,0));//(RGB(198,186,156));
  150. GetClientRect(&rect);
  151. pDC->FillRect (&rect,pnewBrush);
  152. delete pnewBrush;
  153. return 1;
  154. }