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_EXAMPLE_BASE_H_
6 #define UI_VIEWS_EXAMPLES_EXAMPLE_BASE_H_
10 #include "base/macros.h"
11 #include "ui/views/examples/views_examples_export.h"
18 class VIEWS_EXAMPLES_EXPORT ExampleBase
{
20 virtual ~ExampleBase();
22 // Sub-classes should creates and add the views to the given parent.
23 virtual void CreateExampleView(View
* parent
) = 0;
25 const std::string
& example_title() const { return example_title_
; }
26 View
* example_view() { return container_
; }
29 explicit ExampleBase(const char* title
);
31 View
* container() { return container_
; }
33 // Prints a message in the status area, at the bottom of the window.
34 void PrintStatus(const char* format
, ...);
36 // Converts an boolean value to "on" or "off".
37 const char* BoolToOnOff(bool value
) {
38 return value
? "on" : "off";
42 // Name of the example - used as title in the combobox list.
43 std::string example_title_
;
45 // The view that contains the views example.
48 DISALLOW_COPY_AND_ASSIGN(ExampleBase
);
51 } // namespace examples
54 #endif // UI_VIEWS_EXAMPLES_EXAMPLE_BASE_H_