home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / powergui / getstart / start2 / win / start2w.cpp < prev   
Encoding:
C/C++ Source or Header  |  1996-10-29  |  1.9 KB  |  71 lines

  1. //*********************************************************
  2. // Getting Started - Simple Program, Version 2
  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 <icconst.h>
  9. #include "start2w.hpp"
  10. #include "start2.h"
  11.  
  12. CodeWindow::CodeWindow ( const char* title )
  13.   : IFrameWindow ( title,
  14.                    ID_CODEWINDOW,
  15.                    IFrameWindow::classDefaultStyle
  16.                     | IFrameWindow::menuBar ),
  17.     mle( IC_FRAME_CLIENT_ID, this, this,
  18.          IRectangle(),
  19.          ( IMultiLineEdit::classDefaultStyle
  20.             | IMultiLineEdit::horizontalScroll )
  21.            & ~IMultiLineEdit::wordWrap ),
  22.     cmdHandler ( )
  23. {
  24.   // Make the MLE the client window.
  25.   this->setClient( &mle );
  26.  
  27.   // Read this source file into the MLE, and position the
  28.   // cursor at the top of the file.
  29.   mle.importFromFile( __FILE__ );
  30.   mle.setCursorLinePosition( 0 );
  31.  
  32.   // Attach the command handler that will process
  33.   // selections from the menu bar,
  34.   cmdHandler.handleEventsFor( this );
  35. }
  36.  
  37. IBase::Boolean CodeWindow::cut ( )
  38. {
  39.   Boolean didCut = false;
  40.   if ( mle.hasSelectedText() )
  41.   {      // Cut selected text from the MLE to the
  42.          // system clipboard.
  43.      mle.cut();
  44.      didCut = true;
  45.   }
  46.   return didCut;
  47. }
  48.  
  49. IBase::Boolean CodeWindow::copy ( )
  50. {
  51.   Boolean didCopy = false;
  52.   if ( mle.hasSelectedText() )
  53.   {      // Copy selected text from the MLE to the
  54.          // system clipboard.
  55.      mle.copy();
  56.      didCopy = true;
  57.   }
  58.   return didCopy;
  59. }
  60.  
  61. IBase::Boolean CodeWindow::paste ( )
  62. {
  63.   Boolean didPaste = false;
  64.   if ( mle.clipboardHasTextFormat() )
  65.   {      // Paste text from the clipboard to the MLE.
  66.      mle.paste();
  67.      didPaste = true;
  68.   }
  69.   return didPaste;
  70. }
  71.