home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / frame1 / frmextns / frmextns.cpp next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  2.7 KB  |  91 lines

  1. //*********************************************************
  2. // Frame Window Basics - Frame Extension Sampler
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //*********************************************************
  8. #include <iframe.hpp>
  9. #include <imenubar.hpp>
  10. #include <istattxt.hpp>
  11.  
  12. void main ( )
  13. {
  14.   // Create a frame window and add a menu bar.
  15.   IFrameWindow
  16.     frame( "Title Bar" );
  17.   IMenuBar
  18.     menuBar( &frame );
  19.  
  20.   menuBar
  21. #ifdef IC_PM
  22.    .addText( 10, "~File" )
  23.    .addText( 11, "~Edit" )
  24.    .addText( 12, "~View" );
  25. #else
  26.    .addText( 10, "&File" )
  27.    .addText( 11, "&Edit" )
  28.    .addText( 12, "&View" );
  29. #endif
  30.  
  31.   // Create some static text controls.
  32.   IStaticText
  33.     text1( 0, &frame, &frame ),
  34.     text2( 0, &frame, &frame ),
  35.     text3( 0, &frame, &frame ),
  36.     text4( 0, &frame, &frame );
  37. #ifdef IC_PM
  38.   IStaticText
  39.     text5( 0, &frame, &frame ),
  40.     text6( 0, &frame, &frame ),
  41.     text7( 0, &frame, &frame ),
  42.     text8( 0, &frame, &frame );
  43. #endif
  44.  
  45.   IStaticText::Alignment
  46.     alignment = IStaticText::centerCenter;
  47.   text1.setAlignment( alignment ).setText( "aboveClient" );
  48.   text2.setAlignment( alignment ).setText( "belowClient" );
  49.   text3.setAlignment( alignment ).setText( " leftOfClient " );
  50.   text4.setAlignment( alignment ).setText( "rightOfClient" );
  51. #ifdef IC_PM
  52.   text5.setAlignment( alignment ).setText( "leftOfTitleBar" );
  53.   text6.setAlignment( alignment )
  54.        .setText( " rightOfTitleBar " );
  55.   text7.setAlignment( alignment ).setText( " leftOfMenuBar " );
  56.   text8.setAlignment( alignment ).setText( " rightOfMenuBar " );
  57. #endif
  58.  
  59.   const unsigned long
  60.     fixed = 150;
  61.   const IFrameWindow::SeparatorType
  62.     none = IFrameWindow::none,
  63.     thin = IFrameWindow::thinLine,
  64.     thick = IFrameWindow::thickLine;
  65.  
  66.   // Add the static text controls as frame extensions.
  67.   frame
  68.    .addExtension( &text1, IFrameWindow::aboveClient,
  69.                   0.25, thick )
  70.    .addExtension( &text2, IFrameWindow::belowClient,
  71.                   thick )
  72.    .addExtension( &text3, IFrameWindow::leftOfClient,
  73.                   thin )
  74.    .addExtension( &text4, IFrameWindow::rightOfClient,
  75.                   fixed, thin )
  76. #ifdef IC_PM
  77.    .addExtension( &text5, IFrameWindow::leftOfTitleBar,
  78.                   fixed, thick )
  79.    .addExtension( &text6, IFrameWindow::rightOfTitleBar,
  80.                   thin )
  81.    .addExtension( &text7, IFrameWindow::leftOfMenuBar,
  82.                   thick )
  83.    .addExtension( &text8, IFrameWindow::rightOfMenuBar,
  84.                   none )
  85. #endif
  86.    .setFocus ( );
  87.  
  88.   frame
  89.    .showModally();
  90. }
  91.