OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/old_frames/vista_frame.h" | 5 #include "chrome/browser/views/old_frames/vista_frame.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlapp.h> | 9 #include <atlapp.h> |
10 #include <atltheme.h> | 10 #include <atltheme.h> |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 bool VistaFrame::IsMaximized() { | 581 bool VistaFrame::IsMaximized() { |
582 return !!IsZoomed(); | 582 return !!IsZoomed(); |
583 } | 583 } |
584 | 584 |
585 gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { | 585 gfx::Rect VistaFrame::GetBoundsForContentBounds(const gfx::Rect content_rect) { |
586 if (tab_contents_container_->x() == 0 && | 586 if (tab_contents_container_->x() == 0 && |
587 tab_contents_container_->width() == 0) { | 587 tab_contents_container_->width() == 0) { |
588 Layout(); | 588 Layout(); |
589 } | 589 } |
590 | 590 |
591 CPoint p(0, 0); | 591 gfx::Point p; |
592 ChromeViews::View::ConvertPointToViewContainer(tab_contents_container_, &p); | 592 ChromeViews::View::ConvertPointToViewContainer(tab_contents_container_, &p); |
593 CRect bounds; | 593 CRect bounds; |
594 GetBounds(&bounds, true); | 594 GetBounds(&bounds, true); |
595 | 595 |
596 gfx::Rect r; | 596 gfx::Rect r; |
597 r.set_x(content_rect.x() - p.x); | 597 r.set_x(content_rect.x() - p.x()); |
598 r.set_y(content_rect.y() - p.y); | 598 r.set_y(content_rect.y() - p.y()); |
599 r.set_width(p.x + content_rect.width() + | 599 r.set_width(p.x() + content_rect.width() + |
600 (bounds.Width() - (p.x + tab_contents_container_->width()))); | 600 (bounds.Width() - (p.x() + tab_contents_container_->width()))); |
601 r.set_height(p.y + content_rect.height() + | 601 r.set_height(p.y() + content_rect.height() + |
602 (bounds.Height() - (p.y + | 602 (bounds.Height() - (p.y() + |
603 tab_contents_container_->height()))); | 603 tab_contents_container_->height()))); |
604 return r; | 604 return r; |
605 } | 605 } |
606 | 606 |
607 void VistaFrame::InfoBubbleShowing() { | 607 void VistaFrame::InfoBubbleShowing() { |
608 ignore_ncactivate_ = true; | 608 ignore_ncactivate_ = true; |
609 } | 609 } |
610 | 610 |
611 ToolbarStarToggle* VistaFrame::GetStarButton() const { | 611 ToolbarStarToggle* VistaFrame::GetStarButton() const { |
612 return NULL; | 612 return NULL; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 (LPARAM)MAKELONG(pt.x, pt.y), | 965 (LPARAM)MAKELONG(pt.x, pt.y), |
966 &l_res); | 966 &l_res); |
967 | 967 |
968 if (dwm_processed) { | 968 if (dwm_processed) { |
969 return l_res; | 969 return l_res; |
970 } | 970 } |
971 | 971 |
972 CRect cr; | 972 CRect cr; |
973 GetBounds(&cr, false); | 973 GetBounds(&cr, false); |
974 | 974 |
975 CPoint tab_pt(pt); | 975 gfx::Point tab_pt(pt); |
976 ChromeViews::View::ConvertPointToView(NULL, tabstrip_, &tab_pt); | 976 ChromeViews::View::ConvertPointToView(NULL, tabstrip_, &tab_pt); |
977 | 977 |
978 // If we are over the tabstrip | 978 // If we are over the tabstrip |
979 if (tab_pt.x > 0 && tab_pt.y >= kTabShadowSize && | 979 if (tab_pt.x() > 0 && tab_pt.y() >= kTabShadowSize && |
980 tab_pt.x < tabstrip_->width() && | 980 tab_pt.x() < tabstrip_->width() && |
981 tab_pt.y < tabstrip_->height()) { | 981 tab_pt.y() < tabstrip_->height()) { |
982 ChromeViews::View* v = tabstrip_->GetViewForPoint(tab_pt); | 982 ChromeViews::View* v = tabstrip_->GetViewForPoint(tab_pt.ToPOINT()); |
983 if (v == tabstrip_) | 983 if (v == tabstrip_) |
984 return HTCAPTION; | 984 return HTCAPTION; |
985 | 985 |
986 // If the view under mouse is a tab, check if the tab strip allows tab | 986 // If the view under mouse is a tab, check if the tab strip allows tab |
987 // dragging or not. If not, return caption to get window dragging. | 987 // dragging or not. If not, return caption to get window dragging. |
988 if (v->GetClassName() == Tab::kTabClassName && | 988 if (v->GetClassName() == Tab::kTabClassName && |
989 !tabstrip_->HasAvailableDragActions()) | 989 !tabstrip_->HasAvailableDragActions()) |
990 return HTCAPTION; | 990 return HTCAPTION; |
991 | 991 |
992 return HTCLIENT; | 992 return HTCLIENT; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 // 2 is the minimize button. | 1356 // 2 is the minimize button. |
1357 UpdatePosition(titlebar_info, 2, &min_x, &max_x, &max_y); | 1357 UpdatePosition(titlebar_info, 2, &min_x, &max_x, &max_y); |
1358 // 3 is the maximize button. | 1358 // 3 is the maximize button. |
1359 UpdatePosition(titlebar_info, 3, &min_x, &max_x, &max_y); | 1359 UpdatePosition(titlebar_info, 3, &min_x, &max_x, &max_y); |
1360 // 5 is the close button. | 1360 // 5 is the close button. |
1361 UpdatePosition(titlebar_info, 5, &min_x, &max_x, &max_y); | 1361 UpdatePosition(titlebar_info, 5, &min_x, &max_x, &max_y); |
1362 | 1362 |
1363 if (min_x != std::numeric_limits<int>::max() && | 1363 if (min_x != std::numeric_limits<int>::max() && |
1364 max_x != std::numeric_limits<int>::min() && | 1364 max_x != std::numeric_limits<int>::min() && |
1365 max_y != std::numeric_limits<int>::min()) { | 1365 max_y != std::numeric_limits<int>::min()) { |
1366 CPoint screen_drag_point(event.x(), event.y()); | 1366 gfx::Point screen_drag_point(event.x(), event.y()); |
1367 ConvertPointToScreen(this, &screen_drag_point); | 1367 ConvertPointToScreen(this, &screen_drag_point); |
1368 if (screen_drag_point.x >= min_x && screen_drag_point.x <= max_x && | 1368 if (screen_drag_point.x() >= min_x && screen_drag_point.x() <= max_x && |
1369 screen_drag_point.y <= max_y) { | 1369 screen_drag_point.y() <= max_y) { |
1370 return false; | 1370 return false; |
1371 } | 1371 } |
1372 } | 1372 } |
1373 return true; | 1373 return true; |
1374 } | 1374 } |
1375 | 1375 |
1376 LRESULT VistaFrame::OnMouseRange(UINT u_msg, WPARAM w_param, LPARAM l_param, | 1376 LRESULT VistaFrame::OnMouseRange(UINT u_msg, WPARAM w_param, LPARAM l_param, |
1377 BOOL& handled) { | 1377 BOOL& handled) { |
1378 // Tooltip handling is broken in Vista when using custom frames, so | 1378 // Tooltip handling is broken in Vista when using custom frames, so |
1379 // we have to implement a lot of this ourselves. | 1379 // we have to implement a lot of this ourselves. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 &active_bookmark_bar_); | 1627 &active_bookmark_bar_); |
1628 | 1628 |
1629 // Only do a layout if the current contents is non-null. We assume that if the | 1629 // Only do a layout if the current contents is non-null. We assume that if the |
1630 // contents is NULL, we're either being destroyed, or ShowTabContents is going | 1630 // contents is NULL, we're either being destroyed, or ShowTabContents is going |
1631 // to be invoked with a non-null TabContents again so that there is no need | 1631 // to be invoked with a non-null TabContents again so that there is no need |
1632 // in doing a layout now (and would result in extra work/invalidation on | 1632 // in doing a layout now (and would result in extra work/invalidation on |
1633 // tab switches). | 1633 // tab switches). |
1634 if (changed && current_tab) | 1634 if (changed && current_tab) |
1635 Layout(); | 1635 Layout(); |
1636 } | 1636 } |
OLD | NEW |