home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / dynamicp / bclipbrd / cladjmnu.c next >
Text File  |  1997-04-02  |  3KB  |  63 lines

  1. /*====START_GENERATED_PROLOG======================================
  2.  */
  3. /*
  4.  *   COMPONENT_NAME: oddynamicpart
  5.  *
  6.  *   CLASSES: none
  7.  *
  8.  *   ORIGINS: 82,27
  9.  *
  10.  *
  11.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12.  *   All Rights Reserved
  13.  *   Licensed Materials - Property of IBM
  14.  *   US Government Users Restricted Rights - Use, duplication or
  15.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16.  *
  17.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23.  *   OR PERFORMANCE OF THIS SOFTWARE.
  24.  */
  25. /*====END_GENERATED_PROLOG========================================
  26.  */
  27. /* @(#) 1.3 com/src/samples/dynamicp/bclipbrd/cladjmnu.c, oddynamicpart, od96os2, odos29712d 2/18/97 13:55:54 [3/21/97 17:48:06]
  28. *******************************************************************
  29. ** Name: void AdjustMenus
  30. **
  31. ** Description:  Set the Edit menu items relating to clipboard
  32. **               copy, cut, and paste.
  33. **
  34. *******************************************************************
  35. */
  36. {
  37.     _fMenuBar->EnableMenuItem(ev, IDMS_EDIT, EDIT_COPY, kODTrue);
  38.     _fMenuBar->EnableMenuItem(ev, IDMS_EDIT, EDIT_PASTEAS, kODFalse);
  39.     _fMenuBar->EnableMenuItem(ev, IDMS_EDIT, EDIT_PASTELINK, kODFalse);
  40.  
  41.     // see if the clipboard contains anything we know how to paste //
  42.     Boolean canPaste = kODFalse;
  43.     ODClipboard*   clipboard = _fSession->GetClipboard(ev);
  44.     ODArbitrator  *arbitrator     = _fSession->GetArbitrator( ev );
  45.     ODTypeToken    clipboardFocus = _fSession->Tokenize( ev, kODClipboardFocus );
  46.     if (arbitrator->RequestFocus( ev, clipboardFocus, frame )) {
  47.        ODStorageUnit* su = clipboard->GetContentStorageUnit( ev );
  48.  
  49.        ODValueType textType = _fSession->GetTranslation(ev)->
  50.                              GetISOTypeFromPlatformType(ev, CF_TEXT, kODPlatformDataType);
  51.  
  52.        if (su->Exists(ev, kODPropContents, kKindTestDynamicPart, 0)
  53.          || su->Exists(ev, kODPropContents, kODISOStr, 0)
  54.          || su->Exists(ev, kODPropContents, textType, 0) ) {
  55.          canPaste = kODTrue;
  56.        } /* endif */
  57.     } /* endif */
  58.     arbitrator->RelinquishFocus( ev, clipboardFocus, frame );
  59.  
  60.     // Enable Paste for writeable drafts if the clipboard contains pasteable stuff
  61.     _fMenuBar->EnableMenuItem(ev, IDMS_EDIT, EDIT_PASTE, canPaste && !_fDraftReadOnly);
  62. }
  63.