Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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_BASE_CURSOR_CURSOR_LOADER_X11_H_ | |
| 6 #define UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ | |
| 7 | |
| 8 #include <X11/Xcursor/Xcursor.h> | |
| 9 #include <map> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "ui/base/cursor/cursor.h" | |
| 13 #include "ui/base/cursor/cursor_loader.h" | |
| 14 | |
| 15 namespace ui { | |
| 16 | |
| 17 class CursorLoaderX11 : public CursorLoader { | |
| 18 public: | |
| 19 CursorLoaderX11(); | |
| 20 virtual ~CursorLoaderX11(); | |
| 21 | |
| 22 // Overridden from CursorLoader: | |
| 23 virtual void LoadImageCursor( | |
| 24 int id, int resource_id, const gfx::Point& hot) OVERRIDE; | |
| 25 virtual void LoadAnimatedCursor( | |
| 26 int id, int resource_id, const gfx::Point& hot, | |
| 27 int frame_delay_ms) OVERRIDE; | |
| 28 virtual void UnloadAll() OVERRIDE; | |
| 29 virtual void SetPlatformCursor(gfx::NativeCursor* cursor) OVERRIDE; | |
| 30 private: | |
|
sky
2012/09/10 22:49:06
newline between 29/30
mazda
2012/09/11 00:45:09
Done.
| |
| 31 // Returns true if we have an image resource loaded for the |native_cursor|. | |
| 32 bool IsImageCursor(gfx::NativeCursor native_cursor); | |
| 33 | |
| 34 // Gets the X Cursor corresponding to the |native_cursor|. | |
| 35 ::Cursor ImageCursorFromNative(gfx::NativeCursor native_cursor); | |
| 36 | |
| 37 // A map to hold all image cursors. It maps the cursor ID to the X Cursor. | |
| 38 typedef std::map<int, ::Cursor> ImageCursorMap; | |
| 39 ImageCursorMap cursors_; | |
| 40 | |
| 41 // A map to hold all animated cursors. It maps the cursor ID to the pair of | |
| 42 // the X Cursor and the corresponding XcursorImages. We need a pointer to the | |
| 43 // images so that we can free them on destruction. | |
| 44 typedef std::map<int, std::pair< ::Cursor, XcursorImages*> > | |
| 45 AnimatedCursorMap; | |
| 46 AnimatedCursorMap animated_cursors_; | |
| 47 | |
| 48 ::Cursor invisible_cursor_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(CursorLoaderX11); | |
| 51 }; | |
| 52 | |
| 53 } // namespace ui | |
| 54 | |
| 55 #endif // UI_BASE_CURSOR_CURSOR_LOADER_X11_H_ | |
| OLD | NEW |