home *** CD-ROM | disk | FTP | other *** search
/ CD Direkt: Spezial 1 / CDD_SPIELE_.ISO / wingames / pyramid / cdialog.cpp < prev    next >
C/C++ Source or Header  |  1993-08-18  |  2KB  |  71 lines

  1. //-------------------------------------------------------------------
  2. //  PROGRAM:            CDIALOG.CPP
  3. //
  4. //  DESCRIPTION:        Multi-purpose dialog
  5. //
  6. //                      Written by Carlos Yu
  7. //
  8. //  NOTE:             The program design is kinda hacked because
  9. //                    this is my first attempt at creating a
  10. //                    fully functional Windows program using
  11. //                    OWL and C++.
  12. //
  13. //                    Any suggestions on making the program better,
  14. //                    specially the DealCards module which is
  15. //                    painfully slow, would be greatly appreciated.
  16. //
  17. //                    Compuserve ID 72672,1567
  18. //-------------------------------------------------------------------
  19.  
  20. #include "cdialog.h"
  21.  
  22. void CDialog::SetupWindow()
  23. {
  24.     TDialog::SetupWindow();
  25.  
  26.     int  dlgHeight,
  27.          dlgWidth,
  28.          winHeight,
  29.          winWidth;
  30.  
  31.     RECT parentWin,
  32.          dialogWin;
  33.  
  34.     GetWindowRect(HWindow, &dialogWin);
  35.     GetWindowRect(parentHandle, &parentWin);
  36.  
  37.     xPos = parentWin.left;
  38.     yPos = parentWin.top;
  39.  
  40.     dlgHeight       = (dialogWin.bottom - dialogWin.top)  / 2;
  41.     dlgWidth        = (dialogWin.right  - dialogWin.left) / 2;
  42.     winHeight       = (parentWin.bottom - parentWin.top)  / 2;
  43.     winWidth        = (parentWin.right  - parentWin.left) / 2;
  44.  
  45.     //----------------------------
  46.     //  Center dialog in parent
  47.     //  window
  48.     //----------------------------
  49.  
  50.     SetWindowPos(HWindow, 0, (winWidth - dlgWidth) + xPos,
  51.         (winHeight - dlgHeight) + yPos, dlgWidth * 2,
  52.         dlgHeight * 2, SWP_NOSIZE);
  53. }
  54.  
  55. void CDialog::InfoChosen(RTMessage)
  56. {
  57.     GetApplication()->ExecDialog(new CDialog(this, INFODIALOG));
  58. }
  59.  
  60. void CDialog::YesChosen(RTMessage)
  61. {
  62.     CloseWindow(1);
  63. }
  64.  
  65.  
  66. void CDialog::NoChosen(RTMessage)
  67. {
  68.     CloseWindow(0);
  69. }
  70.  
  71.