+++ /dev/null
-<html>\r
-<head>\r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js">Ext.air.SystemTray = function(){\r
- var app = air.NativeApplication.nativeApplication;\r
- var icon, isWindows = false, bitmaps;\r
- \r
- // windows\r
- if(air.NativeApplication.supportsSystemTrayIcon) {\r
- icon = app.icon;\r
- isWindows = true;\r
- }\r
- \r
- // mac\r
- if(air.NativeApplication.supportsDockIcon) {\r
- icon = app.icon;\r
- }\r
- \r
- return {\r
- \r
- setIcon : function(icon, tooltip, initWithIcon){\r
- if(!icon){ // not supported OS\r
- return;\r
- }\r
- var loader = new air.Loader();\r
- loader.contentLoaderInfo.addEventListener(air.Event.COMPLETE, function(e){\r
- bitmaps = new runtime.Array(e.target.content.bitmapData);\r
- if (initWithIcon) {\r
- icon.bitmaps = bitmaps;\r
- }\r
- });\r
- loader.load(new air.URLRequest(icon));\r
- if(tooltip && air.NativeApplication.supportsSystemTrayIcon) {\r
- app.icon.tooltip = tooltip;\r
- }\r
- },\r
- \r
- bounce : function(priority){\r
- icon.bounce(priority);\r
- },\r
- \r
- on : function(eventName, fn, scope){\r
- icon.addEventListener(eventName, function(){\r
- fn.apply(scope || this, arguments);\r
- });\r
- },\r
- \r
- hideIcon : function(){\r
- if(!icon){ // not supported OS\r
- return;\r
- }\r
- icon.bitmaps = [];\r
- },\r
- \r
- showIcon : function(){\r
- if(!icon){ // not supported OS\r
- return;\r
- }\r
- icon.bitmaps = bitmaps;\r
- },\r
- \r
- setMenu: function(actions, _parentMenu){\r
- if(!icon){ // not supported OS\r
- return;\r
- }\r
- var menu = new air.NativeMenu();\r
- \r
- for (var i = 0, len = actions.length; i < len; i++) {\r
- var a = actions[i];\r
- if(a == '-'){\r
- menu.addItem(new air.NativeMenuItem("", true));\r
- }else{\r
- var item = menu.addItem(Ext.air.MenuItem(a));\r
- if(a.menu || (a.initialConfig && a.initialConfig.menu)){\r
- item.submenu = Ext.air.SystemTray.setMenu(a.menu || a.initialConfig.menu, menu);\r
- }\r
- }\r
- \r
- if(!_parentMenu){\r
- icon.menu = menu;\r
- }\r
- }\r
- \r
- return menu;\r
- }\r
- }; \r
-}();</pre> \r
-</body>\r
-</html>
\ No newline at end of file