blob: bcfb9c3524d01a41419a058f24a5e4e2ce87cc17 [file] [log] [blame]
// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_CONTROLS_FOCUSABLE_BORDER_H_
#define UI_VIEWS_CONTROLS_FOCUSABLE_BORDER_H_
#include <optional>
#include "ui/color/color_id.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/views/border.h"
#include "ui/views/view.h"
namespace gfx {
class Canvas;
} // namespace gfx
namespace views {
// A Border class to draw a focused border around a field (e.g textfield).
class VIEWS_EXPORT FocusableBorder : public Border {
public:
FocusableBorder();
FocusableBorder(const FocusableBorder&) = delete;
FocusableBorder& operator=(const FocusableBorder&) = delete;
~FocusableBorder() override;
// Sets the insets of the border.
void SetInsets(const gfx::Insets& insets);
// Sets the corner radius.
void SetCornerRadius(float corner_radius);
// Overridden from Border:
void Paint(const View& view, gfx::Canvas* canvas) override;
gfx::Insets GetInsets() const override;
gfx::Size GetMinimumSize() const override;
private:
SkColor GetCurrentColor(const View& view) const;
gfx::Insets insets_;
float corner_radius_;
};
} // namespace views
#endif // UI_VIEWS_CONTROLS_FOCUSABLE_BORDER_H_