PageRenderTime 68ms CodeModel.GetById 9ms RepoModel.GetById 0ms 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
Possible License(s): LGPL-2.1
  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. #ifndef LL_PREEDITOR
  29. #define LL_PREEDITOR
  30. class LLPreeditor
  31. {
  32. public:
  33. typedef std::vector<S32> segment_lengths_t;
  34. typedef std::vector<BOOL> standouts_t;
  35. // We don't delete against LLPreeditor, but compilers complain without this...
  36. virtual ~LLPreeditor() {};
  37. // Discard any preedit info. on this preeditor.
  38. virtual void resetPreedit() = 0;
  39. // Update the preedit feedback using specified details.
  40. // Existing preedit is discarded and replaced with the new one. (I.e., updatePreedit is not cumulative.)
  41. // All arguments are IN.
  42. // preedit_count is the number of elements in arrays preedit_list and preedit_standouts.
  43. // preedit list is an array of preedit texts (clauses.)
  44. // preedit_standouts indicates whether each preedit text should be shown as standout clause.
  45. // caret_position is the preedit-local position of text editing caret, in # of llwchar.
  46. virtual void updatePreedit(const LLWString &preedit_string,
  47. const segment_lengths_t &preedit_segment_lengths, const standouts_t &preedit_standouts, S32 caret_position) = 0;
  48. // Turn the specified sub-contents into an active preedit.
  49. // Both position and length are IN and count with UTF-32 (llwchar) characters.
  50. // This method primarily facilitates reconversion.
  51. virtual void markAsPreedit(S32 position, S32 length) = 0;
  52. // Get the position and the length of the active preedit in the contents.
  53. // Both position and length are OUT and count with UTF-32 (llwchar) characters.
  54. // When this preeditor has no active preedit, position receives
  55. // the caret position, and length receives 0.
  56. virtual void getPreeditRange(S32 *position, S32 *length) const = 0;
  57. // Get the position and the length of the current selection in the contents.
  58. // Both position and length are OUT and count with UTF-32 (llwchar) characters.
  59. // When this preeditor has no selection, position receives
  60. // the caret position, and length receives 0.
  61. virtual void getSelectionRange(S32 *position, S32 *length) const = 0;
  62. // Get the locations where the preedit and related UI elements are displayed.
  63. // Locations are relative to the app window and measured in GL coordinate space (before scaling.)
  64. // query_position is IN argument, and other three are OUT.
  65. virtual BOOL getPreeditLocation(S32 query_position, LLCoordGL *coord, LLRect *bounds, LLRect *control) const = 0;
  66. // Get the size (height) of the current font used in this preeditor.
  67. virtual S32 getPreeditFontSize() const = 0;
  68. // Get the contents of this preeditor as a LLWString. If there is an active preedit,
  69. // the returned LLWString contains it.
  70. virtual LLWString getPreeditString() const = 0;
  71. // Handle a UTF-32 char on this preeditor, i.e., add the character
  72. // to the contents.
  73. // This is a back door of the method of same name of LLWindowCallback.
  74. // called_from_parent should be set to FALSE if calling through LLPreeditor.
  75. virtual BOOL handleUnicodeCharHere(llwchar uni_char) = 0;
  76. };
  77. #endif