summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-29 00:55:26 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-29 00:55:26 +0000
commit6c4769153ba6cb2f3c6414aaa3a2d2d48a15c235 (patch)
tree9665473a05646bdd1b422a303b73752aa17addfe
parent456a670db8cb72c5c000f26a012fb0730a5658b6 (diff)
downloadchromium_src-6c4769153ba6cb2f3c6414aaa3a2d2d48a15c235.zip
chromium_src-6c4769153ba6cb2f3c6414aaa3a2d2d48a15c235.tar.gz
chromium_src-6c4769153ba6cb2f3c6414aaa3a2d2d48a15c235.tar.bz2
views: Move the implementation of ButtonExample from the header to the source file.
BUG=None TEST=run out/Debug/views_examples, everything should works as before. Review URL: http://codereview.chromium.org/6288017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73049 0039d316-1c4b-4281-b951-d872f2087c98
-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',