forked from adamlaska/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaccelerator_util.h
More file actions
36 lines (26 loc) · 1.15 KB
/
accelerator_util.h
File metadata and controls
36 lines (26 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright (c) 2013 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_ACCELERATOR_UTIL_H_
#define ELECTRON_SHELL_BROWSER_UI_ACCELERATOR_UTIL_H_
#include <map>
#include <string>
#include "shell/browser/ui/electron_menu_model.h"
#include "ui/base/accelerators/accelerator.h"
namespace accelerator_util {
typedef struct {
int position;
electron::ElectronMenuModel* model;
} MenuItem;
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
// Parse a string as an accelerator.
bool StringToAccelerator(const std::string& shortcut,
ui::Accelerator* accelerator);
// Generate a table that contains menu model's accelerators and command ids.
void GenerateAcceleratorTable(AcceleratorTable* table,
electron::ElectronMenuModel* model);
// 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_