OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_EXAMPLES_NATIVE_THEME_BUTTON_EXAMPLE_H_ | 5 #ifndef UI_VIEWS_EXAMPLES_NATIVE_THEME_BUTTON_EXAMPLE_H_ |
6 #define UI_VIEWS_EXAMPLES_NATIVE_THEME_BUTTON_EXAMPLE_H_ | 6 #define UI_VIEWS_EXAMPLES_NATIVE_THEME_BUTTON_EXAMPLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "ui/gfx/native_theme.h" | 10 #include "ui/gfx/native_theme.h" |
11 #include "ui/views/examples/example_base.h" | 11 #include "ui/views/examples/example_base.h" |
12 #include "views/controls/button/custom_button.h" | 12 #include "views/controls/button/custom_button.h" |
13 #include "views/controls/combobox/combobox.h" | 13 #include "views/controls/combobox/combobox_listener.h" |
14 #include "views/native_theme_delegate.h" | 14 #include "views/native_theme_delegate.h" |
15 #include "views/native_theme_painter.h" | 15 #include "views/native_theme_painter.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 class Combobox; | 18 class Combobox; |
19 class NativeThemePainter; | 19 class NativeThemePainter; |
20 } | 20 } |
21 | 21 |
22 namespace examples { | 22 namespace examples { |
23 | 23 |
24 // A subclass of button to test native theme rendering. | 24 // A subclass of button to test native theme rendering. |
25 class ExampleNativeThemeButton : public views::CustomButton, | 25 class ExampleNativeThemeButton : public views::CustomButton, |
26 public views::NativeThemeDelegate, | 26 public views::NativeThemeDelegate, |
27 public views::Combobox::Listener { | 27 public views::ComboboxListener { |
28 public: | 28 public: |
29 ExampleNativeThemeButton(views::ButtonListener* listener, | 29 ExampleNativeThemeButton(views::ButtonListener* listener, |
30 views::Combobox* cb_part, | 30 views::Combobox* cb_part, |
31 views::Combobox* cb_state); | 31 views::Combobox* cb_state); |
32 virtual ~ExampleNativeThemeButton(); | 32 virtual ~ExampleNativeThemeButton(); |
33 | 33 |
34 std::string MessWithState(); | 34 std::string MessWithState(); |
35 | 35 |
36 private: | 36 private: |
37 // Overridden from View: | 37 // Overridden from views::View: |
38 virtual gfx::Size GetPreferredSize() OVERRIDE; | 38 virtual gfx::Size GetPreferredSize() OVERRIDE; |
39 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 39 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; |
40 | 40 |
41 // Overridden from views::Combobox::Listener: | 41 // Overridden from views::ComboboxListener: |
42 virtual void ItemChanged(views::Combobox* combo_box, | 42 virtual void ItemChanged(views::Combobox* combo_box, |
43 int prev_index, | 43 int prev_index, |
44 int new_index) OVERRIDE; | 44 int new_index) OVERRIDE; |
45 | 45 |
46 // Overridden from views::NativeThemePainter::Delegate: | 46 // Overridden from views::NativeThemePainter::Delegate: |
47 virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; | 47 virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; |
48 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | 48 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; |
49 virtual gfx::NativeTheme::State GetThemeState( | 49 virtual gfx::NativeTheme::State GetThemeState( |
50 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; | 50 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
51 virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; | 51 virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 // The only control in this test. | 85 // The only control in this test. |
86 ExampleNativeThemeButton* button_; | 86 ExampleNativeThemeButton* button_; |
87 | 87 |
88 DISALLOW_COPY_AND_ASSIGN(NativeThemeButtonExample); | 88 DISALLOW_COPY_AND_ASSIGN(NativeThemeButtonExample); |
89 }; | 89 }; |
90 | 90 |
91 } // namespace examples | 91 } // namespace examples |
92 | 92 |
93 #endif // UI_VIEWS_EXAMPLES_NATIVE_THEME_BUTTON_EXAMPLE_H_ | 93 #endif // UI_VIEWS_EXAMPLES_NATIVE_THEME_BUTTON_EXAMPLE_H_ |
OLD | NEW |