fix: update Windows caption buttons to match Win11 style (#34790)
This commit is contained in:
parent
4190ec2482
commit
95019f0454
5 changed files with 236 additions and 42 deletions
|
@ -7,8 +7,11 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_UI_VIEWS_WIN_CAPTION_BUTTON_H_
|
||||
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_WIN_CAPTION_BUTTON_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "chrome/browser/ui/frame/window_frame_util.h"
|
||||
#include "chrome/browser/ui/view_ids.h"
|
||||
#include "shell/browser/ui/views/win_icon_painter.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/gfx/canvas.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
|
@ -23,6 +26,8 @@ class WinCaptionButton : public views::Button {
|
|||
WinFrameView* frame_view,
|
||||
ViewID button_type,
|
||||
const std::u16string& accessible_name);
|
||||
~WinCaptionButton() override;
|
||||
|
||||
WinCaptionButton(const WinCaptionButton&) = delete;
|
||||
WinCaptionButton& operator=(const WinCaptionButton&) = delete;
|
||||
|
||||
|
@ -35,6 +40,7 @@ class WinCaptionButton : public views::Button {
|
|||
void SetSize(gfx::Size size);
|
||||
|
||||
private:
|
||||
std::unique_ptr<WinIconPainter> CreateIconPainter();
|
||||
// Returns the amount we should visually reserve on the left (right in RTL)
|
||||
// for spacing between buttons. We do this instead of repositioning the
|
||||
// buttons to avoid the sliver of deadspace that would result.
|
||||
|
@ -53,6 +59,7 @@ class WinCaptionButton : public views::Button {
|
|||
void PaintSymbol(gfx::Canvas* canvas);
|
||||
|
||||
WinFrameView* frame_view_;
|
||||
std::unique_ptr<WinIconPainter> icon_painter_;
|
||||
ViewID button_type_;
|
||||
|
||||
int base_width_ = WindowFrameUtil::kWindows10GlassCaptionButtonWidth;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue