PageRenderTime 6ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llwindow/llpreeditor.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 101 lines | 20 code | 24 blank | 57 comment | 0 complexity | c595a9048b4cc00001a243a0d3af64f6 MD5 | raw file
  1/** 
  2 * @file llpreeditor.h
  3 * @brief I believe this is used for languages like Japanese that require
  4 * an "input method editor" to type Kanji.
  5 * @author Open source patch, incorporated by Dave Simmons
  6 *
  7 * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  8 * Second Life Viewer Source Code
  9 * Copyright (C) 2010, Linden Research, Inc.
 10 * 
 11 * This library is free software; you can redistribute it and/or
 12 * modify it under the terms of the GNU Lesser General Public
 13 * License as published by the Free Software Foundation;
 14 * version 2.1 of the License only.
 15 * 
 16 * This library is distributed in the hope that it will be useful,
 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 19 * Lesser General Public License for more details.
 20 * 
 21 * You should have received a copy of the GNU Lesser General Public
 22 * License along with this library; if not, write to the Free Software
 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 24 * 
 25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 26 * $/LicenseInfo$
 27 */
 28
 29#ifndef LL_PREEDITOR
 30#define LL_PREEDITOR
 31
 32class LLPreeditor
 33{
 34public:
 35
 36	typedef std::vector<S32> segment_lengths_t;
 37	typedef std::vector<BOOL> standouts_t;
 38	
 39	// We don't delete against LLPreeditor, but compilers complain without this...
 40	
 41	virtual ~LLPreeditor() {};
 42
 43	// Discard any preedit info. on this preeditor.
 44	
 45	virtual void resetPreedit() = 0;
 46
 47	// Update the preedit feedback using specified details.
 48	// Existing preedit is discarded and replaced with the new one.  (I.e., updatePreedit is not cumulative.) 
 49	// All arguments are IN.
 50	// preedit_count is the number of elements in arrays preedit_list and preedit_standouts.
 51	// preedit list is an array of preedit texts (clauses.)
 52	// preedit_standouts indicates whether each preedit text should be shown as standout clause.
 53	// caret_position is the preedit-local position of text editing caret, in # of llwchar.
 54	
 55	virtual void updatePreedit(const LLWString &preedit_string,
 56						const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position) = 0;
 57
 58	// Turn the specified sub-contents into an active preedit.
 59	// Both position and length are IN and count with UTF-32 (llwchar) characters.
 60	// This method primarily facilitates reconversion.
 61
 62	virtual void markAsPreedit(S32 position, S32 length) = 0;
 63
 64	// Get the position and the length of the active preedit in the contents.
 65	// Both position and length are OUT and count with UTF-32 (llwchar) characters.
 66	// When this preeditor has no active preedit, position receives
 67	// the caret position, and length receives 0.
 68
 69	virtual void getPreeditRange(S32 *position, S32 *length) const = 0;
 70
 71	// Get the position and the length of the current selection in the contents.
 72	// Both position and length are OUT and count with UTF-32 (llwchar) characters.
 73	// When this preeditor has no selection, position receives
 74	// the caret position, and length receives 0.
 75
 76	virtual void getSelectionRange(S32 *position, S32 *length) const = 0;
 77
 78	// Get the locations where the preedit and related UI elements are displayed.
 79	// Locations are relative to the app window and measured in GL coordinate space (before scaling.)
 80	// query_position is IN argument, and other three are OUT.
 81
 82	virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0;
 83
 84	// Get the size (height) of the current font used in this preeditor.
 85
 86	virtual S32 getPreeditFontSize() const = 0;
 87
 88	// Get the contents of this preeditor as a LLWString.  If there is an active preedit,
 89	// the returned LLWString contains it.
 90
 91	virtual LLWString getPreeditString() const = 0;
 92
 93	// Handle a UTF-32 char on this preeditor, i.e., add the character
 94	// to the contents.
 95	// This is a back door of the method of same name of LLWindowCallback.
 96	// called_from_parent should be set to FALSE if calling through LLPreeditor.
 97
 98	virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0;
 99};
100
101#endif