 41646d1168
			
		
	
	
	
	
	41646d1168* rebase "feat: enable windows control overlay on Windows" * correct compilation error * fix linting errors * modify includes and build file * change `hidden` option to `overlay` * add patch to fix visual layout * add button background color parameter * add button text color parameter * modify `overlay` in docs and modify button hover/press transition color * change `text` to `symbol` * remove todo and fix `text` replacement * add new titleBarOverlay property and remove titleBarStyle `overlay` * update browser and frameless window docs * remove chromium patches * chore: update patches * change button hover color, update trailing `_`, update test file * add dchecks, update title bar drawing checks, update test file * modify for mac and linux builds * update docs with overlayColor and overlaySymbolColor * add corner and side hit test info * modify docs and copyright info * modify `titlebar_overlay_` as boolean or object * move `title_bar_style_ to `NativeWindow` * update docs with boolean and object titlebar_overlay_ * add `IsEmpty` checks * move get options for boolean and object checks * fix linting error * disable `use_lld` for macos * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Update docs/api/frameless-window.md Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * Apply docs suggestions from code review Co-authored-by: Jeremy Rose <jeremya@chromium.org> * modify `true` option description `titleBarOverlay` * ci: cleanup keychain after tests on arm64 mac (#30472) Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
		
			
				
	
	
		
			70 lines
		
	
	
	
		
			2.6 KiB
			
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
	
		
			2.6 KiB
			
		
	
	
	
		
			C++
		
	
	
	
	
	
| // Copyright 2020 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.
 | |
| 
 | |
| #ifndef SHELL_BROWSER_UI_VIEWS_WIN_CAPTION_BUTTON_CONTAINER_H_
 | |
| #define SHELL_BROWSER_UI_VIEWS_WIN_CAPTION_BUTTON_CONTAINER_H_
 | |
| 
 | |
| #include "base/scoped_observation.h"
 | |
| #include "ui/base/metadata/metadata_header_macros.h"
 | |
| #include "ui/base/pointer/touch_ui_controller.h"
 | |
| #include "ui/views/controls/button/button.h"
 | |
| #include "ui/views/view.h"
 | |
| #include "ui/views/widget/widget.h"
 | |
| #include "ui/views/widget/widget_observer.h"
 | |
| 
 | |
| namespace electron {
 | |
| 
 | |
| class WinFrameView;
 | |
| class WinCaptionButton;
 | |
| 
 | |
| // Provides a container for Windows 10 caption buttons that can be moved between
 | |
| // frame and browser window as needed. When extended horizontally, becomes a
 | |
| // grab bar for moving the window.
 | |
| class WinCaptionButtonContainer : public views::View,
 | |
|                                   public views::WidgetObserver {
 | |
|  public:
 | |
|   explicit WinCaptionButtonContainer(WinFrameView* frame_view);
 | |
|   ~WinCaptionButtonContainer() override;
 | |
| 
 | |
|   // Tests to see if the specified |point| (which is expressed in this view's
 | |
|   // coordinates and which must be within this view's bounds) is within one of
 | |
|   // the caption buttons. Returns one of HitTestCompat enum defined in
 | |
|   // ui/base/hit_test.h, HTCAPTION if the area hit would be part of the window's
 | |
|   // drag handle, and HTNOWHERE otherwise.
 | |
|   // See also ClientView::NonClientHitTest.
 | |
|   int NonClientHitTest(const gfx::Point& point) const;
 | |
| 
 | |
|  private:
 | |
|   // views::View:
 | |
|   void AddedToWidget() override;
 | |
|   void RemovedFromWidget() override;
 | |
| 
 | |
|   // views::WidgetObserver:
 | |
|   void OnWidgetBoundsChanged(views::Widget* widget,
 | |
|                              const gfx::Rect& new_bounds) override;
 | |
| 
 | |
|   void ResetWindowControls();
 | |
| 
 | |
|   // Sets caption button visibility and enabled state based on window state.
 | |
|   // Only one of maximize or restore button should ever be visible at the same
 | |
|   // time, and both are disabled in tablet UI mode.
 | |
|   void UpdateButtons();
 | |
| 
 | |
|   WinFrameView* const frame_view_;
 | |
|   WinCaptionButton* const minimize_button_;
 | |
|   WinCaptionButton* const maximize_button_;
 | |
|   WinCaptionButton* const restore_button_;
 | |
|   WinCaptionButton* const close_button_;
 | |
| 
 | |
|   base::ScopedObservation<views::Widget, views::WidgetObserver>
 | |
|       widget_observation_{this};
 | |
| 
 | |
|   base::CallbackListSubscription subscription_ =
 | |
|       ui::TouchUiController::Get()->RegisterCallback(
 | |
|           base::BindRepeating(&WinCaptionButtonContainer::UpdateButtons,
 | |
|                               base::Unretained(this)));
 | |
| };
 | |
| }  // namespace electron
 | |
| 
 | |
| #endif  // SHELL_BROWSER_UI_VIEWS_WIN_CAPTION_BUTTON_CONTAINER_H_
 |