summaryrefslogtreecommitdiffstats
path: root/views/examples/examples_main.h
blob: a427893715e4cccff43428c629c7c8530eb1b21d (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// 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.

#ifndef VIEWS_EXAMPLES_EXAMPLE_MAIN_H_
#define VIEWS_EXAMPLES_EXAMPLE_MAIN_H_
#pragma once

#include <string>
#include <vector>

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "views/widget/widget_delegate.h"

namespace views {
class Label;
class TabbedPane;
class View;
}  // namespace views

namespace examples {
class ExampleBase;

// ExamplesMain creates all view examples.
class ExamplesMain : public views::WidgetDelegate {
 public:
  ExamplesMain();
  virtual ~ExamplesMain();

  // Creates all the examples and shows the window.
  void Init();

  // Prints a message in the status area, at the bottom of the window.
  void SetStatus(const std::string& status);

 private:
  // Adds a new example to the tabbed window.
  void AddExample(ExampleBase* example);

  // views::WidgetDelegate implementation:
  virtual bool CanResize() const OVERRIDE;
  virtual bool CanMaximize() const OVERRIDE;
  virtual string16 GetWindowTitle() const OVERRIDE;
  virtual views::View* GetContentsView() OVERRIDE;
  virtual void WindowClosing() OVERRIDE;
  virtual views::Widget* GetWidget() OVERRIDE;
  virtual const views::Widget* GetWidget() const OVERRIDE;

  views::TabbedPane* tabbed_pane_;
  views::View* contents_;
  views::Label* status_label_;
  std::vector<ExampleBase*> examples_;

  DISALLOW_COPY_AND_ASSIGN(ExamplesMain);
};

}  // namespace examples

#endif  // VIEWS_EXAMPLES_EXAMPLE_MAIN_H_