home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / profile / advprof / keyview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.9 KB  |  68 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 <imle.hpp>
  9. #include <ifont.hpp>
  10. #include "keyview.hpp"
  11. #include "profview.h"
  12.  
  13. ProfileKeyObject :: ProfileKeyObject ( ProfileApplication &app,
  14.                                        const IString      &keyName,
  15.                                        IContainerControl  *cnr )
  16.   : ProfileObject( keyName, KEY_ICON_ID, cnr ),
  17.     profKey( app, keyName )
  18.   {
  19.   }
  20.  
  21. ProfileObjectView *ProfileKeyObject :: newView ( )
  22.   {
  23.   return new KeyView( *this );
  24.   }
  25.  
  26. ProfileKey &ProfileKeyObject :: key ( )
  27.   {
  28.   return profKey;
  29.   }
  30.  
  31. KeyView :: KeyView ( ProfileKeyObject &keyObj )
  32.   : ProfileObjectView( clientWindow(),
  33.                        keyObj,
  34.                        "Contents View" ),
  35.     keyObj( keyObj )
  36.   {
  37.   populate();
  38.   }
  39.  
  40. KeyView &KeyView :: populate ( )
  41.   {
  42.   IMultiLineEdit
  43.    *mle = (IMultiLineEdit*)( client() );
  44.   (*mle)
  45.     .addLineAsLast( "Profile: " + keyObj.key().application().profile().name() )
  46.     .addLineAsLast( "Application: " + keyObj.key().application().name() )
  47.     .addLineAsLast( "Key: " + keyObj.key().name() )
  48.     .addLineAsLast( keyObj.key().formatted(), mle->noTran );
  49.   return *this;
  50.   }
  51.  
  52. IMultiLineEdit *KeyView :: clientWindow ( )
  53.   {
  54.   IMultiLineEdit
  55.    *p = new IMultiLineEdit( 0,
  56.                             IWindow::objectWindow(),
  57.                             IWindow::objectWindow(),
  58.                             IRectangle(),
  59.                             IMultiLineEdit::classDefaultStyle | 
  60.                             IMultiLineEdit::readOnly );
  61.   IFont
  62.     font( "System Monospaced", 12 );
  63.   (*p)
  64.     .setFont( font )
  65.     .setAutoDeleteObject( true );
  66.   return p;
  67.   }
  68.