| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/button.h" | 5 #include "chrome/views/button.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 | 9 |
| 10 #include "base/gfx/image_operations.h" | 10 #include "base/gfx/image_operations.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 images_[aState] = anImage ? *anImage : SkBitmap(); | 50 images_[aState] = anImage ? *anImage : SkBitmap(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void Button::SetImageAlignment(HorizontalAlignment h_align, | 53 void Button::SetImageAlignment(HorizontalAlignment h_align, |
| 54 VerticalAlignment v_align) { | 54 VerticalAlignment v_align) { |
| 55 h_alignment_ = h_align; | 55 h_alignment_ = h_align; |
| 56 v_alignment_ = v_align; | 56 v_alignment_ = v_align; |
| 57 SchedulePaint(); | 57 SchedulePaint(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void Button::GetPreferredSize(CSize *result) { | 60 gfx::Size Button::GetPreferredSize() { |
| 61 if (!images_[BS_NORMAL].isNull()) { | 61 if (!images_[BS_NORMAL].isNull()) |
| 62 result->cx = images_[BS_NORMAL].width(); | 62 return gfx::Size(images_[BS_NORMAL].width(), images_[BS_NORMAL].height()); |
| 63 result->cy = images_[BS_NORMAL].height(); | 63 return gfx::Size(kDefaultWidth, kDefaultHeight); |
| 64 } else { | |
| 65 result->cx = kDefaultWidth; | |
| 66 result->cy = kDefaultHeight; | |
| 67 } | |
| 68 } | 64 } |
| 69 | 65 |
| 70 // Set the tooltip text for this button. | 66 // Set the tooltip text for this button. |
| 71 void Button::SetTooltipText(const std::wstring& text) { | 67 void Button::SetTooltipText(const std::wstring& text) { |
| 72 tooltip_text_ = text; | 68 tooltip_text_ = text; |
| 73 TooltipTextChanged(); | 69 TooltipTextChanged(); |
| 74 } | 70 } |
| 75 | 71 |
| 76 // Return the tooltip text currently used by this button. | 72 // Return the tooltip text currently used by this button. |
| 77 std::wstring Button::GetTooltipText() const { | 73 std::wstring Button::GetTooltipText() const { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 194 } |
| 199 toggled_ = toggled; | 195 toggled_ = toggled; |
| 200 SchedulePaint(); | 196 SchedulePaint(); |
| 201 } | 197 } |
| 202 | 198 |
| 203 void ToggleButton::SetToggledTooltipText(const std::wstring& tooltip) { | 199 void ToggleButton::SetToggledTooltipText(const std::wstring& tooltip) { |
| 204 toggled_tooltip_text_.assign(tooltip); | 200 toggled_tooltip_text_.assign(tooltip); |
| 205 } | 201 } |
| 206 } // namespace ChromeViews | 202 } // namespace ChromeViews |
| 207 | 203 |
| OLD | NEW |