![electron-roller[bot]](/assets/img/avatar_default.png)
*6230977
* chore: bump chromium to 135.0.7012.0 * chore: update accelerator.patch Support parsing Ctrl+Alt shortcuts |6238137
* 6234236: Reapply bindings: Pass CppHeap on Isolate creation |6234236
* 6234614: [ios blink] Move to use external begin frame source |6234614
* chore: update chromium/feat_add_streaming-protocol_registry_to_multibuffer_data_source.patch no manual changes; patch applied with fuzz * chore: update chromium/build_libc_as_static_library.patch no manual changes; patch applied with fuzz * chore: remove chromium/cherry-pick-dd8e2822e507.patch landed upstream * 6188884: Grit: Remove output_all_resource_defines from list of valid attributes. |6188884
* 6226981: [views-ax] Remove View::GetAccessibleNodeData() method |6226981
* 6214895: [views-ax] Deprecate View::NotifyAccessibilityEvent |6214895
* 6196494: Remove ImageView::SetImage() with ImageSkia param |6196494
* 6236267: [cleanup] Remove unused PrinterBasicInfo fields |6236267
* refactor: remove status, isDefault properties from PrinterInfo Xref:6236267
* chore: lint * fixup: added mas bypass to new file added in6208630
see slack for more context * chore: node script/gen-libc++-filenames.js * chore: e patches all * fix: duplicate crdtp symbols * chore: update patches * fixup! [Media Features] Remove launched features --------- Co-authored-by: alice <alice@makenotion.com> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
97 lines
2.9 KiB
C++
97 lines
2.9 KiB
C++
// Copyright (c) 2014 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
|
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|
|
|
|
#include "base/memory/raw_ptr.h"
|
|
#include "shell/browser/native_window_observer.h"
|
|
#include "shell/browser/ui/electron_menu_model.h"
|
|
#include "shell/browser/ui/views/menu_delegate.h"
|
|
#include "shell/browser/ui/views/root_view.h"
|
|
#include "ui/base/metadata/metadata_header_macros.h"
|
|
#include "ui/base/metadata/metadata_impl_macros.h"
|
|
#include "ui/views/accessible_pane_view.h"
|
|
|
|
namespace views {
|
|
class MenuButton;
|
|
}
|
|
|
|
namespace electron {
|
|
|
|
class MenuBar : public views::AccessiblePaneView,
|
|
private MenuDelegate::Observer,
|
|
private NativeWindowObserver {
|
|
METADATA_HEADER(MenuBar, views::AccessiblePaneView)
|
|
|
|
public:
|
|
MenuBar(NativeWindow* window, RootView* root_view);
|
|
~MenuBar() override;
|
|
|
|
// disable copy
|
|
MenuBar(const MenuBar&) = delete;
|
|
MenuBar& operator=(const MenuBar&) = delete;
|
|
|
|
// Replaces current menu with a new one.
|
|
void SetMenu(ElectronMenuModel* menu_model);
|
|
|
|
// Shows underline under accelerators.
|
|
void SetAcceleratorVisibility(bool visible);
|
|
|
|
// Returns true if the submenu has accelerator |key|
|
|
bool HasAccelerator(char16_t key);
|
|
|
|
// Shows the submenu whose accelerator is |key|.
|
|
void ActivateAccelerator(char16_t key);
|
|
|
|
// Returns there are how many items in the root menu.
|
|
size_t GetItemCount() const;
|
|
|
|
// Get the menu under specified screen point.
|
|
bool GetMenuButtonFromScreenPoint(const gfx::Point& point,
|
|
ElectronMenuModel** menu_model,
|
|
views::MenuButton** button);
|
|
|
|
void ViewHierarchyChanged(
|
|
const views::ViewHierarchyChangedDetails& details) override;
|
|
|
|
private:
|
|
// MenuDelegate::Observer:
|
|
void OnBeforeExecuteCommand() override;
|
|
void OnMenuClosed() override;
|
|
|
|
// NativeWindowObserver:
|
|
void OnWindowBlur() override;
|
|
void OnWindowFocus() override;
|
|
|
|
// views::AccessiblePaneView:
|
|
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
|
|
bool SetPaneFocusAndFocusDefault() override;
|
|
void OnThemeChanged() override;
|
|
|
|
// views::FocusChangeListener:
|
|
void OnDidChangeFocus(View* focused_before, View* focused_now) override;
|
|
|
|
void ButtonPressed(size_t id, const ui::Event& event);
|
|
|
|
void RebuildChildren();
|
|
void UpdateViewColors();
|
|
void RefreshColorCache(const ui::NativeTheme* theme);
|
|
View* FindAccelChild(char16_t key);
|
|
|
|
SkColor background_color_;
|
|
#if BUILDFLAG(IS_LINUX)
|
|
SkColor enabled_color_;
|
|
SkColor disabled_color_;
|
|
#endif
|
|
|
|
raw_ptr<NativeWindow> window_;
|
|
raw_ptr<RootView> root_view_;
|
|
raw_ptr<ElectronMenuModel> menu_model_ = nullptr;
|
|
bool accelerator_installed_ = false;
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_UI_VIEWS_MENU_BAR_H_
|