home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / canvas / splitprb / splitprb.cpp < prev   
Encoding:
C/C++ Source or Header  |  1996-10-29  |  3.9 KB  |  150 lines

  1. //*********************************************************
  2. // Canvas - ISplitCanvas with "Problem" Child Windows
  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 <iapp.hpp>
  9. #include <icolor.hpp>
  10. #include <iframe.hpp>
  11. #include <igroupbx.hpp>
  12. #include <ihandle.hpp>
  13. #include <iiconctl.hpp>
  14. #include <imcelcv.hpp>
  15. #include <imle.hpp>
  16. #include <isplitcv.hpp>
  17. #include <istring.hpp>
  18. #include <icconst.h>
  19.  
  20. #define FIX_PROBLEMS  1   // Comment this out to experiment.
  21.  
  22. #ifndef FIX_PROBLEMS
  23.   #define fix1  client
  24.   #define fix2  client
  25.   #define fix3  client
  26.   #define fix4  client
  27. #endif
  28.  
  29. void main ( )
  30. {
  31.   IFrameWindow
  32.     frame( "Split Canvas with \"Problem\" Children" );
  33.   ISplitCanvas
  34.     client( IC_FRAME_CLIENT_ID, &frame, &frame );
  35.   client
  36. #ifdef IC_WIN
  37.    .setSplitBarMiddleColor( IColor::activeFrameBorder );
  38. #else
  39.    .setSplitBarMiddleColor(
  40.             IGUIColor( IGUIColor::activeFrameBorder ) );
  41. #endif
  42.  
  43.   // Create the information text above the split canvas.
  44.   IMultiLineEdit
  45.     mle( 1, &frame, &frame );
  46.   mle
  47.    .disableDataUpdate()
  48.    .setText( "The group box, frame windows, and icon control "
  49.              "are \"problem\" child windows." );
  50.  
  51.   // Create the first problem child of the split canvas.
  52. #ifdef FIX_PROBLEMS
  53.   IMultiCellCanvas
  54.     fix1( 2, &client, &client );
  55. #endif
  56.   IGroupBox
  57.     problem1( 3, &fix1, &fix1 );
  58.   problem1
  59.    .setText( "Group Box" );
  60. #ifdef FIX_PROBLEMS
  61.   problem1
  62.    .setMinimumSize( ISize( 1, 1 ) );
  63.   fix1
  64.    .addToCell( &problem1, 1, 1 )
  65.    .setRowHeight( 1, 0, true )
  66.    .setColumnWidth( 1, 0, true );
  67. #endif
  68.  
  69.   // Create the second problem child of the split canvas.
  70.   // Note that a frame window without a title bar only causes
  71.   // problems on the OS/2 operating system.
  72. #ifdef FIX_PROBLEMS
  73.   IMultiCellCanvas
  74.     fix2( 4, &client, &client );
  75. #endif
  76.   IFrameWindow
  77.     problem2( 5, &fix2, &fix2, IRectangle(),
  78.               IFrameWindow::dialogBorder
  79.                | IWindow::visible );
  80.   IStaticText
  81.     st1( IC_FRAME_CLIENT_ID, &problem2, &problem2 );
  82.   st1
  83.    .setText( "Child frame 1" )
  84.    .setAlignment( IStaticText::centerCenter );
  85.   problem2
  86.    .setClient( &st1 );
  87. #ifdef FIX_PROBLEMS
  88.   problem2
  89.    .setMinimumSize( ISize( 1, 1 ) );
  90.   fix2
  91.    .addToCell( &problem2, 1, 1 )
  92.    .setRowHeight( 1, 0, true )
  93.    .setColumnWidth( 1, 0, true );
  94. #endif
  95.  
  96.   // Create the third problem child of the split canvas.
  97.   // Note that a frame window without a title bar only causes
  98.   // problems on the OS/2 operating system.
  99. #ifdef FIX_PROBLEMS
  100.   IMultiCellCanvas
  101.     fix3( 6, &client, &client );
  102. #endif
  103.   IFrameWindow
  104.     problem3( 7, &fix3, &fix3, IRectangle(),
  105.               IFrameWindow::dialogBorder
  106.                | IWindow::visible );
  107.   IStaticText
  108.     st2( IC_FRAME_CLIENT_ID, &problem3, &problem3 );
  109.   st2
  110.    .setText( "Child frame 2" )
  111.    .setAlignment( IStaticText::centerCenter );
  112.   problem3
  113.    .setClient( &st2 );
  114. #ifdef FIX_PROBLEMS
  115.   problem3
  116.    .setMinimumSize( ISize( 1, 1 ) );
  117.   fix3
  118.    .addToCell( &problem3, 1, 1 )
  119.    .setRowHeight( 1, 0, true )
  120.    .setColumnWidth( 1, 0, true );
  121. #endif
  122.  
  123.   // Create the fourth problem child of the split canvas.
  124. #ifdef FIX_PROBLEMS
  125.   IMultiCellCanvas
  126.     fix4( 8, &client, &client );
  127. #endif
  128.   IIconControl
  129.     problem4( 9, &fix4, &fix4,
  130.               ISystemPointerHandle::question );
  131. #ifdef FIX_PROBLEMS
  132.   problem4
  133.    .setMinimumSize( ISize( 1, 1 ) );
  134.   fix4
  135.    .addToCell( &problem4, 1, 1 )
  136.    .setRowHeight( 1, 0, true )
  137.    .setColumnWidth( 1, 0, true )
  138.    .setBackgroundColor( IColor::cyan );
  139. #endif
  140.  
  141.   // Size and show the window now.
  142.   frame
  143.    .setClient( &client )
  144.    .addExtension( &mle, IFrameWindow::aboveClient )
  145.    .setFocus()
  146.    .show();
  147.  
  148.   IApplication::current().run();
  149. }
  150.