| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 label->SetBounds(label_x, y, label_width, label_height); | 369 label->SetBounds(label_x, y, label_width, label_height); |
| 370 | 370 |
| 371 text_field = new Textfield(); | 371 text_field = new Textfield(); |
| 372 text_field->set_id(kKiwiTextfieldID); | 372 text_field->set_id(kKiwiTextfieldID); |
| 373 left_container_->AddChildView(text_field); | 373 left_container_->AddChildView(text_field); |
| 374 text_field->SetBounds(label_x + label_width + 5, y, | 374 text_field->SetBounds(label_x + label_width + 5, y, |
| 375 text_field_width, label_height); | 375 text_field_width, label_height); |
| 376 | 376 |
| 377 y += label_height + gap_between_labels; | 377 y += label_height + gap_between_labels; |
| 378 | 378 |
| 379 LabelButton* button = | 379 LabelButton* button = MdTextButton::Create(NULL, ASCIIToUTF16("Click me")); |
| 380 MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("Click me")); | |
| 381 button->SetBounds(label_x, y + 10, 80, 30); | 380 button->SetBounds(label_x, y + 10, 80, 30); |
| 382 button->set_id(kFruitButtonID); | 381 button->set_id(kFruitButtonID); |
| 383 left_container_->AddChildView(button); | 382 left_container_->AddChildView(button); |
| 384 y += 40; | 383 y += 40; |
| 385 | 384 |
| 386 cb = new Checkbox(ASCIIToUTF16("This is another check box")); | 385 cb = new Checkbox(ASCIIToUTF16("This is another check box")); |
| 387 cb->SetBounds(label_x + label_width + 5, y, 180, 20); | 386 cb->SetBounds(label_x + label_width + 5, y, 180, 20); |
| 388 cb->set_id(kFruitCheckBoxID); | 387 cb->set_id(kFruitCheckBoxID); |
| 389 left_container_->AddChildView(cb); | 388 left_container_->AddChildView(cb); |
| 390 y += 20; | 389 y += 20; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 Link* link = new Link(ASCIIToUTF16(kTitles[i])); | 464 Link* link = new Link(ASCIIToUTF16(kTitles[i])); |
| 466 link->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 465 link->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 467 link->set_id(kIDs[i]); | 466 link->set_id(kIDs[i]); |
| 468 scroll_content->AddChildView(link); | 467 scroll_content->AddChildView(link); |
| 469 link->SetBounds(5, y, 300, 15); | 468 link->SetBounds(5, y, 300, 15); |
| 470 y += 15; | 469 y += 15; |
| 471 } | 470 } |
| 472 | 471 |
| 473 y = 250; | 472 y = 250; |
| 474 int width = 60; | 473 int width = 60; |
| 475 button = MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("OK")); | 474 button = MdTextButton::Create(NULL, ASCIIToUTF16("OK")); |
| 476 button->set_id(kOKButtonID); | 475 button->set_id(kOKButtonID); |
| 477 button->SetIsDefault(true); | 476 button->SetIsDefault(true); |
| 478 | 477 |
| 479 GetContentsView()->AddChildView(button); | 478 GetContentsView()->AddChildView(button); |
| 480 button->SetBounds(150, y, width, 30); | 479 button->SetBounds(150, y, width, 30); |
| 481 | 480 |
| 482 button = MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("Cancel")); | 481 button = MdTextButton::Create(NULL, ASCIIToUTF16("Cancel")); |
| 483 button->set_id(kCancelButtonID); | 482 button->set_id(kCancelButtonID); |
| 484 GetContentsView()->AddChildView(button); | 483 GetContentsView()->AddChildView(button); |
| 485 button->SetBounds(220, y, width, 30); | 484 button->SetBounds(220, y, width, 30); |
| 486 | 485 |
| 487 button = MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("Help")); | 486 button = MdTextButton::Create(NULL, ASCIIToUTF16("Help")); |
| 488 button->set_id(kHelpButtonID); | 487 button->set_id(kHelpButtonID); |
| 489 GetContentsView()->AddChildView(button); | 488 GetContentsView()->AddChildView(button); |
| 490 button->SetBounds(290, y, width, 30); | 489 button->SetBounds(290, y, width, 30); |
| 491 | 490 |
| 492 y += 40; | 491 y += 40; |
| 493 | 492 |
| 494 View* contents = NULL; | 493 View* contents = NULL; |
| 495 Link* link = NULL; | 494 Link* link = NULL; |
| 496 | 495 |
| 497 // Left bottom box with style checkboxes. | 496 // Left bottom box with style checkboxes. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 style_tab_->AddTab(ASCIIToUTF16("Other"), new View()); | 529 style_tab_->AddTab(ASCIIToUTF16("Other"), new View()); |
| 531 | 530 |
| 532 // Right bottom box with search. | 531 // Right bottom box with search. |
| 533 contents = new View(); | 532 contents = new View(); |
| 534 contents->set_background(Background::CreateSolidBackground(SK_ColorWHITE)); | 533 contents->set_background(Background::CreateSolidBackground(SK_ColorWHITE)); |
| 535 text_field = new Textfield(); | 534 text_field = new Textfield(); |
| 536 contents->AddChildView(text_field); | 535 contents->AddChildView(text_field); |
| 537 text_field->SetBounds(10, 10, 100, 20); | 536 text_field->SetBounds(10, 10, 100, 20); |
| 538 text_field->set_id(kSearchTextfieldID); | 537 text_field->set_id(kSearchTextfieldID); |
| 539 | 538 |
| 540 button = MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("Search")); | 539 button = MdTextButton::Create(NULL, ASCIIToUTF16("Search")); |
| 541 contents->AddChildView(button); | 540 contents->AddChildView(button); |
| 542 button->SetBounds(112, 5, 60, 30); | 541 button->SetBounds(112, 5, 60, 30); |
| 543 button->set_id(kSearchButtonID); | 542 button->set_id(kSearchButtonID); |
| 544 | 543 |
| 545 link = new Link(ASCIIToUTF16("Help")); | 544 link = new Link(ASCIIToUTF16("Help")); |
| 546 link->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 545 link->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 547 link->set_id(kHelpLinkID); | 546 link->set_id(kHelpLinkID); |
| 548 contents->AddChildView(link); | 547 contents->AddChildView(link); |
| 549 link->SetBounds(175, 10, 30, 20); | 548 link->SetBounds(175, 10, 30, 20); |
| 550 | 549 |
| 551 search_border_view_ = new BorderView(contents); | 550 search_border_view_ = new BorderView(contents); |
| 552 search_border_view_->set_id(kSearchContainerID); | 551 search_border_view_->set_id(kSearchContainerID); |
| 553 | 552 |
| 554 GetContentsView()->AddChildView(search_border_view_); | 553 GetContentsView()->AddChildView(search_border_view_); |
| 555 search_border_view_->SetBounds(300, y, 240, 50); | 554 search_border_view_->SetBounds(300, y, 240, 50); |
| 556 | 555 |
| 557 y += 60; | 556 y += 60; |
| 558 | 557 |
| 559 contents = new View(); | 558 contents = new View(); |
| 560 contents->SetFocusBehavior(View::FocusBehavior::ALWAYS); | 559 contents->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
| 561 contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE)); | 560 contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE)); |
| 562 contents->set_id(kThumbnailContainerID); | 561 contents->set_id(kThumbnailContainerID); |
| 563 button = MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("Star")); | 562 button = MdTextButton::Create(NULL, ASCIIToUTF16("Star")); |
| 564 contents->AddChildView(button); | 563 contents->AddChildView(button); |
| 565 button->SetBounds(5, 5, 50, 30); | 564 button->SetBounds(5, 5, 50, 30); |
| 566 button->set_id(kThumbnailStarID); | 565 button->set_id(kThumbnailStarID); |
| 567 button = MdTextButton::CreateMdButton(NULL, ASCIIToUTF16("SuperStar")); | 566 button = MdTextButton::Create(NULL, ASCIIToUTF16("SuperStar")); |
| 568 contents->AddChildView(button); | 567 contents->AddChildView(button); |
| 569 button->SetBounds(60, 5, 100, 30); | 568 button->SetBounds(60, 5, 100, 30); |
| 570 button->set_id(kThumbnailSuperStarID); | 569 button->set_id(kThumbnailSuperStarID); |
| 571 | 570 |
| 572 GetContentsView()->AddChildView(contents); | 571 GetContentsView()->AddChildView(contents); |
| 573 contents->SetBounds(250, y, 200, 50); | 572 contents->SetBounds(250, y, 200, 50); |
| 574 // We can only call RadioButton::SetChecked() on the radio-button is part of | 573 // We can only call RadioButton::SetChecked() on the radio-button is part of |
| 575 // the view hierarchy. | 574 // the view hierarchy. |
| 576 radio_button_to_check->SetChecked(true); | 575 radio_button_to_check->SetChecked(true); |
| 577 } | 576 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 GetFocusManager()->AdvanceFocus(false); | 839 GetFocusManager()->AdvanceFocus(false); |
| 841 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); | 840 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); |
| 842 | 841 |
| 843 // Advance backwards from the root node. | 842 // Advance backwards from the root node. |
| 844 GetFocusManager()->ClearFocus(); | 843 GetFocusManager()->ClearFocus(); |
| 845 GetFocusManager()->AdvanceFocus(true); | 844 GetFocusManager()->AdvanceFocus(true); |
| 846 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); | 845 EXPECT_FALSE(GetFocusManager()->GetFocusedView()); |
| 847 } | 846 } |
| 848 | 847 |
| 849 } // namespace views | 848 } // namespace views |
| OLD | NEW |