Home | History | Annotate | Download | only in platform
      1 /*
      2  * Copyright (C) 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 WebCursorInfo_h
     32 #define WebCursorInfo_h
     33 
     34 #include "WebImage.h"
     35 #include "WebPoint.h"
     36 
     37 #if INSIDE_BLINK
     38 namespace WebCore { class Cursor; }
     39 #endif
     40 
     41 #ifdef WIN32
     42 typedef struct HICON__* HICON;
     43 typedef HICON HCURSOR;
     44 #endif
     45 
     46 namespace blink {
     47 
     48 struct WebCursorInfo {
     49     enum Type {
     50         TypePointer,
     51         TypeCross,
     52         TypeHand,
     53         TypeIBeam,
     54         TypeWait,
     55         TypeHelp,
     56         TypeEastResize,
     57         TypeNorthResize,
     58         TypeNorthEastResize,
     59         TypeNorthWestResize,
     60         TypeSouthResize,
     61         TypeSouthEastResize,
     62         TypeSouthWestResize,
     63         TypeWestResize,
     64         TypeNorthSouthResize,
     65         TypeEastWestResize,
     66         TypeNorthEastSouthWestResize,
     67         TypeNorthWestSouthEastResize,
     68         TypeColumnResize,
     69         TypeRowResize,
     70         TypeMiddlePanning,
     71         TypeEastPanning,
     72         TypeNorthPanning,
     73         TypeNorthEastPanning,
     74         TypeNorthWestPanning,
     75         TypeSouthPanning,
     76         TypeSouthEastPanning,
     77         TypeSouthWestPanning,
     78         TypeWestPanning,
     79         TypeMove,
     80         TypeVerticalText,
     81         TypeCell,
     82         TypeContextMenu,
     83         TypeAlias,
     84         TypeProgress,
     85         TypeNoDrop,
     86         TypeCopy,
     87         TypeNone,
     88         TypeNotAllowed,
     89         TypeZoomIn,
     90         TypeZoomOut,
     91         TypeGrab,
     92         TypeGrabbing,
     93         TypeCustom
     94     };
     95 
     96     Type type;
     97     WebPoint hotSpot;
     98     float imageScaleFactor;
     99     WebImage customImage;
    100 
    101 #ifdef WIN32
    102     // On Windows, TypeCustom may alternatively reference an externally
    103     // defined HCURSOR. If type is TypeCustom and externalHandle is non-
    104     // null, then customData should be ignored. The WebCursorInfo is not
    105     // responsible for managing the lifetime of this cursor handle.
    106     HCURSOR externalHandle;
    107 #endif
    108 
    109     explicit WebCursorInfo(Type type = TypePointer)
    110         : type(type)
    111         , imageScaleFactor(1)
    112     {
    113 #ifdef WIN32
    114         externalHandle = 0;
    115 #endif
    116     }
    117 
    118 #if INSIDE_BLINK
    119     BLINK_PLATFORM_EXPORT explicit WebCursorInfo(const WebCore::Cursor&);
    120 #endif
    121 };
    122 
    123 } // namespace blink
    124 
    125 #endif
    126