OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_BASE_ANDROID_CURSOR_ANCHOR_INFO_BUILDER_H_ |
| 6 #define UI_BASE_ANDROID_CURSOR_ANCHOR_INFO_BUILDER_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_piece.h" |
| 15 #include "ui/base/ui_base_export.h" |
| 16 #include "ui/gfx/geometry/rect_f.h" |
| 17 #include "ui/gfx/geometry/vector2d_f.h" |
| 18 #include "ui/gfx/range/range.h" |
| 19 |
| 20 namespace ui { |
| 21 |
| 22 class UI_BASE_EXPORT CursorAnchorInfoBuilder { |
| 23 public: |
| 24 // Following values are defined in Android Framework. |
| 25 enum Flags { |
| 26 // android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_INVISIBLE_REGION |
| 27 kFlagHasVisibleRegion = 0x01, |
| 28 // android.view.inputmethod.CursorAnchorInfo.FLAG_HAS_VISIBLE_REGION |
| 29 kFlagHasInvisibleRegion = 0x02, |
| 30 // android.view.inputmethod.CursorAnchorInfo.FLAG_IS_RTL |
| 31 kFlagIsRtl = 0x04, |
| 32 }; |
| 33 |
| 34 virtual ~CursorAnchorInfoBuilder(); |
| 35 |
| 36 virtual void AddCharacterBounds(int index, |
| 37 const gfx::RectF& rect, |
| 38 uint32 flags) = 0; |
| 39 virtual base::android::ScopedJavaLocalRef<jobject> Build() = 0; |
| 40 virtual void Reset() = 0; |
| 41 virtual void SetComposingText(int composingTextStart, |
| 42 base::StringPiece16 composingText) = 0; |
| 43 virtual void SetInsertionMarkerLocation(float horizontalPosition, |
| 44 float lineTop, |
| 45 float lineBaseline, |
| 46 float lineBottom, |
| 47 uint32 flags) = 0; |
| 48 virtual void SetScaleAndTranslate(float scale, |
| 49 const gfx::Vector2dF& translate) = 0; |
| 50 virtual void SetSelectionRange(const gfx::Range& range) = 0; |
| 51 |
| 52 static scoped_ptr<CursorAnchorInfoBuilder> Create(); |
| 53 static bool Register(JNIEnv* env); |
| 54 |
| 55 protected: |
| 56 CursorAnchorInfoBuilder(); |
| 57 }; |
| 58 |
| 59 } // namespace ui |
| 60 |
| 61 #endif // UI_BASE_ANDROID_CURSOR_ANCHOR_INFO_BUILDER_H_ |
OLD | NEW |