electron/shell/browser/ui/accelerator_util.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.1 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_UI_ACCELERATOR_UTIL_H_
#define ELECTRON_SHELL_BROWSER_UI_ACCELERATOR_UTIL_H_
2014-03-15 08:36:29 +00:00
#include <map>
#include <string>
#include "shell/browser/ui/electron_menu_model.h"
2014-03-15 08:36:29 +00:00
#include "ui/base/accelerators/accelerator.h"
namespace accelerator_util {
2018-04-18 01:44:10 +00:00
typedef struct {
size_t position;
2018-04-18 01:44:10 +00:00
electron::ElectronMenuModel* model;
} MenuItem;
2014-03-15 08:36:29 +00:00
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
// Parse a string as an accelerator.
bool StringToAccelerator(const std::string& shortcut,
ui::Accelerator* accelerator);
2021-06-01 01:42:38 +00:00
// Generate a table that contains menu model's accelerators and command ids.
void GenerateAcceleratorTable(AcceleratorTable* table,
electron::ElectronMenuModel* model);
2014-03-15 08:36:29 +00:00
// Trigger command from the accelerators table.
bool TriggerAcceleratorTableCommand(AcceleratorTable* table,
const ui::Accelerator& accelerator);
} // namespace accelerator_util
#endif // ELECTRON_SHELL_BROWSER_UI_ACCELERATOR_UTIL_H_