home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pwrgu2.zip / POWERGU2.EXE / CANVAS / SPLITPRB / SPLITPRB.CPP < prev    next >
Text File  |  1995-07-25  |  3KB  |  93 lines

  1. //************************************************************
  2. // Canvas - ISplitCanvas with "problem" Child Windows 
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // All Rights Reserved.
  6. //************************************************************
  7. #include <icolor.hpp>
  8. #include <iframe.hpp>
  9. #include <iapp.hpp>
  10. #include <iiconctl.hpp>
  11. #include <imcelcv.hpp>
  12. #include <imle.hpp>
  13. #include <isplitcv.hpp>
  14. #include <istring.hpp>
  15. #include <icconst.h>
  16.  
  17. #define ADD_MULTICELLCANVAS  1   // Comment this out to experiment.
  18.  
  19. #ifndef ADD_MULTICELLCANVAS
  20.   #define child2  client
  21.   #define child3  client
  22.   #define child4  client
  23. #endif
  24.  
  25. void main ( )
  26. {
  27.   IFrameWindow frame( "Split canvas with \"problem\" children" );
  28.   ISplitCanvas client( IC_FRAME_CLIENT_ID, &frame, &frame );
  29.   client.setColor( ISplitCanvas::splitBarMiddle,
  30.                    IGUIColor( IGUIColor::activeFrameBorder ));
  31.   frame.setClient( &client );
  32.  
  33.   // Create the first child of the split canvas.
  34.   IMultiLineEdit mle( 1, &client, &client );
  35.   mle.setText( "The frames and icon are \"problem\" "
  36.                  + IString( "child windows" ));
  37.  
  38.   // Create the second child of the split canvas.
  39. #ifdef ADD_MULTICELLCANVAS
  40.   IMultiCellCanvas child2( 2, &client, &client );
  41. #endif
  42.   IFrameWindow frame1( 1, &child2, &child2, IRectangle(),
  43.                        IFrameWindow::dialogBorder
  44.                          | IWindow::visible );
  45.   IStaticText st1( IC_FRAME_CLIENT_ID, &frame1, &frame1 );
  46.   st1.setText( "Child frame 1" )
  47.      .setAlignment( IStaticText::centerCenter );
  48.   frame1.setClient( &st1 );
  49. #ifdef ADD_MULTICELLCANVAS
  50.   frame1.setMinimumSize( ISize( 1, 1 ));
  51.   child2.addToCell( &frame1, 1, 1 )
  52.         .setRowHeight( 1, 0, true )
  53.         .setColumnWidth( 1, 0, true );
  54. #endif
  55.  
  56.   // Create the third child of the split canvas.
  57. #ifdef ADD_MULTICELLCANVAS
  58.   IMultiCellCanvas child3( 3, &client, &client );
  59. #endif
  60.   IFrameWindow frame2( 1, &child3, &child3, IRectangle(),
  61.                        IFrameWindow::dialogBorder
  62.                          | IWindow::visible );
  63.   IStaticText st2( IC_FRAME_CLIENT_ID, &frame2, &frame2 );
  64.   st2.setText( "Child frame 2" )
  65.      .setAlignment( IStaticText::centerCenter );
  66.   frame2.setClient( &st2 );
  67. #ifdef ADD_MULTICELLCANVAS
  68.   frame2.setMinimumSize( ISize( 1, 1 ));
  69.   child3.addToCell( &frame2, 1, 1 )
  70.         .setRowHeight( 1, 0, true )
  71.         .setColumnWidth( 1, 0, true );
  72. #endif
  73.  
  74.   // Create the fourth child of the split canvas.
  75. #ifdef ADD_MULTICELLCANVAS
  76.   IMultiCellCanvas child4( 4, &client, &client );
  77. #endif
  78.   IIconControl icon( 1, &child4, &child4,
  79.                      ISystemPointerHandle::question );
  80. #ifdef ADD_MULTICELLCANVAS
  81.   icon.setMinimumSize( ISize( 1, 1 ));
  82.   child4.addToCell( &icon, 1, 1 )
  83.         .setRowHeight( 1, 0, true )
  84.         .setColumnWidth( 1, 0, true )
  85.         .setColor( IColor::pink );
  86. #endif
  87.  
  88.   // Size and show the window now.
  89.   frame.setFocus()
  90.        .show();
  91.   IApplication::current().run();
  92. }
  93.