| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Igalia S.L | 3 * Copyright (C) 2010 Igalia S.L |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #ifndef ContextMenuItem_h | 27 #ifndef ContextMenuItem_h |
| 28 #define ContextMenuItem_h | 28 #define ContextMenuItem_h |
| 29 | 29 |
| 30 #include <wtf/OwnPtr.h> | 30 #include <wtf/OwnPtr.h> |
| 31 #include <wtf/text/WTFString.h> | 31 #include <wtf/text/WTFString.h> |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 | 34 |
| 35 class ContextMenu; | 35 class ContextMenu; |
| 36 | 36 |
| 37 typedef void* PlatformContextMenuItem; | |
| 38 | |
| 39 // This enum needs to be in sync with the WebMenuItemTag enum in WebUIDelega
te.h and the | |
| 40 // extra values in WebUIDelegatePrivate.h | |
| 41 enum ContextMenuAction { | 37 enum ContextMenuAction { |
| 42 ContextMenuItemTagNoAction=0, // This item is not actually in WebUIDeleg
ate.h | |
| 43 ContextMenuItemTagOpenLinkInNewWindow=1, | |
| 44 ContextMenuItemTagDownloadLinkToDisk, | |
| 45 ContextMenuItemTagCopyLinkToClipboard, | |
| 46 ContextMenuItemTagOpenImageInNewWindow, | |
| 47 ContextMenuItemTagDownloadImageToDisk, | |
| 48 ContextMenuItemTagCopyImageToClipboard, | |
| 49 ContextMenuItemTagOpenFrameInNewWindow, | |
| 50 ContextMenuItemTagCopy, | |
| 51 ContextMenuItemTagGoBack, | |
| 52 ContextMenuItemTagGoForward, | |
| 53 ContextMenuItemTagStop, | |
| 54 ContextMenuItemTagReload, | |
| 55 ContextMenuItemTagCut, | |
| 56 ContextMenuItemTagPaste, | |
| 57 ContextMenuItemTagSpellingGuess, | |
| 58 ContextMenuItemTagNoGuessesFound, | |
| 59 ContextMenuItemTagIgnoreSpelling, | |
| 60 ContextMenuItemTagLearnSpelling, | |
| 61 ContextMenuItemTagOther, | |
| 62 ContextMenuItemTagSearchInSpotlight, | |
| 63 ContextMenuItemTagSearchWeb, | |
| 64 ContextMenuItemTagLookUpInDictionary, | |
| 65 ContextMenuItemTagOpenWithDefaultApplication, | |
| 66 ContextMenuItemPDFActualSize, | |
| 67 ContextMenuItemPDFZoomIn, | |
| 68 ContextMenuItemPDFZoomOut, | |
| 69 ContextMenuItemPDFAutoSize, | |
| 70 ContextMenuItemPDFSinglePage, | |
| 71 ContextMenuItemPDFFacingPages, | |
| 72 ContextMenuItemPDFContinuous, | |
| 73 ContextMenuItemPDFNextPage, | |
| 74 ContextMenuItemPDFPreviousPage, | |
| 75 // These are new tags! Not a part of API!!!! | |
| 76 ContextMenuItemTagOpenLink = 2000, | |
| 77 ContextMenuItemTagIgnoreGrammar, | |
| 78 ContextMenuItemTagSpellingMenu, // Spelling or Spelling/Grammar sub-menu | |
| 79 ContextMenuItemTagShowSpellingPanel, | |
| 80 ContextMenuItemTagCheckSpelling, | |
| 81 ContextMenuItemTagCheckSpellingWhileTyping, | |
| 82 ContextMenuItemTagCheckGrammarWithSpelling, | |
| 83 ContextMenuItemTagFontMenu, // Font sub-menu | |
| 84 ContextMenuItemTagShowFonts, | |
| 85 ContextMenuItemTagBold, | |
| 86 ContextMenuItemTagItalic, | |
| 87 ContextMenuItemTagUnderline, | |
| 88 ContextMenuItemTagOutline, | |
| 89 ContextMenuItemTagStyles, | |
| 90 ContextMenuItemTagShowColors, | |
| 91 ContextMenuItemTagSpeechMenu, // Speech sub-menu | |
| 92 ContextMenuItemTagStartSpeaking, | |
| 93 ContextMenuItemTagStopSpeaking, | |
| 94 ContextMenuItemTagWritingDirectionMenu, // Writing Direction sub-menu | |
| 95 ContextMenuItemTagDefaultDirection, | |
| 96 ContextMenuItemTagLeftToRight, | |
| 97 ContextMenuItemTagRightToLeft, | |
| 98 ContextMenuItemTagPDFSinglePageScrolling, | |
| 99 ContextMenuItemTagPDFFacingPagesScrolling, | |
| 100 ContextMenuItemTagInspectElement, | |
| 101 ContextMenuItemTagTextDirectionMenu, // Text Direction sub-menu | |
| 102 ContextMenuItemTagTextDirectionDefault, | |
| 103 ContextMenuItemTagTextDirectionLeftToRight, | |
| 104 ContextMenuItemTagTextDirectionRightToLeft, | |
| 105 ContextMenuItemTagOpenMediaInNewWindow, | |
| 106 ContextMenuItemTagCopyMediaLinkToClipboard, | |
| 107 ContextMenuItemTagToggleMediaControls, | |
| 108 ContextMenuItemTagToggleMediaLoop, | |
| 109 ContextMenuItemTagEnterVideoFullscreen, | |
| 110 ContextMenuItemTagMediaPlayPause, | |
| 111 ContextMenuItemTagMediaMute, | |
| 112 ContextMenuItemTagOpenLinkInThisWindow, | |
| 113 ContextMenuItemBaseCustomTag = 5000, | 38 ContextMenuItemBaseCustomTag = 5000, |
| 114 ContextMenuItemCustomTagNoAction = 5998, | 39 ContextMenuItemCustomTagNoAction = 5998, |
| 115 ContextMenuItemLastCustomTag = 5999, | 40 ContextMenuItemLastCustomTag = 5999 |
| 116 ContextMenuItemBaseApplicationTag = 10000 | |
| 117 }; | 41 }; |
| 118 | 42 |
| 119 enum ContextMenuItemType { | 43 enum ContextMenuItemType { |
| 120 ActionType, | 44 ActionType, |
| 121 CheckableActionType, | 45 CheckableActionType, |
| 122 SeparatorType, | 46 SeparatorType, |
| 123 SubmenuType | 47 SubmenuType |
| 124 }; | 48 }; |
| 125 | 49 |
| 126 class ContextMenuItem { | 50 class ContextMenuItem { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 139 | 63 |
| 140 void setChecked(bool = true); | 64 void setChecked(bool = true); |
| 141 bool checked() const; | 65 bool checked() const; |
| 142 | 66 |
| 143 void setEnabled(bool = true); | 67 void setEnabled(bool = true); |
| 144 bool enabled() const; | 68 bool enabled() const; |
| 145 | 69 |
| 146 void setSubMenu(ContextMenu*); | 70 void setSubMenu(ContextMenu*); |
| 147 | 71 |
| 148 ContextMenuItem(ContextMenuAction, const String&, bool enabled, bool che
cked, const Vector<ContextMenuItem>& subMenuItems); | 72 ContextMenuItem(ContextMenuAction, const String&, bool enabled, bool che
cked, const Vector<ContextMenuItem>& subMenuItems); |
| 149 explicit ContextMenuItem(const PlatformContextMenuItem&); | |
| 150 | |
| 151 PlatformContextMenuItem platformContextMenuItem() const; | |
| 152 | 73 |
| 153 void setTitle(const String& title) { m_title = title; } | 74 void setTitle(const String& title) { m_title = title; } |
| 154 const String& title() const { return m_title; } | 75 const String& title() const { return m_title; } |
| 155 | 76 |
| 156 const Vector<ContextMenuItem>& subMenuItems() const { return m_subMenuIt
ems; } | 77 const Vector<ContextMenuItem>& subMenuItems() const { return m_subMenuIt
ems; } |
| 157 private: | 78 private: |
| 158 ContextMenuItemType m_type; | 79 ContextMenuItemType m_type; |
| 159 ContextMenuAction m_action; | 80 ContextMenuAction m_action; |
| 160 String m_title; | 81 String m_title; |
| 161 bool m_enabled; | 82 bool m_enabled; |
| 162 bool m_checked; | 83 bool m_checked; |
| 163 Vector<ContextMenuItem> m_subMenuItems; | 84 Vector<ContextMenuItem> m_subMenuItems; |
| 164 }; | 85 }; |
| 165 } | 86 } |
| 166 | 87 |
| 167 #endif // ContextMenuItem_h | 88 #endif // ContextMenuItem_h |
| OLD | NEW |