Index: ui/views/controls/button/label_button.h |
diff --git a/ui/views/controls/button/label_button.h b/ui/views/controls/button/label_button.h |
index 2efd5b11f7d273e19eba4cdc95bbac37e5f4eee5..842b4fb2b962749bf45c7f8ea1022405edce0b96 100644 |
--- a/ui/views/controls/button/label_button.h |
+++ b/ui/views/controls/button/label_button.h |
@@ -28,9 +28,25 @@ class VIEWS_EXPORT LabelButton : public CustomButton, |
static const char kViewClassName[]; |
+ // Construct an uninitialized LabelButton with a Listener. Client code must |
+ // also call InitAsTextbutton() or InitAsButton() to initialize the |
+ // (possibly themed) button borders. |
+ explicit LabelButton(ButtonListener* listener); |
+ |
+ // Deprecated (calls virtual methods). TODO(tapted): Remove this overload. |
LabelButton(ButtonListener* listener, const base::string16& text); |
+ |
~LabelButton() override; |
+ // Initializes the LabelButton with STYLE_TEXTBUTTON. If borders have not been |
+ // set with SetBorder(), creates default themed borders. These may also be |
+ // customized by a subclass via CreateDefaultBorder(). |
+ void InitAsTextbutton(const base::string16& text); |
+ |
+ // Initializes with STYLE_BUTTON and creates default borders if SetBorder() |
+ // has not already been called. |
+ void InitAsButton(const base::string16& text); |
+ |
// Get or set the image shown for the specified button state. |
// GetImage returns the image for STATE_NORMAL if the state's image is empty. |
virtual const gfx::ImageSkia& GetImage(ButtonState for_state); |
@@ -73,8 +89,11 @@ class VIEWS_EXPORT LabelButton : public CustomButton, |
bool is_default() const { return is_default_; } |
void SetIsDefault(bool is_default); |
- // Get or set the button's overall style; the default is |STYLE_TEXTBUTTON|. |
+ // Gets the button's overall style. |
ButtonStyle style() const { return style_; } |
+ |
+ // Sets the button style and updates (possibly themed) borders. TODO(tapted): |
+ // Make this method protected after callers have switched to InitAsButton(). |
void SetStyle(ButtonStyle style); |
// Set the spacing between the image and the text. Shrinking the spacing |
@@ -127,6 +146,7 @@ class VIEWS_EXPORT LabelButton : public CustomButton, |
gfx::Rect GetThemePaintRect() const override; |
private: |
+ FRIEND_TEST_ALL_PREFIXES(BlueButtonTest, Border); |
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); |
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); |
FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); |