Changeset 39416 in webkit
- Timestamp:
- Dec 19, 2008 4:28:32 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r39414 r39416 1 2008-12-19 miggilin <mr.diggilin@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Add Context Menu support to wx bindings. 6 7 https://bugs.webkit.org/show_bug.cgi?id=22675 8 9 * platform/ContextMenu.h: 10 * platform/ContextMenuItem.h: 11 (WebCore::PlatformMenuItemDescription::PlatformMenuItemDescription): 12 * platform/wx/ContextMenuItemWx.cpp: Added. 13 * platform/wx/ContextMenuWx.cpp: Added. 14 * platform/wx/LocalizedStringsWx.cpp: 15 * platform/wx/TemporaryLinkStubs.cpp: 16 * webcore-wx.bkl: 17 18 1 19 2008-12-19 Beth Dakin <bdakin@apple.com> 2 20 -
trunk/WebCore/platform/ContextMenu.h
r27644 r39416 70 70 71 71 PlatformMenuDescription releasePlatformDescription(); 72 72 #if PLATFORM(WX) 73 static ContextMenuItem* itemWithId(int); 74 #endif 73 75 private: 74 76 HitTestResult m_hitTestResult; 75 76 77 #if PLATFORM(MAC) 77 78 // Keep this in sync with the PlatformMenuDescription typedef -
trunk/WebCore/platform/ContextMenuItem.h
r38591 r39416 173 173 }; 174 174 #elif PLATFORM(WX) 175 typedef wxMenuItem* PlatformMenuItemDescription; 175 struct PlatformMenuItemDescription { 176 PlatformMenuItemDescription() 177 : type(ActionType), 178 action(ContextMenuItemTagNoAction), 179 checked(false), 180 enabled(true) 181 {} 182 183 ContextMenuItemType type; 184 ContextMenuAction action; 185 String title; 186 wxMenu * subMenu; 187 bool checked; 188 bool enabled; 189 }; 176 190 #else 177 191 typedef void* PlatformMenuItemDescription; -
trunk/WebCore/platform/wx/LocalizedStringsWx.cpp
r38415 r39416 69 69 String contextMenuItemTagOpenLinkInNewWindow() 70 70 { 71 return String( );71 return String("Open Link in New Window"); 72 72 } 73 73 74 74 String contextMenuItemTagDownloadLinkToDisk() 75 75 { 76 return String( );76 return String("Download Link to Disk"); 77 77 } 78 78 79 79 String contextMenuItemTagCopyLinkToClipboard() 80 80 { 81 return String( );81 return String("Copy Link to Clipboard"); 82 82 } 83 83 84 84 String contextMenuItemTagOpenImageInNewWindow() 85 85 { 86 return String( );86 return String("Open Image in New Window"); 87 87 } 88 88 89 89 String contextMenuItemTagDownloadImageToDisk() 90 90 { 91 return String( );91 return String("Download Image to Disk"); 92 92 } 93 93 94 94 String contextMenuItemTagCopyImageToClipboard() 95 95 { 96 return String( );96 return String("Copy Image to Clipboard"); 97 97 } 98 98 99 99 String contextMenuItemTagOpenFrameInNewWindow() 100 100 { 101 return String( );101 return String("Open Frame in New Window"); 102 102 } 103 103 104 104 String contextMenuItemTagCopy() 105 105 { 106 return String( );106 return String("Copy"); 107 107 } 108 108 109 109 String contextMenuItemTagGoBack() 110 110 { 111 return String( );111 return String("Go Back"); 112 112 } 113 113 114 114 String contextMenuItemTagGoForward() 115 115 { 116 return String( );116 return String("Go Forward"); 117 117 } 118 118 119 119 String contextMenuItemTagStop() 120 120 { 121 return String( );121 return String("Stop"); 122 122 } 123 123 124 124 String contextMenuItemTagReload() 125 125 { 126 return String( );126 return String("Reload"); 127 127 } 128 128 129 129 String contextMenuItemTagCut() 130 130 { 131 return String( );131 return String("Cut"); 132 132 } 133 133 134 134 String contextMenuItemTagPaste() 135 135 { 136 return String( );136 return String("Paste"); 137 137 } 138 138 139 139 String contextMenuItemTagNoGuessesFound() 140 140 { 141 return String( );141 return String("No Guesses Found"); 142 142 } 143 143 144 144 String contextMenuItemTagIgnoreSpelling() 145 145 { 146 return String( );146 return String("Ignore Spelling"); 147 147 } 148 148 149 149 String contextMenuItemTagLearnSpelling() 150 150 { 151 return String( );151 return String("Learn Spelling"); 152 152 } 153 153 154 154 String contextMenuItemTagSearchWeb() 155 155 { 156 return String( );156 return String("Search Web"); 157 157 } 158 158 159 159 String contextMenuItemTagLookUpInDictionary() 160 160 { 161 return String( );161 return String("Look Up in Dictionary"); 162 162 } 163 163 164 164 String contextMenuItemTagOpenLink() 165 165 { 166 return String( );166 return String("Open Link"); 167 167 } 168 168 169 169 String contextMenuItemTagIgnoreGrammar() 170 170 { 171 return String( );171 return String("Ignore Grammar"); 172 172 } 173 173 174 174 String contextMenuItemTagSpellingMenu() 175 175 { 176 return String( );176 return String("Spelling"); 177 177 } 178 178 179 179 String contextMenuItemTagShowSpellingPanel(bool show) 180 180 { 181 return String( );181 return String("Show Spelling Panel"); 182 182 } 183 183 184 184 String contextMenuItemTagCheckSpelling() 185 185 { 186 return String( );186 return String("Check Spelling"); 187 187 } 188 188 189 189 String contextMenuItemTagCheckSpellingWhileTyping() 190 190 { 191 return String( );191 return String("Check Spelling While Typing"); 192 192 } 193 193 194 194 String contextMenuItemTagCheckGrammarWithSpelling() 195 195 { 196 return String( );196 return String("Check Grammar with Spelling"); 197 197 } 198 198 199 199 String contextMenuItemTagFontMenu() 200 200 { 201 return String( );201 return String("Font"); 202 202 } 203 203 204 204 String contextMenuItemTagBold() 205 205 { 206 return String( );206 return String("Bold"); 207 207 } 208 208 209 209 String contextMenuItemTagItalic() 210 210 { 211 return String( );211 return String("Italic"); 212 212 } 213 213 214 214 String contextMenuItemTagUnderline() 215 215 { 216 return String( );216 return String("Underline"); 217 217 } 218 218 219 219 String contextMenuItemTagOutline() 220 220 { 221 return String( );221 return String("Outline"); 222 222 } 223 223 224 224 String contextMenuItemTagWritingDirectionMenu() 225 225 { 226 return String( );226 return String("Writing Direction"); 227 227 } 228 228 229 229 String contextMenuItemTagTextDirectionMenu() 230 230 { 231 return String( );231 return String("Text Direction"); 232 232 } 233 233 234 234 String contextMenuItemTagDefaultDirection() 235 235 { 236 return String( );236 return String("Default Direction"); 237 237 } 238 238 239 239 String contextMenuItemTagLeftToRight() 240 240 { 241 return String( );241 return String("Left to Right"); 242 242 } 243 243 244 244 String contextMenuItemTagRightToLeft() 245 245 { 246 return String( );246 return String("Right to Left"); 247 247 } 248 248 -
trunk/WebCore/platform/wx/TemporaryLinkStubs.cpp
r38057 r39416 137 137 void Icon::paint(GraphicsContext*, const IntRect&) { notImplemented(); } 138 138 139 ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) { notImplemented(); }140 ContextMenu::~ContextMenu() { notImplemented(); }141 void ContextMenu::appendItem(ContextMenuItem&) { notImplemented(); }142 void ContextMenu::setPlatformDescription(PlatformMenuDescription) { notImplemented(); }143 144 ContextMenuItem::ContextMenuItem(PlatformMenuItemDescription) { notImplemented(); }145 ContextMenuItem::ContextMenuItem(ContextMenu*) { notImplemented(); }146 ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu) { notImplemented(); }147 ContextMenuItem::~ContextMenuItem() { notImplemented(); }148 PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription() { notImplemented(); return m_platformDescription; }149 ContextMenuItemType ContextMenuItem::type() const { notImplemented(); return ActionType; }150 void ContextMenuItem::setType(ContextMenuItemType) { notImplemented(); }151 ContextMenuAction ContextMenuItem::action() const { notImplemented(); return ContextMenuItemTagNoAction; }152 void ContextMenuItem::setAction(ContextMenuAction) { notImplemented(); }153 String ContextMenuItem::title() const { notImplemented(); return String(); }154 void ContextMenuItem::setTitle(const String&) { notImplemented(); }155 //PlatformMenuDescription ContextMenuItem::platformSubMenu() const { notImplemented(); return 0; }156 void ContextMenuItem::setSubMenu(ContextMenu*) { notImplemented(); }157 void ContextMenuItem::setChecked(bool) { notImplemented(); }158 void ContextMenuItem::setEnabled(bool) { notImplemented(); }159 160 139 void Editor::showColorPanel() { notImplemented(); } 161 140 void Editor::showFontPanel() { notImplemented(); } -
trunk/WebCore/webcore-wx.bkl
r38766 r39416 92 92 platform/wx/SystemTimeWx.cpp 93 93 platform/wx/WidgetWx.cpp 94 platform/wx/ContextMenuWx.cpp 95 platform/wx/ContextMenuItemWx.cpp 94 96 95 97 <!-- files from other ports we currently rely on --> -
trunk/WebKit/wx/ChangeLog
r39409 r39416 1 2008-12-19 miggilin <mr.diggilin@gmail.com> 2 3 Reviewed by Kevin Ollivier. 4 5 Add Context Menu support to wx bindings. 6 7 https://bugs.webkit.org/show_bug.cgi?id=22675 8 9 * WebKitSupport/ContextMenuClientWx.cpp: 10 (WebCore::ContextMenuClientWx::contextMenuDestroyed): 11 (WebCore::ContextMenuClientWx::getCustomMenuFromDefaultItems): 12 * WebView.cpp: 13 (wxWebView::OnMouseEvents): 14 (wxWebView::OnContextMenuEvents): 15 (wxWebView::OnMenuSelectEvents): 16 * WebView.h: 17 18 1 19 2008-12-19 Kevin Ollivier <kevino@theolliviers.com> 2 20 -
trunk/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp
r29663 r39416 29 29 #include "ContextMenuClientWx.h" 30 30 #include "NotImplemented.h" 31 #include "ContextMenu.h" 31 32 #include <stdio.h> 32 33 … … 39 40 void ContextMenuClientWx::contextMenuDestroyed() 40 41 { 41 notImplemented();42 delete this; 42 43 } 43 44 44 PlatformMenuDescription ContextMenuClientWx::getCustomMenuFromDefaultItems(ContextMenu* )45 PlatformMenuDescription ContextMenuClientWx::getCustomMenuFromDefaultItems(ContextMenu* menu) 45 46 { 46 notImplemented(); 47 return 0; 47 return menu->releasePlatformDescription(); 48 48 } 49 49 -
trunk/WebKit/wx/WebView.cpp
r39273 r39416 38 38 #include "markup.h" 39 39 #include "Page.h" 40 #include "ContextMenu.h" 41 #include "ContextMenuItem.h" 42 #include "ContextMenuController.h" 40 43 #include "PlatformKeyboardEvent.h" 41 44 #include "PlatformMouseEvent.h" … … 173 176 EVT_SIZE(wxWebView::OnSize) 174 177 EVT_MOUSE_EVENTS(wxWebView::OnMouseEvents) 178 EVT_CONTEXT_MENU(wxWebView::OnContextMenuEvents) 179 EVT_MENU(wxID_ANY, wxWebView::OnMenuSelectEvents) 175 180 EVT_KEY_DOWN(wxWebView::OnKeyEvents) 176 181 EVT_KEY_UP(wxWebView::OnKeyEvents) … … 516 521 else if (type == wxEVT_MOTION) 517 522 frame->eventHandler()->mouseMoved(wkEvent); 523 } 524 525 void wxWebView::OnContextMenuEvents(wxContextMenuEvent& event) 526 { 527 m_impl->page->contextMenuController()->clearContextMenu(); 528 wxPoint localEventPoint = ScreenToClient(event.GetPosition()); 529 530 if (!m_mainFrame) 531 return; 532 533 WebCore::Frame* focusedFrame = m_mainFrame->GetFrame(); 534 if (!focusedFrame->view()) 535 return; 536 537 //Create WebCore mouse event from the wxContextMenuEvent 538 wxMouseEvent mouseEvent(wxEVT_RIGHT_DOWN); 539 mouseEvent.m_x = localEventPoint.x; 540 mouseEvent.m_y = localEventPoint.y; 541 WebCore::PlatformMouseEvent wkEvent(mouseEvent, event.GetPosition()); 542 543 bool handledEvent = focusedFrame->eventHandler()->sendContextMenuEvent(wkEvent); 544 if (!handledEvent) 545 return; 546 547 WebCore::ContextMenu* coreMenu = m_impl->page->contextMenuController()->contextMenu(); 548 if (!coreMenu) 549 return; 550 551 WebCore::PlatformMenuDescription menuWx = coreMenu->platformDescription(); 552 if (!menuWx) 553 return; 554 555 PopupMenu(menuWx, localEventPoint); 556 } 557 558 void wxWebView::OnMenuSelectEvents(wxCommandEvent& event) 559 { 560 WebCore::ContextMenuItem* item = WebCore::ContextMenu::itemWithId (event.GetId()); 561 if (!item) 562 return; 563 564 m_impl->page->contextMenuController()->contextMenuItemSelected(item); 565 delete item; 518 566 } 519 567 -
trunk/WebKit/wx/WebView.h
r39273 r39416 150 150 void OnSize(wxSizeEvent& event); 151 151 void OnMouseEvents(wxMouseEvent& event); 152 void OnContextMenuEvents(wxContextMenuEvent& event); 153 void OnMenuSelectEvents(wxCommandEvent& event); 152 154 void OnKeyEvents(wxKeyEvent& event); 153 155 void OnSetFocus(wxFocusEvent& event);
Note: See TracChangeset
for help on using the changeset viewer.