Chromium Code Reviews| Index: ui/views/controls/button/web_style_text_button.h |
| diff --git a/ui/views/controls/button/web_style_text_button.h b/ui/views/controls/button/web_style_text_button.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..98746e709cacd02234a2f51eace21897faa2cf60 |
| --- /dev/null |
| +++ b/ui/views/controls/button/web_style_text_button.h |
| @@ -0,0 +1,57 @@ |
| +// 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. |
| + |
| +#ifndef UI_VIEWS_CONTROLS_BUTTON_WEB_STYLE_TEXT_BUTTON_H_ |
| +#define UI_VIEWS_CONTROLS_BUTTON_WEB_STYLE_TEXT_BUTTON_H_ |
| + |
| +#include "ui/views/controls/button/text_button.h" |
| + |
| +namespace views { |
| + |
| +class WebStyleTextButtonBackground; |
| +class WebStyleTextButtonBorder; |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// |
| +// WebStyleTextButton |
| +// |
| +// Similar to TextButton, but rendered with in a style similar to |
| +// Chrome WebUI. |
| +// |
| +//////////////////////////////////////////////////////////////////////////////// |
| + |
| +class VIEWS_EXPORT WebStyleTextButton : public TextButton { |
|
Ben Goodger (Google)
2012/09/17 22:37:26
Can we avoid adding Yet-Another-Button-Subclass an
Mike Wittman
2012/09/21 22:53:18
Yes. I've refactored the necessary functionality
|
| + public: |
| + // The button's class name. |
| + static const char kViewClassName[]; |
| + |
| + WebStyleTextButton(ButtonListener* listener, const string16& title); |
| + |
| + // Overridden from View |
| + virtual gfx::Size GetPreferredSize() OVERRIDE; |
| + virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| + |
| + // Overridden from CustomButton |
| + virtual void StateChanged() OVERRIDE; |
| + |
| + // Overridden from TextButton: |
| + virtual std::string GetClassName() const OVERRIDE; |
| + |
| + private: |
| + void SetBackgroundForState(ButtonState state); |
| + void SetShadowForState(ButtonState state); |
| + void SetBorderColorForState(ButtonState state); |
| + |
| + ButtonState prior_state_; |
| + // Weak pointer to typed background instance. |
| + WebStyleTextButtonBackground* web_style_background_; |
| + // Weak pointer to typed border instance. |
| + WebStyleTextButtonBorder* web_style_border_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(WebStyleTextButton); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_CONTROLS_BUTTON_WEB_STYLE_TEXT_BUTTON_H_ |