| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| 11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
| 12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
| 13 * distribution. | 13 * distribution. |
| 14 * * Neither the name of Google Inc. nor the names of its | 14 * * Neither the name of Google Inc. nor the names of its |
| 15 * contributors may be used to endorse or promote products derived from | 15 * contributors may be used to endorse or promote products derived from |
| 16 * this software without specific prior written permission. | 16 * this software without specific prior written permission. |
| 17 * | 17 * |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebWidget_h | 31 #ifndef WebWidget_h |
| 32 #define WebWidget_h | 32 #define WebWidget_h |
| 33 | 33 |
| 34 #error "This header file is still a work in progress; do not include!" | 34 #include "WebCanvas.h" |
| 35 | |
| 36 #include "WebCommon.h" | 35 #include "WebCommon.h" |
| 36 #include "WebCompositionCommand.h" |
| 37 #include "WebTextDirection.h" | 37 #include "WebTextDirection.h" |
| 38 | 38 |
| 39 namespace WebKit { | 39 namespace WebKit { |
| 40 class WebInputEvent; |
| 41 class WebString; |
| 42 struct WebRect; |
| 43 struct WebSize; |
| 40 | 44 |
| 41 class WebWidget { | 45 class WebWidget { |
| 42 public: | 46 public: |
| 43 // This method closes and deletes the WebWidget. | 47 // This method closes and deletes the WebWidget. |
| 44 virtual void close() = 0; | 48 virtual void close() = 0; |
| 45 | 49 |
| 46 // Returns the current size of the WebWidget. | 50 // Returns the current size of the WebWidget. |
| 47 virtual WebSize size() = 0; | 51 virtual WebSize size() = 0; |
| 48 | 52 |
| 49 // Called to resize the WebWidget. | 53 // Called to resize the WebWidget. |
| 50 virtual void resize(const WebSize&) = 0; | 54 virtual void resize(const WebSize&) = 0; |
| 51 | 55 |
| 52 // Called to layout the WebWidget. This MUST be called before Paint, | 56 // Called to layout the WebWidget. This MUST be called before Paint, |
| 53 // and it may result in calls to WebWidgetClient::didInvalidateRect. | 57 // and it may result in calls to WebWidgetClient::didInvalidateRect. |
| 54 virtual void layout() = 0; | 58 virtual void layout() = 0; |
| 55 | 59 |
| 56 // Called to paint the specified region of the WebWidget onto the given | 60 // Called to paint the specified region of the WebWidget onto the given |
| 57 // canvas. You MUST call Layout before calling this method. It is | 61 // canvas. You MUST call Layout before calling this method. It is |
| 58 // okay to call paint multiple times once layout has been called, | 62 // okay to call paint multiple times once layout has been called, |
| 59 // assuming no other changes are made to the WebWidget (e.g., once | 63 // assuming no other changes are made to the WebWidget (e.g., once |
| 60 // events are processed, it should be assumed that another call to | 64 // events are processed, it should be assumed that another call to |
| 61 // layout is warranted before painting again). | 65 // layout is warranted before painting again). |
| 62 virtual void paint(WebCanvas*, const WebRect&) = 0; | 66 virtual void paint(WebCanvas*, const WebRect&) = 0; |
| 63 | 67 |
| 64 // Called to inform the WebWidget of an input event. Returns true if | 68 // Called to inform the WebWidget of an input event. Returns true if |
| 65 // the event has been processed, false otherwise. | 69 // the event has been processed, false otherwise. |
| 66 virtual void handleInputEvent(const WebInputEvent&) = 0; | 70 virtual bool handleInputEvent(const WebInputEvent&) = 0; |
| 67 | 71 |
| 68 // Called to inform the WebWidget that mouse capture was lost. | 72 // Called to inform the WebWidget that mouse capture was lost. |
| 69 virtual void mouseCaptureLost() = 0; | 73 virtual void mouseCaptureLost() = 0; |
| 70 | 74 |
| 71 // Called to inform the WebWidget that it has gained or lost keyboard focus. | 75 // Called to inform the WebWidget that it has gained or lost keyboard focus. |
| 72 virtual void setFocus(bool) = 0; | 76 virtual void setFocus(bool) = 0; |
| 73 | 77 |
| 74 // Called to inform the WebWidget of a composition event. | 78 // Called to inform the WebWidget of a composition event. |
| 75 virtual bool handleCompositionEvent(WebCompositionCommand command, | 79 virtual bool handleCompositionEvent(WebCompositionCommand command, |
| 76 int cursorPosition, | 80 int cursorPosition, |
| 77 int targetStart, | 81 int targetStart, |
| 78 int targetEnd, | 82 int targetEnd, |
| 79 const WebString& text) = 0; | 83 const WebString& text) = 0; |
| 80 | 84 |
| 81 // Retrieve the status of this WebWidget required by IME APIs. Upon | 85 // Retrieve the status of this WebWidget required by IME APIs. Upon |
| 82 // success enabled and caretBounds are set. | 86 // success enabled and caretBounds are set. |
| 83 virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0; | 87 virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0; |
| 84 | 88 |
| 85 // Changes the text direction of the selected input node. | 89 // Changes the text direction of the selected input node. |
| 86 virtual void setTextDirection(WebTextDirection) = 0; | 90 virtual void setTextDirection(WebTextDirection) = 0; |
| 87 }; | 91 }; |
| 88 | 92 |
| 89 } // namespace WebKit | 93 } // namespace WebKit |
| 90 | 94 |
| 91 #endif | 95 #endif |
| OLD | NEW |