Source code of Windows XP (NT5)
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.

106 lines
3.0 KiB

  1. // ctrltest.cpp : Dialogs and Controls test applet
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1998 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. #include "stdafx.h"
  13. #include "ctrltest.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // Main Window
  16. // The OnTest routines are in the source files containing the particular
  17. // dialog that they are working with. For example OnTestDerivedEdit is
  18. // in file dertest.cpp
  19. BEGIN_MESSAGE_MAP(CTestWindow, CFrameWnd)
  20. //{{AFX_MSG_MAP(CTestWindow)
  21. ON_COMMAND(IDM_TEST_DERIVED_EDIT, OnTestDerivedEdit)
  22. ON_COMMAND(IDM_TEST_WNDCLASS_EDIT, OnTestWndClassEdit)
  23. ON_COMMAND(IDM_TEST_SUB_EDIT, OnTestSubclassedEdit)
  24. ON_COMMAND(IDM_TEST_BITMAP_BUTTON1, OnTestBitmapButton1)
  25. ON_COMMAND(IDM_TEST_BITMAP_BUTTON2, OnTestBitmapButton2)
  26. ON_COMMAND(IDM_TEST_BITMAP_BUTTON3, OnTestBitmapButton3)
  27. ON_COMMAND(IDM_TEST_CUSTOM_LIST, OnTestCustomList)
  28. ON_COMMAND(IDM_TEST_SPIN_EDIT, OnTestSpinEdit)
  29. //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31. void CTestWindow::SetupMenus()
  32. {
  33. if ((GetSystemMetrics(SM_PENWINDOWS)) == NULL)
  34. {
  35. CMenu* pMenu = GetMenu();
  36. ASSERT(pMenu != NULL);
  37. pMenu->EnableMenuItem(IDM_TEST_PENEDIT_CODE, MF_DISABLED|MF_GRAYED);
  38. pMenu->EnableMenuItem(IDM_TEST_PENEDIT_TEMPLATE, MF_DISABLED|MF_GRAYED);
  39. pMenu->EnableMenuItem(IDM_TEST_PENEDIT_FEATURES, MF_DISABLED|MF_GRAYED);
  40. }
  41. // do not test for spin control until the user tries it
  42. // if the custom control DLL is not present, the test spin
  43. // control menu item will be disabled in 'OnTestSpinEdit'.
  44. // custom menu tests
  45. AttachCustomMenu();
  46. }
  47. /////////////////////////////////////////////////////////////////////////////
  48. // Application class
  49. class CTestApp : public CWinApp
  50. {
  51. public:
  52. CTestApp();
  53. virtual BOOL InitInstance();
  54. //{{AFX_MSG(CTestApp)
  55. afx_msg void OnAppAbout();
  56. //}}AFX_MSG
  57. DECLARE_MESSAGE_MAP();
  58. };
  59. CTestApp::CTestApp()
  60. {
  61. // Place all significant initialization in InitInstance
  62. }
  63. BEGIN_MESSAGE_MAP(CTestApp, CWinApp)
  64. //{{AFX_MSG_MAP(CTestApp)
  65. ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  66. //}}AFX_MSG_MAP
  67. END_MESSAGE_MAP()
  68. CTestApp NEAR theTestApp;
  69. BOOL CTestApp::InitInstance()
  70. {
  71. //SetDialogBkColor(); // Gray dialog backgrounds
  72. Enable3dControls();
  73. CTestWindow* pMainWnd = new CTestWindow;
  74. if (!pMainWnd->Create(NULL, _T("Control Test App"),
  75. WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault, NULL,
  76. MAKEINTRESOURCE(AFX_IDI_STD_FRAME)/*menu*/))
  77. return FALSE;
  78. pMainWnd->m_bAutoMenuEnable = FALSE; // do manual menu enabling
  79. pMainWnd->SetupMenus();
  80. pMainWnd->ShowWindow(m_nCmdShow);
  81. m_pMainWnd = pMainWnd; // store in CWinApp member
  82. return TRUE;
  83. }
  84. void CTestApp::OnAppAbout()
  85. {
  86. CDialog(_T("ABOUTBOX")).DoModal();
  87. }
  88. /////////////////////////////////////////////////////////////////////////////