Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: views/window/custom_frame_view.cc

Issue 577018: Support app menu and double-click close on upper left corner of window, part ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 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/window/custom_frame_view.h" 5 #include "views/window/custom_frame_view.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/font.h" 8 #include "app/gfx/font.h"
9 #include "app/gfx/path.h" 9 #include "app/gfx/path.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "app/theme_provider.h" 11 #include "app/theme_provider.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds( 131 gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds(
132 const gfx::Rect& client_bounds) const { 132 const gfx::Rect& client_bounds) const {
133 int top_height = NonClientTopBorderHeight(); 133 int top_height = NonClientTopBorderHeight();
134 int border_thickness = NonClientBorderThickness(); 134 int border_thickness = NonClientBorderThickness();
135 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness), 135 return gfx::Rect(std::max(0, client_bounds.x() - border_thickness),
136 std::max(0, client_bounds.y() - top_height), 136 std::max(0, client_bounds.y() - top_height),
137 client_bounds.width() + (2 * border_thickness), 137 client_bounds.width() + (2 * border_thickness),
138 client_bounds.height() + top_height + border_thickness); 138 client_bounds.height() + top_height + border_thickness);
139 } 139 }
140 140
141 gfx::Point CustomFrameView::GetSystemMenuPoint() const {
142 gfx::Point system_menu_point(
143 MirroredXCoordinateInsideView(FrameBorderThickness()),
144 NonClientTopBorderHeight() - BottomEdgeThicknessWithinNonClientHeight());
145 ConvertPointToScreen(this, &system_menu_point);
146 return system_menu_point;
147 }
148
149 int CustomFrameView::NonClientHitTest(const gfx::Point& point) { 141 int CustomFrameView::NonClientHitTest(const gfx::Point& point) {
150 // Then see if the point is within any of the window controls. 142 // Then see if the point is within any of the window controls.
151 if (close_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(point)) 143 if (close_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(point))
152 return HTCLOSE; 144 return HTCLOSE;
153 if (restore_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains( 145 if (restore_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(
154 point)) 146 point))
155 return HTMAXBUTTON; 147 return HTMAXBUTTON;
156 if (maximize_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains( 148 if (maximize_button_->GetBounds(APPLY_MIRRORING_TRANSFORMATION).Contains(
157 point)) 149 point))
158 return HTMAXBUTTON; 150 return HTMAXBUTTON;
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); 579 title_font_ = new gfx::Font(win_util::GetWindowTitleFont());
588 #elif defined(OS_LINUX) 580 #elif defined(OS_LINUX)
589 // TODO: need to resolve what font this is. 581 // TODO: need to resolve what font this is.
590 title_font_ = new gfx::Font(); 582 title_font_ = new gfx::Font();
591 #endif 583 #endif
592 initialized = true; 584 initialized = true;
593 } 585 }
594 } 586 }
595 587
596 } // namespace views 588 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698