| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WEBKIT_GLUE_WEBPOPUPMENU_IMPL_H_ | |
| 6 #define WEBKIT_GLUE_WEBPOPUPMENU_IMPL_H_ | |
| 7 | |
| 8 #include "webkit/api/public/WebPoint.h" | |
| 9 #include "webkit/api/public/WebPopupMenu.h" | |
| 10 #include "webkit/api/public/WebSize.h" | |
| 11 | |
| 12 #include "FramelessScrollViewClient.h" | |
| 13 #include <wtf/RefCounted.h> | |
| 14 | |
| 15 namespace WebCore { | |
| 16 class Frame; | |
| 17 class FramelessScrollView; | |
| 18 class KeyboardEvent; | |
| 19 class Page; | |
| 20 class PlatformKeyboardEvent; | |
| 21 class Range; | |
| 22 class Widget; | |
| 23 } | |
| 24 | |
| 25 namespace WebKit { | |
| 26 class WebKeyboardEvent; | |
| 27 class WebMouseEvent; | |
| 28 class WebMouseWheelEvent; | |
| 29 struct WebRect; | |
| 30 } | |
| 31 | |
| 32 struct MenuItem; | |
| 33 | |
| 34 class WebPopupMenuImpl : public WebKit::WebPopupMenu, | |
| 35 public WebCore::FramelessScrollViewClient, | |
| 36 public RefCounted<WebPopupMenuImpl> { | |
| 37 public: | |
| 38 // WebWidget | |
| 39 virtual void close(); | |
| 40 virtual WebKit::WebSize size() { return size_; } | |
| 41 virtual void resize(const WebKit::WebSize& new_size); | |
| 42 virtual void layout(); | |
| 43 virtual void paint(WebKit::WebCanvas* canvas, | |
| 44 const WebKit::WebRect& rect); | |
| 45 virtual bool handleInputEvent(const WebKit::WebInputEvent& input_event); | |
| 46 virtual void mouseCaptureLost(); | |
| 47 virtual void setFocus(bool enable); | |
| 48 virtual bool handleCompositionEvent(WebKit::WebCompositionCommand command, | |
| 49 int cursor_position, | |
| 50 int target_start, | |
| 51 int target_end, | |
| 52 const WebKit::WebString& text); | |
| 53 virtual bool queryCompositionStatus(bool* enabled, | |
| 54 WebKit::WebRect* caret_rect); | |
| 55 virtual void setTextDirection(WebKit::WebTextDirection direction); | |
| 56 | |
| 57 // WebPopupMenuImpl | |
| 58 void Init(WebCore::FramelessScrollView* widget, | |
| 59 const WebKit::WebRect& bounds); | |
| 60 | |
| 61 WebKit::WebWidgetClient* client() { | |
| 62 return client_; | |
| 63 } | |
| 64 | |
| 65 void MouseMove(const WebKit::WebMouseEvent& mouse_event); | |
| 66 void MouseLeave(const WebKit::WebMouseEvent& mouse_event); | |
| 67 void MouseDown(const WebKit::WebMouseEvent& mouse_event); | |
| 68 void MouseUp(const WebKit::WebMouseEvent& mouse_event); | |
| 69 void MouseDoubleClick(const WebKit::WebMouseEvent& mouse_event); | |
| 70 void MouseWheel(const WebKit::WebMouseWheelEvent& wheel_event); | |
| 71 bool KeyEvent(const WebKit::WebKeyboardEvent& key_event); | |
| 72 | |
| 73 protected: | |
| 74 friend class WebKit::WebPopupMenu; // For WebPopupMenu::create | |
| 75 friend class WTF::RefCounted<WebPopupMenuImpl>; | |
| 76 | |
| 77 WebPopupMenuImpl(WebKit::WebWidgetClient* client); | |
| 78 ~WebPopupMenuImpl(); | |
| 79 | |
| 80 // WebCore::HostWindow methods: | |
| 81 virtual void repaint(const WebCore::IntRect&, | |
| 82 bool content_changed, | |
| 83 bool immediate = false, | |
| 84 bool repaint_content_only = false); | |
| 85 virtual void scroll(const WebCore::IntSize& scroll_delta, | |
| 86 const WebCore::IntRect& scroll_rect, | |
| 87 const WebCore::IntRect& clip_rect); | |
| 88 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; | |
| 89 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; | |
| 90 virtual PlatformPageClient platformPageClient() const { return NULL; } | |
| 91 virtual void scrollRectIntoView(const WebCore::IntRect&, | |
| 92 const WebCore::ScrollView*) const; | |
| 93 virtual void scrollbarsModeDidChange() const; | |
| 94 | |
| 95 // WebCore::FramelessScrollViewClient methods: | |
| 96 virtual void popupClosed(WebCore::FramelessScrollView* popup_view); | |
| 97 | |
| 98 WebKit::WebWidgetClient* client_; | |
| 99 WebKit::WebSize size_; | |
| 100 | |
| 101 WebKit::WebPoint last_mouse_position_; | |
| 102 | |
| 103 // This is a non-owning ref. The popup will notify us via popupClosed() | |
| 104 // before it is destroyed. | |
| 105 WebCore::FramelessScrollView* widget_; | |
| 106 }; | |
| 107 | |
| 108 #endif // WEBKIT_GLUE_WEBPOPUPMENU_IMPL_H_ | |
| OLD | NEW |