forked from dart-lang/sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelpDialog.dart
87 lines (77 loc) · 2.39 KB
/
HelpDialog.dart
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.9
part of swarmlib;
/**
* An informational dialog that shows keyboard shortcuts and provides a
* link to the Dart language webpage.
*/
//TODO(efortuna): fix DialogView so it doesn't require the HTML passed to
// the constructor.
class HelpDialog extends DialogView {
CompositeView _parent;
Function _doneHandler;
HelpDialog(this._parent, this._doneHandler)
: super('Information', '', makeContent());
void onDone() {
_doneHandler();
}
static View makeContent() {
return new View.html('''
<div>
<p>
Keyboard shortcuts:
${generateTableHtml()}
</p>
<p>
<div id="dart-logo">
<a href="http://dartlang.org">
Dart, the programming language</a>.
</div>
</p>
</div>
''');
}
static String generateTableHtml() {
String cellStart = '''<th valign="middle" align="center">''';
return '''<table width="90%" border=1 cellspacing="0" cellpadding="2">
<tr bgcolor="#c3d9ff">
${cellStart} Shortcut Key </th>
${cellStart} Action </th>
</tr>
<tr>
${cellStart} j, <down arrow> </th>
${cellStart} Next Article </th>
</tr>
<tr>
${cellStart} k, <up arrow> </th>
${cellStart} Previous Article </th>
</tr>
<tr>
${cellStart} o, <enter> </th>
${cellStart} Open Article </th>
</tr>
<tr>
${cellStart} <esc>, <delete> </th>
${cellStart} Back </th>
</tr>
<tr>
${cellStart} a, h, <left arrow> </th>
${cellStart} Left </th>
</tr>
<tr>
${cellStart} d, l, <right arrow> </th>
${cellStart} Right </th>
</tr>
<tr>
${cellStart} n </th>
${cellStart} Next Category </th>
</tr>
<tr>
${cellStart} p </th>
${cellStart} Previous Category </th>
</tr>
</table>''';
}
}