MainFrm.cpp
上传用户:wlkj888
上传日期:2022-08-01
资源大小:806k
文件大小:9k
源码类别:

对话框与窗口

开发平台:

Visual C++

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. #include "stdafx.h"
  4. #include "OutlookDemo.h"
  5. #include "resource.h"
  6. #include "MainFrm.h"
  7. #include "GOut.h"
  8. #include "Cajon.h"
  9. #include "GuiDrawLayer.h"
  10. #include "GuiToolButton.h"
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16. #define IDT_BACK 5555
  17. #define IDT_FORW 5556
  18. #define IDT_GO  5557 
  19. #define IDT_DEL  5558
  20. #define IDT_UNDO 5559
  21. #define IDT_STANDAR 5560
  22. #define ID_VIEWCAPTION 5000
  23. #define IDO_OUTODAY    5600
  24. #define IDO_CALENDARIO 5601
  25. #define IDO_CONTACTO   5602
  26. #define IDO_TAREAS     5603
  27. #define IDO_NOTAS    5604
  28. #define IDO_ELIMINAR   5605
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CMainFrame
  31. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  32. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  33. //{{AFX_MSG_MAP(CMainFrame)
  34. ON_WM_CREATE()
  35. ON_WM_SYSCOLORCHANGE()
  36. ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
  37. ON_COMMAND(ID_EDIT_PASTE, OnEditPaste)
  38. ON_COMMAND(ID_EDIT_CUT, OnEditCut)
  39. ON_COMMAND(IDT_BACK,OnBack)
  40. ON_COMMAND(ID_2003, On2003)
  41. ON_COMMAND(ID_XP, OnXP)
  42. //}}AFX_MSG_MAP
  43. ON_COMMAND(IDO_OUTODAY,  OnToday)
  44. ON_COMMAND(IDO_CALENDARIO, OnCalendario)
  45. ON_COMMAND(IDO_CONTACTO, OnContacto)
  46. ON_COMMAND(IDO_TAREAS, OnTareas)
  47. ON_COMMAND(IDO_NOTAS, OnNotas)
  48. ON_COMMAND(IDO_ELIMINAR, OnEliminar)
  49. END_MESSAGE_MAP()
  50. static UINT indicators[] =
  51. {
  52. ID_SEPARATOR,           // status line indicator
  53. ID_INDICATOR_CAPS,
  54. ID_INDICATOR_NUM,
  55. ID_INDICATOR_SCRL,
  56. };
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CMainFrame construction/destruction
  59. void CMainFrame::OnBack()
  60. {
  61. AfxMessageBox("Back");
  62. }
  63. void CMainFrame::OnToday()
  64. {
  65. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  66. pBtn->SetCaption("OutLook Today");
  67. pBtn->SetToolTip("OutLook Today");
  68. pBtn->SethIcon(m_guiMiniToolLeft.GetImagIcon(0));
  69. m_guiMiniToolLeft.RecalLayout();
  70. }
  71. void CMainFrame::OnCalendario()
  72. {
  73. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  74. pBtn->SetCaption("Calendario");
  75. pBtn->SetToolTip("Calendario");
  76. pBtn->SethIcon(m_guiMiniToolLeft.GetImagIcon(1));
  77. m_guiMiniToolLeft.RecalLayout();
  78. }
  79. void CMainFrame::OnContacto()
  80. {
  81. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  82. pBtn->SetCaption("Contacto");
  83. pBtn->SetToolTip("Contacto");
  84. pBtn->SethIcon(m_guiMiniToolLeft.GetImagIcon(2));
  85. m_guiMiniToolLeft.RecalLayout();
  86. }
  87. void CMainFrame::OnTareas()
  88. {
  89. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  90. pBtn->SetCaption("Tareas");
  91. pBtn->SetToolTip("Tareas");
  92. pBtn->SethIcon(m_guiMiniToolLeft.GetImagIcon(3));
  93. m_guiMiniToolLeft.RecalLayout();
  94. }
  95. void CMainFrame::OnNotas()
  96. {
  97. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  98. pBtn->SetCaption("Notas");
  99. pBtn->SetToolTip("Notas");
  100. pBtn->SethIcon(m_guiMiniToolLeft.GetImagIcon(4));
  101. m_guiMiniToolLeft.RecalLayout();
  102. }
  103. void CMainFrame::OnEliminar()
  104. {
  105. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  106. pBtn->SetCaption("Eliminar");
  107. pBtn->SetToolTip("Eliminar");
  108. pBtn->SethIcon(m_guiMiniToolLeft.GetImagIcon(15));
  109. m_guiMiniToolLeft.RecalLayout();
  110. }
  111. CMainFrame::CMainFrame()
  112. {
  113. // TODO: add member initialization code here
  114. }
  115. CMainFrame::~CMainFrame()
  116. {
  117. }
  118. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  119. {
  120. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  121. return -1;
  122. InitMenu(IDR_MAINFRAME);
  123. InitToolBar(IDR_MAINFRAME);
  124. InitStatusBar(indicators,sizeof(indicators)/sizeof(UINT));
  125. EnableDocking(CBRS_ALIGN_ANY);
  126. // m_wndToolBar.SetTextButton(0,"&New"); 
  127. // m_wndToolBar.SetTextButton(1,"&Send/Receiver"); 
  128. m_wndMenuBar.EnableDocking(CBRS_ALIGN_ANY);
  129. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  130. DockControlBar(&m_wndMenuBar,m_dockTop);
  131. DockControlBar(&m_wndToolBar,m_dockTop);
  132. // TODO: Delete these three lines if you don't want the toolbar to
  133. //  be dockable
  134. if (!m_CapOutBar.Create (WS_CHILD | WS_VISIBLE , 
  135. this,ID_VIEWCAPTION))
  136. {
  137. TRACE0("Failed to create caption barn");
  138. return FALSE;
  139. }
  140. if (!m_CapOutBar.SetSplitter(&m_MiniSplitter))
  141. return FALSE;
  142. m_MiniSplitter.AddMiniToolLeft(&m_guiMiniToolLeft);
  143. m_MiniSplitter.AddMiniToolRight(&m_guiMiniToolRight);
  144. m_guiMiniToolLeft.SetImageList(IDB_BITMAP2,16,11,RGB (255, 0, 0));
  145. m_guiMiniToolRight.SetImageList(IDB_BITMAP2,16,11,RGB (255, 0, 0));
  146. //Left MiniTool 
  147. m_guiMiniToolLeft.AddButton(11,IDT_BACK,NULL,"Back ","Back");
  148. m_guiMiniToolLeft.AddButton(12,IDT_FORW,NULL,"Forward","Forward");
  149. m_guiMiniToolLeft.AddButton(0,IDT_STANDAR,NULL,"OutLook Today","OutLook Today");
  150. CGuiToolButton* pBtn=m_guiMiniToolLeft.GetButton(IDT_STANDAR);
  151. pBtn->SetFontColor(RGB(0,0,0));
  152. //Right MiniTool
  153. m_guiMiniToolRight.CreateCombo(&m_cb,333,100);
  154. m_guiMiniToolRight.AddButton(13,IDT_GO,NULL,"Go  ","Go  ");
  155. m_guiMiniToolRight.AddButton(15,IDT_UNDO,NULL,"Undo  ","Undo  ");
  156. //m_MiniSplitter.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style),GuiDrawLayer::GetRGBColorBTNHigh());
  157. m_guiMiniToolRight.SetCaption("&Direccion:",CGuiMiniTool::ALIGN_LEFT);
  158. m_guiMiniToolRight.SetColorCaption(GuiDrawLayer::GetRGBColorBTNHigh());
  159. m_guiMiniToolRight.AutoSize(TRUE);
  160. m_cb.AddString("outlook:Tareas");
  161. m_cb.AddString("outlook:Notas");
  162. m_cb.AddString("Toolbar Combobox item four");
  163. m_cb.AddString("Toolbar Combobox item five");
  164. m_cb.AddString("Toolbar Combobox item six");
  165. m_guiMiniToolLeft.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
  166. m_guiMiniToolRight.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
  167. m_cb.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
  168. // On2003();
  169. sProfile = _T("DevOutLook");
  170. //LoadBars();
  171. //active las las siguientes lineas para ver la etiqueta a la derecha
  172. //m_guiMiniToolLeft.SetCaption("Fecha del dia de hoy",CGuiMiniTool::ALIGN_RIGHT);
  173. //m_guiMiniToolLeft.SetColorCaption(GuiDrawLayer::GetRGBColorBTNHigh());
  174. return 0;
  175. }
  176. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  177. {
  178. if( !CFrameWnd::PreCreateWindow(cs) )
  179. return FALSE;
  180. // TODO: Modify the Window class or styles here by modifying
  181. //  the CREATESTRUCT cs
  182. return TRUE;
  183. }
  184. /////////////////////////////////////////////////////////////////////////////
  185. // CMainFrame diagnostics
  186. #ifdef _DEBUG
  187. void CMainFrame::AssertValid() const
  188. {
  189. CFrameWnd::AssertValid();
  190. }
  191. void CMainFrame::Dump(CDumpContext& dc) const
  192. {
  193. CFrameWnd::Dump(dc);
  194. }
  195. #endif //_DEBUG
  196. /////////////////////////////////////////////////////////////////////////////
  197. // CMainFrame message handlers
  198. BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
  199. {
  200. // TODO: Add your specialized code here and/or call the base class
  201. if (!m_wndSplitter.CreateStatic(this, 1, 2))
  202. {
  203. TRACE0("Failed to create splitter windown");
  204. return FALSE;
  205. }
  206. // Outlook bar view.
  207. if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CGOut),
  208. CSize(150, 0), pContext))
  209. {
  210. TRACE0("Failed to create CGOutn"); 
  211. return FALSE;
  212. }
  213. if (!m_wndSplitter.CreateView(0,1, RUNTIME_CLASS(CCajon),
  214. CSize(90, 0), pContext))
  215. {
  216. TRACE0("Failed to create CGOutn"); 
  217. return FALSE;
  218. }
  219. return TRUE; //CFrameWnd::OnCreateClient(lpcs, pContext);
  220. }
  221. void CMainFrame::OnSysColorChange() 
  222. {
  223. CFrameWnd::OnSysColorChange();
  224. GuiDrawLayer::IsThemeXP();
  225. m_MiniSplitter.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style),GuiDrawLayer::GetRGBColorBTNHigh());
  226. m_guiMiniToolLeft.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
  227. m_guiMiniToolRight.SetColor(GuiDrawLayer::GetRGBColorShadow(GuiDrawLayer::m_Style));
  228. }
  229. void CMainFrame::OnEditCut()
  230. {
  231. // TODO: Add your command handler code here
  232. }
  233. void CMainFrame::OnEditCopy() 
  234. {
  235. // TODO: Add your command handler code here
  236. }
  237. void CMainFrame::OnEditPaste() 
  238. {
  239. // TODO: Add your command handler code here
  240. }
  241. void CMainFrame::On2003()
  242. {
  243. GuiDrawLayer::m_Style=GUISTYLE_2003;
  244. StyleDispl(GUISTYLE_2003);
  245. m_guiMiniToolLeft.StyleDispl(GUISTYLE_2003);
  246. m_guiMiniToolRight.StyleDispl(GUISTYLE_2003);
  247. m_CapOutBar.StyleDispl(GUISTYLE_2003);
  248. m_wndSplitter.StyleDispl(GUISTYLE_2003);
  249. CGOut* pWnd =(CGOut*)m_wndSplitter.GetPane(0, 0);
  250. pWnd->out.StyleDispl(GUISTYLE_2003);
  251. pWnd->cf.StyleDispl(GUISTYLE_2003);
  252. }
  253. void CMainFrame::OnXP()
  254. {
  255. GuiDrawLayer::m_Style=GUISTYLE_XP;
  256. StyleDispl(GUISTYLE_XP);
  257. m_guiMiniToolLeft.StyleDispl(GUISTYLE_XP);
  258. m_guiMiniToolRight.StyleDispl(GUISTYLE_XP);
  259. m_CapOutBar.StyleDispl(GUISTYLE_XP);
  260. m_wndSplitter.StyleDispl(GUISTYLE_XP);
  261. CGOut* pWnd =(CGOut*)m_wndSplitter.GetPane(0, 0);
  262. pWnd->out.StyleDispl(GUISTYLE_XP);
  263. pWnd->cf.StyleDispl(GUISTYLE_XP);
  264. }