OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class Settings { | 5 class Settings { |
6 // theme values: | 6 // theme values: |
7 static const THEME_SIMPLE = 1; | 7 static const THEME_SIMPLE = 1; |
8 static const THEME_BUTTON = 2; | 8 static const THEME_BUTTON = 2; |
9 | 9 |
10 SettingsDialog ui; | 10 SettingsDialog ui; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } else { | 42 } else { |
43 close(); | 43 close(); |
44 } | 44 } |
45 } | 45 } |
46 | 46 |
47 void decorateDropdown() { | 47 void decorateDropdown() { |
48 ui.settings.style.backgroundColor = _dialogOpened ? | 48 ui.settings.style.backgroundColor = _dialogOpened ? |
49 "transparent" : "#333"; | 49 "transparent" : "#333"; |
50 } | 50 } |
51 | 51 |
52 bool get isOpen() => _dialogOpened; | 52 bool get isOpen => _dialogOpened; |
53 | 53 |
54 /* | 54 /* |
55 * Optional MouseEvent if passed if the source of event is from outside of | 55 * Optional MouseEvent if passed if the source of event is from outside of |
56 * the dialog then the dialog can be closed. | 56 * the dialog then the dialog can be closed. |
57 */ | 57 */ |
58 void close([MouseEvent e]) { | 58 void close([MouseEvent e]) { |
59 if (isOpen) { | 59 if (isOpen) { |
60 if (ui.simple.checked) { | 60 if (ui.simple.checked) { |
61 theme = THEME_SIMPLE; | 61 theme = THEME_SIMPLE; |
62 } else if (ui.buttons.checked) { | 62 } else if (ui.buttons.checked) { |
63 theme = THEME_BUTTON; | 63 theme = THEME_BUTTON; |
64 } | 64 } |
65 | 65 |
66 if (e == null || !ui.settingsDialog.contains(e.srcElement)) { | 66 if (e == null || !ui.settingsDialog.contains(e.srcElement)) { |
67 decorateDropdown(); | 67 decorateDropdown(); |
68 ui.settingsDialog.style.visibility = "hidden"; | 68 ui.settingsDialog.style.visibility = "hidden"; |
69 _dialogOpened = false; | 69 _dialogOpened = false; |
70 } | 70 } |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 bool get isSimple() => theme == THEME_SIMPLE; | 74 bool get isSimple => theme == THEME_SIMPLE; |
75 bool get isButton() => theme == THEME_BUTTON; | 75 bool get isButton => theme == THEME_BUTTON; |
76 | 76 |
77 } | 77 } |
OLD | NEW |