Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 5 #ifndef VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| 6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 6 #define VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 virtual size_t GetCursorPosition() const OVERRIDE; | 115 virtual size_t GetCursorPosition() const OVERRIDE; |
| 116 virtual bool HandleKeyPressed(const KeyEvent& e) OVERRIDE; | 116 virtual bool HandleKeyPressed(const KeyEvent& e) OVERRIDE; |
| 117 virtual bool HandleKeyReleased(const KeyEvent& e) OVERRIDE; | 117 virtual bool HandleKeyReleased(const KeyEvent& e) OVERRIDE; |
| 118 virtual void HandleFocus() OVERRIDE; | 118 virtual void HandleFocus() OVERRIDE; |
| 119 virtual void HandleBlur() OVERRIDE; | 119 virtual void HandleBlur() OVERRIDE; |
| 120 virtual TextInputClient* GetTextInputClient() OVERRIDE; | 120 virtual TextInputClient* GetTextInputClient() OVERRIDE; |
| 121 virtual void ApplyStyleRange(const gfx::StyleRange& style) OVERRIDE; | 121 virtual void ApplyStyleRange(const gfx::StyleRange& style) OVERRIDE; |
| 122 virtual void ApplyDefaultStyle() OVERRIDE; | 122 virtual void ApplyDefaultStyle() OVERRIDE; |
| 123 virtual void ClearEditHistory() OVERRIDE; | 123 virtual void ClearEditHistory() OVERRIDE; |
| 124 | 124 |
| 125 // TODO(xji): might need to declare it in NativeTextfieldWrapper. | |
|
msw
2011/08/03 19:46:39
I think we ought to inline this function at its on
| |
| 126 // Selects the selection model given by |sel|. | |
| 127 void SelectSelectionModel(const gfx::SelectionModel& sel); | |
| 128 | |
| 125 // ui::SimpleMenuModel::Delegate overrides | 129 // ui::SimpleMenuModel::Delegate overrides |
| 126 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; | 130 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; |
| 127 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; | 131 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; |
| 128 virtual bool GetAcceleratorForCommandId( | 132 virtual bool GetAcceleratorForCommandId( |
| 129 int command_id, | 133 int command_id, |
| 130 ui::Accelerator* accelerator) OVERRIDE; | 134 ui::Accelerator* accelerator) OVERRIDE; |
| 131 virtual void ExecuteCommand(int command_id) OVERRIDE; | 135 virtual void ExecuteCommand(int command_id) OVERRIDE; |
| 132 | 136 |
| 133 // class name of internal | 137 // class name of internal |
| 134 static const char kViewClassName[]; | 138 static const char kViewClassName[]; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 156 virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE; | 160 virtual bool SetSelectionRange(const ui::Range& range) OVERRIDE; |
| 157 virtual bool DeleteRange(const ui::Range& range) OVERRIDE; | 161 virtual bool DeleteRange(const ui::Range& range) OVERRIDE; |
| 158 virtual bool GetTextFromRange( | 162 virtual bool GetTextFromRange( |
| 159 const ui::Range& range, | 163 const ui::Range& range, |
| 160 const base::Callback<void(const string16&)>& callback) OVERRIDE; | 164 const base::Callback<void(const string16&)>& callback) OVERRIDE; |
| 161 virtual void OnInputMethodChanged() OVERRIDE; | 165 virtual void OnInputMethodChanged() OVERRIDE; |
| 162 virtual bool ChangeTextDirectionAndLayoutAlignment( | 166 virtual bool ChangeTextDirectionAndLayoutAlignment( |
| 163 base::i18n::TextDirection direction) OVERRIDE; | 167 base::i18n::TextDirection direction) OVERRIDE; |
| 164 virtual View* GetOwnerViewOfTextInputClient() OVERRIDE; | 168 virtual View* GetOwnerViewOfTextInputClient() OVERRIDE; |
| 165 | 169 |
| 170 // TODO(xji): might need to declare in TextInputClient. | |
| 171 // Merge SelectionModels |start| and |end| so that selection start is | |
| 172 // the selection start from |start|, while selection end, caret position, | |
| 173 // and caret placement are values from |end|. Set the merged model. | |
| 174 // Returns false if the operation is not supported. | |
| 175 bool SetMergedSelectionModel(const gfx::SelectionModel& start, | |
|
msw
2011/08/03 19:46:39
I think we ought to inline this function at its on
| |
| 176 const gfx::SelectionModel& end); | |
| 177 | |
| 166 // Overridden from TextfieldViewsModel::Delegate: | 178 // Overridden from TextfieldViewsModel::Delegate: |
| 167 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; | 179 virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE; |
| 168 | 180 |
| 169 // Returns the TextfieldViewsModel's text/cursor/selection rendering model. | 181 // Returns the TextfieldViewsModel's text/cursor/selection rendering model. |
| 170 gfx::RenderText* GetRenderText() const; | 182 gfx::RenderText* GetRenderText() const; |
| 171 | 183 |
| 172 // A callback function to periodically update the cursor state. | 184 // A callback function to periodically update the cursor state. |
| 173 void UpdateCursor(); | 185 void UpdateCursor(); |
| 174 | 186 |
| 175 // Repaint the cursor. | 187 // Repaint the cursor. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 scoped_ptr<views::MenuItemView> context_menu_menu_; | 263 scoped_ptr<views::MenuItemView> context_menu_menu_; |
| 252 | 264 |
| 253 scoped_ptr<TouchSelectionController> touch_selection_controller_; | 265 scoped_ptr<TouchSelectionController> touch_selection_controller_; |
| 254 | 266 |
| 255 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); | 267 DISALLOW_COPY_AND_ASSIGN(NativeTextfieldViews); |
| 256 }; | 268 }; |
| 257 | 269 |
| 258 } // namespace views | 270 } // namespace views |
| 259 | 271 |
| 260 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ | 272 #endif // VIEWS_CONTROLS_TEXTFIELD_NATIVE_TEXTFIELD_VIEWS_H_ |
| OLD | NEW |