Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

318 lines
4.5 KiB

  1. /*++
  2. Copyright (c) 1994-95 Microsoft Corporation
  3. Module Name:
  4. mainfrm.cpp
  5. Abstract:
  6. Main frame implementation.
  7. Author:
  8. Don Ryan (donryan) 12-Feb-1995
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #include "stdafx.h"
  14. #include "llsmgr.h"
  15. #include "mainfrm.h"
  16. #include "llsdoc.h"
  17. #include "llsview.h"
  18. #include <htmlhelp.h>
  19. #ifdef _DEBUG
  20. #undef THIS_FILE
  21. static char BASED_CODE THIS_FILE[] = __FILE__;
  22. #endif
  23. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  24. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  25. //{{AFX_MSG_MAP(CMainFrame)
  26. ON_WM_CREATE()
  27. ON_COMMAND(ID_HELP_HTMLHELP, OnHtmlHelp)
  28. ON_WM_INITMENUPOPUP()
  29. ON_WM_SETFOCUS()
  30. //}}AFX_MSG_MAP
  31. ON_COMMAND(ID_HELP, OnHtmlHelp)
  32. ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp)
  33. ON_COMMAND(ID_DEFAULT_HELP, OnHtmlHelp)
  34. END_MESSAGE_MAP()
  35. static UINT BASED_CODE buttons[] =
  36. {
  37. ID_SELECT_DOMAIN,
  38. ID_SEPARATOR,
  39. ID_NEW_LICENSE,
  40. ID_SEPARATOR,
  41. ID_VIEW_PROPERTIES,
  42. ID_SEPARATOR,
  43. ID_APP_ABOUT,
  44. };
  45. static UINT BASED_CODE indicators[] =
  46. {
  47. ID_SEPARATOR,
  48. ID_INDICATOR_CAPS,
  49. ID_INDICATOR_NUM,
  50. ID_INDICATOR_SCRL,
  51. };
  52. CMainFrame::CMainFrame()
  53. /*++
  54. Routine Description:
  55. Constructor for main frame window.
  56. Arguments:
  57. None.
  58. Return Values:
  59. None.
  60. --*/
  61. {
  62. //
  63. // Nothing to do here.
  64. //
  65. }
  66. CMainFrame::~CMainFrame()
  67. /*++
  68. Routine Description:
  69. Destructor for main frame window.
  70. Arguments:
  71. None.
  72. Return Values:
  73. None.
  74. --*/
  75. {
  76. //
  77. // Nothing to do here.
  78. //
  79. }
  80. #ifdef _DEBUG
  81. void CMainFrame::AssertValid() const
  82. /*++
  83. Routine Description:
  84. Validates object.
  85. Arguments:
  86. None.
  87. Return Values:
  88. None.
  89. --*/
  90. {
  91. CFrameWnd::AssertValid();
  92. }
  93. #endif // _DEBUG
  94. #ifdef _DEBUG
  95. void CMainFrame::Dump(CDumpContext& dc) const
  96. /*++
  97. Routine Description:
  98. Dump contents of object.
  99. Arguments:
  100. dc - dump context.
  101. Return Values:
  102. None.
  103. --*/
  104. {
  105. CFrameWnd::Dump(dc);
  106. }
  107. #endif // _DEBUG
  108. BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
  109. /*++
  110. Routine Description:
  111. Message handler for WM_COMMAND.
  112. Arguments:
  113. wParam - usual.
  114. lParam - usual.
  115. Return Values:
  116. Depends on message.
  117. --*/
  118. {
  119. if (wParam == ID_APP_STARTUP)
  120. {
  121. theApp.OnAppStartup();
  122. return TRUE; // processed...
  123. }
  124. return CFrameWnd::OnCommand(wParam, lParam);
  125. }
  126. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  127. /*++
  128. Routine Description:
  129. Message handler for WM_CREATE.
  130. Arguments:
  131. lpCreateStruct - contains information about CWnd being constructed.
  132. Return Values:
  133. None.
  134. --*/
  135. {
  136. if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  137. return -1;
  138. if (!m_wndStatusBar.Create(this) ||
  139. !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT)))
  140. return -1;
  141. if (!m_wndToolBar.Create(this) ||
  142. !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  143. !m_wndToolBar.SetButtons(buttons, sizeof(buttons)/sizeof(UINT)))
  144. return -1;
  145. m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  146. EnableDocking(CBRS_ALIGN_ANY);
  147. DockControlBar(&m_wndToolBar);
  148. m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle()|CBRS_TOOLTIPS|CBRS_FLYBY);
  149. return 0;
  150. }
  151. void CMainFrame::OnHtmlHelp()
  152. /*++
  153. Routine Description:
  154. Message handler for ID_HELP_SEARCH.
  155. Arguments:
  156. None.
  157. Return Values:
  158. None.
  159. --*/
  160. {
  161. ::HtmlHelp(m_hWnd, L"liceconcepts.chm", HH_DISPLAY_TOPIC,0);
  162. // theApp.WinHelp((ULONG_PTR)"", HELP_PARTIALKEY); // force search...
  163. }
  164. void CMainFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu)
  165. /*++
  166. Routine Description:
  167. Message handler for WM_INITMENUPOPUP.
  168. Arguments:
  169. pPopupMenu - menu object.
  170. nIndex - menu position.
  171. bSysMenu - true if system menu.
  172. Return Values:
  173. None.
  174. --*/
  175. {
  176. ((CLlsmgrView*)m_pViewActive)->OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
  177. CFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
  178. }
  179. void CMainFrame::OnSetFocus(CWnd* pOldWnd)
  180. /*++
  181. Routine Description:
  182. Handles focus for application.
  183. Arguments:
  184. pOldWnd - window releasing focus.
  185. Return Values:
  186. None.
  187. --*/
  188. {
  189. CFrameWnd::OnSetFocus(pOldWnd);
  190. }