| Index: ui/views/controls/button/custom_button.h
|
| diff --git a/ui/views/controls/button/custom_button.h b/ui/views/controls/button/custom_button.h
|
| index 6c158166ab9f13c445af38ad40231140b30ff795..1002fee1332df8cc9b1b26d37f03dea71b879bd7 100644
|
| --- a/ui/views/controls/button/custom_button.h
|
| +++ b/ui/views/controls/button/custom_button.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
|
| #define UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
|
|
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "ui/base/animation/animation_delegate.h"
|
| #include "ui/base/events/event_constants.h"
|
| #include "ui/views/controls/button/button.h"
|
| @@ -15,6 +16,8 @@ class ThrobAnimation;
|
|
|
| namespace views {
|
|
|
| +class CustomButtonStateChangedDelegate;
|
| +
|
| // A button with custom rendering. The common base class of ImageButton and
|
| // TextButton.
|
| // Note that this type of button is not focusable by default and will not be
|
| @@ -98,6 +101,11 @@ class VIEWS_EXPORT CustomButton : public Button,
|
| // Overridden from ui::AnimationDelegate:
|
| virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
|
|
|
| + // Takes ownership of the delegate.
|
| + void set_state_changed_delegate(CustomButtonStateChangedDelegate* delegate) {
|
| + state_changed_delegate_.reset(delegate);
|
| + }
|
| +
|
| protected:
|
| // Construct the Button with a Listener. See comment for Button's ctor.
|
| explicit CustomButton(ButtonListener* listener);
|
| @@ -142,9 +150,24 @@ class VIEWS_EXPORT CustomButton : public Button,
|
| // See description above setter.
|
| bool request_focus_on_press_;
|
|
|
| + scoped_ptr<CustomButtonStateChangedDelegate> state_changed_delegate_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(CustomButton);
|
| };
|
|
|
| +// Delegate for actions taken on state changes by CustomButton.
|
| +class VIEWS_EXPORT CustomButtonStateChangedDelegate {
|
| +public:
|
| + virtual ~CustomButtonStateChangedDelegate() {}
|
| + virtual void StateChanged(CustomButton::ButtonState state) = 0;
|
| +
|
| +protected:
|
| + CustomButtonStateChangedDelegate() {}
|
| +
|
| +private:
|
| + DISALLOW_COPY_AND_ASSIGN(CustomButtonStateChangedDelegate);
|
| +};
|
| +
|
| } // namespace views
|
|
|
| #endif // UI_VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
|
|
|