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_TEXT_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // button. | 24 // button. |
25 class VIEWS_EXPORT TextButtonBorder : public Border { | 25 class VIEWS_EXPORT TextButtonBorder : public Border { |
26 public: | 26 public: |
27 TextButtonBorder(); | 27 TextButtonBorder(); |
28 virtual ~TextButtonBorder(); | 28 virtual ~TextButtonBorder(); |
29 | 29 |
30 void SetInsets(const gfx::Insets& insets); | 30 void SetInsets(const gfx::Insets& insets); |
31 | 31 |
32 // Border: | 32 // Border: |
33 virtual gfx::Insets GetInsets() const OVERRIDE; | 33 virtual gfx::Insets GetInsets() const OVERRIDE; |
| 34 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
34 | 35 |
35 private: | 36 private: |
36 // Border: | 37 // Border: |
37 virtual TextButtonBorder* AsTextButtonBorder() OVERRIDE; | 38 virtual TextButtonBorder* AsTextButtonBorder() OVERRIDE; |
38 virtual const TextButtonBorder* AsTextButtonBorder() const OVERRIDE; | 39 virtual const TextButtonBorder* AsTextButtonBorder() const OVERRIDE; |
39 | 40 |
40 gfx::Insets insets_; | 41 gfx::Insets insets_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(TextButtonBorder); | 43 DISALLOW_COPY_AND_ASSIGN(TextButtonBorder); |
43 }; | 44 }; |
(...skipping 11 matching lines...) Expand all Loading... |
55 virtual ~TextButtonDefaultBorder(); | 56 virtual ~TextButtonDefaultBorder(); |
56 | 57 |
57 // TextButtonDefaultBorder takes and retains ownership of these |painter|s. | 58 // TextButtonDefaultBorder takes and retains ownership of these |painter|s. |
58 void set_normal_painter(Painter* painter) { normal_painter_.reset(painter); } | 59 void set_normal_painter(Painter* painter) { normal_painter_.reset(painter); } |
59 void set_hot_painter(Painter* painter) { hot_painter_.reset(painter); } | 60 void set_hot_painter(Painter* painter) { hot_painter_.reset(painter); } |
60 void set_pushed_painter(Painter* painter) { pushed_painter_.reset(painter); } | 61 void set_pushed_painter(Painter* painter) { pushed_painter_.reset(painter); } |
61 | 62 |
62 private: | 63 private: |
63 // TextButtonBorder: | 64 // TextButtonBorder: |
64 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; | 65 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; |
| 66 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
65 | 67 |
66 scoped_ptr<Painter> normal_painter_; | 68 scoped_ptr<Painter> normal_painter_; |
67 scoped_ptr<Painter> hot_painter_; | 69 scoped_ptr<Painter> hot_painter_; |
68 scoped_ptr<Painter> pushed_painter_; | 70 scoped_ptr<Painter> pushed_painter_; |
69 | 71 |
70 int vertical_padding_; | 72 int vertical_padding_; |
71 | 73 |
72 DISALLOW_COPY_AND_ASSIGN(TextButtonDefaultBorder); | 74 DISALLOW_COPY_AND_ASSIGN(TextButtonDefaultBorder); |
73 }; | 75 }; |
74 | 76 |
75 | 77 |
76 // A Border subclass that paints a TextButton's background layer using the | 78 // A Border subclass that paints a TextButton's background layer using the |
77 // platform's native theme look. This handles normal/disabled/hot/pressed | 79 // platform's native theme look. This handles normal/disabled/hot/pressed |
78 // states, with possible animation between states. | 80 // states, with possible animation between states. |
79 class VIEWS_EXPORT TextButtonNativeThemeBorder : public TextButtonBorder { | 81 class VIEWS_EXPORT TextButtonNativeThemeBorder : public TextButtonBorder { |
80 public: | 82 public: |
81 explicit TextButtonNativeThemeBorder(NativeThemeDelegate* delegate); | 83 explicit TextButtonNativeThemeBorder(NativeThemeDelegate* delegate); |
82 virtual ~TextButtonNativeThemeBorder(); | 84 virtual ~TextButtonNativeThemeBorder(); |
83 | 85 |
84 // TextButtonBorder: | 86 // TextButtonBorder: |
85 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; | 87 virtual void Paint(const View& view, gfx::Canvas* canvas) OVERRIDE; |
| 88 // We don't override GetMinimumSize(), since there's no easy way to calculate |
| 89 // the minimum size required by the various theme components. |
86 | 90 |
87 private: | 91 private: |
88 // The delegate the controls the appearance of this border. | 92 // The delegate the controls the appearance of this border. |
89 NativeThemeDelegate* delegate_; | 93 NativeThemeDelegate* delegate_; |
90 | 94 |
91 DISALLOW_COPY_AND_ASSIGN(TextButtonNativeThemeBorder); | 95 DISALLOW_COPY_AND_ASSIGN(TextButtonNativeThemeBorder); |
92 }; | 96 }; |
93 | 97 |
94 | 98 |
95 // A base class for different types of buttons, like push buttons, radio | 99 // A base class for different types of buttons, like push buttons, radio |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 // True if the button should ignore the minimum size for the platform. Default | 371 // True if the button should ignore the minimum size for the platform. Default |
368 // is true. Set to false to prevent narrower buttons. | 372 // is true. Set to false to prevent narrower buttons. |
369 bool ignore_minimum_size_; | 373 bool ignore_minimum_size_; |
370 | 374 |
371 DISALLOW_COPY_AND_ASSIGN(TextButton); | 375 DISALLOW_COPY_AND_ASSIGN(TextButton); |
372 }; | 376 }; |
373 | 377 |
374 } // namespace views | 378 } // namespace views |
375 | 379 |
376 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 380 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
OLD | NEW |