PageRenderTime 47ms CodeModel.GetById 1ms app.highlight 38ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/llui/lltextbase.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 578 lines | 410 code | 89 blank | 79 comment | 1 complexity | c40bfc78813bd2f2200f2dc5bb6743dc MD5 | raw file
  1/** 
  2 * @file lltextbase.h
  3 * @author Martin Reddy
  4 * @brief The base class of text box/editor, providing Url handling support
  5 *
  6 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  7 * Second Life Viewer Source Code
  8 * Copyright (C) 2010, Linden Research, Inc.
  9 * 
 10 * This library is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU Lesser General Public
 12 * License as published by the Free Software Foundation;
 13 * version 2.1 of the License only.
 14 * 
 15 * This library is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18 * Lesser General Public License for more details.
 19 * 
 20 * You should have received a copy of the GNU Lesser General Public
 21 * License along with this library; if not, write to the Free Software
 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 23 * 
 24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 25 * $/LicenseInfo$
 26 */
 27
 28#ifndef LL_LLTEXTBASE_H
 29#define LL_LLTEXTBASE_H
 30
 31#include "v4color.h"
 32#include "lleditmenuhandler.h"
 33#include "llstyle.h"
 34#include "llkeywords.h"
 35#include "llpanel.h"
 36
 37#include <string>
 38#include <vector>
 39#include <set>
 40
 41#include <boost/signals2.hpp>
 42
 43class LLContextMenu;
 44class LLUrlMatch;
 45
 46///
 47/// A text segment is used to specify a subsection of a text string
 48/// that should be formatted differently, such as a hyperlink. It
 49/// includes a start/end offset from the start of the string, a
 50/// style to render with, an optional tooltip, etc.
 51///
 52class LLTextSegment : public LLRefCount, public LLMouseHandler
 53{
 54public:
 55	LLTextSegment(S32 start, S32 end) : mStart(start), mEnd(end){};
 56	virtual ~LLTextSegment();
 57
 58	virtual bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
 59	virtual S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
 60	virtual S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
 61	virtual void				updateLayout(const class LLTextBase& editor);
 62	virtual F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
 63	virtual bool				canEdit() const;
 64	virtual void				unlinkFromDocument(class LLTextBase* editor);
 65	virtual void				linkToDocument(class LLTextBase* editor);
 66
 67	virtual const LLColor4&		getColor() const;
 68	//virtual void 				setColor(const LLColor4 &color);
 69	virtual LLStyleConstSP		getStyle() const;
 70	virtual void 				setStyle(LLStyleConstSP style);
 71	virtual void				setToken( LLKeywordToken* token );
 72	virtual LLKeywordToken*		getToken() const;
 73	virtual void				setToolTip(const std::string& tooltip);
 74	virtual void				dump() const;
 75
 76	// LLMouseHandler interface
 77	/*virtual*/ BOOL			handleMouseDown(S32 x, S32 y, MASK mask);
 78	/*virtual*/ BOOL			handleMouseUp(S32 x, S32 y, MASK mask);
 79	/*virtual*/ BOOL			handleMiddleMouseDown(S32 x, S32 y, MASK mask);
 80	/*virtual*/ BOOL			handleMiddleMouseUp(S32 x, S32 y, MASK mask);
 81	/*virtual*/ BOOL			handleRightMouseDown(S32 x, S32 y, MASK mask);
 82	/*virtual*/ BOOL			handleRightMouseUp(S32 x, S32 y, MASK mask);
 83	/*virtual*/ BOOL			handleDoubleClick(S32 x, S32 y, MASK mask);
 84	/*virtual*/ BOOL			handleHover(S32 x, S32 y, MASK mask);
 85	/*virtual*/ BOOL			handleScrollWheel(S32 x, S32 y, S32 clicks);
 86	/*virtual*/ BOOL			handleToolTip(S32 x, S32 y, MASK mask);
 87	/*virtual*/ const std::string&	getName() const;
 88	/*virtual*/ void			onMouseCaptureLost();
 89	/*virtual*/ void			screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const;
 90	/*virtual*/ void			localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const;
 91	/*virtual*/ BOOL			hasMouseCapture();
 92
 93	S32							getStart() const 					{ return mStart; }
 94	void						setStart(S32 start)					{ mStart = start; }
 95	S32							getEnd() const						{ return mEnd; }
 96	void						setEnd( S32 end )					{ mEnd = end; }
 97
 98protected:
 99	S32				mStart;
100	S32				mEnd;
101};
102
103class LLNormalTextSegment : public LLTextSegment
104{
105public:
106	LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
107	LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE);
108	~LLNormalTextSegment();
109
110	/*virtual*/ bool				getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
111	/*virtual*/ S32					getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
112	/*virtual*/ S32					getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
113	/*virtual*/ F32					draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
114	/*virtual*/ bool				canEdit() const { return true; }
115	/*virtual*/ const LLColor4&		getColor() const					{ return mStyle->getColor(); }
116	/*virtual*/ LLStyleConstSP		getStyle() const					{ return mStyle; }
117	/*virtual*/ void 				setStyle(LLStyleConstSP style)	{ mStyle = style; }
118	/*virtual*/ void				setToken( LLKeywordToken* token )	{ mToken = token; }
119	/*virtual*/ LLKeywordToken*		getToken() const					{ return mToken; }
120	/*virtual*/ BOOL				getToolTip( std::string& msg ) const;
121	/*virtual*/ void				setToolTip(const std::string& tooltip);
122	/*virtual*/ void				dump() const;
123
124	/*virtual*/ BOOL				handleHover(S32 x, S32 y, MASK mask);
125	/*virtual*/ BOOL				handleRightMouseDown(S32 x, S32 y, MASK mask);
126	/*virtual*/ BOOL				handleMouseDown(S32 x, S32 y, MASK mask);
127	/*virtual*/ BOOL				handleMouseUp(S32 x, S32 y, MASK mask);
128	/*virtual*/ BOOL				handleToolTip(S32 x, S32 y, MASK mask);
129
130protected:
131	F32					drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRect rect);
132
133protected:
134	class LLTextBase&	mEditor;
135	LLStyleConstSP		mStyle;
136	S32					mFontHeight;
137	LLKeywordToken* 	mToken;
138	std::string     	mTooltip;
139	boost::signals2::connection mImageLoadedConnection;
140};
141
142// Text segment that changes it's style depending of mouse pointer position ( is it inside or outside segment)
143class LLOnHoverChangeableTextSegment : public LLNormalTextSegment
144{
145public:
146	LLOnHoverChangeableTextSegment( LLStyleConstSP style, LLStyleConstSP normal_style, S32 start, S32 end, LLTextBase& editor );
147	/*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
148	/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
149protected:
150	// Style used for text when mouse pointer is over segment
151	LLStyleConstSP		mHoveredStyle;
152	// Style used for text when mouse pointer is outside segment
153	LLStyleConstSP		mNormalStyle;
154
155};
156
157class LLIndexSegment : public LLTextSegment
158{
159public:
160	LLIndexSegment() : LLTextSegment(0, 0) {}
161};
162
163class LLInlineViewSegment : public LLTextSegment
164{
165public:
166	struct Params : public LLInitParam::Block<Params>
167	{
168		Mandatory<LLView*>		view;
169		Optional<bool>			force_newline;
170		Optional<S32>			left_pad,
171								right_pad,
172								bottom_pad,
173								top_pad;
174	};
175
176	LLInlineViewSegment(const Params& p, S32 start, S32 end);
177	~LLInlineViewSegment();
178	/*virtual*/ bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
179	/*virtual*/ S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
180	/*virtual*/ void		updateLayout(const class LLTextBase& editor);
181	/*virtual*/ F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
182	/*virtual*/ bool		canEdit() const { return false; }
183	/*virtual*/ void		unlinkFromDocument(class LLTextBase* editor);
184	/*virtual*/ void		linkToDocument(class LLTextBase* editor);
185
186private:
187	S32 mLeftPad;
188	S32 mRightPad;
189	S32 mTopPad;
190	S32 mBottomPad;
191	LLView* mView;
192	bool	mForceNewLine;
193};
194
195class LLLineBreakTextSegment : public LLTextSegment
196{
197public:
198
199	LLLineBreakTextSegment(LLStyleConstSP style,S32 pos);
200	LLLineBreakTextSegment(S32 pos);
201	~LLLineBreakTextSegment();
202	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
203	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
204	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
205
206private:
207	S32			mFontHeight;
208};
209
210class LLImageTextSegment : public LLTextSegment
211{
212public:
213	LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor);
214	~LLImageTextSegment();
215	bool		getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
216	S32			getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars) const;
217	F32			draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect);
218
219private:
220	class LLTextBase&	mEditor;
221	LLStyleConstSP	mStyle;
222};
223
224typedef LLPointer<LLTextSegment> LLTextSegmentPtr;
225
226///
227/// The LLTextBase class provides a base class for all text fields, such
228/// as LLTextEditor and LLTextBox. It implements shared functionality
229/// such as Url highlighting and opening.
230///
231class LLTextBase 
232:	public LLUICtrl,
233	protected LLEditMenuHandler
234{
235public:
236	friend class LLTextSegment;
237	friend class LLNormalTextSegment;
238	friend class LLUICtrlFactory;
239
240	struct LineSpacingParams : public LLInitParam::ChoiceBlock<LineSpacingParams>
241	{
242		Alternative<F32>	multiple;
243		Alternative<S32>	pixels;
244		LineSpacingParams();
245	};
246
247	struct Params : public LLInitParam::Block<Params, LLUICtrl::Params>
248	{
249		Optional<LLUIColor>		cursor_color,
250								text_color,
251								text_readonly_color,
252								bg_readonly_color,
253								bg_writeable_color,
254								bg_focus_color,
255								text_selected_color,
256								bg_selected_color;
257
258		Optional<bool>			bg_visible,
259								border_visible,
260								track_end,
261								read_only,
262								allow_scroll,
263								plain_text,
264								wrap,
265								use_ellipses,
266								parse_urls,
267								parse_highlights,
268								clip,
269								clip_partial;
270								
271		Optional<S32>			v_pad,
272								h_pad;
273
274
275		Optional<LineSpacingParams>
276								line_spacing;
277
278		Optional<S32>			max_text_length;
279
280		Optional<LLFontGL::ShadowType>	font_shadow;
281
282		Params();
283	};
284
285	// LLMouseHandler interface
286	/*virtual*/ BOOL		handleMouseDown(S32 x, S32 y, MASK mask);
287	/*virtual*/ BOOL		handleMouseUp(S32 x, S32 y, MASK mask);
288	/*virtual*/ BOOL		handleMiddleMouseDown(S32 x, S32 y, MASK mask);
289	/*virtual*/ BOOL		handleMiddleMouseUp(S32 x, S32 y, MASK mask);
290	/*virtual*/ BOOL		handleRightMouseDown(S32 x, S32 y, MASK mask);
291	/*virtual*/ BOOL		handleRightMouseUp(S32 x, S32 y, MASK mask);
292	/*virtual*/ BOOL		handleDoubleClick(S32 x, S32 y, MASK mask);
293	/*virtual*/ BOOL		handleHover(S32 x, S32 y, MASK mask);
294	/*virtual*/ BOOL		handleScrollWheel(S32 x, S32 y, S32 clicks);
295	/*virtual*/ BOOL		handleToolTip(S32 x, S32 y, MASK mask);
296
297	// LLView interface
298	/*virtual*/ void		reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
299	/*virtual*/ void		draw();
300
301	// LLUICtrl interface
302	/*virtual*/ BOOL		acceptsTextInput() const { return !mReadOnly; }
303	/*virtual*/ void		setColor( const LLColor4& c );
304	virtual     void 		setReadOnlyColor(const LLColor4 &c);
305	virtual	    void		handleVisibilityChange( BOOL new_visibility );
306
307	/*virtual*/ void		setValue(const LLSD& value );
308	/*virtual*/ LLTextViewModel* getViewModel() const;
309
310	// LLEditMenuHandler interface
311	/*virtual*/ BOOL		canDeselect() const;
312	/*virtual*/ void		deselect();
313
314	// used by LLTextSegment layout code
315	bool					getWordWrap() { return mWordWrap; }
316	bool					getUseEllipses() { return mUseEllipses; }
317	bool					truncate(); // returns true of truncation occurred
318
319	// TODO: move into LLTextSegment?
320	void					createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url
321
322	// Text accessors
323	// TODO: add optional style parameter
324	virtual void			setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style
325	virtual std::string		getText() const;
326	void					setMaxTextLength(S32 length) { mMaxTextByteLength = length; }
327
328	// wide-char versions
329	void					setWText(const LLWString& text);
330	const LLWString&       	getWText() const;
331
332	void					appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params());
333	// force reflow of text
334	void					needsReflow(S32 index = 0);
335
336	S32						getLength() const { return getWText().length(); }
337	S32						getLineCount() const { return mLineInfoList.size(); }
338
339	void					addDocumentChild(LLView* view);
340	void					removeDocumentChild(LLView* view);
341	const LLView*			getDocumentView() const { return mDocumentView; }
342	LLRect					getVisibleTextRect() const { return mVisibleTextRect; }
343	LLRect					getTextBoundingRect();
344	LLRect					getVisibleDocumentRect() const;
345
346	S32						getVPad() { return mVPad; }
347	S32						getHPad() { return mHPad; }
348
349	S32						getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round, bool hit_past_end_of_line = true) const;
350	LLRect					getLocalRectFromDocIndex(S32 pos) const;
351	LLRect					getDocRectFromDocIndex(S32 pos) const;
352
353	void					setReadOnly(bool read_only) { mReadOnly = read_only; }
354	bool					getReadOnly() { return mReadOnly; }
355
356	void					setPlainText(bool value) { mPlainText = value;}
357	bool					getPlainText() const { return mPlainText; }
358
359	// cursor manipulation
360	bool					setCursor(S32 row, S32 column);
361	bool					setCursorPos(S32 cursor_pos, bool keep_cursor_offset = false);
362	void					startOfLine();
363	void					endOfLine();
364	void					startOfDoc();
365	void					endOfDoc();
366	void					changePage( S32 delta );
367	void					changeLine( S32 delta );
368
369	bool					scrolledToStart();
370	bool					scrolledToEnd();
371
372	const LLFontGL*			getDefaultFont() const					{ return mDefaultFont; }
373
374	virtual void			appendLineBreakSegment(const LLStyle::Params& style_params);
375	virtual void			appendImageSegment(const LLStyle::Params& style_params);
376	virtual void			appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
377	boost::signals2::connection setURLClickedCallback(const commit_signal_t::slot_type& cb);
378
379protected:
380	// helper structs
381	struct compare_bottom;
382	struct compare_top;
383	struct line_end_compare;
384	typedef std::vector<LLTextSegmentPtr> segment_vec_t;
385
386	// Abstract inner base class representing an undoable editor command.
387	// Concrete sub-classes can be defined for operations such as insert, remove, etc.
388	// Used as arguments to the execute() method below.
389	class TextCmd
390	{
391	public:
392		TextCmd( S32 pos, BOOL group_with_next, LLTextSegmentPtr segment = LLTextSegmentPtr() ) 
393		:	mPos(pos), 
394			mGroupWithNext(group_with_next)
395		{
396			if (segment.notNull())
397			{
398				mSegments.push_back(segment);
399			}
400		}
401		virtual			~TextCmd() {}
402		virtual BOOL	execute(LLTextBase* editor, S32* delta) = 0;
403		virtual S32		undo(LLTextBase* editor) = 0;
404		virtual S32		redo(LLTextBase* editor) = 0;
405		virtual BOOL	canExtend(S32 pos) const { return FALSE; }
406		virtual void	blockExtensions() {}
407		virtual BOOL	extendAndExecute( LLTextBase* editor, S32 pos, llwchar c, S32* delta ) { llassert(0); return 0; }
408		virtual BOOL	hasExtCharValue( llwchar value ) const { return FALSE; }
409
410		// Defined here so they can access protected LLTextEditor editing methods
411		S32				insert(LLTextBase* editor, S32 pos, const LLWString &wstr) { return editor->insertStringNoUndo( pos, wstr, &mSegments ); }
412		S32 			remove(LLTextBase* editor, S32 pos, S32 length) { return editor->removeStringNoUndo( pos, length ); }
413		S32				overwrite(LLTextBase* editor, S32 pos, llwchar wc) { return editor->overwriteCharNoUndo(pos, wc); }
414		
415		S32				getPosition() const { return mPos; }
416		BOOL			groupWithNext() const { return mGroupWithNext; }
417		
418	protected:
419		const S32			mPos;
420		BOOL				mGroupWithNext;
421		segment_vec_t		mSegments;
422	};
423
424	struct compare_segment_end
425	{
426		bool operator()(const LLTextSegmentPtr& a, const LLTextSegmentPtr& b) const;
427	};
428	typedef std::multiset<LLTextSegmentPtr, compare_segment_end> segment_set_t;
429
430	// protected member variables
431	// List of offsets and segment index of the start of each line.  Always has at least one node (0).
432	struct line_info
433	{
434		line_info(S32 index_start, S32 index_end, LLRect rect, S32 line_num);
435		S32 mDocIndexStart;
436		S32 mDocIndexEnd;
437		LLRect mRect;
438		S32 mLineNum; // actual line count (ignoring soft newlines due to word wrap)
439	};
440	typedef std::vector<line_info> line_list_t;
441
442	// member functions
443	LLTextBase(const Params &p);
444	virtual ~LLTextBase();
445	void							initFromParams(const Params& p);
446	virtual void					onValueChange(S32 start, S32 end);
447
448	// draw methods
449	void							drawSelectionBackground(); // draws the black box behind the selected text
450	void							drawCursor();
451	void							drawText();
452
453	// modify contents
454	S32								insertStringNoUndo(S32 pos, const LLWString &wstr, segment_vec_t* segments = NULL); // returns num of chars actually inserted
455	S32 							removeStringNoUndo(S32 pos, S32 length);
456	S32								overwriteCharNoUndo(S32 pos, llwchar wc);
457	void							appendAndHighlightText(const std::string &new_text, S32 highlight_part, const LLStyle::Params& stylep, bool underline_on_hover_only = false);
458
459
460	// manage segments 
461	void                			getSegmentAndOffset( S32 startpos, segment_set_t::const_iterator* seg_iter, S32* offsetp ) const;
462	void                			getSegmentAndOffset( S32 startpos, segment_set_t::iterator* seg_iter, S32* offsetp );
463	LLTextSegmentPtr    			getSegmentAtLocalPos( S32 x, S32 y, bool hit_past_end_of_line = true);
464	segment_set_t::iterator			getEditableSegIterContaining(S32 index);
465	segment_set_t::const_iterator	getEditableSegIterContaining(S32 index) const;
466	segment_set_t::iterator			getSegIterContaining(S32 index);
467	segment_set_t::const_iterator	getSegIterContaining(S32 index) const;
468	void                			clearSegments();
469	void							createDefaultSegment();
470	virtual void					updateSegments();
471	void							insertSegment(LLTextSegmentPtr segment_to_insert);
472	const LLStyle::Params&			getDefaultStyleParams();
473
474	//  manage lines
475	S32								getLineStart( S32 line ) const;
476	S32								getLineEnd( S32 line ) const;
477	S32								getLineNumFromDocIndex( S32 doc_index, bool include_wordwrap = true) const;
478	S32								getLineOffsetFromDocIndex( S32 doc_index, bool include_wordwrap = true) const;
479	S32								getFirstVisibleLine() const;
480	std::pair<S32, S32>				getVisibleLines(bool fully_visible = false);
481	S32								getLeftOffset(S32 width);
482	void							reflow();
483
484	// cursor
485	void							updateCursorXPos();
486	void							setCursorAtLocalPos( S32 local_x, S32 local_y, bool round, bool keep_cursor_offset=false );
487	S32								getEditableIndex(S32 index, bool increasing_direction); // constraint cursor to editable segments of document
488	void							resetCursorBlink() { mCursorBlinkTimer.reset(); }
489	void							updateScrollFromCursor();
490
491	// text selection
492	bool							hasSelection() const { return (mSelectionStart !=mSelectionEnd); }
493	void 							startSelection();
494	void 							endSelection();
495
496	// misc
497	void							updateRects();
498	void							needsScroll() { mScrollNeeded = TRUE; }
499
500	struct URLLabelCallback;
501	// Replace a URL with a new icon and label, for example, when
502	// avatar names are looked up.
503	void replaceUrl(const std::string &url, const std::string &label, const std::string& icon);
504	
505	void							appendTextImpl(const std::string &new_text, const LLStyle::Params& input_params = LLStyle::Params());
506	void							appendAndHighlightTextImpl(const std::string &new_text, S32 highlight_part, const LLStyle::Params& style_params, bool underline_on_hover_only = false);
507	
508
509protected:
510	// text segmentation and flow
511	segment_set_t       		mSegments;
512	line_list_t					mLineInfoList;
513	LLRect						mVisibleTextRect;			// The rect in which text is drawn.  Excludes borders.
514	LLRect						mTextBoundingRect;
515
516	// default text style
517	LLStyle::Params				mDefaultStyle;
518	bool						mStyleDirty;
519	const LLFontGL* const		mDefaultFont;		// font that is used when none specified, can only be set by constructor
520	const LLFontGL::ShadowType	mFontShadow;		// shadow style, can only be set by constructor
521
522	// colors
523	LLUIColor					mCursorColor;
524	LLUIColor					mFgColor;
525	LLUIColor					mReadOnlyFgColor;
526	LLUIColor					mWriteableBgColor;
527	LLUIColor					mReadOnlyBgColor;
528	LLUIColor					mFocusBgColor;
529	LLUIColor					mTextSelectedColor;
530	LLUIColor					mSelectedBGColor;
531
532	// cursor
533	S32							mCursorPos;			// I-beam is just after the mCursorPos-th character.
534	S32							mDesiredXPixel;		// X pixel position where the user wants the cursor to be
535	LLFrameTimer				mCursorBlinkTimer;  // timer that controls cursor blinking
536
537	// selection
538	S32							mSelectionStart;
539	S32							mSelectionEnd;
540	
541	BOOL						mIsSelecting;		// Are we in the middle of a drag-select? 
542
543	// configuration
544	S32							mHPad;				// padding on left of text
545	S32							mVPad;				// padding above text
546	LLFontGL::HAlign			mHAlign;
547	LLFontGL::VAlign			mVAlign;
548	F32							mLineSpacingMult;	// multiple of line height used as space for a single line of text (e.g. 1.5 to get 50% padding)
549	S32							mLineSpacingPixels;	// padding between lines
550	bool						mBorderVisible;
551	bool                		mParseHTML;			// make URLs interactive
552	bool						mParseHighlights;	// highlight user-defined keywords
553	bool                		mWordWrap;
554	bool						mUseEllipses;
555	bool						mTrackEnd;			// if true, keeps scroll position at end of document during resize
556	bool						mReadOnly;
557	bool						mBGVisible;			// render background?
558	bool						mClip;				// clip text to widget rect
559	bool						mClipPartial;		// false if we show lines that are partially inside bounding rect
560	bool						mPlainText;			// didn't use Image or Icon segments
561	S32							mMaxTextByteLength;	// Maximum length mText is allowed to be in bytes
562
563	// support widgets
564	LLContextMenu*				mPopupMenu;
565	LLView*						mDocumentView;
566	class LLScrollContainer*	mScroller;
567
568	// transient state
569	S32							mReflowIndex;		// index at which to start reflow.  S32_MAX indicates no reflow needed.
570	bool						mScrollNeeded;		// need to change scroll region because of change to cursor position
571	S32							mScrollIndex;		// index of first character to keep visible in scroll region
572
573	// Fired when a URL link is clicked
574	commit_signal_t*			mURLClickSignal;
575
576};
577
578#endif