home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
odtlktv4.zip
/
ODTLKT
/
TOOLKIT
/
SAMPLES
/
OPENDOC
/
PARTS
/
TTAPE1
/
TEXTDATA.HPP
< prev
next >
Wrap
Text File
|
1995-12-15
|
7KB
|
225 lines
/***********************************************************************
*
* File Name : TEXTDATA.HPP
*
* Description : Header file for the TextData class. Contains the
* TextData class definition.
*
* Notes : N/A
*
* Entry Points: DefaultOutlineFont
* TextData::TextData
* TextData::~TextData
* TextData::DrawTape
* TextData::GetTextBuffer
* TextData::GetTextArea
* TextData::GetGap
* TextData::GetScrollPos
* TextData::GetScrollRate
* TextData::GetBackText
* TextData::GetTextFileSize
* TextData::NeedToScroll
* TextData::SetSize
* TextData::SetTextBuffer
* TextData::SetTextArea
* TextData::SetNeedToScroll
* TextData::SetScrollRate
* TextData::SetBackText
*
* (C) COPYRIGHT International Business Machines Corp. 1995
* All Rights Reserved
* Licensed Materials - Property of IBM
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* DISCLAIMER OF WARRANTIES. The following [enclosed] code is
* sample code created by IBM Corporation. This sample code is not
* part of any standard or IBM product and is provided to you solely
* for the purpose of assisting you in the development of your
* applications. The code is provided "AS IS", without
* warranty of any kind. IBM shall not be liable for any damages
* arising out of your use of the sample code, even if they have been
* advised of the possibility of such damages.
*
***********************************************************************/
#ifndef _TEXTDATA_
#define _TEXTDATA_
#define INCL_WIN
#define INCL_GPI
#define INCL_DOS
#include <os2.h>
const USHORT MAXSIZETEXTFILE = 32000; /* Maximum size of text file. */
const ULONG RATE = 200UL; /* Initial text scroll rate. */
typedef struct
{
HPS hps;
FONTMETRICS fmFont;
FATTRS fAttr;
RECTL rectlBox;
LONG lColorText,
lBackText;
LONG lScrollRate;
SHORT sNeedToScroll;
} TEXTAREA;
class TextData
{
public:
TextData(TextData *initData = NULL); /* Constructor. */
virtual ~TextData() /* Destructor. */
{ if (textBuffer != NULL)
delete [] textBuffer;
if (textArea != NULL)
delete textArea; }
/* Draw method. */
virtual VOID DrawTape(HPS hps);
/* Accessor methods. */
CHAR *GetTextBuffer(int bufferIndex) const;
VOID GetTextArea(TEXTAREA& textOut);
/*
*
* Method(s) : TextData::GetGap
*
* Description : Get the current starting location of the text
* within the Ticker Tape window.
*
* Parameters : None.
*
* Returns : SHORT - the starting location of text within
* the Ticker Tape window.
*/
SHORT GetGap () { return sGap; }
/*
*
* Method(s) : TextData::GetScrollPos
*
* Description : Get position of the first character to display
* within the Ticker Tape window.
*
* Parameters : None.
*
* Returns : SHORT - the current Scroll Position.
*/
SHORT GetScrollPos () { return sScrollPos; }
/*
*
* Method(s) : TextData::GetScrollRate
*
* Description : Get the Ticker Tape text scroll rate.
*
* Parameters : None.
*
* Returns : LONG - the Ticker Tape text scroll rate.
*/
LONG GetScrollRate () { return textArea->lScrollRate; }
/*
*
* Method(s) : TextData::GetBackText
*
* Description : Get the Ticker Tape text background color.
*
* Parameters : None.
*
* Returns : LONG - the Ticker Tape text background color.
*/
LONG GetBackText () { return textArea->lBackText; }
/*
*
* Method(s) : TextData::GetTextFileSize
*
* Description : Return the length of the textBuffer buffer.
*
* Parameters : None.
*
* Returns : SHORT - the length of the Ticker Tape text string
* stored in textBuffer.
*/
SHORT GetTextFileSize () { return sTextFileSize; }
/*
*
* Method(s) : TextData::NeedToScroll
*
* Description : Get whether there should be scrolling the next
* time the text is drawn with TextData::DrawTape.
*
* Parameters : None.
*
* Returns : SHORT - the current need to scroll value.
*/
SHORT NeedToScroll () { return textArea->sNeedToScroll; }
/* Set methods. */
VOID SetSize(RECTL *rclFrame);
SHORT SetTextBuffer(CHAR *text,
SHORT sInitGap,
SHORT sInitScrollPos);
VOID SetTextArea(TEXTAREA textIn);
/*
*
* Method(s) : TextData::SetNeedToScroll
*
* Description : Set whether there should be scrolling the next
* time the text is drawn with TextData::DrawTape.
*
* Parameters : SHORT sNeed - the new need to scroll value.
*
* Returns : VOID
*/
VOID SetNeedToScroll (SHORT sNeed)
{ textArea->sNeedToScroll = sNeed; }
/*
*
* Method(s) : TextData::SetScrollRate
*
* Description : Set the Ticker Tape text scroll rate.
*
* Parameters : LONG lScroll - the new scroll rate.
*
* Returns : VOID.
*/
VOID SetScrollRate (LONG lScroll)
{ textArea->lScrollRate = lScroll; }
/*
*
* Method(s) : TextData::SetBackText
*
* Description : Set the text background color attribute stored
* in the lBackText field within the text area.
*
* Parameters : LONG lBackText
*
* Returns : VOID
*/
VOID SetBackText (LONG lBackText)
{ textArea->lBackText = lBackText; }
protected:
TEXTAREA* textArea; /* The text attributes structure. */
CHAR* textBuffer; /* Buffer for containing the text. */
SHORT sTextFileSize; /* Current size of the text buffer. */
SHORT sGap, /* Position of first character in window. */
sScrollPos; /* Index-position of the first character. */
};
/*
* Prototype for the DefaultOutlineFont utility routine.
*/
void DefaultOutlineFont(TEXTAREA *textarea);
#endif /* _TEXTDATA_ */