summaryrefslogtreecommitdiffstats
path: root/views/examples/button_example.cc
blob: d27a5d2e83971cd0452df629a4e718af160fadbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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