summaryrefslogtreecommitdiffstats
path: root/views/examples/message_box_example.h
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-20 17:22:48 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-20 17:22:48 +0000
commite557d64b1d89a5acbe4b185e63c029c428bd217b (patch)
treeadc254b279329bfae6f1a53cc19a03a3cade7a41 /views/examples/message_box_example.h
parentdd92c8dc5191650d37501f74bf017e4ad4f664a4 (diff)
downloadchromium_src-e557d64b1d89a5acbe4b185e63c029c428bd217b.zip
chromium_src-e557d64b1d89a5acbe4b185e63c029c428bd217b.tar.gz
chromium_src-e557d64b1d89a5acbe4b185e63c029c428bd217b.tar.bz2
Porting the view examples to Windows.
Some refactoring done to the tests also. See original review at: http://codereview.chromium.org/295013/show BUG=None TEST=Make sure the view examples build and run on Windows and Linux. Review URL: http://codereview.chromium.org/294026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/examples/message_box_example.h')
-rw-r--r--views/examples/message_box_example.h37
1 files changed, 22 insertions, 15 deletions
diff --git a/views/examples/message_box_example.h b/views/examples/message_box_example.h
index d586d58..3edd210 100644
--- a/views/examples/message_box_example.h
+++ b/views/examples/message_box_example.h
@@ -11,26 +11,22 @@
#include "views/controls/message_box_view.h"
#include "views/controls/tabbed_pane/tabbed_pane.h"
#include "views/examples/example_base.h"
+#include "views/grid_layout.h"
namespace examples {
-// A MessageBoxView example. This tests some of checkbox features
-// as well.
+// A MessageBoxView example. This tests some of checkbox features as well.
class MessageBoxExample : protected ExampleBase, private views::ButtonListener {
public:
- MessageBoxExample(views::TabbedPane* tabbed_pane, views::Label* message)
- : ExampleBase(message),
- message_box_view_(
- new MessageBoxView(0, L"Message Box Message", L"Default Prompt")),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- status_(new views::TextButton(this, L"Show Status"))),
- ALLOW_THIS_IN_INITIALIZER_LIST(
- toggle_(new views::TextButton(this, L"Toggle Checkbox"))) {
- views::View* container = new views::View();
- tabbed_pane->AddTab(L"Message Box View", container);
-
- views::GridLayout* layout = new views::GridLayout(container);
- container->SetLayoutManager(layout);
+ explicit MessageBoxExample(ExamplesMain* main) : ExampleBase(main) {
+ message_box_view_ =
+ new MessageBoxView(0, L"Message Box Message", L"Default Prompt");
+ status_ = new views::TextButton(this, L"Show Status");
+ toggle_ = new views::TextButton(this, L"Toggle Checkbox");
+
+ container_ = new views::View();
+ views::GridLayout* layout = new views::GridLayout(container_);
+ container_->SetLayoutManager(layout);
message_box_view_->SetCheckBoxLabel(L"Check Box");
@@ -56,6 +52,14 @@ class MessageBoxExample : protected ExampleBase, private views::ButtonListener {
virtual ~MessageBoxExample() {}
+ virtual std::wstring GetExampleTitle() {
+ return L"Message Box View";
+ }
+
+ virtual views::View* GetExampleView() {
+ return container_;
+ }
+
private:
// ButtonListener overrides.
virtual void ButtonPressed(views::Button* sender, const views::Event& event) {
@@ -70,6 +74,9 @@ class MessageBoxExample : protected ExampleBase, private views::ButtonListener {
}
}
+ // The view containing this test's controls.
+ views::View* container_;
+
// The MessageBoxView to be tested.
MessageBoxView* message_box_view_;