home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / smarts / ioc / prodinfo.cpp < prev    next >
Encoding:
Text File  |  1996-02-21  |  4.4 KB  |  117 lines

  1. --------------------------------------------------------------------------------
  2. --
  3. -- COPYRIGHT:
  4. --   IBM WorkFrame - Project Smarts
  5. --   (C) Copyright International Business Machines Corporation 1996
  6. --   Licensed Material - Program-Property of IBM - All Rights Reserved.
  7. --   US Government Users Restricted Rights - Use, duplication, or disclosure
  8. --   restricted by GSA ADP Schedule Contract with IBM Corp.
  9. --
  10. --------------------------------------------------------------------------------
  11.  
  12. <include prologcp.tde>
  13.  
  14. /* UI Class Library headers */
  15. #include <ibase.hpp>
  16.  
  17. /* Application headers */
  18. #include "prodinfo.hpp"
  19. #include "$FILE_NAME$.h"
  20.  
  21. /****************** ProdInfoDialog Implementation *******************/
  22.  
  23.  
  24. /***********************************************************/
  25. /* Constructor for the product information dialog class.   */
  26. /***********************************************************/
  27. ProdInfoDialog::ProdInfoDialog( IWindow *owner )
  28.   :IFrameWindow( ID_PRODINFO, IWindow::desktopWindow(), owner,
  29.                  IRectangle( 200, 200, 600, 470 ),
  30.                  IFrameWindow::systemMenu
  31.                  | IFrameWindow::dialogBackground
  32.                  | IFrameWindow::dialogBorder )
  33.   ,canvas( ID_PRODINFO_CANVAS, this, this )
  34.   ,iconCtl( ID_PRODINFO_ICON, &canvas, &canvas )
  35.   ,text1( ID_PRODINFO_TEXT1, &canvas, &canvas )
  36.   ,text2( ID_PRODINFO_TEXT2, &canvas, &canvas )
  37.   ,text3( ID_PRODINFO_TEXT3, &canvas, &canvas )
  38.   ,text4( ID_PRODINFO_TEXT4, &canvas, &canvas )
  39.   ,text5( ID_PRODINFO_TEXT5, &canvas, &canvas )
  40.   ,button( ID_PRODINFO_OK, &canvas, &canvas )
  41. {
  42.    // Set self as command event handler
  43.    handleEventsFor(this);
  44.  
  45.    // Set text for the controls
  46.    iconCtl.setIcon( IDI_ICON );
  47.    text1.setText( IResourceId( IDS_PRODINFO_TEXT1 ) );
  48.    text1.setForegroundColor( IColor::red );
  49.    text2.setText( IResourceId( IDS_PRODINFO_TEXT2 ) );
  50.    text3.setText( IResourceId( IDS_PRODINFO_TEXT3 ) );
  51.    text4.setText( IResourceId( IDS_PRODINFO_TEXT4 ) );
  52.    text5.setText( IResourceId( IDS_PRODINFO_TEXT5 ) );
  53.    button.setText( IResourceId( IDS_PRODINFO_OK ) );
  54.  
  55.    // Set the canvas orientation to veritical
  56.    // Set the canvas alignment to center all the controls
  57.    canvas.setDeckOrientation( ISetCanvas::vertical );
  58.    canvas.setAlignment( ISetCanvas::centerCenter );
  59.  
  60.    // Set the client as the canvas
  61.    setClient( &canvas );
  62.  
  63.    /******************************************************************************
  64.    * Resize the window based on the minimum size of the canvas                   *
  65.    ******************************************************************************/
  66. #ifndef IC_MOTIF
  67.    moveSizeToClient( IRectangle( IPoint(
  68.                      IWindow::desktopWindow()->size().width()/2,
  69.                      IWindow::desktopWindow()->size().height()/2 ),
  70.                      canvas.minimumSize() ) );
  71. #else
  72.    moveSizeTo( IRectangle( IPoint(
  73.                IWindow::desktopWindow()->size().width()/2,
  74.                IWindow::desktopWindow()->size().height()/2 ),
  75.                canvas.minimumSize() ) );
  76. #endif
  77.  
  78.    /******************************************************************************
  79.    * Center the frame window                                                     *
  80.    ******************************************************************************/
  81.    moveSizeTo( rect().centerAt( IWindow::desktopWindow()->rect().center() ) );
  82.  
  83.    /******************************************************************************
  84.    * Show the dialog window                                                      *
  85.    ******************************************************************************/
  86.    setFocus();
  87.    show();
  88.  
  89. }
  90.  
  91.  
  92. /***********************************************************/
  93. /* Destructor for the product information dialog class.    */
  94. /***********************************************************/
  95. ProdInfoDialog :: ~ProdInfoDialog()
  96. {
  97.    stopHandlingEventsFor(this);
  98. }
  99.  
  100.  
  101.  
  102. /***********************************************************/
  103. /* Command handler function for the product information    */
  104. /* dialog. There is only one control to handle.            */
  105. /***********************************************************/
  106. Boolean ProdInfoDialog :: command( ICommandEvent& cmdevt)
  107. {
  108.   switch ( cmdevt.commandId() )
  109.   {
  110.      case ID_PRODINFO_OK:
  111.         dismiss(ID_PRODINFO_OK);
  112.         return true;
  113.   }
  114.  
  115.   return false;
  116. }
  117.