blob: a5cfe72cb8aa9f7bade8157f5759467a35decbe6 [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/message_center/views/padded_button.h"
#include <memory>
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/painter.h"
namespace message_center {
PaddedButton::PaddedButton(views::ButtonListener* listener)
: views::ImageButton(listener) {
SetFocusForPlatform();
SetBackground(views::CreateSolidBackground(kControlButtonBackgroundColor));
SetBorder(views::CreateEmptyBorder(gfx::Insets(kControlButtonBorderSize)));
set_animate_on_state_change(false);
SetInkDropMode(InkDropMode::ON);
set_ink_drop_base_color(SkColorSetA(SK_ColorBLACK, 0.6 * 0xff));
set_has_ink_drop_action_on_click(true);
}
std::unique_ptr<views::InkDrop> PaddedButton::CreateInkDrop() {
auto ink_drop = CreateDefaultInkDropImpl();
ink_drop->SetShowHighlightOnHover(false);
ink_drop->SetShowHighlightOnFocus(false);
return std::move(ink_drop);
}
std::unique_ptr<views::InkDropRipple> PaddedButton::CreateInkDropRipple()
const {
return std::make_unique<views::FloodFillInkDropRipple>(
size(), GetInkDropCenterBasedOnLastEvent(),
SkColorSetA(SK_ColorBLACK, 0.6 * 255), ink_drop_visible_opacity());
}
} // namespace message_center