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

  1. //************************************************************
  2. // Container Control - Tree Name 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. #include <iframe.hpp>
  9. #include <icnrctl.hpp>
  10. #include <iapp.hpp>
  11. #include "treenamv.h"
  12.  
  13. void main ()
  14. {
  15.  
  16. IFrameWindow cnrFrame("Tree Name View");
  17. cnrFrame.sizeTo(ISize(280,350));
  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.                                   ICON_FOLDER);
  29. IContainerObject* root2 = new IContainerObject("Root 2",
  30.                                   ICON_FOLDER);
  31. IContainerObject* root3 = new IContainerObject("Root 3",
  32.                                   ICON_FOLDER);
  33.  
  34. // Create a few Child objects
  35. IContainerObject* root1Child1 = new
  36.     IContainerObject("Root 1 - Child 1", ICON_FOLDER);
  37. IContainerObject* root1Child2 = new
  38.     IContainerObject("Root 1 - Child 2", ICON_FOLDER);
  39. IContainerObject* root1Child3 = new
  40.     IContainerObject("Root 1 - Child 3", ICON_FOLDER);
  41.  
  42. // Add the root objects
  43. cnr.addObject(root1);
  44. cnr.addObject(root2);
  45. cnr.addObject(root3);
  46.  
  47. // Add Two of Root1's children
  48. cnr.addObject(root1Child2, root1);
  49. cnr.addObject(root1Child3, root1);
  50.  
  51. // Now add a Root1 Child as first child
  52. cnr.addObjectAfter(root1Child1, 0, root1);
  53.  
  54. // Show the Tree Name view
  55. cnr.showTreeNameView();
  56.  
  57. // Expand the tree
  58. cnr.expandTree();
  59.  
  60. // Make the frame visible and give it focus
  61. cnrFrame.show();
  62. cnrFrame.setFocus();
  63.  
  64. // Start the message loop
  65. IApplication::current().run();
  66. }
  67.