| 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_WEBWIDGET_H__ | |
| 6 #define WEBKIT_GLUE_WEBWIDGET_H__ | |
| 7 | |
| 8 #include "skia/ext/platform_canvas.h" | |
| 9 #include "webkit/glue/webtextdirection.h" | |
| 10 | |
| 11 namespace WebKit { | |
| 12 class WebInputEvent; | |
| 13 struct WebRect; | |
| 14 struct WebSize; | |
| 15 } | |
| 16 | |
| 17 class WebWidgetDelegate; | |
| 18 | |
| 19 class WebWidget { | |
| 20 public: | |
| 21 WebWidget() {} | |
| 22 | |
| 23 // This method creates a WebWidget that is initially invisible and positioned | |
| 24 // according to the given bounds relative to the specified parent window. | |
| 25 // The caller is responsible for showing the WebWidget's view window (see | |
| 26 // GetViewWindow) once it is ready to have the WebWidget appear on the screen. | |
| 27 static WebWidget* Create(WebWidgetDelegate* delegate); | |
| 28 | |
| 29 // This method closes and deletes the WebWidget. | |
| 30 virtual void Close() = 0; | |
| 31 | |
| 32 // Called to resize the WebWidget. | |
| 33 virtual void Resize(const WebKit::WebSize& new_size) = 0; | |
| 34 | |
| 35 // Returns the current size of the WebWidget. | |
| 36 virtual WebKit::WebSize GetSize() = 0; | |
| 37 | |
| 38 // Called to layout the WebWidget. This MUST be called before Paint, and it | |
| 39 // may result in calls to WebWidgetDelegate::DidInvalidateRect. | |
| 40 virtual void Layout() = 0; | |
| 41 | |
| 42 // Called to paint the specified region of the WebWidget onto the given canvas
. | |
| 43 // You MUST call Layout before calling this method. It is okay to call Paint | |
| 44 // multiple times once Layout has been called, assuming no other changes are | |
| 45 // made to the WebWidget (e.g., once events are processed, it should be assume
d | |
| 46 // that another call to Layout is warranted before painting again). | |
| 47 virtual void Paint(skia::PlatformCanvas* canvas, | |
| 48 const WebKit::WebRect& rect) = 0; | |
| 49 | |
| 50 // Called to inform the WebWidget of an input event. | |
| 51 // Returns true if the event has been processed, false otherwise. | |
| 52 virtual bool HandleInputEvent(const WebKit::WebInputEvent* input_event) = 0; | |
| 53 | |
| 54 // Called to inform the WebWidget that mouse capture was lost. | |
| 55 virtual void MouseCaptureLost() = 0; | |
| 56 | |
| 57 // Called to inform the WebWidget that it has gained or lost keyboard focus. | |
| 58 virtual void SetFocus(bool enable) = 0; | |
| 59 | |
| 60 // Called to inform the webwidget of a composition event from IMM | |
| 61 // (Input Method Manager). | |
| 62 virtual bool ImeSetComposition(int string_type, int cursor_position, | |
| 63 int target_start, int target_end, | |
| 64 const std::wstring& ime_string) = 0; | |
| 65 | |
| 66 // Retrieve the status of this widget required by IME APIs. | |
| 67 virtual bool ImeUpdateStatus(bool* enable_ime, | |
| 68 WebKit::WebRect* caret_rect) = 0; | |
| 69 | |
| 70 // Changes the text direction of the selected input node. | |
| 71 virtual void SetTextDirection(WebTextDirection direction) = 0; | |
| 72 | |
| 73 protected: | |
| 74 virtual ~WebWidget() {} | |
| 75 | |
| 76 private: | |
| 77 DISALLOW_EVIL_CONSTRUCTORS(WebWidget); | |
| 78 }; | |
| 79 | |
| 80 #endif // #ifndef WEBKIT_GLUE_WEBWIDGET_H__ | |
| OLD | NEW |