OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/view.h" | 5 #include "views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #ifndef NDEBUG | 8 #ifndef NDEBUG |
9 #include <iostream> | 9 #include <iostream> |
10 #endif | 10 #endif |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (HitTest(location)) { | 529 if (HitTest(location)) { |
530 ConvertPointToScreen(this, &location); | 530 ConvertPointToScreen(this, &location); |
531 ShowContextMenu(location, true); | 531 ShowContextMenu(location, true); |
532 } | 532 } |
533 } else { | 533 } else { |
534 OnMouseReleased(e, canceled); | 534 OnMouseReleased(e, canceled); |
535 } | 535 } |
536 // WARNING: we may have been deleted. | 536 // WARNING: we may have been deleted. |
537 } | 537 } |
538 | 538 |
| 539 #if defined(TOUCH_UI) |
| 540 bool View::ProcessTouchEvent(const TouchEvent& e) { |
| 541 // TODO(rjkroege): Implement a grab scheme similar to as |
| 542 // as is found in MousePressed. |
| 543 const bool result = OnTouchEvent(e); |
| 544 return result; |
| 545 } |
| 546 #endif |
| 547 |
539 void View::AddChildView(View* v) { | 548 void View::AddChildView(View* v) { |
540 AddChildView(static_cast<int>(child_views_.size()), v); | 549 AddChildView(static_cast<int>(child_views_.size()), v); |
541 } | 550 } |
542 | 551 |
543 void View::AddChildView(int index, View* v) { | 552 void View::AddChildView(int index, View* v) { |
544 CHECK(v != this) << "You cannot add a view as its own child"; | 553 CHECK(v != this) << "You cannot add a view as its own child"; |
545 | 554 |
546 // Remove the view from its current parent if any. | 555 // Remove the view from its current parent if any. |
547 if (v->GetParent()) | 556 if (v->GetParent()) |
548 v->GetParent()->RemoveChildView(v); | 557 v->GetParent()->RemoveChildView(v); |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 | 1291 |
1283 void View::OnMouseMoved(const MouseEvent& e) { | 1292 void View::OnMouseMoved(const MouseEvent& e) { |
1284 } | 1293 } |
1285 | 1294 |
1286 void View::OnMouseEntered(const MouseEvent& e) { | 1295 void View::OnMouseEntered(const MouseEvent& e) { |
1287 } | 1296 } |
1288 | 1297 |
1289 void View::OnMouseExited(const MouseEvent& e) { | 1298 void View::OnMouseExited(const MouseEvent& e) { |
1290 } | 1299 } |
1291 | 1300 |
| 1301 #if defined(TOUCH_UI) |
| 1302 bool View::OnTouchEvent(const TouchEvent& event) { |
| 1303 DLOG(INFO) << "visited the OnTouchEvent"; |
| 1304 return false; |
| 1305 } |
| 1306 #endif |
| 1307 |
1292 void View::SetMouseHandler(View *new_mouse_handler) { | 1308 void View::SetMouseHandler(View *new_mouse_handler) { |
1293 // It is valid for new_mouse_handler to be NULL | 1309 // It is valid for new_mouse_handler to be NULL |
1294 if (parent_) | 1310 if (parent_) |
1295 parent_->SetMouseHandler(new_mouse_handler); | 1311 parent_->SetMouseHandler(new_mouse_handler); |
1296 } | 1312 } |
1297 | 1313 |
1298 void View::SetVisible(bool flag) { | 1314 void View::SetVisible(bool flag) { |
1299 if (flag != is_visible_) { | 1315 if (flag != is_visible_) { |
1300 // If the tab is currently visible, schedule paint to | 1316 // If the tab is currently visible, schedule paint to |
1301 // refresh parent | 1317 // refresh parent |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 possible_drag = false; | 1536 possible_drag = false; |
1521 start_pt = gfx::Point(); | 1537 start_pt = gfx::Point(); |
1522 } | 1538 } |
1523 | 1539 |
1524 void View::DragInfo::PossibleDrag(const gfx::Point& p) { | 1540 void View::DragInfo::PossibleDrag(const gfx::Point& p) { |
1525 possible_drag = true; | 1541 possible_drag = true; |
1526 start_pt = p; | 1542 start_pt = p; |
1527 } | 1543 } |
1528 | 1544 |
1529 } // namespace | 1545 } // namespace |
OLD | NEW |