home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CSimpleTextView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.2 KB  |  138 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #pragma once
  20.  
  21. #include <CWASTEEdit.h>
  22.  
  23.  
  24. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  25. //    Wrapping Modes
  26. //
  27. //    Text can be wrapped in one of the following three ways:
  28. //
  29. //        wrapMode_WrapToFrame - Wrap to view frame.  This is similar to common
  30. //            TE style wrapping.  
  31. //
  32. //        wrapMode_FixedPage - Don't wrap.  This would be like the metrowerks
  33. //            code editor in which the page size is arbitrarily large in width
  34. //            but no wrapping will occur when text flows outside the page bounds.
  35. //
  36. //        wrapMode_FixedPage - Text is wrapped to the width of the page.  This
  37. //            would be like a word processor.
  38. //
  39. //        wrapMode_WrapWidestUnbreakable - The page size is determined by
  40. //            the view frame size or the width of the widest unbreakable run.
  41. //            This behaviour would be most like an HTML browser.  Text can
  42. //            always be broken, but things like graphic images can not.
  43. //            With text only, this behaves like the normal wrap to frame mode.
  44. //
  45. //    IMPORTANT NOTE:  if you are providing multiple views on a text engine,
  46. //        and those views have different wrapping modes, the formatter will
  47. //        reformat the text to the mode specified by the view EVERY TIME THE
  48. //        VIEW IS FOCUSED.  This is probably not something you'd want to have
  49. //        happening in your app.
  50. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  51.  
  52.  
  53. enum {
  54.     wrapMode_WrapToFrame = 1,
  55.     wrapMode_FixedPage,
  56.     wrapMode_FixedPageWrap,
  57.     wrapMode_WrapWidestUnbreakable
  58. };
  59.  
  60. struct SSimpleTextParms {
  61.     Uint16                attributes;
  62.     Uint16                wrappingMode;
  63.     ResIDT                traitsID;
  64.     ResIDT                textID;
  65.     Int32                pageWidth;
  66.     Int32                pageHeight;
  67.     Rect                margins;
  68. };
  69.  
  70. class CSimpleTextView : public CWASTEEdit
  71.     {
  72. //        friend class LTextEditHandler;    //    this will be going away!
  73.  
  74.         private:
  75.         
  76.                                                         CSimpleTextView();    //    Must use parameters
  77.         
  78.         public:
  79.         
  80.             enum 
  81.                 { 
  82.                 
  83.                     class_ID = 'Stxt' 
  84.                     
  85.                 };
  86.             
  87.                                                         CSimpleTextView(                LStream            *inStream);
  88.             
  89.             virtual                                ~CSimpleTextView();
  90.             
  91. //        virtual void        BuildTextObjects(LModelObject *inSuperModel);
  92.             
  93. // Ñ Event Handler Overrides
  94. //        virtual void            NoteOverNewThing(LManipulator* inThing);
  95.  
  96.             virtual Boolean                ObeyCommand(                        CommandT         inCommand, 
  97.                                                                                                         void                *ioParam);
  98.                                                                                                 
  99.             virtual void                    FindCommandStatus(            CommandT         inCommand, 
  100.                                                                                                         Boolean            &outEnabled, 
  101.                                                                                                         Boolean            &outUsesMark, 
  102.                                                                                                         Char16            &outMark, 
  103.                                                                                                         Str255             outName);
  104.  
  105.             static pascal void         TSMPreUpdate(                     WEReference inWE);
  106.  
  107.             // Ñ Initialization
  108.                 
  109.             virtual    void                     SetInitialTraits(ResIDT inTextTraitsID);
  110.             virtual    void                    SetInitialText(ResIDT inTextID);
  111.             
  112.             virtual Boolean                IsReadOnly();
  113.             virtual void                    SetReadOnly( const Boolean inFlag );
  114.             
  115.             // Commands
  116.                     
  117.             void                                    Save( const FSSpec    &inFileSpec );
  118.                     
  119.         protected:
  120.  
  121.             virtual void                    ClickSelf( const SMouseDownEvent &inMouseDown);
  122.             virtual void                    BeTarget();
  123.             virtual void                    DontBeTarget();
  124.         
  125.             virtual    void                    FinishCreateSelf(void);
  126.             virtual void                    Initialize();
  127.             
  128. //            SSimpleTextParms*            mTextParms;
  129.  
  130.             static Boolean                                sInitialized;
  131.             static Boolean                                sHasTSM;
  132.             static WETSMPreUpdateUPP            sPreUpdateUPP;
  133.             static CSimpleTextView                *sTargetView;
  134.             
  135.     };
  136.  
  137.  
  138.