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

Side by Side Diff: chrome/views/non_client_view.cc

Issue 21116: Support custom border widths. Allow user to resize the window (instead of do... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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
« no previous file with comments | « chrome/browser/views/frame/aero_glass_non_client_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/views/non_client_view.h" 5 #include "chrome/views/non_client_view.h"
6 6
7 namespace views { 7 namespace views {
8 8
9 const int NonClientView::kClientEdgeThickness = 1; 9 const int NonClientView::kClientEdgeThickness = 1;
10 10
11 int NonClientView::GetHTComponentForFrame(const gfx::Point& point, 11 int NonClientView::GetHTComponentForFrame(const gfx::Point& point,
12 int top_resize_border_height, 12 int top_resize_border_height,
13 int resize_border_thickness, 13 int resize_border_thickness,
14 int resize_corner_size, 14 int resize_corner_size,
15 bool can_resize) { 15 bool can_resize) {
16 int component = HTNOWHERE; 16 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for
17 // a |resize_corner_size|-length strip of both the side and top borders, but
18 // only to return HTBOTTOMLEFT/HTBOTTOMRIGHT along the bottom border + corner
19 // (not the side border). Vista goes further and doesn't return these on any
20 // of the side borders. Here we copy the XP behavior.
21 int component;
17 if (point.x() < resize_border_thickness) { 22 if (point.x() < resize_border_thickness) {
18 if (point.y() < resize_corner_size) { 23 if (point.y() < resize_corner_size)
19 component = HTTOPLEFT; 24 component = HTTOPLEFT;
20 } else if (point.y() >= (height() - resize_corner_size)) { 25 else if (point.y() >= (height() - resize_border_thickness))
21 component = HTBOTTOMLEFT; 26 component = HTBOTTOMLEFT;
22 } else { 27 else
23 component = HTLEFT; 28 component = HTLEFT;
24 } 29 } else if (point.x() >= (width() - resize_border_thickness)) {
25 } else if (point.x() < resize_corner_size) { 30 if (point.y() < resize_corner_size)
26 if (point.y() < top_resize_border_height) { 31 component = HTTOPRIGHT;
32 else if (point.y() >= (height() - resize_border_thickness))
33 component = HTBOTTOMRIGHT;
34 else
35 component = HTRIGHT;
36 } else if (point.y() < top_resize_border_height) {
37 if (point.x() < resize_corner_size)
27 component = HTTOPLEFT; 38 component = HTTOPLEFT;
28 } else if (point.y() >= (height() - resize_border_thickness)) { 39 else if (point.x() >= (width() - resize_corner_size))
40 component = HTTOPRIGHT;
41 else
42 component = HTTOP;
43 } else if (point.y() >= (height() - resize_border_thickness)) {
44 if (point.x() < resize_corner_size)
29 component = HTBOTTOMLEFT; 45 component = HTBOTTOMLEFT;
30 } 46 else if (point.x() >= (width() - resize_corner_size))
31 } else if (point.x() >= (width() - resize_border_thickness)) {
32 if (point.y() < resize_corner_size) {
33 component = HTTOPRIGHT;
34 } else if (point.y() >= (height() - resize_corner_size)) {
35 component = HTBOTTOMRIGHT; 47 component = HTBOTTOMRIGHT;
36 } else { 48 else
37 component = HTRIGHT; 49 component = HTBOTTOM;
38 } 50 } else {
39 } else if (point.x() >= (width() - resize_corner_size)) { 51 return HTNOWHERE;
40 if (point.y() < top_resize_border_height) {
41 component = HTTOPRIGHT;
42 } else if (point.y() >= (height() - resize_border_thickness)) {
43 component = HTBOTTOMRIGHT;
44 }
45 } else if (point.y() < top_resize_border_height) {
46 component = HTTOP;
47 } else if (point.y() >= (height() - resize_border_thickness)) {
48 component = HTBOTTOM;
49 } 52 }
50 53
51 // If the window can't be resized, there are no resize boundaries, just 54 // If the window can't be resized, there are no resize boundaries, just
52 // window borders. 55 // window borders.
53 if (component != HTNOWHERE) 56 return can_resize ? component : HTBORDER;
54 return can_resize ? component : HTBORDER;
55 return HTNOWHERE;
56 } 57 }
57 58
58 } // namespace views 59 } // namespace views
59 60
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/aero_glass_non_client_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698