Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / views / examples / table_example.h
blob06ac3c01a68ce953c2f36728a093f8ad7be6f4e5
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_
6 #define UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/base/models/table_model.h"
13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/table/table_grouper.h"
15 #include "ui/views/controls/table/table_view.h"
16 #include "ui/views/controls/table/table_view_observer.h"
17 #include "ui/views/examples/example_base.h"
19 namespace gfx {
20 class ImageSkia;
23 namespace views {
24 class Checkbox;
25 class TableView;
27 namespace examples {
29 class VIEWS_EXAMPLES_EXPORT TableExample : public ExampleBase,
30 public ui::TableModel,
31 public TableGrouper,
32 public TableViewObserver,
33 public ButtonListener {
34 public:
35 TableExample();
36 virtual ~TableExample();
38 // ExampleBase:
39 virtual void CreateExampleView(View* container) OVERRIDE;
41 // ui::TableModel:
42 virtual int RowCount() OVERRIDE;
43 virtual base::string16 GetText(int row, int column_id) OVERRIDE;
44 virtual gfx::ImageSkia GetIcon(int row) OVERRIDE;
45 virtual void SetObserver(ui::TableModelObserver* observer) OVERRIDE;
47 // TableGrouper:
48 virtual void GetGroupRange(int model_index, GroupRange* range) OVERRIDE;
50 // TableViewObserver:
51 virtual void OnSelectionChanged() OVERRIDE;
52 virtual void OnDoubleClick() OVERRIDE;
53 virtual void OnMiddleClick() OVERRIDE;
54 virtual void OnKeyDown(ui::KeyboardCode virtual_keycode) OVERRIDE;
56 // ButtonListener:
57 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE;
59 private:
60 // The table to be tested.
61 TableView* table_;
63 Checkbox* column1_visible_checkbox_;
64 Checkbox* column2_visible_checkbox_;
65 Checkbox* column3_visible_checkbox_;
66 Checkbox* column4_visible_checkbox_;
68 SkBitmap icon1_;
69 SkBitmap icon2_;
71 DISALLOW_COPY_AND_ASSIGN(TableExample);
74 } // namespace examples
75 } // namespace views
77 #endif // UI_VIEWS_EXAMPLES_TABLE_EXAMPLE_H_