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

Side by Side Diff: ui/views/window/dialog_client_view.cc

Issue 371633002: LabelButton: cache the last computed preferred size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « ui/views/examples/button_example.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) 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_client_view.h" 5 #include "ui/views/window/dialog_client_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/events/keycodes/keyboard_codes.h" 9 #include "ui/events/keycodes/keyboard_codes.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 GetDialogDelegate()->GetDefaultDialogButton() == type && 380 GetDialogDelegate()->GetDefaultDialogButton() == type &&
381 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) { 381 GetDialogDelegate()->ShouldDefaultButtonBeBlue()) {
382 button = new BlueButton(this, title); 382 button = new BlueButton(this, title);
383 } else { 383 } else {
384 button = new LabelButton(this, title); 384 button = new LabelButton(this, title);
385 button->SetStyle(Button::STYLE_BUTTON); 385 button->SetStyle(Button::STYLE_BUTTON);
386 } 386 }
387 button->SetFocusable(true); 387 button->SetFocusable(true);
388 388
389 const int kDialogMinButtonWidth = 75; 389 const int kDialogMinButtonWidth = 75;
390 button->set_min_size(gfx::Size(kDialogMinButtonWidth, 0)); 390 button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0));
391 button->SetGroup(kButtonGroup); 391 button->SetGroup(kButtonGroup);
392 return button; 392 return button;
393 } 393 }
394 394
395 void DialogClientView::UpdateButton(LabelButton* button, 395 void DialogClientView::UpdateButton(LabelButton* button,
396 ui::DialogButton type) { 396 ui::DialogButton type) {
397 DialogDelegate* dialog = GetDialogDelegate(); 397 DialogDelegate* dialog = GetDialogDelegate();
398 button->SetText(dialog->GetDialogButtonLabel(type)); 398 button->SetText(dialog->GetDialogButtonLabel(type));
399 button->SetEnabled(dialog->IsDialogButtonEnabled(type)); 399 button->SetEnabled(dialog->IsDialogButtonEnabled(type));
400 400
(...skipping 18 matching lines...) Expand all
419 gfx::Insets(0, kButtonHEdgeMarginNew, 419 gfx::Insets(0, kButtonHEdgeMarginNew,
420 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew); 420 kButtonVEdgeMarginNew, kButtonHEdgeMarginNew);
421 } 421 }
422 422
423 void DialogClientView::Close() { 423 void DialogClientView::Close() {
424 GetWidget()->Close(); 424 GetWidget()->Close();
425 GetDialogDelegate()->OnClosed(); 425 GetDialogDelegate()->OnClosed();
426 } 426 }
427 427
428 } // namespace views 428 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/button_example.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698