| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| 6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> |
| 10 |
| 9 #include "gfx/font.h" | 11 #include "gfx/font.h" |
| 10 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 12 #include "views/border.h" | 14 #include "views/border.h" |
| 13 #include "views/controls/button/custom_button.h" | 15 #include "views/controls/button/custom_button.h" |
| 14 | 16 |
| 15 namespace views { | 17 namespace views { |
| 16 | 18 |
| 17 //////////////////////////////////////////////////////////////////////////////// | 19 //////////////////////////////////////////////////////////////////////////////// |
| 18 // | 20 // |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // | 67 // |
| 66 // TextButton | 68 // TextButton |
| 67 // | 69 // |
| 68 // A button which displays text and/or and icon that can be changed in | 70 // A button which displays text and/or and icon that can be changed in |
| 69 // response to actions. TextButton reserves space for the largest string | 71 // response to actions. TextButton reserves space for the largest string |
| 70 // passed to SetText. To reset the cached max size invoke ClearMaxTextSize. | 72 // passed to SetText. To reset the cached max size invoke ClearMaxTextSize. |
| 71 // | 73 // |
| 72 //////////////////////////////////////////////////////////////////////////////// | 74 //////////////////////////////////////////////////////////////////////////////// |
| 73 class TextButton : public CustomButton { | 75 class TextButton : public CustomButton { |
| 74 public: | 76 public: |
| 77 // The menu button's class name. |
| 78 static const char kViewClassName[]; |
| 79 |
| 75 // Enumeration of how the prefix ('&') character is processed. The default | 80 // Enumeration of how the prefix ('&') character is processed. The default |
| 76 // is |PREFIX_NONE|. | 81 // is |PREFIX_NONE|. |
| 77 enum PrefixType { | 82 enum PrefixType { |
| 78 // No special processing is done. | 83 // No special processing is done. |
| 79 PREFIX_NONE, | 84 PREFIX_NONE, |
| 80 | 85 |
| 81 // The character following the prefix character is not rendered specially. | 86 // The character following the prefix character is not rendered specially. |
| 82 PREFIX_HIDE, | 87 PREFIX_HIDE, |
| 83 | 88 |
| 84 // The character following the prefix character is underlined. | 89 // The character following the prefix character is underlined. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 virtual gfx::Size GetPreferredSize(); | 151 virtual gfx::Size GetPreferredSize(); |
| 147 virtual gfx::Size GetMinimumSize(); | 152 virtual gfx::Size GetMinimumSize(); |
| 148 virtual void SetEnabled(bool enabled); | 153 virtual void SetEnabled(bool enabled); |
| 149 | 154 |
| 150 // Text colors. | 155 // Text colors. |
| 151 static const SkColor kEnabledColor; | 156 static const SkColor kEnabledColor; |
| 152 static const SkColor kHighlightColor; | 157 static const SkColor kHighlightColor; |
| 153 static const SkColor kDisabledColor; | 158 static const SkColor kDisabledColor; |
| 154 static const SkColor kHoverColor; | 159 static const SkColor kHoverColor; |
| 155 | 160 |
| 161 // Returns views/TextButton. |
| 162 virtual std::string GetClassName() const; |
| 163 |
| 156 protected: | 164 protected: |
| 157 SkBitmap icon() const { return icon_; } | 165 SkBitmap icon() const { return icon_; } |
| 158 | 166 |
| 159 virtual void Paint(gfx::Canvas* canvas); | 167 virtual void Paint(gfx::Canvas* canvas); |
| 160 | 168 |
| 161 // Called when enabled or disabled state changes, or the colors for those | 169 // Called when enabled or disabled state changes, or the colors for those |
| 162 // states change. | 170 // states change. |
| 163 virtual void UpdateColor(); | 171 virtual void UpdateColor(); |
| 164 | 172 |
| 165 private: | 173 private: |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 bool show_multiple_icon_states_; | 225 bool show_multiple_icon_states_; |
| 218 | 226 |
| 219 PrefixType prefix_type_; | 227 PrefixType prefix_type_; |
| 220 | 228 |
| 221 DISALLOW_COPY_AND_ASSIGN(TextButton); | 229 DISALLOW_COPY_AND_ASSIGN(TextButton); |
| 222 }; | 230 }; |
| 223 | 231 |
| 224 } // namespace views | 232 } // namespace views |
| 225 | 233 |
| 226 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 234 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| OLD | NEW |