| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 */ | |
| 30 | |
| 31 #ifndef WebPopupMenuImpl_h | |
| 32 #define WebPopupMenuImpl_h | |
| 33 | |
| 34 // FIXME: Add this to FramelessScrollViewClient.h | |
| 35 namespace WebCore { class FramelessScrollView; } | |
| 36 | |
| 37 #include "FramelessScrollViewClient.h" | |
| 38 // FIXME: remove the relative paths once glue/ consumers are removed. | |
| 39 #include "../public/WebPoint.h" | |
| 40 #include "../public/WebPopupMenu.h" | |
| 41 #include "../public/WebSize.h" | |
| 42 #include <wtf/RefCounted.h> | |
| 43 | |
| 44 namespace WebCore { | |
| 45 class Frame; | |
| 46 class FramelessScrollView; | |
| 47 class KeyboardEvent; | |
| 48 class Page; | |
| 49 class PlatformKeyboardEvent; | |
| 50 class Range; | |
| 51 class Widget; | |
| 52 } | |
| 53 | |
| 54 namespace WebKit { | |
| 55 class WebKeyboardEvent; | |
| 56 class WebMouseEvent; | |
| 57 class WebMouseWheelEvent; | |
| 58 struct WebRect; | |
| 59 | |
| 60 class WebPopupMenuImpl : public WebPopupMenu, | |
| 61 public WebCore::FramelessScrollViewClient, | |
| 62 public RefCounted<WebPopupMenuImpl> { | |
| 63 public: | |
| 64 // WebWidget | |
| 65 virtual void close(); | |
| 66 virtual WebSize size() { return m_size; } | |
| 67 virtual void resize(const WebSize&); | |
| 68 virtual void layout(); | |
| 69 virtual void paint(WebCanvas* canvas, const WebRect& rect); | |
| 70 virtual bool handleInputEvent(const WebInputEvent&); | |
| 71 virtual void mouseCaptureLost(); | |
| 72 virtual void setFocus(bool enable); | |
| 73 virtual bool handleCompositionEvent( | |
| 74 WebCompositionCommand command, int cursorPosition, | |
| 75 int targetStart, int targetEnd, const WebString& text); | |
| 76 virtual bool queryCompositionStatus(bool* enabled, WebRect* caretRect); | |
| 77 virtual void setTextDirection(WebTextDirection direction); | |
| 78 | |
| 79 // WebPopupMenuImpl | |
| 80 void Init(WebCore::FramelessScrollView* widget, | |
| 81 const WebRect& bounds); | |
| 82 | |
| 83 WebWidgetClient* client() { return m_client; } | |
| 84 | |
| 85 void MouseMove(const WebMouseEvent&); | |
| 86 void MouseLeave(const WebMouseEvent&); | |
| 87 void MouseDown(const WebMouseEvent&); | |
| 88 void MouseUp(const WebMouseEvent&); | |
| 89 void MouseDoubleClick(const WebMouseEvent&); | |
| 90 void MouseWheel(const WebMouseWheelEvent&); | |
| 91 bool KeyEvent(const WebKeyboardEvent&); | |
| 92 | |
| 93 protected: | |
| 94 friend class WebPopupMenu; // For WebPopupMenu::create | |
| 95 friend class WTF::RefCounted<WebPopupMenuImpl>; | |
| 96 | |
| 97 WebPopupMenuImpl(WebWidgetClient* client); | |
| 98 ~WebPopupMenuImpl(); | |
| 99 | |
| 100 // WebCore::HostWindow methods: | |
| 101 virtual void repaint( | |
| 102 const WebCore::IntRect&, bool contentChanged, bool immediate = false, | |
| 103 bool repaintContentOnly = false); | |
| 104 virtual void scroll( | |
| 105 const WebCore::IntSize& scrollDelta, const WebCore::IntRect& scrollRect, | |
| 106 const WebCore::IntRect& clipRect); | |
| 107 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; | |
| 108 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; | |
| 109 virtual PlatformPageClient platformPageClient() const { return 0; } | |
| 110 virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::ScrollView*) const; | |
| 111 virtual void scrollbarsModeDidChange() const; | |
| 112 | |
| 113 // WebCore::FramelessScrollViewClient methods: | |
| 114 virtual void popupClosed(WebCore::FramelessScrollView*); | |
| 115 | |
| 116 WebWidgetClient* m_client; | |
| 117 WebSize m_size; | |
| 118 | |
| 119 WebPoint m_lastMousePosition; | |
| 120 | |
| 121 // This is a non-owning ref. The popup will notify us via popupClosed() | |
| 122 // before it is destroyed. | |
| 123 WebCore::FramelessScrollView* m_widget; | |
| 124 }; | |
| 125 | |
| 126 } // namespace WebKit | |
| 127 | |
| 128 #endif | |
| OLD | NEW |