| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/views/border.h" | 11 #include "ui/views/border.h" |
| 12 #include "ui/views/controls/button/custom_button.h" | 12 #include "ui/views/controls/button/button.h" |
| 13 #include "ui/views/painter.h" | 13 #include "ui/views/painter.h" |
| 14 | 14 |
| 15 namespace views { | 15 namespace views { |
| 16 | 16 |
| 17 // A Border that paints a LabelButton's background frame. | 17 // A Border that paints a LabelButton's background frame. |
| 18 class VIEWS_EXPORT LabelButtonBorder : public Border { | 18 class VIEWS_EXPORT LabelButtonBorder : public Border { |
| 19 public: | 19 public: |
| 20 LabelButtonBorder(); | 20 explicit LabelButtonBorder(Button::ButtonStyle style); |
| 21 virtual ~LabelButtonBorder(); | 21 virtual ~LabelButtonBorder(); |
| 22 | 22 |
| 23 bool native_theme() const { return native_theme_; } | 23 Button::ButtonStyle style() const { return style_; } |
| 24 void set_native_theme(bool native_theme) { native_theme_ = native_theme; } | |
| 25 | 24 |
| 26 // Overridden from Border: | 25 // Overridden from Border: |
| 27 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; | 26 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; |
| 28 virtual gfx::Insets GetInsets() const OVERRIDE; | 27 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 29 | 28 |
| 30 // Get or set the painter used for the specified button state. | 29 // Get or set the painter used for the specified button state. |
| 31 // LabelButtonBorder takes and retains ownership of |painter|. | 30 // LabelButtonBorder takes and retains ownership of |painter|. |
| 32 Painter* GetPainter(CustomButton::ButtonState state); | 31 Painter* GetPainter(Button::ButtonState state); |
| 33 void SetPainter(CustomButton::ButtonState state, Painter* painter); | 32 void SetPainter(Button::ButtonState state, Painter* painter); |
| 34 | 33 |
| 35 private: | 34 private: |
| 36 // The painters used for each button state. | 35 // The painters used for each button state. |
| 37 scoped_ptr<Painter> painters_[CustomButton::STATE_COUNT]; | 36 scoped_ptr<Painter> painters_[Button::STATE_COUNT]; |
| 38 | 37 |
| 39 // A flag controlling native (true) or Views theme styling; false by default. | 38 // The button style supplied in part by this border. |
| 40 bool native_theme_; | 39 Button::ButtonStyle style_; |
| 41 | 40 |
| 42 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder); | 41 DISALLOW_COPY_AND_ASSIGN(LabelButtonBorder); |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 } // namespace views | 44 } // namespace views |
| 46 | 45 |
| 47 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ | 46 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_BORDER_H_ |
| OLD | NEW |