home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / BORLAND TURBO / DYNAMN.PAK / COLOROPT.CPP next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  4.7 KB  |  156 lines

  1. // coloropt.cpp
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 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. //
  13. // Purpose: implementation of the CColorOptDlg class
  14. //
  15. // Functions:
  16. //      Most of this file was generated by AppWizard.  The functions
  17. //      which contain code specific to this sample are:
  18. //
  19. //      CColorOptDlg::CColorOptDlg()         -- dialog constructor
  20. //      CColorOptDlg::DoDataExchange()       -- connect data to controls
  21. //      CColorOptDlg::OnInitDialog()         -- initialize dialog
  22.  
  23. #include "stdafx.h"
  24. #include "dynamenu.h"
  25. #include "coloropt.h"
  26. #include "dmdoc.h"    // for CDynaMenuDoc class
  27.  
  28. #ifdef _DEBUG
  29. #undef THIS_FILE
  30. static char BASED_CODE THIS_FILE[] = __FILE__;
  31. #endif
  32.  
  33. /////////////////////////////////////////////////////////////////////////////
  34. // CColorOptDlg dialog
  35.  
  36.  
  37. //***********************************************************************
  38. // Function: CColorOptDlg::CColorOptDlg()
  39. //
  40. // Purpose:
  41. //    This is the constructor for the color options dialog class.
  42. //
  43. // Parameters:
  44. //    pDoc    -- pointer to the CDynaMenuDoc with the data we want to
  45. //               update
  46. //    pParent -- pointer to parent window for dialog
  47. //
  48. // Returns:
  49. //    none
  50. //
  51. // Comments:
  52. //    none
  53. //
  54. // History:
  55. //
  56. //   Date   Comment                                           Initials
  57. // ======== ================================================= ========
  58. // 03/24/94 Created                                             MIK
  59. //
  60. //***********************************************************************
  61. CColorOptDlg::CColorOptDlg(CDynaMenuDoc* pDoc, CWnd* pParent /*=NULL*/)
  62.     : CDialog(CColorOptDlg::IDD, pParent)
  63. {
  64.     //{{AFX_DATA_INIT(CColorOptDlg)
  65.         // NOTE: the ClassWizard will add member initialization here
  66.     //}}AFX_DATA_INIT
  67.  
  68.     m_pDoc = pDoc;
  69. }
  70.  
  71. //***********************************************************************
  72. // Function: CColorOptDlg::DoDataExchange()
  73. //
  74. // Purpose:
  75. //    DoDataExchange is called by the framework to initialize the
  76. //    dialog's control, or to retrieve data from the dialog.
  77. //
  78. //    Instead of using ClassWizard to generate the DDX calls, we
  79. //    add our own, so that we can loop over an array.
  80. //
  81. // Parameters:
  82. //    pDX -- pointer to a CDataExchange object
  83. //
  84. // Returns:
  85. //    none
  86. //
  87. // Comments:
  88. //    see CWnd::DoDataExchange documentation for further information.
  89. //
  90. // History:
  91. //
  92. //   Date   Comment                                           Initials
  93. // ======== ================================================= ========
  94. // 03/24/94 Created                                             MIK
  95. //
  96. //***********************************************************************
  97. void CColorOptDlg::DoDataExchange(CDataExchange* pDX)
  98. {
  99.     CDialog::DoDataExchange(pDX);
  100.     //{{AFX_DATA_MAP(CColorOptDlg)
  101.         // NOTE: the ClassWizard will add DDX and DDV calls here
  102.     //}}AFX_DATA_MAP
  103.  
  104.     for (int i = 0; i < NUM_TEXTCOLOR; i++)
  105.         DDX_Check(pDX, IDC_COLOR1 + i, m_pDoc->m_abAllowColor[i]);
  106. }
  107.  
  108. BEGIN_MESSAGE_MAP(CColorOptDlg, CDialog)
  109.     //{{AFX_MSG_MAP(CColorOptDlg)
  110.         // NOTE: the ClassWizard will add message map macros here
  111.     //}}AFX_MSG_MAP
  112. END_MESSAGE_MAP()
  113.  
  114.  
  115. /////////////////////////////////////////////////////////////////////////////
  116. // CColorOptDlg message handlers
  117.  
  118. //***********************************************************************
  119. // Function: CColorOptDlg::OnInitDialog()
  120. //
  121. // Purpose:
  122. //    OnInitDialog is called by the framework in response to a
  123. //    WM_INITDIALOG message.  It allows us to initialize a dialog
  124. //    before it is displayed.
  125. //
  126. //    We set the text of the dialog's checkbox controls using the
  127. //    strings defined in the color definitions, CDynaMenuDoc::m_aColorDef.
  128. //
  129. // Parameters:
  130. //    none
  131. //
  132. // Returns:
  133. //    nonzero to have Windows set input focus, 0 if focus explicitly set
  134. //
  135. // Comments:
  136. //    see CDialog::OnInitDialog documentation for further information.
  137. //
  138. //***********************************************************************
  139. BOOL CColorOptDlg::OnInitDialog()
  140. {
  141.     // set the text of each color checkbox
  142.     for (int i = 0; i < NUM_TEXTCOLOR; i++)
  143.     {
  144.         CWnd* pCtl = GetDlgItem(i + IDC_COLOR1);
  145.         CString strColor;
  146.         strColor.LoadString(CDynaMenuDoc::m_aColorDef[i].m_nString);
  147.         pCtl->SetWindowText(strColor);
  148.     }
  149.  
  150.     // center the dialog window
  151.     CenterWindow();
  152.  
  153.     // do the default processing (including DDX)
  154.     return CDialog::OnInitDialog();
  155. }
  156.