electron/shell/browser/ui/gtk/menu_gtk.h
electron-roller[bot] 8f7a48879e
chore: bump chromium to 119.0.6045.0 (main) (#40076)
* chore: bump chromium in DEPS to 119.0.6045.0

* chore: update patches

* 4864948: Remove legacy-legacy

https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4864948

* 4907760: Remove ui/base/glib/glib_signal.h

https://chromium-review.googlesource.com/c/chromium/src/+/4907760

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2023-10-05 19:59:39 -04:00

45 lines
1.1 KiB
C++

// Copyright 2014 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 ELECTRON_SHELL_BROWSER_UI_GTK_MENU_GTK_H_
#define ELECTRON_SHELL_BROWSER_UI_GTK_MENU_GTK_H_
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "ui/base/glib/scoped_gobject.h"
#include "ui/base/glib/scoped_gsignal.h"
typedef struct _GtkMenu GtkMenu;
typedef struct _GtkWidget GtkWidget;
namespace ui {
class MenuModel;
}
namespace electron::gtkui {
class MenuGtk {
public:
explicit MenuGtk(ui::MenuModel* model);
virtual ~MenuGtk();
// Refreshes all the menu item labels and menu item checked/enabled states.
void Refresh();
GtkMenu* GetGtkMenu();
private:
// Callback for when a menu item is activated.
void OnMenuItemActivated(GtkWidget* menu_item);
raw_ptr<ui::MenuModel> menu_model_; // not owned
ScopedGObject<GtkWidget> gtk_menu_;
bool block_activation_ = false;
std::vector<ScopedGSignal> signals_;
};
} // namespace electron::gtkui
#endif // ELECTRON_SHELL_BROWSER_UI_GTK_MENU_GTK_H_