OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/panels/panel_frame_view.h" | 5 #include "chrome/browser/ui/panels/panel_frame_view.h" |
6 | 6 |
7 #include "chrome/browser/themes/theme_service.h" | 7 #include "chrome/browser/themes/theme_service.h" |
8 #include "chrome/browser/themes/theme_service_factory.h" | 8 #include "chrome/browser/themes/theme_service_factory.h" |
9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
10 #include "chrome/browser/ui/panels/panel_constants.h" | 10 #include "chrome/browser/ui/panels/panel_constants.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 paint_state = PAINT_AS_ACTIVE; | 418 paint_state = PAINT_AS_ACTIVE; |
419 else | 419 else |
420 paint_state = PAINT_AS_INACTIVE; | 420 paint_state = PAINT_AS_INACTIVE; |
421 | 421 |
422 UpdateControlStyles(paint_state); | 422 UpdateControlStyles(paint_state); |
423 PaintFrameBackground(canvas); | 423 PaintFrameBackground(canvas); |
424 PaintFrameEdge(canvas); | 424 PaintFrameEdge(canvas); |
425 PaintDivider(canvas); | 425 PaintDivider(canvas); |
426 } | 426 } |
427 | 427 |
428 bool PanelFrameView::OnMousePressed(const views::MouseEvent& event) { | 428 bool PanelFrameView::OnMousePressed(const ui::MouseEvent& event) { |
429 if (event.IsOnlyLeftMouseButton()) { | 429 if (event.IsOnlyLeftMouseButton()) { |
430 // |event.location| is in the view's coordinate system. Convert it to the | 430 // |event.location| is in the view's coordinate system. Convert it to the |
431 // screen coordinate system. | 431 // screen coordinate system. |
432 gfx::Point mouse_location = event.location(); | 432 gfx::Point mouse_location = event.location(); |
433 views::View::ConvertPointToScreen(this, &mouse_location); | 433 views::View::ConvertPointToScreen(this, &mouse_location); |
434 | 434 |
435 // If the mouse location falls within the resizing area of the titlebar, | 435 // If the mouse location falls within the resizing area of the titlebar, |
436 // do not handle the event so that the system resizing logic could kick in. | 436 // do not handle the event so that the system resizing logic could kick in. |
437 if (!panel_view_->IsWithinResizingArea(mouse_location) && | 437 if (!panel_view_->IsWithinResizingArea(mouse_location) && |
438 panel_view_->OnTitlebarMousePressed(mouse_location)) | 438 panel_view_->OnTitlebarMousePressed(mouse_location)) |
439 return true; | 439 return true; |
440 } | 440 } |
441 return NonClientFrameView::OnMousePressed(event); | 441 return NonClientFrameView::OnMousePressed(event); |
442 } | 442 } |
443 | 443 |
444 bool PanelFrameView::OnMouseDragged(const views::MouseEvent& event) { | 444 bool PanelFrameView::OnMouseDragged(const ui::MouseEvent& event) { |
445 // |event.location| is in the view's coordinate system. Convert it to the | 445 // |event.location| is in the view's coordinate system. Convert it to the |
446 // screen coordinate system. | 446 // screen coordinate system. |
447 gfx::Point mouse_location = event.location(); | 447 gfx::Point mouse_location = event.location(); |
448 views::View::ConvertPointToScreen(this, &mouse_location); | 448 views::View::ConvertPointToScreen(this, &mouse_location); |
449 | 449 |
450 if (panel_view_->OnTitlebarMouseDragged(mouse_location)) | 450 if (panel_view_->OnTitlebarMouseDragged(mouse_location)) |
451 return true; | 451 return true; |
452 return NonClientFrameView::OnMouseDragged(event); | 452 return NonClientFrameView::OnMouseDragged(event); |
453 } | 453 } |
454 | 454 |
455 void PanelFrameView::OnMouseReleased(const views::MouseEvent& event) { | 455 void PanelFrameView::OnMouseReleased(const ui::MouseEvent& event) { |
456 if (panel_view_->OnTitlebarMouseReleased( | 456 if (panel_view_->OnTitlebarMouseReleased( |
457 event.IsControlDown() ? panel::APPLY_TO_ALL : panel::NO_MODIFIER)) | 457 event.IsControlDown() ? panel::APPLY_TO_ALL : panel::NO_MODIFIER)) |
458 return; | 458 return; |
459 NonClientFrameView::OnMouseReleased(event); | 459 NonClientFrameView::OnMouseReleased(event); |
460 } | 460 } |
461 | 461 |
462 void PanelFrameView::OnMouseCaptureLost() { | 462 void PanelFrameView::OnMouseCaptureLost() { |
463 if (panel_view_->OnTitlebarMouseCaptureLost()) | 463 if (panel_view_->OnTitlebarMouseCaptureLost()) |
464 return; | 464 return; |
465 NonClientFrameView::OnMouseCaptureLost(); | 465 NonClientFrameView::OnMouseCaptureLost(); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 625 |
626 void PanelFrameView::PaintDivider(gfx::Canvas* canvas) { | 626 void PanelFrameView::PaintDivider(gfx::Canvas* canvas) { |
627 // Draw the divider between the titlebar and the client area only if the panel | 627 // Draw the divider between the titlebar and the client area only if the panel |
628 // is big enough to show more than the titlebar. | 628 // is big enough to show more than the titlebar. |
629 if (height() > TitlebarHeight()) { | 629 if (height() > TitlebarHeight()) { |
630 canvas->DrawLine(gfx::Point(0, panel::kTitlebarHeight - 1), | 630 canvas->DrawLine(gfx::Point(0, panel::kTitlebarHeight - 1), |
631 gfx::Point(width() - 1, panel::kTitlebarHeight - 1), | 631 gfx::Point(width() - 1, panel::kTitlebarHeight - 1), |
632 kDividerColor); | 632 kDividerColor); |
633 } | 633 } |
634 } | 634 } |
OLD | NEW |