txtattrb.h

来自「linux下的一款播放器」· C头文件 代码 · 共 1,012 行 · 第 1/3 页

H
1,012
字号
/* ***** BEGIN LICENSE BLOCK ***** * Source last modified: $Id: txtattrb.h,v 1.1.2.1 2004/07/09 01:50:15 hubbe Exp $ *  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved. *  * The contents of this file, and the files included with this file, * are subject to the current version of the RealNetworks Public * Source License (the "RPSL") available at * http://www.helixcommunity.org/content/rpsl unless you have licensed * the file under the current version of the RealNetworks Community * Source License (the "RCSL") available at * http://www.helixcommunity.org/content/rcsl, in which case the RCSL * will apply. You may also obtain the license terms directly from * RealNetworks.  You may not use this file except in compliance with * the RPSL or, if you have a valid RCSL with RealNetworks applicable * to this file, the RCSL.  Please see the applicable RPSL or RCSL for * the rights, obligations and limitations governing use of the * contents of the file. *  * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL") in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your version of * this file only under the terms of the GPL, and not to allow others * to use your version of this file under the terms of either the RPSL * or RCSL, indicate your decision by deleting the provisions above * and replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient may * use your version of this file under the terms of any one of the * RPSL, the RCSL or the GPL. *  * This file is part of the Helix DNA Technology. RealNetworks is the * developer of the Original Code and owns the copyrights in the * portions it created. *  * This file, and the files included with this file, is distributed * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET * ENJOYMENT OR NON-INFRINGEMENT. *  * Technology Compatibility Kit Test Suite(s) Location: *    http://www.helixcommunity.org/content/tck *  * Contributor(s): *  * ***** END LICENSE BLOCK ***** *//////////////////////////////////////////////////////////////////////////////////  TXTATTRB.H////  This is the header file for the class TextAttributes, which holds the//  text-to-be-rendered's attributes like font color, weight, size,//  italicized or not, ...etc., and class TextAttributeStacks which is a//  group of TextAttrbStack objects that keep track of changes in//  attributes so that when the scope of a change ends (and that change//  is "popped" from the stack), the previous value for that attribute//  can be obtained and used for the next block of text.//#if !defined(_TXTATTRB_H_)#define _TXTATTRB_H_class TextWindow;#if !defined(BAD_RGB_COLOR)#define BAD_RGB_COLOR			0xBADCBADC //Illegal COLORTYPE val.#endif#if !defined(TRANSPARENT_COLOR)#define TRANSPARENT_COLOR		0xFF000000#endif#define DEFAULT_TEXT_COLOR		0x00000000 //Black, in Windows.//Means use MM_TRANSPARENT in TextOut():#define DEFAULT_TEXT_BGCOLOR		BAD_RGB_COLOR #define DEFAULT_TICKER_UPPERCOLOR	0x00FFFFFF //White, in Windows.#define DEFAULT_TICKER_LOWERCOLOR	0x0000FF00 //Light green, in Windows.#define DEFAULT_FONT_PTSIZE		FONT_SIZE_0#define DEFAULT_BLINKRATE		0#define TIME_INVALID			((ULONG32)0xFFFFFFFF)enum{    URL_TARGET_INVALID = 0L,    URL_TARGET_PLAYER,    URL_TARGET_BROWSER};//added this function which converts a predefined // string into a font index (returning default index if string unrecognized):ULONG32 getFontFaceIndexFromString(_CHAR* pFntFc, ULONG32 len,	ULONG32 ulMajorContentVersion, ULONG32 ulMinorContentVersion);//////////////////////////////////////////////////////////////////////////////////	TextAttributes class://class TextAttributes {   public:     TextAttributes() { init(); }        //Call this right after calling the default T.A.(T.A.&)    // constructor if you are creating a new TextLine with this call:    void clearWithoutDeletingHrefBuf() { m_pHrefBuf=NULL; m_hrefBufLen=0L; 	    m_ulTargetOfURL = URL_TARGET_INVALID;}    ~TextAttributes() { delete_all(); }    void delete_all() { clear_URL(); }    void clear_URL();    void clear()    {	//You MUST call this before init() unless in constructor:	delete_all();	init();    }    void init();        //Data access functions:    COLORTYPE getTextColor() { return (m_textColor); }    COLORTYPE getTickertapeTextColor()    {	return(isTickerUpperText()?m_tickerUpperColor:m_tickerLowerColor);    }    COLORTYPE getTextBackgroundColor() { return (m_textBackgroundColor); }    COLORTYPE getTickerUpperColor() { return (m_tickerUpperColor); }    COLORTYPE getTickerLowerColor() { return (m_tickerLowerColor); }    const _CHAR* getFontFaceString(	    ULONG32 ulMajorContentVersion, ULONG32 ulMinorContentVersion);    ULONG32 getFontFace() { return (m_fontFaceIndex); }    ULONG32 getFontPointSize() { return (m_fontPointSize); }     ULONG32 getFontCharset() { return (m_fontCharset); }     BOOL isBold() { return (m_isBold); }     BOOL isItalicized() { return (m_isItalicized); }     BOOL isUnderlined() { return (m_isUnderlined); }    BOOL isStruckOut() { return (m_isStruckOut); }    BOOL isStartOfNewLine() { return (m_numNewlinesAtStart>0L); }    //added this for crawlrate "newlines":    BOOL isFakeNewLine() { return m_isFakeNewLine; }    BOOL isWordWrapNewLine() { return m_isWordWrapNewLine; }    ULONG32 getNumNewlinesAtStart() { return m_numNewlinesAtStart; }    LONG32 GetBreakSpacingX() { return m_breakSpacingX; }    LONG32 GetBreakSpacingY() { return m_breakSpacingY; }    BOOL isTickerUpperText() { return (m_isTickerUpperText); }    ULONG32 getBlinkRate() { return (m_blinkRate); }    BOOL isCentered() { return m_isCentered; }    BOOL isPreFormatted() { return m_bIsPreFormatted; }    ULONG32 isRequired() { return m_ulRequired; }    //added this for indenting text in lists and as requested:    UINT16 getLineIndentAmtInPixels() { return(m_lineIndentAmtInPixels);}    BOOL isLit() { return (m_isLit); }     _CHAR* getHrefBuf() { return (m_pHrefBuf); }    ULONG32 getHrefBufLen() { return (m_hrefBufLen); }    //This tells to which app (browser or player) to send the    // URL in m_pHrefBuf when mouse-clicked:    ULONG32 getTargetOfURL() {return m_ulTargetOfURL; }    ULONG32 getBeginTime() { return (m_beginTime); }    ULONG32 getStartTime() { return (m_beginTime); }    ULONG32 getEndTime() { return (m_endTime); }    ULONG32 getStopTime() { return (m_endTime); }    ULONG32 getMostRecentTimeTagEndTime() { 	    return m_ulMostRecentTimeTagEndTime; }    ULONG32 getLastKnownTime() { return (m_lastKnownTime); }    LONG32 getLastKnownX() { return (m_lastKnownX); }     LONG32 getLastKnownY() { return (m_lastKnownY); }    LONG32 getXAtTimeZeroUpperLeftCorner() {	    return (m_xAtTimeZeroUpperLeftCorner); }     LONG32 getYAtTimeZeroUpperLeftCorner() { 	    return (m_yAtTimeZeroUpperLeftCorner); }     LONG32 getXUpperLeftCorner() { return (m_xUpperLeftCorner); }     LONG32 getYUpperLeftCorner() { return (m_yUpperLeftCorner); }    LONG32 getXLowerRightCorner() { return (m_xUpperLeftCorner+m_xExtent-1);}     LONG32 getYLowerRightCorner() { return (m_yUpperLeftCorner+m_yExtent-1);}    LONG32 getXExtent() { return (m_xExtent); }    LONG32 getYExtent() { return (m_yExtent); }    void setTextColor(COLORTYPE c) { m_textColor = c; }    void setTextBackgroundColor(COLORTYPE c) { m_textBackgroundColor = c; }    void setTickerUpperColor(COLORTYPE c) { m_tickerUpperColor = c; }    void setTickerLowerColor(COLORTYPE c) { m_tickerLowerColor = c; }    //Added this line to handle charsets:    void setFontCharset(ULONG32 fntCharset) { m_fontCharset=fntCharset; }     void setFontPointSize(ULONG32 fntPtSz) { m_fontPointSize=fntPtSz; }     void isBold(BOOL isB) { m_isBold = isB; }     void isItalicized(BOOL isI) { m_isItalicized = isI; }     void isUnderlined(BOOL isU) { m_isUnderlined = isU; }    void isStruckOut(BOOL isSU) { m_isStruckOut = isSU; }    void setNumNewlinesAtStart(ULONG32 numNL) {m_numNewlinesAtStart = numNL;}    //added this for crawlrate "newlines":    void isFakeNewLine(BOOL isFNL) { m_isFakeNewLine = isFNL; }    //added this to know who's a newline due to wordwrap:    void isWordWrapNewLine(BOOL isWWNL) { m_isWordWrapNewLine = isWWNL; }    void SetBreakSpacingX(LONG32 brkSpcX) { m_breakSpacingX = brkSpcX; }    void SetBreakSpacingY(LONG32 brkSpcY) { m_breakSpacingY = brkSpcY; }    void isTickerUpperText(BOOL isTUT) { m_isTickerUpperText = isTUT; }    void setBlinkRate(ULONG32 br) { m_blinkRate = br; }    void isCentered(BOOL isCntr) { m_isCentered = isCntr; }    void isPreFormatted(BOOL bIsPre) { m_bIsPreFormatted = bIsPre; }    void isRequired(ULONG32 ulRequired) { m_ulRequired = ulRequired; }    //added this for indenting text in lists and as requested:    void setLineIndentAmtInPixels(UINT16 li) { m_lineIndentAmtInPixels = li;}    void isLit(BOOL isL) { m_isLit = isL; }     void setBeginTime(ULONG32 t) { m_beginTime = t; }    void setStartTime(ULONG32 t) { setBeginTime(t); }    void setEndTime(ULONG32 t) { m_endTime = t; }    void setMostRecentTimeTagEndTime(ULONG32 t)	    { m_ulMostRecentTimeTagEndTime = t; }    void setStopTime(ULONG32 t) { setEndTime(t); }    void setLastKnownTime(ULONG32 t) { m_lastKnownTime=t; }    void setLastKnownX(LONG32 x) { m_lastKnownX=x; }     void setLastKnownY(LONG32 y) { m_lastKnownY=y; }    void setXAtTimeZeroUpperLeftCorner(LONG32 x) { 	    m_xAtTimeZeroUpperLeftCorner=x; }     void setYAtTimeZeroUpperLeftCorner(LONG32 y) { 	    m_yAtTimeZeroUpperLeftCorner=y; }     void setXUpperLeftCorner(LONG32 x) { m_xUpperLeftCorner=x; }     void setYUpperLeftCorner(LONG32 y) { m_yUpperLeftCorner=y; }    void setXExtent(LONG32 x) { m_xExtent=x; }    void setYExtent(LONG32 y) { m_yExtent=y; }    void setFontFace(_CHAR* pFntFc, ULONG32 len,	    ULONG32 ulMajorContentVersion,	    ULONG32 ulMinorContentVersion);    void setFontFace(ULONG32 fntFcIndex);    ULONG32 getNumLinkColorOverrides() { return m_ulNumLinkColorOverrides; }    void setNumLinkColorOverrides(ULONG32 ulNLCO)	    { m_ulNumLinkColorOverrides = ulNLCO; }    //Creates new buffer and copies href into it;    // returns FALSE if alloc (new) fails:    BOOL copyIntoHrefBuf(_CHAR* pHref, ULONG32 len, ULONG32 ulTargetOfURL);    //This gets called in response to a <CLEAR> tag being    // encountered at time ulNewEndTime; if(m_startTime < ulNewEndTime),    // this function resets m_endTime to min(m_endTime, ulNewEndTime);    // returns TRUE if change is made to m_endTime, else FALSE:    BOOL MarkForClear(ULONG32 ulNewEndTime, BOOL bIsLiveSource);    LONG32 ComputeScrollDelta(ULONG32 ulCurTime, LONG32 scrollrate);    LONG32 ComputeCrawlDelta(ULONG32 ulCurTime, LONG32 scrollrate);    ///Changes the start and end times of *this if refTA's    // start or end time is earlier or later, respectively, than this's:    BOOL updateStartAndEndTimes(TextAttributes* pTA, BOOL bIsLiveSource);    //Changes the start and end times of *this as    // calculated by "appearance" of the text in the window, i.e.,    // if there is a scrollrate or crawlrate, this calculates when it first    // becomes visible in the window and then when it moves back out:    BOOL adjustStartAndEndTimes(TextWindow* pTW);  private:    COLORTYPE m_textColor; //a.k.a., "Foreground Color".    //Bkground color for just the text's bounding box:    COLORTYPE m_textBackgroundColor;        //Foreground color for "upper" line of ticker tape text:    COLORTYPE m_tickerUpperColor;    //Foreground color for "lower" line of ticker tape text:    COLORTYPE m_tickerLowerColor;    //Font face; defaults to NULL which means use system    // fixed font.  This is only 32 chars because that is    // the limit Windows placed on the lpszFace parameter    // of CreateFont().  32 includes the terminating '\0':    ULONG32 m_fontFaceIndex;     //Added this line to handle charsets:    ULONG32 m_fontCharset;  //these are #defined (ULONG32)values    //Font size if a scalable font is selected:    ULONG32 m_fontPointSize;      //TRUE if text is to be rendered as bold. (Use <B>..</B> tags):    BOOL m_isBold;    //TRUE if text is to be in italics. (Use <I>..</I> tags):    BOOL m_isItalicized;    //TRUE if text is to be underlined. (Use <U>..</U> tags):    BOOL m_isUnderlined;    //TRUE if text is to be "crossed out". (Use <S>..</S> tags):    BOOL m_isStruckOut;     // This is the number of newlines (<BR> or <P>..etc. tags)    // that start this text (also, could be a newline from wordwraping):    ULONG32 m_numNewlinesAtStart;    //added the following to fake newlines in horizontal-    // motion-only windows with no explicit line breaks (so file format can    // divide the text up into time-based chunks based on visibility in the    // window at any particular time):    BOOL m_isFakeNewLine;    //added the following to keep track of who starts a    // new line due to wordwrap:    BOOL m_isWordWrapNewLine;    //This is the spacing, in logical units, that the <BR> tags (see    // numNewlinesAtStart, above) moved the text's location, in X:    LONG32 m_breakSpacingX;    //This is the spacing, in logical units, that the <BR> tags (see    // numNewlinesAtStart, above) moved the text's location, in Y:    LONG32 m_breakSpacingY;    //Is TRUE if is an upper-line text of tickertape window:    BOOL m_isTickerUpperText;     //Is in msec. Isn't blinking if==0.  Example: 2000 means alternate    // between ON for 2 seconds then OFF for 2 seconds:    ULONG32 m_blinkRate;    //If blinkRate != 0, this tells whether is lit or unlit since    // last timer:    BOOL m_isLit;    //Tells whether *this's text is between <CENTER> and </CENTER> tags:    BOOL m_isCentered;    //Tells whether *this's text is between <PRE> and </PRE> tags:    BOOL m_bIsPreFormatted;    //Tells whether *this's text is between <REQUIRED> and </REQUIRED> tags:    ULONG32 m_ulRequired; //Is count of <REQ..> tags since the last </REQ...>    //Holds URL or filename contained inside <A> tag if the associated    // text of *this was between a <A ..> and a </A>:    _CHAR* m_pHrefBuf;     //  Use this so length doesn't have to be recalculated to use buffer:    ULONG32 m_hrefBufLen;     ULONG32 m_ulTargetOfURL;        //added this for indenting text in lists and    // as requested:    UINT16 m_lineIndentAmtInPixels;    //This is the time after which the text should be drawn:    ULONG32 m_beginTime;    //This is the time after which the text should be deleted:    ULONG32 m_endTime;    //For calculating where text was last drawn so that next    // draw will scroll or crawl at the proper rate:    ULONG32 m_lastKnownTime;    //For calculating where text was last drawn so that next    // draw will scroll or crawl at the proper rate:    LONG32 m_lastKnownX;	    //For calculating where text was last drawn so that next    // draw will scroll or crawl at the proper rate:

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?