Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1214)

Unified Diff: samples/total/client/ContextMenu.dart

Issue 10635015: Delete proxy and total samples, which have bit-rotted. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/total/client/Command.dart ('k') | samples/total/client/ContextMenuBuilder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/total/client/ContextMenu.dart
===================================================================
--- samples/total/client/ContextMenu.dart (revision 9011)
+++ samples/total/client/ContextMenu.dart (working copy)
@@ -1,79 +0,0 @@
-// 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.
-
-typedef bool EnabledFunction();
-typedef void CallbackFunction(Element elmt, int value);
-
-class ElementFunc {
- Element _element;
- EnabledFunction _func;
-
- Element get element() => _element;
-
- EnabledFunction get func() => _func;
-
- ElementFunc(this._element, this._func) { }
-}
-
-class ContextMenu {
- Element _contextMenu;
- List<ElementFunc> _enableFunctions;
- Element _parent;
- Spreadsheet _spreadsheet;
- SpreadsheetPresenter _spreadsheetPresenter;
-
- Element get parent() => _parent;
-
- ContextMenu(this._spreadsheetPresenter) {
- Document doc = document;
- _contextMenu = new Element.tag("ul");
- _contextMenu.style.setProperty("left","0px");
- _contextMenu.style.setProperty("top", "0px");
- _contextMenu.classes.add("contextMenu");
- _contextMenu.classes.add("fadeOut");
-
- // Parent off the document body to avoid problems when the menu
- // extends past the border of its owner spreadsheet
- _parent = doc.body;
- _parent.nodes.add(_contextMenu);
- _spreadsheet = _spreadsheetPresenter.spreadsheet;
- }
-
- Element addMenuItem(String label, int value,
- EnabledFunction enabled, CallbackFunction callback) {
- Element item = new Element.tag("li");
- item.classes.add("contextMenuItem");
- item.classes.add("contextMenuItem-enabled");
- item.innerHTML = label;
- item.on.click.add((Event e) {
- _spreadsheetPresenter.popdownMenu(_contextMenu, value, callback);
- });
- _contextMenu.nodes.add(item);
- if (_enableFunctions == null) {
- _enableFunctions = new List<ElementFunc>();
- }
- _enableFunctions.add(new ElementFunc(item, enabled));
- return item;
- }
-
- // Display the popup at the given coordinates
- void show(int x, int y) {
- // Enable or disable the menu items
- _enableFunctions.forEach((ElementFunc elementFunc) {
- _enableMenuItem(elementFunc.element, (elementFunc.func)());
- });
- _spreadsheetPresenter.popupMenu(_contextMenu, x, y);
- }
-
- // Enable or disable a particular menu item
- void _enableMenuItem(Element item, bool enabled) {
- if (enabled) {
- item.classes.remove("contextMenuItem-disabled");
- item.classes.add("contextMenuItem-enabled");
- } else {
- item.classes.remove("contextMenuItem-enabled");
- item.classes.add("contextMenuItem-disabled");
- }
- }
-}
« no previous file with comments | « samples/total/client/Command.dart ('k') | samples/total/client/ContextMenuBuilder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698