diff options
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/examples/native_theme_button_example.cc | 16 | ||||
-rw-r--r-- | ui/views/examples/native_theme_button_example.h | 12 |
2 files changed, 17 insertions, 11 deletions
diff --git a/ui/views/examples/native_theme_button_example.cc b/ui/views/examples/native_theme_button_example.cc index 9e38467..d796ba8 100644 --- a/ui/views/examples/native_theme_button_example.cc +++ b/ui/views/examples/native_theme_button_example.cc @@ -220,21 +220,23 @@ void NativeThemeButtonExample::CreateExampleView(View* container) { layout->StartRow(0, 0); layout->AddView(new Label(ASCIIToUTF16("Part:"))); - Combobox* cb_part = new Combobox( + combobox_model_part_.reset( new ExampleComboboxModel(kParts, arraysize(kParts))); - cb_part->SetSelectedIndex(0); - layout->AddView(cb_part); + Combobox* combobox_part = new Combobox(combobox_model_part_.get()); + combobox_part->SetSelectedIndex(0); + layout->AddView(combobox_part); layout->StartRow(0, 0); layout->AddView(new Label(ASCIIToUTF16("State:"))); - Combobox* cb_state = new Combobox( + combobox_model_state_.reset( new ExampleComboboxModel(kStates, arraysize(kStates))); - cb_state->SetSelectedIndex(0); - layout->AddView(cb_state); + Combobox* combobox_state = new Combobox(combobox_model_state_.get()); + combobox_state->SetSelectedIndex(0); + layout->AddView(combobox_state); layout->AddPaddingRow(0, 32); - button_ = new ExampleNativeThemeButton(this, cb_part, cb_state); + button_ = new ExampleNativeThemeButton(this, combobox_part, combobox_state); column_set = layout->AddColumnSet(1); column_set->AddPaddingColumn(0, 16); diff --git a/ui/views/examples/native_theme_button_example.h b/ui/views/examples/native_theme_button_example.h index 9896818..862443a 100644 --- a/ui/views/examples/native_theme_button_example.h +++ b/ui/views/examples/native_theme_button_example.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -7,12 +7,12 @@ #pragma once #include "base/basictypes.h" +#include "base/memory/scoped_ptr.h" #include "ui/gfx/native_theme.h" #include "ui/views/controls/button/custom_button.h" #include "ui/views/controls/combobox/combobox_listener.h" #include "ui/views/examples/example_base.h" #include "ui/views/native_theme_delegate.h" -#include "ui/views/native_theme_painter.h" namespace views { class Combobox; @@ -20,6 +20,8 @@ class NativeThemePainter; namespace examples { +class ExampleComboboxModel; + // A subclass of button to test native theme rendering. class ExampleNativeThemeButton : public CustomButton, public NativeThemeDelegate, @@ -42,7 +44,7 @@ class ExampleNativeThemeButton : public CustomButton, int prev_index, int new_index) OVERRIDE; - // Overridden from NativeThemePainter::Delegate: + // Overridden from NativeThemeDelegate: virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; virtual gfx::Rect GetThemePaintRect() const OVERRIDE; virtual gfx::NativeTheme::State GetThemeState( @@ -79,9 +81,11 @@ class NativeThemeButtonExample : public ExampleBase, public ButtonListener { // Overridden from ButtonListener: virtual void ButtonPressed(Button* sender, const Event& event) OVERRIDE; - // The only control in this test. ExampleNativeThemeButton* button_; + scoped_ptr<ExampleComboboxModel> combobox_model_part_; + scoped_ptr<ExampleComboboxModel> combobox_model_state_; + DISALLOW_COPY_AND_ASSIGN(NativeThemeButtonExample); }; |