OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 /** | |
6 * An informational dialog that shows keyboard shortcuts and provides a | |
7 * link to the Dart language webpage. | |
8 */ | |
9 //TODO(efortuna): fix DialogView so it doesn't require the HTML passed to | |
10 // the constructor. | |
11 class HelpDialog extends DialogView { | |
12 CompositeView _parent; | |
13 Function _doneHandler; | |
14 | |
15 HelpDialog(this._parent, this._doneHandler) | |
16 : super('Information', '', makeContent()); | |
17 | |
18 void onDone() { _doneHandler(); } | |
19 | |
20 static View makeContent() { | |
21 return new View.html( | |
22 ''' | |
23 <div> | |
24 | |
25 <p> | |
26 Keyboard shortcuts: | |
27 ${generateTableHtml()} | |
28 </p> | |
29 | |
30 <p> | |
31 <div id="dart-logo"> | |
32 <a href="http://dartlang.org"> | |
33 Dart, the programming language</a>. | |
34 </div> | |
35 </p> | |
36 </div> | |
37 '''); | |
38 } | |
39 | |
40 static String generateTableHtml() { | |
41 String cellStart = '''<th valign="middle" align="center">'''; | |
42 return '''<table width="90%" border=1 cellspacing="0" cellpadding="2"> | |
43 <tr bgcolor="#c3d9ff"> | |
44 ${cellStart} Shortcut Key </th> | |
45 ${cellStart} Action </th> | |
46 </tr> | |
47 <tr> | |
48 ${cellStart} j, <down arrow> </th> | |
49 ${cellStart} Next Article </th> | |
50 </tr> | |
51 <tr> | |
52 ${cellStart} k, <up arrow> </th> | |
53 ${cellStart} Previous Article </th> | |
54 </tr> | |
55 <tr> | |
56 ${cellStart} o, <enter> </th> | |
57 ${cellStart} Open Article </th> | |
58 </tr> | |
59 <tr> | |
60 ${cellStart} <esc>, <delete> </th> | |
61 ${cellStart} Back </th> | |
62 </tr> | |
63 <tr> | |
64 ${cellStart} a, h, <left arrow> </th> | |
65 ${cellStart} Left </th> | |
66 </tr> | |
67 <tr> | |
68 ${cellStart} d, l, <right arrow> </th> | |
69 ${cellStart} Right </th> | |
70 </tr> | |
71 <tr> | |
72 ${cellStart} n </th> | |
73 ${cellStart} Next Category </th> | |
74 </tr> | |
75 <tr> | |
76 ${cellStart} p </th> | |
77 ${cellStart} Previous Category </th> | |
78 </tr> | |
79 | |
80 </table>'''; | |
81 } | |
82 } | |
OLD | NEW |