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 "ui/views/window/custom_frame_view.h" | 5 #include "ui/views/window/custom_frame_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
11 #include "grit/ui_strings.h" | 11 #include "grit/ui_strings.h" |
12 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/font.h" | 16 #include "ui/gfx/font.h" |
17 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
18 #include "ui/gfx/path.h" | 18 #include "ui/gfx/path.h" |
19 #include "ui/views/color_constants.h" | 19 #include "ui/views/color_constants.h" |
20 #include "ui/views/controls/button/image_button.h" | 20 #include "ui/views/controls/button/image_button.h" |
21 | |
22 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
23 #include "ui/views/linux_ui/linux_ui.h" | |
24 #endif | |
25 | |
21 #include "ui/views/views_delegate.h" | 26 #include "ui/views/views_delegate.h" |
22 #include "ui/views/widget/native_widget_aura.h" | 27 #include "ui/views/widget/native_widget_aura.h" |
23 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
24 #include "ui/views/widget/widget_delegate.h" | 29 #include "ui/views/widget/widget_delegate.h" |
25 #include "ui/views/window/client_view.h" | 30 #include "ui/views/window/client_view.h" |
26 #include "ui/views/window/frame_background.h" | 31 #include "ui/views/window/frame_background.h" |
27 #include "ui/views/window/window_resources.h" | 32 #include "ui/views/window/window_resources.h" |
28 #include "ui/views/window/window_shape.h" | 33 #include "ui/views/window/window_shape.h" |
29 | 34 |
30 namespace views { | 35 namespace views { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 // CustomFrameView, public: | 78 // CustomFrameView, public: |
74 | 79 |
75 CustomFrameView::CustomFrameView() | 80 CustomFrameView::CustomFrameView() |
76 : frame_(NULL), | 81 : frame_(NULL), |
77 window_icon_(NULL), | 82 window_icon_(NULL), |
78 minimize_button_(NULL), | 83 minimize_button_(NULL), |
79 maximize_button_(NULL), | 84 maximize_button_(NULL), |
80 restore_button_(NULL), | 85 restore_button_(NULL), |
81 close_button_(NULL), | 86 close_button_(NULL), |
82 should_show_maximize_button_(false), | 87 should_show_maximize_button_(false), |
83 frame_background_(new FrameBackground()) { | 88 frame_background_(new FrameBackground()), |
89 minimum_title_bar_x_(0), | |
90 maximum_title_bar_x_(INT_MAX) { | |
91 trailing_buttons_.push_back(views::FRAME_BUTTON_MINIMIZE); | |
92 trailing_buttons_.push_back(views::FRAME_BUTTON_MAXIMIZE); | |
93 trailing_buttons_.push_back(views::FRAME_BUTTON_CLOSE); | |
84 } | 94 } |
85 | 95 |
86 CustomFrameView::~CustomFrameView() { | 96 CustomFrameView::~CustomFrameView() { |
87 } | 97 } |
88 | 98 |
89 void CustomFrameView::Init(Widget* frame) { | 99 void CustomFrameView::Init(Widget* frame) { |
90 frame_ = frame; | 100 frame_ = frame; |
91 | 101 |
92 close_button_ = new ImageButton(this); | 102 close_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_CLOSE, |
93 close_button_->SetAccessibleName( | 103 IDR_CLOSE, IDR_CLOSE_H, IDR_CLOSE_P); |
94 l10n_util::GetStringUTF16(IDS_APP_ACCNAME_CLOSE)); | |
95 | |
96 // Close button images will be set in LayoutWindowControls(). | |
97 AddChildView(close_button_); | |
98 | 104 |
99 minimize_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_MINIMIZE, | 105 minimize_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_MINIMIZE, |
100 IDR_MINIMIZE, IDR_MINIMIZE_H, IDR_MINIMIZE_P); | 106 IDR_MINIMIZE, IDR_MINIMIZE_H, IDR_MINIMIZE_P); |
101 | 107 |
102 maximize_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_MAXIMIZE, | 108 maximize_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_MAXIMIZE, |
103 IDR_MAXIMIZE, IDR_MAXIMIZE_H, IDR_MAXIMIZE_P); | 109 IDR_MAXIMIZE, IDR_MAXIMIZE_H, IDR_MAXIMIZE_P); |
104 | 110 |
105 restore_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_RESTORE, | 111 restore_button_ = InitWindowCaptionButton(IDS_APP_ACCNAME_RESTORE, |
106 IDR_RESTORE, IDR_RESTORE_H, IDR_RESTORE_P); | 112 IDR_RESTORE, IDR_RESTORE_H, IDR_RESTORE_P); |
107 | 113 |
108 should_show_maximize_button_ = frame_->widget_delegate()->CanMaximize(); | 114 should_show_maximize_button_ = frame_->widget_delegate()->CanMaximize(); |
109 | 115 |
110 if (frame_->widget_delegate()->ShouldShowWindowIcon()) { | 116 if (frame_->widget_delegate()->ShouldShowWindowIcon()) { |
111 window_icon_ = new ImageButton(this); | 117 window_icon_ = new ImageButton(this); |
112 AddChildView(window_icon_); | 118 AddChildView(window_icon_); |
113 } | 119 } |
120 | |
121 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | |
122 views::LinuxUI* ui = views::LinuxUI::instance(); | |
123 if (ui) | |
124 ui->AddWindowButtonOrderObserver(this); | |
125 #endif | |
114 } | 126 } |
115 | 127 |
116 /////////////////////////////////////////////////////////////////////////////// | 128 /////////////////////////////////////////////////////////////////////////////// |
117 // CustomFrameView, NonClientFrameView implementation: | 129 // CustomFrameView, NonClientFrameView implementation: |
118 | 130 |
119 gfx::Rect CustomFrameView::GetBoundsForClientView() const { | 131 gfx::Rect CustomFrameView::GetBoundsForClientView() const { |
120 return client_view_bounds_; | 132 return client_view_bounds_; |
121 } | 133 } |
122 | 134 |
123 gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds( | 135 gfx::Rect CustomFrameView::GetWindowBoundsForClientBounds( |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 frame_->Close(); | 259 frame_->Close(); |
248 else if (sender == minimize_button_) | 260 else if (sender == minimize_button_) |
249 frame_->Minimize(); | 261 frame_->Minimize(); |
250 else if (sender == maximize_button_) | 262 else if (sender == maximize_button_) |
251 frame_->Maximize(); | 263 frame_->Maximize(); |
252 else if (sender == restore_button_) | 264 else if (sender == restore_button_) |
253 frame_->Restore(); | 265 frame_->Restore(); |
254 } | 266 } |
255 | 267 |
256 /////////////////////////////////////////////////////////////////////////////// | 268 /////////////////////////////////////////////////////////////////////////////// |
269 // CustomFrameView, WindowButtonOrderObserver: | |
270 | |
271 void CustomFrameView::OnWindowButtonOrderingChange( | |
272 const std::vector<views::FrameButton>& leading_buttons, | |
273 const std::vector<views::FrameButton>& trailing_buttons) { | |
274 leading_buttons_ = leading_buttons; | |
275 trailing_buttons_ = trailing_buttons; | |
276 } | |
277 | |
278 /////////////////////////////////////////////////////////////////////////////// | |
257 // CustomFrameView, private: | 279 // CustomFrameView, private: |
258 | 280 |
259 int CustomFrameView::FrameBorderThickness() const { | 281 int CustomFrameView::FrameBorderThickness() const { |
260 return frame_->IsMaximized() ? 0 : kFrameBorderThickness; | 282 return frame_->IsMaximized() ? 0 : kFrameBorderThickness; |
261 } | 283 } |
262 | 284 |
263 int CustomFrameView::NonClientBorderThickness() const { | 285 int CustomFrameView::NonClientBorderThickness() const { |
264 // In maximized mode, we don't show a client edge. | 286 // In maximized mode, we don't show a client edge. |
265 return FrameBorderThickness() + | 287 return FrameBorderThickness() + |
266 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); | 288 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); |
267 } | 289 } |
268 | 290 |
269 int CustomFrameView::NonClientTopBorderHeight() const { | 291 int CustomFrameView::NonClientTopBorderHeight() const { |
270 return std::max(FrameBorderThickness() + IconSize(), | 292 return std::max(FrameBorderThickness() + IconSize(), |
271 CaptionButtonY() + kCaptionButtonHeightWithPadding) + | 293 CaptionButtonY() + kCaptionButtonHeightWithPadding) + |
272 TitlebarBottomThickness(); | 294 TitlebarBottomThickness(); |
273 } | 295 } |
274 | 296 |
275 int CustomFrameView::CaptionButtonY() const { | 297 int CustomFrameView::CaptionButtonY() const { |
276 // Maximized buttons start at window top so that even if their images aren't | 298 // Maximized buttons start at window top so that even if their images aren't |
277 // drawn flush with the screen edge, they still obey Fitts' Law. | 299 // drawn flush with the screen edge, they still obey Fitts' Law. |
278 return frame_->IsMaximized() ? FrameBorderThickness() : kFrameShadowThickness; | 300 return frame_->IsMaximized() ? FrameBorderThickness() : kFrameBorderThickness; |
279 } | 301 } |
280 | 302 |
281 int CustomFrameView::TitlebarBottomThickness() const { | 303 int CustomFrameView::TitlebarBottomThickness() const { |
282 return kTitlebarTopAndBottomEdgeThickness + | 304 return kTitlebarTopAndBottomEdgeThickness + |
283 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); | 305 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); |
284 } | 306 } |
285 | 307 |
286 int CustomFrameView::IconSize() const { | 308 int CustomFrameView::IconSize() const { |
287 #if defined(OS_WIN) | 309 #if defined(OS_WIN) |
288 // This metric scales up if either the titlebar height or the titlebar font | 310 // This metric scales up if either the titlebar height or the titlebar font |
(...skipping 17 matching lines...) Expand all Loading... | |
306 // from below the 3D edge. | 328 // from below the 3D edge. |
307 int unavailable_px_at_top = frame_->IsMaximized() ? | 329 int unavailable_px_at_top = frame_->IsMaximized() ? |
308 frame_thickness : kTitlebarTopAndBottomEdgeThickness; | 330 frame_thickness : kTitlebarTopAndBottomEdgeThickness; |
309 // When the icon is shorter than the minimum space we reserve for the caption | 331 // When the icon is shorter than the minimum space we reserve for the caption |
310 // button, we vertically center it. We want to bias rounding to put extra | 332 // button, we vertically center it. We want to bias rounding to put extra |
311 // space above the icon, since the 3D edge (+ client edge, for restored | 333 // space above the icon, since the 3D edge (+ client edge, for restored |
312 // windows) below looks (to the eye) more like additional space than does the | 334 // windows) below looks (to the eye) more like additional space than does the |
313 // 3D edge (or nothing at all, for maximized windows) above; hence the +1. | 335 // 3D edge (or nothing at all, for maximized windows) above; hence the +1. |
314 int y = unavailable_px_at_top + (NonClientTopBorderHeight() - | 336 int y = unavailable_px_at_top + (NonClientTopBorderHeight() - |
315 unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2; | 337 unavailable_px_at_top - size - TitlebarBottomThickness() + 1) / 2; |
316 return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size); | 338 return gfx::Rect(frame_thickness + kIconLeftSpacing + minimum_title_bar_x_, |
339 y, size, size); | |
317 } | 340 } |
318 | 341 |
319 bool CustomFrameView::ShouldShowTitleBarAndBorder() const { | 342 bool CustomFrameView::ShouldShowTitleBarAndBorder() const { |
320 if (frame_->IsFullscreen()) | 343 if (frame_->IsFullscreen()) |
321 return false; | 344 return false; |
322 | 345 |
323 if (ViewsDelegate::views_delegate) { | 346 if (ViewsDelegate::views_delegate) { |
324 return !ViewsDelegate::views_delegate->WindowManagerProvidesTitleBar( | 347 return !ViewsDelegate::views_delegate->WindowManagerProvidesTitleBar( |
325 frame_->IsMaximized()); | 348 frame_->IsMaximized()); |
326 } | 349 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 | 482 |
460 SkColor CustomFrameView::GetFrameColor() const { | 483 SkColor CustomFrameView::GetFrameColor() const { |
461 return frame_->IsActive() ? kDefaultColorFrame : kDefaultColorFrameInactive; | 484 return frame_->IsActive() ? kDefaultColorFrame : kDefaultColorFrameInactive; |
462 } | 485 } |
463 | 486 |
464 const gfx::ImageSkia* CustomFrameView::GetFrameImage() const { | 487 const gfx::ImageSkia* CustomFrameView::GetFrameImage() const { |
465 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 488 return ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
466 frame_->IsActive() ? IDR_FRAME : IDR_FRAME_INACTIVE).ToImageSkia(); | 489 frame_->IsActive() ? IDR_FRAME : IDR_FRAME_INACTIVE).ToImageSkia(); |
467 } | 490 } |
468 | 491 |
492 void CustomFrameView::LayoutButton(ImageButton* button, int x, int y, | |
493 bool leading) { | |
flackr
2014/04/22 18:36:45
I don't think this wrapping conforms to the style
jonross
2014/04/23 18:53:53
Done.
| |
494 button->SetVisible(true); | |
495 button->SetImageAlignment(ImageButton::ALIGN_LEFT, | |
496 ImageButton::ALIGN_BOTTOM); | |
497 gfx::Size button_size = button->GetPreferredSize(); | |
498 | |
499 if (!leading) | |
500 x -= button_size.width(); | |
501 | |
502 button->SetBounds(x, y, button_size.width(), button_size.height()); | |
503 } | |
504 | |
469 void CustomFrameView::LayoutWindowControls() { | 505 void CustomFrameView::LayoutWindowControls() { |
470 close_button_->SetImageAlignment(ImageButton::ALIGN_LEFT, | 506 minimum_title_bar_x_ = 0; |
471 ImageButton::ALIGN_BOTTOM); | 507 maximum_title_bar_x_ = width(); |
472 int caption_y = CaptionButtonY(); | 508 int caption_y = CaptionButtonY(); |
473 bool is_maximized = frame_->IsMaximized(); | 509 bool is_maximized = frame_->IsMaximized(); |
474 // There should always be the same number of non-shadow pixels visible to the | 510 // There should always be the same number of non-shadow pixels visible to the |
475 // side of the caption buttons. In maximized mode we extend the rightmost | 511 // side of the caption buttons. In maximized mode we extend the edge button |
476 // button to the screen corner to obey Fitts' Law. | 512 // to the screen corner to obey Fitts' Law. |
477 int right_extra_width = is_maximized ? | 513 int extra_width = is_maximized ? |
478 (kFrameBorderThickness - kFrameShadowThickness) : 0; | 514 (kFrameBorderThickness - kFrameShadowThickness) : 0; |
479 gfx::Size close_button_size = close_button_->GetPreferredSize(); | 515 int next_button_x = FrameBorderThickness() + extra_width; |
480 close_button_->SetBounds(width() - FrameBorderThickness() - | |
481 right_extra_width - close_button_size.width(), caption_y, | |
482 close_button_size.width() + right_extra_width, | |
483 close_button_size.height()); | |
484 | 516 |
485 // When the window is restored, we show a maximized button; otherwise, we show | |
486 // a restore button. | |
487 bool is_restored = !is_maximized && !frame_->IsMinimized(); | 517 bool is_restored = !is_maximized && !frame_->IsMinimized(); |
488 ImageButton* invisible_button = is_restored ? restore_button_ | 518 ImageButton* invisible_button = is_restored ? restore_button_ |
489 : maximize_button_; | 519 : maximize_button_; |
490 invisible_button->SetVisible(false); | 520 invisible_button->SetVisible(false); |
491 | 521 |
492 ImageButton* visible_button = is_restored ? maximize_button_ | 522 ImageButton* button = NULL; |
493 : restore_button_; | 523 for (std::vector<views::FrameButton>::const_iterator it = |
494 FramePartImage normal_part, hot_part, pushed_part; | 524 leading_buttons_.begin(); it != leading_buttons_.end(); ++it) { |
495 int next_button_x; | 525 switch (*it) { |
496 if (should_show_maximize_button_) { | 526 case views::FRAME_BUTTON_MINIMIZE: { |
497 visible_button->SetVisible(true); | 527 button = minimize_button_; |
flackr
2014/04/22 18:36:45
What if the button order specifies multiple of the
jonross
2014/04/23 18:53:53
Currently the last specified instance will determi
| |
498 visible_button->SetImageAlignment(ImageButton::ALIGN_LEFT, | 528 break; |
499 ImageButton::ALIGN_BOTTOM); | 529 } |
500 gfx::Size visible_button_size = visible_button->GetPreferredSize(); | 530 case views::FRAME_BUTTON_MAXIMIZE: { |
501 visible_button->SetBounds(close_button_->x() - visible_button_size.width(), | 531 button = is_restored ? maximize_button_ : restore_button_; |
502 caption_y, visible_button_size.width(), | 532 if (!should_show_maximize_button_) { |
503 visible_button_size.height()); | 533 button->SetVisible(false); |
504 next_button_x = visible_button->x(); | 534 continue; |
505 } else { | 535 } |
506 visible_button->SetVisible(false); | 536 break; |
507 next_button_x = close_button_->x(); | 537 } |
538 case views::FRAME_BUTTON_CLOSE: { | |
539 button = close_button_; | |
540 break; | |
541 } | |
542 } | |
543 LayoutButton(button, next_button_x, caption_y, true); | |
544 next_button_x += button->width(); | |
545 minimum_title_bar_x_ = next_button_x; | |
508 } | 546 } |
509 | 547 |
510 minimize_button_->SetVisible(true); | 548 // Trailing buttions are laid out in a RTL fashion |
511 minimize_button_->SetImageAlignment(ImageButton::ALIGN_LEFT, | 549 next_button_x = width() - FrameBorderThickness() - extra_width; |
512 ImageButton::ALIGN_BOTTOM); | 550 for (std::vector<views::FrameButton>::const_reverse_iterator it = |
513 gfx::Size minimize_button_size = minimize_button_->GetPreferredSize(); | 551 trailing_buttons_.rbegin(); it != trailing_buttons_.rend(); ++it) { |
514 minimize_button_->SetBounds( | 552 switch (*it) { |
flackr
2014/04/22 18:36:45
This duplication should be avoided. Maybe a common
jonross
2014/04/23 18:53:53
Done.
| |
515 next_button_x - minimize_button_size.width(), caption_y, | 553 case views::FRAME_BUTTON_MINIMIZE: { |
516 minimize_button_size.width(), | 554 button = minimize_button_; |
517 minimize_button_size.height()); | 555 break; |
518 | 556 } |
519 normal_part = IDR_CLOSE; | 557 case views::FRAME_BUTTON_MAXIMIZE: { |
520 hot_part = IDR_CLOSE_H; | 558 button = is_restored ? maximize_button_ : restore_button_; |
521 pushed_part = IDR_CLOSE_P; | 559 if (!should_show_maximize_button_) { |
522 | 560 button->SetVisible(false); |
523 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 561 continue; |
524 | 562 } |
525 close_button_->SetImage(CustomButton::STATE_NORMAL, | 563 break; |
526 rb.GetImageNamed(normal_part).ToImageSkia()); | 564 } |
527 close_button_->SetImage(CustomButton::STATE_HOVERED, | 565 case views::FRAME_BUTTON_CLOSE: { |
528 rb.GetImageNamed(hot_part).ToImageSkia()); | 566 button = close_button_; |
529 close_button_->SetImage(CustomButton::STATE_PRESSED, | 567 break; |
530 rb.GetImageNamed(pushed_part).ToImageSkia()); | 568 } |
569 } | |
570 LayoutButton(button, next_button_x, caption_y, false); | |
571 next_button_x = button->x(); | |
572 maximum_title_bar_x_ = next_button_x; | |
573 } | |
531 } | 574 } |
532 | 575 |
533 void CustomFrameView::LayoutTitleBar() { | 576 void CustomFrameView::LayoutTitleBar() { |
534 // The window title position is calculated based on the icon position, even | 577 // The window title position is calculated based on the icon position, even |
535 // when there is no icon. | 578 // when there is no icon. |
536 gfx::Rect icon_bounds(IconBounds()); | 579 gfx::Rect icon_bounds(IconBounds()); |
537 bool show_window_icon = window_icon_ != NULL; | 580 bool show_window_icon = window_icon_ != NULL; |
538 if (show_window_icon) | 581 if (show_window_icon) |
539 window_icon_->SetBoundsRect(icon_bounds); | 582 window_icon_->SetBoundsRect(icon_bounds); |
540 | 583 |
541 // The offset between the window left edge and the title text. | 584 // The offset between the window left edge and the title text. |
542 int title_x = show_window_icon ? icon_bounds.right() + kTitleIconOffsetX | 585 int title_x = show_window_icon ? icon_bounds.right() + kTitleIconOffsetX |
543 : icon_bounds.x(); | 586 : icon_bounds.x(); |
544 int title_height = GetTitleFontList().GetHeight(); | 587 int title_height = GetTitleFontList().GetHeight(); |
545 // We bias the title position so that when the difference between the icon and | 588 // We bias the title position so that when the difference between the icon and |
546 // title heights is odd, the extra pixel of the title is above the vertical | 589 // title heights is odd, the extra pixel of the title is above the vertical |
547 // midline rather than below. This compensates for how the icon is already | 590 // midline rather than below. This compensates for how the icon is already |
548 // biased downwards (see IconBounds()) and helps prevent descenders on the | 591 // biased downwards (see IconBounds()) and helps prevent descenders on the |
549 // title from overlapping the 3D edge at the bottom of the titlebar. | 592 // title from overlapping the 3D edge at the bottom of the titlebar. |
550 title_bounds_.SetRect(title_x, | 593 title_bounds_.SetRect(title_x, |
551 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2), | 594 icon_bounds.y() + ((icon_bounds.height() - title_height - 1) / 2), |
552 std::max(0, minimize_button_->x() - kTitleCaptionSpacing - | 595 std::max(0, maximum_title_bar_x_ - kTitleCaptionSpacing - |
flackr
2014/04/22 18:36:45
Seems like it's very important that this is called
jonross
2014/04/23 18:53:53
Not guaranteed by API. But it is private, and curr
| |
553 title_x), title_height); | 596 title_x), title_height); |
554 } | 597 } |
555 | 598 |
556 void CustomFrameView::LayoutClientView() { | 599 void CustomFrameView::LayoutClientView() { |
557 if (!ShouldShowTitleBarAndBorder()) { | 600 if (!ShouldShowTitleBarAndBorder()) { |
558 client_view_bounds_ = bounds(); | 601 client_view_bounds_ = bounds(); |
559 return; | 602 return; |
560 } | 603 } |
561 | 604 |
562 int top_height = NonClientTopBorderHeight(); | 605 int top_height = NonClientTopBorderHeight(); |
(...skipping 15 matching lines...) Expand all Loading... | |
578 rb.GetImageNamed(normal_image_id).ToImageSkia()); | 621 rb.GetImageNamed(normal_image_id).ToImageSkia()); |
579 button->SetImage(CustomButton::STATE_HOVERED, | 622 button->SetImage(CustomButton::STATE_HOVERED, |
580 rb.GetImageNamed(hot_image_id).ToImageSkia()); | 623 rb.GetImageNamed(hot_image_id).ToImageSkia()); |
581 button->SetImage(CustomButton::STATE_PRESSED, | 624 button->SetImage(CustomButton::STATE_PRESSED, |
582 rb.GetImageNamed(pushed_image_id).ToImageSkia()); | 625 rb.GetImageNamed(pushed_image_id).ToImageSkia()); |
583 AddChildView(button); | 626 AddChildView(button); |
584 return button; | 627 return button; |
585 } | 628 } |
586 | 629 |
587 } // namespace views | 630 } // namespace views |
OLD | NEW |