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_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void SetFontList(const gfx::FontList& font_list); | 58 void SetFontList(const gfx::FontList& font_list); |
59 | 59 |
60 // Set the elide behavior of this button. | 60 // Set the elide behavior of this button. |
61 void SetElideBehavior(gfx::ElideBehavior elide_behavior); | 61 void SetElideBehavior(gfx::ElideBehavior elide_behavior); |
62 | 62 |
63 // Get or set the horizontal alignment used for the button; reversed in RTL. | 63 // Get or set the horizontal alignment used for the button; reversed in RTL. |
64 // The optional image will lead the text, unless the button is right-aligned. | 64 // The optional image will lead the text, unless the button is right-aligned. |
65 gfx::HorizontalAlignment GetHorizontalAlignment() const; | 65 gfx::HorizontalAlignment GetHorizontalAlignment() const; |
66 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); | 66 void SetHorizontalAlignment(gfx::HorizontalAlignment alignment); |
67 | 67 |
68 // Set the directionality mode used for the button text. | |
69 void SetDirectionalityMode(gfx::DirectionalityMode mode); | |
70 | |
71 // Call set_min_size(gfx::Size()) to clear the monotonically increasing size. | 68 // Call set_min_size(gfx::Size()) to clear the monotonically increasing size. |
72 void set_min_size(const gfx::Size& min_size) { min_size_ = min_size; } | 69 void set_min_size(const gfx::Size& min_size) { min_size_ = min_size; } |
73 void set_max_size(const gfx::Size& max_size) { max_size_ = max_size; } | 70 void set_max_size(const gfx::Size& max_size) { max_size_ = max_size; } |
74 | 71 |
75 // Get or set the option to handle the return key; false by default. | 72 // Get or set the option to handle the return key; false by default. |
76 bool is_default() const { return is_default_; } | 73 bool is_default() const { return is_default_; } |
77 void SetIsDefault(bool is_default); | 74 void SetIsDefault(bool is_default); |
78 | 75 |
79 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. | 76 // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. |
80 ButtonStyle style() const { return style_; } | 77 ButtonStyle style() const { return style_; } |
81 void SetStyle(ButtonStyle style); | 78 void SetStyle(ButtonStyle style); |
82 | 79 |
83 void SetFocusPainter(scoped_ptr<Painter> focus_painter); | 80 void SetFocusPainter(scoped_ptr<Painter> focus_painter); |
84 Painter* focus_painter() { return focus_painter_.get(); } | 81 Painter* focus_painter() { return focus_painter_.get(); } |
85 | 82 |
86 // View: | 83 // View: |
87 virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE; | 84 virtual void SetBorder(scoped_ptr<Border> border) OVERRIDE; |
88 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 85 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
| 86 virtual int GetHeightForWidth(int w) const OVERRIDE; |
89 virtual void Layout() OVERRIDE; | 87 virtual void Layout() OVERRIDE; |
90 virtual const char* GetClassName() const OVERRIDE; | 88 virtual const char* GetClassName() const OVERRIDE; |
91 | 89 |
92 protected: | 90 protected: |
93 ImageView* image() const { return image_; } | 91 ImageView* image() const { return image_; } |
94 Label* label() const { return label_; } | 92 Label* label() const { return label_; } |
95 | 93 |
96 // Returns the available area for the label and image. Subclasses can change | 94 // Returns the available area for the label and image. Subclasses can change |
97 // these bounds if they need room to do manual painting. | 95 // these bounds if they need room to do manual painting. |
98 virtual gfx::Rect GetChildAreaBounds(); | 96 virtual gfx::Rect GetChildAreaBounds(); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 bool border_is_themed_border_; | 176 bool border_is_themed_border_; |
179 | 177 |
180 scoped_ptr<Painter> focus_painter_; | 178 scoped_ptr<Painter> focus_painter_; |
181 | 179 |
182 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 180 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
183 }; | 181 }; |
184 | 182 |
185 } // namespace views | 183 } // namespace views |
186 | 184 |
187 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 185 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
OLD | NEW |