#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/base/models/combobox_model.h"
+#include "ui/views/background.h"
+#include "ui/views/border.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/scroll_view.h"
#include "ui/views/controls/tabbed_pane/tabbed_pane.h"
#include "ui/views/controls/textfield/textfield.h"
-#include "ui/views/focus/accelerator_handler.h"
#include "ui/views/focus/focus_manager_test.h"
#include "ui/views/widget/root_view.h"
#include "ui/views/widget/widget.h"
+using base::ASCIIToUTF16;
+
namespace views {
namespace {
public:
// Overridden from ui::ComboboxModel:
virtual int GetItemCount() const OVERRIDE { return 10; }
- virtual string16 GetItemAt(int index) OVERRIDE {
+ virtual base::string16 GetItemAt(int index) OVERRIDE {
return ASCIIToUTF16("Item ") + base::IntToString16(index);
}
};
public:
explicit BorderView(View* child) : child_(child), widget_(NULL) {
DCHECK(child);
- set_focusable(false);
+ SetFocusable(false);
}
virtual ~BorderView() {}
cb->set_id(kTopCheckBoxID);
left_container_ = new PaneView();
- left_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK));
+ left_container_->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK));
left_container_->set_background(
Background::CreateSolidBackground(240, 240, 240));
left_container_->set_id(kLeftContainerID);
y += label_height + gap_between_labels;
LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Click me"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
button->SetBounds(label_x, y + 10, 80, 30);
button->set_id(kFruitButtonID);
left_container_->AddChildView(button);
left_container_->AddChildView(combobox);
right_container_ = new PaneView();
- right_container_->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK));
+ right_container_->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK));
right_container_->set_background(
Background::CreateSolidBackground(240, 240, 240));
right_container_->set_id(kRightContainerID);
y += radio_button_height + gap_between_radio_buttons;
View* inner_container = new View();
- inner_container->set_border(Border::CreateSolidBorder(1, SK_ColorBLACK));
+ inner_container->SetBorder(Border::CreateSolidBorder(1, SK_ColorBLACK));
inner_container->set_background(
Background::CreateSolidBackground(230, 230, 230));
inner_container->set_id(kInnerContainerID);
y = 250;
int width = 60;
button = new LabelButton(NULL, ASCIIToUTF16("OK"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
button->set_id(kOKButtonID);
button->SetIsDefault(true);
button->SetBounds(150, y, width, 30);
button = new LabelButton(NULL, ASCIIToUTF16("Cancel"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
button->set_id(kCancelButtonID);
GetContentsView()->AddChildView(button);
button->SetBounds(220, y, width, 30);
button = new LabelButton(NULL, ASCIIToUTF16("Help"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
button->set_id(kHelpButtonID);
GetContentsView()->AddChildView(button);
button->SetBounds(290, y, width, 30);
text_field->SetBounds(10, 50, 100, 20);
text_field->set_id(kStyleTextEditID);
- style_tab_ = new TabbedPane(false);
+ style_tab_ = new TabbedPane();
style_tab_->set_id(kStyleContainerID);
GetContentsView()->AddChildView(style_tab_);
style_tab_->SetBounds(10, y, 210, 100);
text_field->set_id(kSearchTextfieldID);
button = new LabelButton(NULL, ASCIIToUTF16("Search"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
contents->AddChildView(button);
button->SetBounds(112, 5, 60, 30);
button->set_id(kSearchButtonID);
y += 60;
contents = new View();
- contents->set_focusable(true);
+ contents->SetFocusable(true);
contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE));
contents->set_id(kThumbnailContainerID);
button = new LabelButton(NULL, ASCIIToUTF16("Star"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
contents->AddChildView(button);
button->SetBounds(5, 5, 50, 30);
button->set_id(kThumbnailStarID);
button = new LabelButton(NULL, ASCIIToUTF16("SuperStar"));
- button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
+ button->SetStyle(Button::STYLE_BUTTON);
contents->AddChildView(button);
button->SetBounds(60, 5, 100, 30);
button->set_id(kThumbnailSuperStarID);
kSearchTextfieldID, kSearchButtonID, kHelpLinkID,
kThumbnailContainerID, kThumbnailStarID, kThumbnailSuperStarID };
- // Uncomment the following line to manually test the UI of this test.
- // base::RunLoop(new AcceleratorHandler()).Run();
-
// Let's traverse the whole focus hierarchy (several times, to make sure it
// loops OK).
GetFocusManager()->ClearFocus();
v->SetEnabled(false);
}
- // Uncomment the following line to manually test the UI of this test.
- // base::RunLoop(new AcceleratorHandler()).Run();
-
View* focused_view;
// Let's do one traversal (several times, to make sure it loops ok).
GetFocusManager()->ClearFocus();
v->SetVisible(false);
}
- // Uncomment the following line to manually test the UI of this test.
- // base::RunLoop(new AcceleratorHandler()).Run();
-
View* focused_view;
// Let's do one traversal (several times, to make sure it loops ok).
GetFocusManager()->ClearFocus();
FocusSearch focus_search_right(right_container_, true, true);
right_container_->EnablePaneFocus(&focus_search_right);
- FindViewByID(kRosettaLinkID)->set_focusable(false);
- FindViewByID(kStupeurEtTremblementLinkID)->set_focusable(false);
- FindViewByID(kDinerGameLinkID)->set_accessibility_focusable(true);
- FindViewByID(kDinerGameLinkID)->set_focusable(false);
+ FindViewByID(kRosettaLinkID)->SetFocusable(false);
+ FindViewByID(kStupeurEtTremblementLinkID)->SetFocusable(false);
+ FindViewByID(kDinerGameLinkID)->SetAccessibilityFocusable(true);
+ FindViewByID(kDinerGameLinkID)->SetFocusable(false);
FindViewByID(kAsterixLinkID)->RequestFocus();
// Traverse the focus hierarchy within the pane several times.