home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / cnr / treeicov / treeicov.cpp < prev    next >
Text File  |  1996-10-29  |  2KB  |  68 lines

  1. //************************************************************
  2. // Container Control - Tree Icon View                         
  3. //
  4. // Copyright (C) 1994, Law, Leong, Love, Olson, Tsuji.
  5. // Copyright (c) 1997 John Wiley & Sons, Inc. 
  6. // All Rights Reserved.
  7. //************************************************************
  8.  
  9. #include <iframe.hpp>
  10. #include <icnrctl.hpp>
  11. #include <iapp.hpp>
  12. #include "treeicov.h"
  13.  
  14. void main ()
  15. {
  16.  
  17. IFrameWindow cnrFrame("Tree Icon View");
  18. cnrFrame.sizeTo(ISize(300,350));
  19.  
  20. IContainerControl cnr(0x101,        
  21.                       &cnrFrame,    
  22.                       &cnrFrame);
  23.  
  24. // Put container in client area
  25. cnrFrame.setClient(&cnr);
  26.  
  27. // Create the root objects
  28. IContainerObject* root1 = new IContainerObject("Root 1", 
  29.                                   ICON_FOLDER);
  30. IContainerObject* root2 = new IContainerObject("Root 2",
  31.                                   ICON_FOLDER);
  32. IContainerObject* root3 = new IContainerObject("Root 3",
  33.                                   ICON_FOLDER);
  34.  
  35. // Create a few Child objects
  36. IContainerObject* root1Child1 = new
  37.     IContainerObject("Root 1 - Child 1", ICON_FOLDER);
  38. IContainerObject* root1Child2 = new
  39.     IContainerObject("Root 1 - Child 2", ICON_FOLDER);
  40. IContainerObject* root1Child3 = new
  41.     IContainerObject("Root 1 - Child 3", ICON_FOLDER);
  42.  
  43. // Add the root objects
  44. cnr.addObject(root1);
  45. cnr.addObject(root2);
  46. cnr.addObject(root3);
  47.  
  48. // Add Two of Root1's children
  49. cnr.addObject(root1Child2, root1);
  50. cnr.addObject(root1Child3, root1);
  51.  
  52. // Now add a Root1 Child as first child
  53. cnr.addObjectAfter(root1Child1, 0, root1);
  54.  
  55. // Show the Tree Icon view
  56. cnr.showTreeIconView();
  57.  
  58. // Expand the tree
  59. cnr.expandTree();
  60.  
  61. // Make the frame visible and give it focus
  62. cnrFrame.show();
  63. cnrFrame.setFocus();
  64.  
  65. // Start the message loop
  66. IApplication::current().run();
  67. }
  68.