blob: b17065c402044aaab135b3b3caae155ec519e9bf (
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
|
// Copyright (c) 2009 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_BASE_H_
#define VIEWS_EXAMPLES_EXAMPLE_BASE_H_
#include <string>
#include "base/basictypes.h"
namespace views {
class Label;
class TabbedPane;
} // namespace views
namespace examples {
// ExampleBase defines utility functions for examples.
class ExampleBase {
protected:
explicit ExampleBase(views::Label* status) : status_(status) {}
virtual ~ExampleBase() {}
// Prints a message in the status area, at the bottom of the window.
void PrintStatus(const wchar_t* format, ...);
// Converts an integer/boolean to wchat "on"/"off".
static const wchar_t* IntToOnOff(int value) {
return value ? L"on" : L"off";
}
// Adds a new tab with the button with given label to the tabbed pane.
static void AddButton(views::TabbedPane* tabbed_pane,
const std::wstring& label);
private:
// A label to show a message at the bottom of example app.
views::Label* status_;
DISALLOW_COPY_AND_ASSIGN(ExampleBase);
};
} // namespace examples
#endif // VIEWS_EXAMPLES_EXAMPLE_BASE_H_
|