home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / mgl11 / demo / explwind.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-09  |  2.5 KB  |  85 lines

  1. /****************************************************************************
  2. *
  3. *                    Demo - Demonstration Program for the
  4. *                        MegaGraph Graphics Library
  5. *
  6. *                    Copyright (C) 1994 SciTech Software.
  7. *                            All rights reserved.
  8. *
  9. * Filename:        $RCSfile: explwind.cpp $
  10. * Version:        $Revision: 1.2 $
  11. *
  12. * Language:        C++ 3.0
  13. * Environment:    any
  14. *
  15. * Description:    Member functions for the class ExplanationWindow, a class
  16. *                providing information about the current demo in progress.
  17. *
  18. * $Id: explwind.cpp 1.2 1994/03/09 11:29:38 kjb release $
  19. *
  20. ****************************************************************************/
  21.  
  22. #include "demo.hpp"
  23.  
  24. #pragma    hdrstop
  25.  
  26. #include "explwind.hpp"
  27.  
  28. /*----------------------------- Implementation ----------------------------*/
  29.  
  30. ExplanationWindow::ExplanationWindow(const TRect& bounds)
  31.     : TDialog(bounds,NULL,wfFramed),
  32.       TWindowInit(TWindow::initFrame,TWindow::initTitleBar)
  33. /****************************************************************************
  34. *
  35. * Function:        ExplanationWindow::ExplanationWindow
  36. * Parameters:    bounds        - Bounding box for the window
  37. *
  38. * Description:    Constructor for the ExplanationWindow class. The window will
  39. *                be placed at the bottom of the bounding box passed to
  40. *                this routine.
  41. *
  42. ****************************************************************************/
  43. {
  44.     options &= ~(ofSelectable | ofFirstClick);
  45.  
  46.     fontManager.useFont(fmSystemFont);
  47.  
  48.     // Adjust the bounds for the entire window
  49.  
  50.     TRect    r(innerBounds());
  51.     int        borderH = r.left() - bounds.left() + 1;
  52.     int        borderV = r.top() - bounds.top() + 1;
  53.  
  54.     r.inset(1,1);
  55.     r.top() = r.bottom() - MGL_textHeight() * 3;
  56.     r.inset(-borderH,-borderV);
  57.     setBounds(r);
  58.  
  59.     getExtent(r);
  60.     r.inset(borderH,borderV);
  61.  
  62.     explanation = new TMultiLineText(r,"");
  63.     insert(explanation);
  64. }
  65.  
  66. void ExplanationWindow::handleEvent(TEvent& event,phaseType)
  67. /****************************************************************************
  68. *
  69. * Function:        ExplanationWindow::handleEvent
  70. * Parameters:    event    - Event to handle
  71. *                phase    - Current phase for the event (pre,focus,post)
  72. *
  73. * Description:    Event handling routine for the ExplanationWindow class. Here
  74. *                we handle events that change the text in the window.
  75. *
  76. ****************************************************************************/
  77. {
  78.     if (event.what == evBroadcast) {
  79.         if (event.message.command == cmSetExplanation) {
  80.             explanation->setText((const char *)event.message.infoPtr);
  81.             clearEvent(event);
  82.             }
  83.         }
  84. }
  85.