home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / grafik / mgl11 / demo / titlwind.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-09  |  2.3 KB  |  81 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: titlwind.cpp $
  10. * Version:        $Revision: 1.2 $
  11. *
  12. * Language:        C++ 3.0
  13. * Environment:    any
  14. *
  15. * Description:    Member functions for the class TitleWindow, a class
  16. *                providing information about the current demo in progress.
  17. *
  18. * $Id: titlwind.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 "titlwind.hpp"
  27.  
  28. /*----------------------------- Implementation ----------------------------*/
  29.  
  30. TitleWindow::TitleWindow(const TRect& bounds)
  31.     : TDialog(bounds,NULL,wfFramed),
  32.       TWindowInit(TWindow::initFrame,TWindow::initTitleBar)
  33. /****************************************************************************
  34. *
  35. * Function:        TitleWindow::TitleWindow
  36. * Parameters:    bounds        - Bounding box for the window
  37. *
  38. * Description:    Constructor for the TitleWindow class. The window will
  39. *                be placed at the top 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();
  52.     int        borderV = r.top() - bounds.top();
  53.  
  54.     r.bottom() = r.top() + MGL_textHeight();
  55.     title = new TStaticText(r,"",0);
  56.     insert(title);
  57.  
  58.     r.inset(-borderH,-borderV);
  59.     setBounds(r);
  60. }
  61.  
  62. void TitleWindow::handleEvent(TEvent& event,phaseType)
  63. /****************************************************************************
  64. *
  65. * Function:        TitleWindow::handleEvent
  66. * Parameters:    event    - Event to handle
  67. *                phase    - Current phase for the event (pre,focus,post)
  68. *
  69. * Description:    Event handling routine for the TitleWindow class. Here
  70. *                we handle events that change the text in the window.
  71. *
  72. ****************************************************************************/
  73. {
  74.     if (event.what == evBroadcast) {
  75.         if (event.message.command == cmSetDemoTitle) {
  76.             title->setText((const char *)event.message.infoPtr);
  77.             clearEvent(event);
  78.             }
  79.         }
  80. }
  81.