home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / text / textmgr.hpp < prev    next >
Text File  |  1997-04-02  |  3KB  |  86 lines

  1. /*====START_GENERATED_PROLOG======================================
  2.  */
  3. /*
  4.  *   COMPONENT_NAME: odtextpart
  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.11 com/src/samples/text/textmgr.hpp, odtextpart, od96os2, odos29712d 2/21/97 13:40:58 [3/21/97 17:48:38]
  28. #ifndef _TEXTMGR_HPP_
  29. #define _TEXTMGR_HPP_
  30.  
  31. #include "textplat.h"
  32. #include "paragrph.hpp"
  33.  
  34. class TextPart;
  35. class IndexedCollection;
  36. struct MYFONT {
  37.   char name[128];
  38.   long id;
  39.   long width;
  40.   long height;
  41.   long externalLeading;
  42.   long descender;
  43.   long ascender;
  44. };
  45.  
  46. #define CHARACTER_KEY 1
  47. #define VIRTUAL_KEY 2
  48. #define ACCEL_KEY 3
  49. #define TEXT_CHANGED 4
  50. #define NO_CHANGE 5
  51.  
  52. class TextMgr
  53. {
  54.    public:
  55.       TextMgr(TextPart*);
  56.       ~TextMgr();
  57.       void ToggleInsertMode();
  58.       void DisplayCursor(ODFacet* facet, ODRect clipRect);
  59.       void CreateCursor(HWND hwnd);
  60.       void DeleteCursor(HWND hwnd);
  61.       void SetCursor(HWND hwnd, ODPoint cursor, ODRect cliprect);
  62.       void AddText(char* text, int textSize);
  63.       BOOL ProcessKeyInput(long &message, short keyEvent);
  64.       int GetText(char** text);
  65.       int GetTextSize();
  66.       BOOL HasText();
  67.       long GetTotalHeight();
  68.       long GetMaximumWidth();
  69.       void DrawText(HDC hdc, ODRect clipRect);
  70.       void SetFont(HDC hdc, int printing);
  71.       Paragraph* GetLastParagraph();
  72.       Paragraph* GetParagraphFrom(POSITION pos);
  73.  
  74.    private:
  75.       TextPart*  myParent;
  76.       Environment*  myEv;
  77.       IndexedCollection* paragraphs;
  78.       int insertMode;
  79.       MYFONT myFont;
  80.       POSITION cursorPos;
  81.       POSITION currentPos;
  82.       Paragraph* currentParagraph;
  83.       int maxParagraphLength;
  84. };
  85. #endif
  86.