| 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/dialog_frame_view.h" | 5 #include "ui/views/window/dialog_frame_view.h" |
| 6 | 6 |
| 7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
| 8 #include "ui/base/hit_test.h" | 8 #include "ui/base/hit_test.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // DialogFrameView, View overrides: | 107 // DialogFrameView, View overrides: |
| 108 | 108 |
| 109 std::string DialogFrameView::GetClassName() const { | 109 std::string DialogFrameView::GetClassName() const { |
| 110 return kViewClassName; | 110 return kViewClassName; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void DialogFrameView::Layout() { | 113 void DialogFrameView::Layout() { |
| 114 gfx::Rect bounds = GetLocalBounds(); | 114 gfx::Rect bounds = GetLocalBounds(); |
| 115 bounds.Inset(border()->GetInsets()); | 115 bounds.Inset(border()->GetInsets()); |
| 116 // Small additional insets yield the desired 10px visual close button insets. | 116 // Small additional insets yield the desired 10px visual close button insets. |
| 117 bounds.Inset(0, 2, 1, 0); | 117 bounds.Inset(0, 2, close_->width() + 1, 0); |
| 118 close_->SetPosition(gfx::Point(bounds.right() - close_->width(), bounds.y())); | 118 close_->SetPosition(gfx::Point(bounds.right(), bounds.y())); |
| 119 // Small additional insets yield the desired 20px visual title label insets. | 119 // Small additional insets yield the desired 20px visual title label insets. |
| 120 bounds.Inset(2 * kSpacing - 1, kSpacing, close_->width(), 0); | 120 bounds.Inset(2 * kSpacing - 1, kSpacing, 0, 0); |
| 121 bounds.set_height(title_->font().GetHeight()); | 121 bounds.set_height(title_->font().GetHeight()); |
| 122 title_->SetBoundsRect(bounds); | 122 title_->SetBoundsRect(bounds); |
| 123 } | 123 } |
| 124 | 124 |
| 125 //////////////////////////////////////////////////////////////////////////////// | 125 //////////////////////////////////////////////////////////////////////////////// |
| 126 // DialogFrameView, ButtonListener overrides: | 126 // DialogFrameView, ButtonListener overrides: |
| 127 | 127 |
| 128 void DialogFrameView::ButtonPressed(Button* sender, const ui::Event& event) { | 128 void DialogFrameView::ButtonPressed(Button* sender, const ui::Event& event) { |
| 129 if (sender == close_) | 129 if (sender == close_) |
| 130 GetWidget()->Close(); | 130 GetWidget()->Close(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 //////////////////////////////////////////////////////////////////////////////// | 133 //////////////////////////////////////////////////////////////////////////////// |
| 134 // DialogFrameView, private: | 134 // DialogFrameView, private: |
| 135 | 135 |
| 136 gfx::Insets DialogFrameView::GetClientInsets() const { | 136 gfx::Insets DialogFrameView::GetClientInsets() const { |
| 137 gfx::Insets insets = border()->GetInsets(); | 137 gfx::Insets insets = border()->GetInsets(); |
| 138 insets += content_margins_; | 138 insets += content_margins_; |
| 139 return insets; | 139 return insets; |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace views | 142 } // namespace views |
| OLD | NEW |