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

  1. //************************************************************
  2. // Static Controls - Icon and Bitmap 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 <ibmpctl.hpp>
  9. #include <iframe.hpp>
  10. #include <iapp.hpp>
  11. #include <iiconctl.hpp>
  12. #include <imcelcv.hpp>
  13. #include <istattxt.hpp>
  14. #include <icconst.h>
  15. #include "iconbmp.h"
  16.  
  17. void main ( )
  18. {
  19.   IFrameWindow frame( "Icon and Bitmap Example" );
  20.  
  21.   // Put the icons and bitmaps on an expandable canvas.
  22.   IMultiCellCanvas client( IC_FRAME_CLIENT_ID, &frame, &frame );
  23.   frame.setClient( &client );
  24.  
  25.   // Create the background bitmap.
  26.   IBitmapControl bmp1( 1, &client, &client, ID_CPPBITMAP );
  27.  
  28.   // Text labels.
  29.   IStaticText
  30.     bmpHeading   ( 0, &client, &client ),
  31.     iconHeading  ( 0, &client, &client );
  32.   bmpHeading
  33.    .setText( "Bitmap - Sized by canvas" )
  34.    .setAlignment( IStaticText::centerCenter )
  35.    .disableFillBackground();
  36.   iconHeading
  37.    .setText( "Icon - Actual size" )
  38.    .setAlignment( IStaticText::centerCenter )
  39.    .disableFillBackground();
  40.  
  41.   // Create an icon.
  42.   IIconControl icon1( 1, &client, &client,
  43.                       ID_CPPICON, IRectangle(),
  44.                       IIconControl::classDefaultStyle
  45.                         | IIconControl::sizeToIcon );
  46.  
  47.   // Put the child windows in the multicell canvas.
  48.   client
  49.    .addToCell( &bmp1,        1, 1, 5, 7 )
  50.    .addToCell( &bmpHeading,  1, 2, 5 )
  51.    .addToCell( &iconHeading, 2, 5, 3 )
  52.    .addToCell( &icon1,       3, 4 );
  53.  
  54.   // Assign expandable columns and rows.
  55.   client
  56.    .setColumnWidth( 2, 1, true )
  57.    .setColumnWidth( 4, 1, true )
  58.    .setColumnWidth( 5, 3, true )
  59.    .setRowHeight( 3, 4, true )
  60.    .setRowHeight( 6, 1, true );
  61.  
  62.   // Show the window now.
  63.   frame.setFocus()
  64.        .show();
  65.   IApplication::current().run();
  66. }
  67.