Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / ozone / platform / dri / dri_cursor.h
1 // Copyright 2014 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 UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "ui/base/cursor/cursor.h"
10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h"
11 #include "ui/gfx/native_widget_types.h"
12
13 namespace gfx {
14 class PointF;
15 class Vector2dF;
16 }
17
18 namespace ui {
19
20 class BitmapCursorOzone;
21 class BitmapCursorFactoryOzone;
22 class DriWindowManager;
23 class HardwareCursorDelegate;
24
25 class DriCursor : public CursorDelegateEvdev {
26  public:
27   explicit DriCursor(HardwareCursorDelegate* hardware,
28                      DriWindowManager* window_manager);
29   ~DriCursor() override;
30
31   // Set's platform_cursor for widget. SetCursor is not responsible for showing
32   // the cursor. ShowCursor needs  to be explicitly called to make the cursor
33   // visible.
34   void SetCursor(gfx::AcceleratedWidget widget, PlatformCursor platform_cursor);
35   void ShowCursor();
36   void HideCursor();
37   gfx::AcceleratedWidget GetCursorWindow();
38
39   // CursorDelegateEvdev:
40   void MoveCursorTo(gfx::AcceleratedWidget widget,
41                     const gfx::PointF& location) override;
42   void MoveCursor(const gfx::Vector2dF& delta) override;
43   bool IsCursorVisible() override;
44   gfx::PointF location() override;
45
46  private:
47   // The location of the bitmap (the cursor location is the hotspot location).
48   gfx::Point bitmap_location();
49
50   // The DRI implementation for setting the hardware cursor.
51   HardwareCursorDelegate* hardware_;
52
53   DriWindowManager* window_manager_;  // Not owned.
54
55   // The current cursor bitmap.
56   scoped_refptr<BitmapCursorOzone> cursor_;
57
58   // The window under the cursor.
59   gfx::AcceleratedWidget cursor_window_;
60
61   // The location of the cursor within the window.
62   gfx::PointF cursor_location_;
63 };
64
65 }  // namespace ui
66
67 #endif  // UI_OZONE_PLATFORM_DRI_DRI_CURSOR_H_