#include "ui/views/controls/button/button.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_forward.h"
#include "base/functional/overloaded.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/actions/actions.h"
#include "ui/base/class_property.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/animation/throb_animation.h"
#include "ui/gfx/color_palette.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_state.h"
#include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/button/button_controller_delegate.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/radio_button.h"
#include "ui/views/controls/button/toggle_button.h"
#include "ui/views/controls/focus_ring.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/painter.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view_class_properties.h"
#if defined(USE_AURA)
#include "ui/aura/client/capture_client.h"
#include "ui/aura/window.h"
#endif
namespace views {
namespace {
DEFINE_UI_CLASS_PROPERTY_KEY(…)
}
Button::DefaultButtonControllerDelegate::DefaultButtonControllerDelegate(
Button* button)
: … { … }
Button::DefaultButtonControllerDelegate::~DefaultButtonControllerDelegate() =
default;
void Button::DefaultButtonControllerDelegate::RequestFocusFromEvent() { … }
void Button::DefaultButtonControllerDelegate::NotifyClick(
const ui::Event& event) { … }
void Button::DefaultButtonControllerDelegate::OnClickCanceled(
const ui::Event& event) { … }
bool Button::DefaultButtonControllerDelegate::IsTriggerableEvent(
const ui::Event& event) { … }
bool Button::DefaultButtonControllerDelegate::ShouldEnterPushedState(
const ui::Event& event) { … }
bool Button::DefaultButtonControllerDelegate::ShouldEnterHoveredState() { … }
InkDrop* Button::DefaultButtonControllerDelegate::GetInkDrop() { … }
int Button::DefaultButtonControllerDelegate::GetDragOperations(
const gfx::Point& press_pt) { … }
bool Button::DefaultButtonControllerDelegate::InDrag() { … }
Button::PressedCallback::PressedCallback(base::OnceClosure closure)
: … { … }
Button::PressedCallback::PressedCallback(
Button::PressedCallback::Callback callback)
: … { … }
Button::PressedCallback::PressedCallback(base::RepeatingClosure closure)
: … { … }
Button::PressedCallback::PressedCallback(PressedCallback&&) = default;
Button::PressedCallback& Button::PressedCallback::operator=(PressedCallback&&) =
default;
Button::PressedCallback::~PressedCallback() = default;
operator bool()
void Button::PressedCallback::Run(const ui::Event& event) { … }
Button::ScopedAnchorHighlight::ScopedAnchorHighlight(
base::WeakPtr<Button> button)
: … { … }
Button::ScopedAnchorHighlight::~ScopedAnchorHighlight() { … }
Button::ScopedAnchorHighlight::ScopedAnchorHighlight(
Button::ScopedAnchorHighlight&&) = default;
Button::ScopedAnchorHighlight& Button::ScopedAnchorHighlight::operator=(
Button::ScopedAnchorHighlight&& other) { … }
constexpr Button::ButtonState Button::kButtonStates[STATE_COUNT];
const Button* Button::AsButton(const views::View* view) { … }
Button* Button::AsButton(views::View* view) { … }
Button::ButtonState Button::GetButtonStateFrom(ui::NativeTheme::State state) { … }
Button::~Button() = default;
void Button::SetTooltipText(const std::u16string& tooltip_text) { … }
const std::u16string& Button::GetTooltipText() const { … }
void Button::SetCallback(PressedCallback callback) { … }
void Button::AdjustAccessibleName(std::u16string& new_name,
ax::mojom::NameFrom& name_from) { … }
Button::ButtonState Button::GetState() const { … }
void Button::SetState(ButtonState state) { … }
int Button::GetTag() const { … }
void Button::SetTag(int tag) { … }
void Button::SetAnimationDuration(base::TimeDelta duration) { … }
void Button::SetTriggerableEventFlags(int triggerable_event_flags) { … }
int Button::GetTriggerableEventFlags() const { … }
void Button::SetRequestFocusOnPress(bool value) { … }
bool Button::GetRequestFocusOnPress() const { … }
void Button::SetAnimateOnStateChange(bool value) { … }
bool Button::GetAnimateOnStateChange() const { … }
void Button::SetHideInkDropWhenShowingContextMenu(bool value) { … }
bool Button::GetHideInkDropWhenShowingContextMenu() const { … }
void Button::SetShowInkDropWhenHotTracked(bool value) { … }
bool Button::GetShowInkDropWhenHotTracked() const { … }
void Button::SetHasInkDropActionOnClick(bool value) { … }
bool Button::GetHasInkDropActionOnClick() const { … }
void Button::SetInstallFocusRingOnFocus(bool install) { … }
bool Button::GetInstallFocusRingOnFocus() const { … }
void Button::SetHotTracked(bool is_hot_tracked) { … }
bool Button::IsHotTracked() const { … }
void Button::SetFocusPainter(std::unique_ptr<Painter> focus_painter) { … }
void Button::SetHighlighted(bool highlighted) { … }
Button::ScopedAnchorHighlight Button::AddAnchorHighlight() { … }
base::CallbackListSubscription Button::AddStateChangedCallback(
PropertyChangedCallback callback) { … }
base::CallbackListSubscription Button::AddAnchorCountChangedCallback(
base::RepeatingCallback<void(size_t)> callback) { … }
Button::KeyClickAction Button::GetKeyClickActionForEvent(
const ui::KeyEvent& event) { … }
void Button::SetButtonController(
std::unique_ptr<ButtonController> button_controller) { … }
gfx::Point Button::GetMenuPosition() const { … }
void Button::SetInkDropView(View* view) { … }
bool Button::OnMousePressed(const ui::MouseEvent& event) { … }
bool Button::OnMouseDragged(const ui::MouseEvent& event) { … }
void Button::OnMouseReleased(const ui::MouseEvent& event) { … }
void Button::OnMouseCaptureLost() { … }
void Button::OnMouseEntered(const ui::MouseEvent& event) { … }
void Button::OnMouseExited(const ui::MouseEvent& event) { … }
void Button::OnMouseMoved(const ui::MouseEvent& event) { … }
bool Button::OnKeyPressed(const ui::KeyEvent& event) { … }
bool Button::OnKeyReleased(const ui::KeyEvent& event) { … }
void Button::OnGestureEvent(ui::GestureEvent* event) { … }
bool Button::AcceleratorPressed(const ui::Accelerator& accelerator) { … }
bool Button::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { … }
std::u16string Button::GetTooltipText(const gfx::Point& p) const { … }
void Button::ShowContextMenu(const gfx::Point& p,
ui::MenuSourceType source_type) { … }
void Button::OnDragDone() { … }
void Button::OnPaint(gfx::Canvas* canvas) { … }
void Button::GetAccessibleNodeData(ui::AXNodeData* node_data) { … }
void Button::VisibilityChanged(View* starting_from, bool visible) { … }
void Button::ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) { … }
void Button::OnFocus() { … }
void Button::OnBlur() { … }
std::unique_ptr<ActionViewInterface> Button::GetActionViewInterface() { … }
void Button::AnimationProgressed(const gfx::Animation* animation) { … }
Button::Button(PressedCallback callback)
: … { … }
void Button::RequestFocusFromEvent() { … }
void Button::NotifyClick(const ui::Event& event) { … }
void Button::OnClickCanceled(const ui::Event& event) { … }
void Button::OnSetTooltipText(const std::u16string& tooltip_text) { … }
void Button::StateChanged(ButtonState old_state) { … }
bool Button::IsTriggerableEvent(const ui::Event& event) { … }
bool Button::ShouldUpdateInkDropOnClickCanceled() const { … }
bool Button::ShouldEnterPushedState(const ui::Event& event) { … }
void Button::PaintButtonContents(gfx::Canvas* canvas) { … }
bool Button::ShouldEnterHoveredState() { … }
base::WeakPtr<Button> Button::GetWeakPtr() { … }
void Button::OnEnabledChanged() { … }
void Button::ReleaseAnchorHighlight() { … }
void Button::SetDefaultActionVerb(ax::mojom::DefaultActionVerb verb) { … }
void Button::UpdateAccessibleDefaultActionVerb() { … }
ButtonActionViewInterface::ButtonActionViewInterface(Button* action_view)
: … { … }
void ButtonActionViewInterface::ActionItemChangedImpl(
actions::ActionItem* action_item) { … }
void ButtonActionViewInterface::LinkActionInvocationToView(
base::RepeatingClosure invoke_action_callback) { … }
BEGIN_METADATA(…)
}
DEFINE_ENUM_CONVERTERS(…)