| 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/bookmark_editor_view.h" | 5 #include "chrome/browser/views/bookmark_editor_view.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/app/locales/locale_settings.h" | 10 #include "chrome/app/locales/locale_settings.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 void BookmarkEditorView::Layout() { | 105 void BookmarkEditorView::Layout() { |
| 106 // Let the grid layout manager lay out most of the dialog... | 106 // Let the grid layout manager lay out most of the dialog... |
| 107 GetLayoutManager()->Layout(this); | 107 GetLayoutManager()->Layout(this); |
| 108 | 108 |
| 109 // Manually lay out the New Folder button in the same row as the OK/Cancel | 109 // Manually lay out the New Folder button in the same row as the OK/Cancel |
| 110 // buttons... | 110 // buttons... |
| 111 CRect parent_bounds; | 111 CRect parent_bounds; |
| 112 GetParent()->GetLocalBounds(&parent_bounds, false); | 112 GetParent()->GetLocalBounds(&parent_bounds, false); |
| 113 CSize prefsize; | 113 gfx::Size prefsize = new_group_button_.GetPreferredSize(); |
| 114 new_group_button_.GetPreferredSize(&prefsize); | 114 int button_y = parent_bounds.bottom - prefsize.height() - kButtonVEdgeMargin; |
| 115 int button_y = parent_bounds.bottom - prefsize.cy - kButtonVEdgeMargin; | 115 new_group_button_.SetBounds(kPanelHorizMargin, button_y, prefsize.width(), |
| 116 new_group_button_.SetBounds(kPanelHorizMargin, button_y, prefsize.cx, | 116 prefsize.height()); |
| 117 prefsize.cy); | |
| 118 } | 117 } |
| 119 | 118 |
| 120 void BookmarkEditorView::GetPreferredSize(CSize *out) { | 119 gfx::Size BookmarkEditorView::GetPreferredSize() { |
| 121 DCHECK(out); | 120 return gfx::Size(ChromeViews::Window::GetLocalizedContentsSize( |
| 122 *out = ChromeViews::Window::GetLocalizedContentsSize( | |
| 123 IDS_EDITBOOKMARK_DIALOG_WIDTH_CHARS, | 121 IDS_EDITBOOKMARK_DIALOG_WIDTH_CHARS, |
| 124 IDS_EDITBOOKMARK_DIALOG_HEIGHT_LINES).ToSIZE(); | 122 IDS_EDITBOOKMARK_DIALOG_HEIGHT_LINES)); |
| 125 } | 123 } |
| 126 | 124 |
| 127 void BookmarkEditorView::DidChangeBounds(const CRect& previous, | 125 void BookmarkEditorView::DidChangeBounds(const CRect& previous, |
| 128 const CRect& current) { | 126 const CRect& current) { |
| 129 Layout(); | 127 Layout(); |
| 130 } | 128 } |
| 131 | 129 |
| 132 void BookmarkEditorView::ViewHierarchyChanged(bool is_add, | 130 void BookmarkEditorView::ViewHierarchyChanged(bool is_add, |
| 133 ChromeViews::View* parent, | 131 ChromeViews::View* parent, |
| 134 ChromeViews::View* child) { | 132 ChromeViews::View* child) { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 } | 522 } |
| 525 } | 523 } |
| 526 DCHECK(child_bb_node); | 524 DCHECK(child_bb_node); |
| 527 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); | 525 bb_model_->SetTitle(child_bb_node, child_b_node->GetTitle()); |
| 528 } | 526 } |
| 529 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, | 527 ApplyNameChangesAndCreateNewGroups(child_bb_node, child_b_node, |
| 530 parent_b_node, parent_bb_node); | 528 parent_b_node, parent_bb_node); |
| 531 } | 529 } |
| 532 } | 530 } |
| 533 | 531 |
| OLD | NEW |