summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--views/examples/button_example.cc35
-rw-r--r--views/examples/button_example.h34
-rw-r--r--views/views.gyp1
3 files changed, 50 insertions, 20 deletions
diff --git a/views/examples/button_example.cc b/views/examples/button_example.cc
new file mode 100644
index 0000000..d27a5d2
--- /dev/null
+++ b/views/examples/button_example.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "views/examples/button_example.h"
+
+#include "views/layout/fill_layout.h"
+#include "views/view.h"
+
+namespace examples {
+
+ButtonExample::ButtonExample(ExamplesMain* main)
+ : ExampleBase(main),
+ count_(0) {
+}
+
+ButtonExample::~ButtonExample() {
+}
+
+std::wstring ButtonExample::GetExampleTitle() {
+ return L"Text Button";
+}
+
+void ButtonExample::CreateExampleView(views::View* container) {
+ button_ = new views::TextButton(this, L"Button");
+ container->SetLayoutManager(new views::FillLayout);
+ container->AddChildView(button_);
+}
+
+void ButtonExample::ButtonPressed(views::Button* sender,
+ const views::Event& event) {
+ PrintStatus(L"Pressed! count:%d", ++count_);
+}
+
+} // namespace examples
diff --git a/views/examples/button_example.h b/views/examples/button_example.h
index 9a2e2a2..fe8567b 100644
--- a/views/examples/button_example.h
+++ b/views/examples/button_example.h
@@ -6,37 +6,31 @@
#define VIEWS_EXAMPLES_BUTTON_EXAMPLE_H_
#pragma once
-#include "base/string_util.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
#include "views/controls/button/text_button.h"
#include "views/examples/example_base.h"
-#include "views/layout/fill_layout.h"
-#include "views/view.h"
+
+namespace views {
+class View;
+}
namespace examples {
// ButtonExample simply counts the number of clicks.
class ButtonExample : public ExampleBase, public views::ButtonListener {
public:
- explicit ButtonExample(ExamplesMain* main) : ExampleBase(main), count_(0) {
- button_ = new views::TextButton(this, L"Button");
- }
-
- virtual ~ButtonExample() {}
-
- virtual std::wstring GetExampleTitle() {
- return L"Text Button";
- }
+ explicit ButtonExample(ExamplesMain* main);
+ virtual ~ButtonExample();
- virtual void CreateExampleView(views::View* container) {
- container->SetLayoutManager(new views::FillLayout);
- container->AddChildView(button_);
- }
+ // Overridden from ExampleBase:
+ virtual std::wstring GetExampleTitle() OVERRIDE;
+ virtual void CreateExampleView(views::View* container) OVERRIDE;
private:
- // ButtonListner implementation.
- virtual void ButtonPressed(views::Button* sender, const views::Event& event) {
- PrintStatus(L"Pressed! count:%d", ++count_);
- }
+ // Overridden from views::ButtonListener:
+ virtual void ButtonPressed(views::Button* sender,
+ const views::Event& event) OVERRIDE;
// The only control in this test.
views::TextButton* button_;
diff --git a/views/views.gyp b/views/views.gyp
index c4c5654..ca7c6ff 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -520,6 +520,7 @@
'..',
],
'sources': [
+ 'examples/button_example.cc',
'examples/button_example.h',
'examples/combobox_example.cc',
'examples/combobox_example.h',