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 #include "views/controls/textfield/native_textfield_views.h" | 5 #include "views/controls/textfield/native_textfield_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 SetContextMenuController(this); | 79 SetContextMenuController(this); |
80 } | 80 } |
81 | 81 |
82 NativeTextfieldViews::~NativeTextfieldViews() { | 82 NativeTextfieldViews::~NativeTextfieldViews() { |
83 } | 83 } |
84 | 84 |
85 //////////////////////////////////////////////////////////////////////////////// | 85 //////////////////////////////////////////////////////////////////////////////// |
86 // NativeTextfieldViews, View overrides: | 86 // NativeTextfieldViews, View overrides: |
87 | 87 |
88 bool NativeTextfieldViews::OnMousePressed(const views::MouseEvent& e) { | 88 bool NativeTextfieldViews::OnMousePressed(const views::MouseEvent& event) { |
89 if (HandleMousePressed(e)) | 89 if (HandleMousePressed(event)) |
90 SchedulePaint(); | 90 SchedulePaint(); |
91 return true; | 91 return true; |
92 } | 92 } |
93 | 93 |
94 bool NativeTextfieldViews::OnMouseDragged(const views::MouseEvent& e) { | 94 bool NativeTextfieldViews::OnMouseDragged(const views::MouseEvent& event) { |
95 size_t pos = FindCursorPosition(e.location()); | 95 size_t pos = FindCursorPosition(event.location()); |
96 if (model_->MoveCursorTo(pos, true)) { | 96 if (model_->MoveCursorTo(pos, true)) { |
97 UpdateCursorBoundsAndTextOffset(); | 97 UpdateCursorBoundsAndTextOffset(); |
98 SchedulePaint(); | 98 SchedulePaint(); |
99 } | 99 } |
100 return true; | 100 return true; |
101 } | 101 } |
102 | 102 |
103 void NativeTextfieldViews::OnMouseReleased(const views::MouseEvent& e, | 103 bool NativeTextfieldViews::OnKeyPressed(const views::KeyEvent& event) { |
104 bool canceled) { | |
105 } | |
106 | |
107 bool NativeTextfieldViews::OnKeyPressed(const views::KeyEvent& e) { | |
108 // OnKeyPressed/OnKeyReleased/OnFocus/OnBlur will never be invoked on | 104 // OnKeyPressed/OnKeyReleased/OnFocus/OnBlur will never be invoked on |
109 // NativeTextfieldViews as it will never gain focus. | 105 // NativeTextfieldViews as it will never gain focus. |
110 NOTREACHED(); | 106 NOTREACHED(); |
111 return false; | 107 return false; |
112 } | 108 } |
113 | 109 |
114 bool NativeTextfieldViews::OnKeyReleased(const views::KeyEvent& e) { | 110 bool NativeTextfieldViews::OnKeyReleased(const views::KeyEvent& event) { |
115 NOTREACHED(); | 111 NOTREACHED(); |
116 return false; | 112 return false; |
117 } | 113 } |
118 | 114 |
119 void NativeTextfieldViews::OnPaint(gfx::Canvas* canvas) { | 115 void NativeTextfieldViews::OnPaint(gfx::Canvas* canvas) { |
120 text_border_->set_has_focus(textfield_->HasFocus()); | 116 text_border_->set_has_focus(textfield_->HasFocus()); |
121 OnPaintBackground(canvas); | 117 OnPaintBackground(canvas); |
122 PaintTextAndCursor(canvas); | 118 PaintTextAndCursor(canvas); |
123 if (textfield_->draw_border()) | 119 if (textfield_->draw_border()) |
124 OnPaintBorder(canvas); | 120 OnPaintBorder(canvas); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 } | 903 } |
908 | 904 |
909 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, | 905 void NativeTextfieldViews::TextfieldBorder::SetInsets(int top, |
910 int left, | 906 int left, |
911 int bottom, | 907 int bottom, |
912 int right) { | 908 int right) { |
913 insets_.Set(top, left, bottom, right); | 909 insets_.Set(top, left, bottom, right); |
914 } | 910 } |
915 | 911 |
916 } // namespace views | 912 } // namespace views |
OLD | NEW |