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

  1. //************************************************************
  2. // Container Control - Tree Text 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.  
  13. void main ()
  14. {
  15.  
  16. IFrameWindow cnrFrame("Tree Text View");
  17. cnrFrame.sizeTo(ISize(280,230));
  18.  
  19. IContainerControl cnr(0x101,        
  20.                       &cnrFrame,    
  21.                       &cnrFrame);
  22.  
  23. // Put container in client area
  24. cnrFrame.setClient(&cnr);
  25.  
  26. // Create the root objects
  27. IContainerObject* root1 = new IContainerObject("Root 1");
  28. IContainerObject* root2 = new IContainerObject("Root 2");
  29. IContainerObject* root3 = new IContainerObject("Root 3");
  30.  
  31. // Create a few Child objects
  32. IContainerObject* root1Child1 = new
  33.     IContainerObject("Root 1 - Child 1");
  34. IContainerObject* root1Child2 = new
  35.     IContainerObject("Root 1 - Child 2");
  36. IContainerObject* root1Child3 = new
  37.     IContainerObject("Root 1 - Child 3");
  38.  
  39. // Add the root objects
  40. cnr.addObject(root1);
  41. cnr.addObject(root2);
  42. cnr.addObject(root3);
  43.  
  44. // Add Two of Root1's children
  45. cnr.addObject(root1Child2, root1);
  46. cnr.addObject(root1Child3, root1);
  47.  
  48. // Now add a Root1 Child as first child
  49. cnr.addObjectAfter(root1Child1, 0, root1);
  50.  
  51. // Show the Tree Text view
  52. cnr.showTreeTextView();
  53.  
  54. // Expand the tree
  55. cnr.expandTree();
  56.  
  57. // Make the frame visible and give it focus
  58. cnrFrame.show();
  59. cnrFrame.setFocus();
  60.  
  61. // Start the message loop
  62. IApplication::current().run();
  63. }
  64.