home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / profile / advprof / profobj.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.9 KB  |  81 lines

  1. //************************************************************
  2. // GUI Profile Viewer Example
  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 "profobj.hpp"
  9.  
  10. ProfileObject :: ProfileObject ( const IString     &name,
  11.                                  unsigned long      iconId,
  12.                                  IContainerControl *cnr )
  13.   : IContainerObject( name, iconId ),
  14.     objCnr( cnr )
  15.   {
  16.   }
  17.  
  18. void ProfileObject :: handleOpen ( IContainerControl * )
  19.   {
  20.   this->view().open();
  21.   }
  22.  
  23. ProfileObjectView &ProfileObject :: view ( )
  24.   {
  25.   if ( !objView )
  26.     {
  27.     objView = this -> newView();
  28.     setInUse( true );
  29.     }
  30.   return *objView;
  31.   }
  32.  
  33. ProfileObject &ProfileObject :: viewClosed ( )
  34.   {
  35.   this->objView = 0;
  36.   setInUse( false );
  37.   return *this;
  38.   }
  39.  
  40. IContainerControl *ProfileObject :: container ( ) const
  41.   {
  42.   return objCnr;
  43.   }
  44.  
  45. ProfileObjectView &ProfileObjectView :: open ( )
  46.   {
  47.   if ( isMinimized() )
  48.     restore();
  49.   setFocus();
  50.   show();
  51.   return *this;
  52.   }
  53.  
  54. ProfileObjectView :: ProfileObjectView ( IWindow *client,
  55.                                          ProfileObject &object,
  56.                                          const IString &viewName )
  57.   : IFrameWindow( 0, 0, object.container()->parent(),
  58.                   nextShellRect().scaleBy( 0.5, 0.5 ),
  59.                   classDefaultStyle | noMoveWithOwner ),
  60.     viewTitle( this ),
  61.     viewObj( &object )
  62.   {
  63.   viewTitle.setObjectText( object.iconText() );
  64.   viewTitle.setViewText( viewName );
  65.   setIcon( object.icon() );
  66.   setClient( client );
  67.   client->setOwner( this );
  68.   setAutoDeleteObject( true );
  69.   }
  70.  
  71. ProfileObjectView :: ~ProfileObjectView ( )
  72.   {
  73.   if ( viewObj )
  74.     viewObj -> viewClosed();
  75.   }
  76.  
  77. ProfileObject *ProfileObjectView :: object ( ) const
  78.   {
  79.   return viewObj;
  80.   }
  81.