home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 11.ddi / MFC / SAMPLES / CTRLTEST / CTRLTEST.H$ / ctrltest
Encoding:
Text File  |  1992-03-16  |  4.8 KB  |  161 lines

  1. // ctrltest.h : main window class interface
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 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 Microsoft
  9. // QuickHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14. #ifndef RC_INVOKED
  15. #include <afxwin.h>
  16. #else
  17. #include <windows.h>
  18. #include <afxres.h>
  19. #endif
  20.  
  21. /////////////////////////////////////////////////////////////////////////////
  22.  
  23. /////////////////////////////////
  24. // Menu command IDs
  25.  
  26. #define IDM_EXIT                    100
  27. #define IDM_ABOUT                   101
  28.  
  29. // Simple tests
  30. #define IDM_TEST_DERIVED_EDIT       200
  31. #define IDM_TEST_WNDCLASS_EDIT      201
  32. #define IDM_TEST_SUB_EDIT           202
  33.  
  34. // Pen edit tests
  35. #define IDM_TEST_PENEDIT_CODE       300
  36. #define IDM_TEST_PENEDIT_TEMPLATE   301
  37. #define IDM_TEST_PENEDIT_FEATURES   302
  38.  
  39. // custom control tests
  40. #define IDM_TEST_BITMAP_BUTTON1     400
  41. #define IDM_TEST_BITMAP_BUTTON2     401
  42. #define IDM_TEST_CUSTOM_MENU        402
  43. #define IDM_TEST_CUSTOM_LIST        403
  44. #define IDM_TEST_SPIN_EDIT          404
  45.  
  46. // custom menu test - menu ids: BASE + RGB bits : 8 colors max
  47.  
  48. #define IDM_COLOR_FIRST             500
  49. #define IDM_COLOR_BLACK             (IDM_COLOR_FIRST + 0)
  50. #define IDM_COLOR_BLUE              (IDM_COLOR_FIRST + 1)
  51. #define IDM_COLOR_GREEN             (IDM_COLOR_FIRST + 2)
  52. #define IDM_COLOR_CYAN              (IDM_COLOR_FIRST + 3)
  53. #define IDM_COLOR_RED               (IDM_COLOR_FIRST + 4)
  54. #define IDM_COLOR_MAGENTA           (IDM_COLOR_FIRST + 5)
  55. #define IDM_COLOR_YELLOW            (IDM_COLOR_FIRST + 6)
  56. #define IDM_COLOR_WHITE             (IDM_COLOR_FIRST + 7)
  57.  
  58. #define IDM_COLOR_LAST              (IDM_COLOR_FIRST + 7)
  59.  
  60. /////////////////////////////////
  61. // Dialog IDs are same as related menu commands
  62.  
  63. #define IDD_ABOUT                   IDM_ABOUT
  64. #define IDD_DERIVED_EDIT            IDM_TEST_DERIVED_EDIT
  65. #define IDD_WNDCLASS_EDIT           IDM_TEST_WNDCLASS_EDIT
  66. #define IDD_SUB_EDIT                IDM_TEST_SUB_EDIT
  67. #define IDD_SUB_PENEDIT             IDM_TEST_PENEDIT_TEMPLATE
  68. #define IDD_PENEDIT_FEATURES        IDM_TEST_PENEDIT_FEATURES
  69. #define IDD_SPIN_EDIT               IDM_TEST_SPIN_EDIT
  70. #define IDD_CUSTOM_LIST             IDM_TEST_CUSTOM_LIST
  71.  
  72. /////////////////////////////////
  73. // Specific control commands and dialogs
  74. // other special IDs for controls and dialogs
  75.  
  76. // configure local pen edit
  77. #define IDC_CONFIGURE               1000
  78. #define IDD_PENEDIT_CONFIGURE       IDC_CONFIGURE
  79. #define IDC_LEFTHANDED              1001
  80.  
  81. // ALC configuration
  82. #define IDC_ALC_FIRST               1100
  83. #define IDC_ALC_LAST                (IDC_ALC_MIN + 31) // at most 32 bits
  84.  
  85. /////////////////////////////////
  86. // other general control IDs
  87.  
  88. #define IDC_EDIT1       2101
  89. #define IDC_EDIT2       2102
  90. #define IDC_EDIT3       2103
  91. #define IDC_EDIT4       2104
  92.  
  93. #define IDC_BUTTON1     2201
  94. #define IDC_BUTTON2     2202
  95. #define IDC_BUTTON3     2203
  96. #define IDC_BUTTON4     2204
  97.  
  98. #define IDC_LISTBOX1    2301
  99.  
  100. /////////////////////////////////////////////////////////////////////////////
  101. // ColorMenu - used for custom menu test
  102. //   included here to show how it should be embedded as a member of the
  103. //    main frame window that uses it
  104.  
  105. class CColorMenu : public CMenu
  106. {
  107. public:
  108. // Operations
  109.     void AppendColorMenuItem(UINT nID, COLORREF color);
  110.  
  111. // Implementation
  112.     virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);
  113.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  114.     CColorMenu();
  115.     virtual ~CColorMenu();
  116. };
  117.  
  118. /////////////////////////////////////////////////////////////////////////////
  119. // Main Window
  120. //   used as the context for running all the tests
  121.  
  122. class CTestWindow : public CFrameWnd
  123. public:
  124.     // construction helpers
  125.     void SetupMenus();
  126.  
  127. protected:
  128.     // command handlers
  129.     afx_msg void OnExit();
  130.     afx_msg void OnAbout();
  131.  
  132.     // simple tests
  133.     afx_msg void OnTestDerivedEdit();
  134.     afx_msg void OnTestWndClassEdit();
  135.     afx_msg void OnTestSubclassedEdit();
  136.  
  137.     // pen tests
  138.     afx_msg void OnTestPenEditFromCode();
  139.     afx_msg void OnTestPenEditFromTemplate();
  140.     afx_msg void OnTestPenEditFeatures();
  141.  
  142.     // custom control tests
  143.     afx_msg void OnTestBitmapButton1();
  144.     afx_msg void OnTestBitmapButton2();
  145.     afx_msg void OnTestCustomList();
  146.     afx_msg void OnTestSpinEdit();
  147.  
  148.     // custom menu tests
  149.     void AttachCustomMenu();
  150.     CColorMenu  m_colorMenu;
  151.     virtual BOOL OnCommand(UINT wParam, LONG lParam);
  152.  
  153. // Implementation
  154.     virtual void PostNcDestroy();
  155.     DECLARE_MESSAGE_MAP()
  156. };
  157.  
  158. /////////////////////////////////////////////////////////////////////////////
  159.  
  160.