1 | package clarin.cmdi.componentregistry.common.components |
---|
2 | { |
---|
3 | import clarin.cmdi.componentregistry.services.Config; |
---|
4 | |
---|
5 | import flash.events.ContextMenuEvent; |
---|
6 | import flash.geom.Point; |
---|
7 | import flash.system.System; |
---|
8 | import flash.ui.ContextMenu; |
---|
9 | import flash.ui.ContextMenuItem; |
---|
10 | |
---|
11 | public class RssContextMenu |
---|
12 | { |
---|
13 | |
---|
14 | [Bindable] |
---|
15 | public var cm:ContextMenu; |
---|
16 | |
---|
17 | private var _copyRssLinkMenuItem:ContextMenuItem; |
---|
18 | private var _showRssLinkMenuItem:ContextMenuItem; |
---|
19 | |
---|
20 | |
---|
21 | |
---|
22 | public function RssContextMenu() |
---|
23 | { |
---|
24 | cm = new ContextMenu(); |
---|
25 | cm.hideBuiltInItems(); |
---|
26 | cm.customItems = createMenuItems(); |
---|
27 | |
---|
28 | } |
---|
29 | |
---|
30 | private function createMenuItems():Array { |
---|
31 | var result:Array = new Array(); |
---|
32 | |
---|
33 | _copyRssLinkMenuItem = new ContextMenuItem("Copy the link to the clipboard"); |
---|
34 | _copyRssLinkMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, copyRssLink); |
---|
35 | _copyRssLinkMenuItem.visible = true; |
---|
36 | result.push(_copyRssLinkMenuItem); |
---|
37 | |
---|
38 | _showRssLinkMenuItem = new ContextMenuItem("Show link to the RSS feed"); |
---|
39 | _showRssLinkMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, showRssLink); |
---|
40 | _showRssLinkMenuItem.visible = true; |
---|
41 | result.push(_showRssLinkMenuItem); |
---|
42 | |
---|
43 | return result; |
---|
44 | } |
---|
45 | |
---|
46 | |
---|
47 | protected function copyRssLink(event:ContextMenuEvent):void { |
---|
48 | } |
---|
49 | |
---|
50 | protected function showRssLink(event:ContextMenuEvent):void{ |
---|
51 | } |
---|
52 | |
---|
53 | protected function positioning(xShift:int, event:ContextMenuEvent):Point{ |
---|
54 | var point:Point = new Point(); |
---|
55 | point.x = event.mouseTarget.mouseX; |
---|
56 | point.y = event.mouseTarget.mouseY; |
---|
57 | point = event.mouseTarget.localToGlobal(point); |
---|
58 | return (new Point(point.x-xShift, point.y)); |
---|
59 | } |
---|
60 | } |
---|
61 | } |
---|