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 #include "ui/views/examples/native_theme_button_example.h" | 5 #include "ui/views/examples/native_theme_button_example.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 return gfx::NativeTheme::kHovered; | 186 return gfx::NativeTheme::kHovered; |
187 } | 187 } |
188 | 188 |
189 gfx::Size ExampleNativeThemeButton::GetPreferredSize() { | 189 gfx::Size ExampleNativeThemeButton::GetPreferredSize() { |
190 return painter_.get() == NULL ? gfx::Size() : painter_->GetPreferredSize(); | 190 return painter_.get() == NULL ? gfx::Size() : painter_->GetPreferredSize(); |
191 } | 191 } |
192 | 192 |
193 void ExampleNativeThemeButton::OnPaintBackground(gfx::Canvas* canvas) { | 193 void ExampleNativeThemeButton::OnPaintBackground(gfx::Canvas* canvas) { |
194 // Fill the background with a known colour so that we know where the bounds | 194 // Fill the background with a known colour so that we know where the bounds |
195 // of the View are. | 195 // of the View are. |
196 canvas->FillRect(SkColorSetRGB(255, 128, 128), GetLocalBounds()); | 196 canvas->FillRect(GetLocalBounds(), SkColorSetRGB(255, 128, 128)); |
197 CustomButton::OnPaintBackground(canvas); | 197 CustomButton::OnPaintBackground(canvas); |
198 } | 198 } |
199 | 199 |
200 //////////////////////////////////////////////////////////////////////////////// | 200 //////////////////////////////////////////////////////////////////////////////// |
201 | 201 |
202 NativeThemeButtonExample::NativeThemeButtonExample() | 202 NativeThemeButtonExample::NativeThemeButtonExample() |
203 : ExampleBase("Native Theme Button") { | 203 : ExampleBase("Native Theme Button") { |
204 } | 204 } |
205 | 205 |
206 NativeThemeButtonExample::~NativeThemeButtonExample() { | 206 NativeThemeButtonExample::~NativeThemeButtonExample() { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 layout->AddPaddingRow(0, 8); | 249 layout->AddPaddingRow(0, 8); |
250 } | 250 } |
251 | 251 |
252 void NativeThemeButtonExample::ButtonPressed(Button* sender, | 252 void NativeThemeButtonExample::ButtonPressed(Button* sender, |
253 const Event& event) { | 253 const Event& event) { |
254 PrintStatus(button_->MessWithState().c_str()); | 254 PrintStatus(button_->MessWithState().c_str()); |
255 } | 255 } |
256 | 256 |
257 } // namespace examples | 257 } // namespace examples |
258 } // namespace views | 258 } // namespace views |
OLD | NEW |