#ifndef UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_
#define UI_VIEWS_WINDOW_FRAME_BACKGROUND_H_
#include "base/memory/raw_ptr.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/views/views_export.h"
namespace gfx {
class Canvas;
}
namespace ui {
class ColorProvider;
class NativeTheme;
}
namespace views {
class View;
class VIEWS_EXPORT FrameBackground {
public:
FrameBackground();
FrameBackground(const FrameBackground&) = delete;
FrameBackground& operator=(const FrameBackground&) = delete;
~FrameBackground();
void set_frame_color(SkColor color) { frame_color_ = color; }
void set_use_custom_frame(bool use_custom_frame) {
use_custom_frame_ = use_custom_frame;
}
void set_is_active(bool is_active) { is_active_ = is_active; }
void set_theme_image(const gfx::ImageSkia& image) { theme_image_ = image; }
void set_theme_image_inset(gfx::Point theme_image_inset) {
theme_image_inset_ = theme_image_inset;
}
void set_theme_overlay_image(const gfx::ImageSkia& image) {
theme_overlay_image_ = image;
}
void set_top_area_height(int height) { top_area_height_ = height; }
void set_maximized_top_inset(int inset) { maximized_top_inset_ = inset; }
void SetSideImages(const gfx::ImageSkia* left,
const gfx::ImageSkia* top,
const gfx::ImageSkia* right,
const gfx::ImageSkia* bottom);
void SetCornerImages(const gfx::ImageSkia* top_left,
const gfx::ImageSkia* top_right,
const gfx::ImageSkia* bottom_left,
const gfx::ImageSkia* bottom_right);
void PaintRestored(gfx::Canvas* canvas, const View* view) const;
void PaintMaximized(gfx::Canvas* canvas, const View* view) const;
void PaintMaximized(gfx::Canvas* canvas,
const ui::NativeTheme* native_theme,
const ui::ColorProvider* color_provider,
int x,
int y,
int width) const;
void FillFrameBorders(gfx::Canvas* canvas,
const View* view,
int left_edge_width,
int right_edge_width,
int bottom_edge_height) const;
private:
SkColor frame_color_ = 0;
bool use_custom_frame_ = true;
bool is_active_ = true;
gfx::ImageSkia theme_image_;
gfx::Point theme_image_inset_;
gfx::ImageSkia theme_overlay_image_;
int top_area_height_ = 0;
raw_ptr<const gfx::ImageSkia> left_edge_ = nullptr;
raw_ptr<const gfx::ImageSkia> top_edge_ = nullptr;
raw_ptr<const gfx::ImageSkia> right_edge_ = nullptr;
raw_ptr<const gfx::ImageSkia> bottom_edge_ = nullptr;
raw_ptr<const gfx::ImageSkia> top_left_corner_ = nullptr;
raw_ptr<const gfx::ImageSkia> top_right_corner_ = nullptr;
raw_ptr<const gfx::ImageSkia> bottom_left_corner_ = nullptr;
raw_ptr<const gfx::ImageSkia> bottom_right_corner_ = nullptr;
int maximized_top_inset_ = 0;
};
}
#endif