home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WRICHEDT.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-03
|
9KB
|
270 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
/*************************************************************************
*
* WRichTextBox -- Wrapper for the Windows 95 RichTextBox control.
*
* Events:
*
*************************************************************************/
#ifndef _WRICHEDT_HPP_INCLUDED
#define _WRICHEDT_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WCOLOR_HPP_INCLUDED
# include "wcolor.hpp"
#endif
#ifndef _WCONTROL_HPP_INCLUDED
# include "wcontrol.hpp"
#endif
#ifndef _WTEXTBOX_HPP_INCLUDED
# include "wtextbox.hpp"
#endif
#ifndef _WFONT_HPP_INCLUDED
# include "wfont.hpp"
#endif
#ifndef _WARRAY_HPP_INCLUDED
# include "warray.hpp"
#endif
class WRichTextBox;
enum WCharacterFormatType { /* for Get/SetCharacterFormat() */
WCFDefault,
WCFCurrentSelection,
WCFCurrentWord /* for SetCharacterFormat() only */
};
enum WParagraphAlignType { /* for Get/SetParagraphFormat() */
WPALeft,
WPACenter,
WPARight
};
typedef WArray< WLong > WLongArray;
typedef struct WParagraphFormat { /* for Get/SetParagraphFormat() */
WParagraphAlignType align;
WFloat startIndent; /* in inches */
WFloat subsequentIndent; /* in inches */
WFloat rightIndent; /* in inches */
WLongArray tabStopsArray;
WBool bullet;
} WParagraphFormat;
enum WCFMaskType {
WCFMBold = 0x00000001,
WCFMItalic = 0x00000002,
WCFMUnderline = 0x00000004,
WCFMStrikeout = 0x00000008,
WCFMProtect = 0x00000010,
WCFMFontCharacterSet= 0x08000000,
WCFMBaselineOffset = 0x10000000,
WCFMFontFaceName = 0x20000000,
WCFMFontPitch = 0x20000000,
WCFMFontFamily = 0x20000000,
WCFMColor = 0x40000000,
WCFMHeight = 0x80000000,
WCFMAll = 0xF800001F
};
typedef WULong WCFMask;
class WCMCLASS WCharacterFormat { /* for Get/SetCharacterFormat() */
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WCharacterFormat() {}
WCharacterFormat( const WFont & font, WBool autoColr=TRUE,
WBool protct=FALSE, WLong baselineOffst=0 );
~WCharacterFormat() {}
/**********************************************************
* Properties
*********************************************************/
// Font
WBool SetFont( const WFont & font, WBool autoColr=TRUE,
WBool protct=FALSE, WLong baselineOffst=0 );
WFont GetFont();
/**********************************************************
* Data Members
*********************************************************/
public:
WBool autoColor;
WBool bold;
WBool italic;
WBool strikeout;
WBool underline;
WBool protect;
WLong height;
WLong baselineOffset; /* +ve => superscript, -ve => subscript */
WColor color; /* ignored if autoColor on */
WFCharSetType fontCharacterSet;
WFPitchType fontPitch;
WFFamilyType fontFamily;
WString fontFaceName;
};
#undef FindText
#if defined( _UNICODE )
#define FindText FindTextW
#else
#define FindText FindTextA
#endif
//
// RichTextBox styles
//
#define WRESDisableNoScroll ((WStyle)0x00002000L) // ES_DISABLENOSCROLL
#define WRESSunken ((WStyle)0x00004000L) // ES_SUNKEN
#define WRESSaveSelection ((WStyle)0x00008000L) // ES_SAVESEL
#define WRESSelectionBar ((WStyle)0x01000000L) // ES_SELECTIONBAR
class WCMCLASS WRichTextBox : public WTextBox {
WDeclareSubclass( WRichTextBox, WTextBox );
public:
/**********************************************************
* Constructors and Destructors
*********************************************************/
WRichTextBox();
~WRichTextBox();
/**********************************************************
* Properties
*********************************************************/
// CharacterFormat - The formatting of characters
WBool SetCharacterFormat( const WCharacterFormat & format,
WCharacterFormatType type=WCFDefault,
WCFMask mask=WCFMAll );
WCharacterFormat GetCharacterFormat(
WCharacterFormatType type=WCFDefault );
// ParagraphFormat -- The formatting of paragraphs
WBool SetParagraphFormat( const WParagraphFormat & format );
WParagraphFormat GetParagraphFormat();
// SelectedText -- The currently selected
// (i.e. highlighted) text.
WString GetSelectedText() const;
// Font
virtual WBool SetFont( const WFont & font, WBool preserveSize=TRUE );
virtual WFont GetFont( WBool getResultingFont=TRUE );
// ContextMenuEnabled
WBool GetContextMenuEnabled() const;
WBool SetContextMenuEnabled( WBool contextMenuEnabled );
/**********************************************************
* Methods
*********************************************************/
// FindText
//
// Finds the next occurence of a given string. Returns the
// index of the beginning of the found string.
WLong FindText( const WString & str, WBool caseSensitive=FALSE,
WBool matchWholeWord=FALSE, WLong beginAt=0,
WLong endAt=-1 );
// Load
WBool Load( const WFilePath & fileName, WBool regularText=FALSE );
WBool Load( const WBuffer & buffer, WBool regularText=FALSE );
// Save
WBool Save( const WFilePath & fileName, WBool regularText=FALSE );
WBool Save( WBuffer & buffer, WBool regularText=FALSE );
/**********************************************************
* Event Handlers
*********************************************************/
WBool RightButtonUpEventHandler( WWindow * source,
WMouseEventData * event );
/**********************************************************
* Overrides
*********************************************************/
virtual const WChar * InitializeClass();
virtual WStyle GetDefaultStyle() const;
virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
void * data=NULL );
virtual WColor GetBackColor( WBool getResultingColor=TRUE ) const;
virtual WBool SetBackColor( const WColor & backColor );
virtual WColor GetForeColor( WBool getResultingColor=TRUE ) const;
virtual WBool SetForeColor( const WColor & foreColor );
virtual WBool LoadWindow( WWindow * parent,
const WResourceID & id,
WModuleHandle module=_ApplicationModule );
virtual WBool MakeWindow( WWindow * parent, WUInt id,
const WChar *className,
const WChar *title, const WRect & r,
WStyle wstyle, WStyle exStyle,
void * data=NULL );
/**********************************************************
* Data Members
*********************************************************/
private:
WBool _contextMenuEnabled;
};
#ifndef _WTEMPLAT_HPP_INCLUDED
# include "wtemplat.hpp"
#endif
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WRICHEDT_HPP_INCLUDED