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