Home | History | Annotate | Download | only in chromium
      1 /*
      2  * Copyright (c) 2008, 2009, Google Inc. All rights reserved.
      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  */
     30 
     31 #ifndef PlatformCursor_h
     32 #define PlatformCursor_h
     33 
     34 #include "Image.h"
     35 #include "IntPoint.h"
     36 #include "RefPtr.h"
     37 
     38 namespace WebCore {
     39 
     40     class PlatformCursor {
     41     public:
     42         enum Type {
     43             TypePointer,
     44             TypeCross,
     45             TypeHand,
     46             TypeIBeam,
     47             TypeWait,
     48             TypeHelp,
     49             TypeEastResize,
     50             TypeNorthResize,
     51             TypeNorthEastResize,
     52             TypeNorthWestResize,
     53             TypeSouthResize,
     54             TypeSouthEastResize,
     55             TypeSouthWestResize,
     56             TypeWestResize,
     57             TypeNorthSouthResize,
     58             TypeEastWestResize,
     59             TypeNorthEastSouthWestResize,
     60             TypeNorthWestSouthEastResize,
     61             TypeColumnResize,
     62             TypeRowResize,
     63             TypeMiddlePanning,
     64             TypeEastPanning,
     65             TypeNorthPanning,
     66             TypeNorthEastPanning,
     67             TypeNorthWestPanning,
     68             TypeSouthPanning,
     69             TypeSouthEastPanning,
     70             TypeSouthWestPanning,
     71             TypeWestPanning,
     72             TypeMove,
     73             TypeVerticalText,
     74             TypeCell,
     75             TypeContextMenu,
     76             TypeAlias,
     77             TypeProgress,
     78             TypeNoDrop,
     79             TypeCopy,
     80             TypeNone,
     81             TypeNotAllowed,
     82             TypeZoomIn,
     83             TypeZoomOut,
     84             TypeGrab,
     85             TypeGrabbing,
     86             TypeCustom
     87         };
     88 
     89         // Cursor.h assumes that it can initialize us to 0.
     90         explicit PlatformCursor(int type = 0) : m_type(TypePointer) {}
     91 
     92         PlatformCursor(Type type) : m_type(type) {}
     93 
     94         PlatformCursor(Image* image, const IntPoint& hotSpot)
     95             : m_image(image)
     96             , m_hotSpot(hotSpot)
     97             , m_type(TypeCustom) {}
     98 
     99         PassRefPtr<Image> customImage() const { return m_image; }
    100         const IntPoint& hotSpot() const { return m_hotSpot; }
    101         Type type() const { return m_type; }
    102 
    103     private:
    104         RefPtr<Image> m_image;
    105         IntPoint m_hotSpot;
    106         Type m_type;
    107     };
    108 
    109 } // namespace WebCore
    110 
    111 #endif
    112