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

  1. //************************************************************
  2. // Static Controls - Group Box and Outline Box Example
  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 <icanvas.hpp>
  9. #include <iframe.hpp>
  10. #include <iapp.hpp>
  11. #include <igroupbx.hpp>
  12. #include <ioutlbox.hpp>
  13. #include <iradiobt.hpp>
  14. #include <istattxt.hpp>
  15. #include <icconst.h>
  16. #include <icoordsy.hpp>
  17.  
  18. void main ( )
  19. {
  20.   // Set the coordinate system to upper-left on all platforms.
  21.   ICoordinateSystem::setApplicationOrientation(
  22.       ICoordinateSystem::originUpperLeft);
  23.  
  24.   IFrameWindow frame( "Group Box and Outline Box Example" );
  25.   ICanvas client( IC_FRAME_CLIENT_ID, &frame, &frame,
  26.                   IRectangle( IPoint(), ISize( 390, 200 )));
  27.   frame.setClient( &client );
  28.  
  29.   // Create a group box with radio buttons.
  30.   IGroupBox group( 1, &client, &client,
  31.                    IRectangle( IPoint( 30, 10),
  32.                                ISize( 150, 170 )));
  33.   group.setText( "Group box" );
  34.  
  35.   ISize buttonSize( 130, 30 );
  36.   IRadioButton
  37.     first ( 2, &client, &client,
  38.             IRectangle( IPoint( 40, 40 ), buttonSize )),
  39.     second( 3, &client, &client,
  40.             IRectangle( IPoint( 40, 90 ), buttonSize )),
  41.     third ( 4, &client, &client,
  42.             IRectangle( IPoint( 40, 140 ), buttonSize ));
  43.   first
  44.    .setText( "First" )
  45.    .enableTabStop()
  46.    .enableGroup();
  47.   second.setText( "Second" );
  48.   third.setText( "Third" );
  49.  
  50.   // Create an outline box with text.
  51.   IOutlineBox outline( 5, &client, &client,
  52.                        IRectangle( IPoint( 210, 10 ),
  53.                                    ISize( 150, 170 )));
  54.   IStaticText text( 6, &client, &client,
  55.                     IRectangle( IPoint( 220, 20 ),
  56.                                 ISize( 130, 150 )));
  57.   text
  58.    .setAlignment( IStaticText::topLeftWrapped )
  59.    .setText( "Text in an outline box." );
  60.  
  61.   // Size and show the window now.
  62.   frame
  63.    .moveSizeToClient( IRectangle( IPoint( 50, 30 ),
  64.                                   client.size() ))
  65.    .setFocus()
  66.    .show();
  67.   IApplication::current().run();
  68. }
  69.