github.com/rajveermalviya/gamen@v0.1.2-0.20220930195403-9be15877c1aa/internal/win32/cursor.go (about)

     1  //go:build windows
     2  
     3  package win32
     4  
     5  import (
     6  	"github.com/rajveermalviya/gamen/cursors"
     7  	"github.com/rajveermalviya/gamen/internal/win32/procs"
     8  )
     9  
    10  // TODO: we should embed missing cursors using https://github.com/tc-hib/go-winres
    11  //
    12  // firefox: https://github.com/mozilla/gecko-dev/tree/master/widget/windows/res
    13  // chromium: https://chromium.googlesource.com/chromium/src.git/+/refs/heads/main/ui/resources/cursors/
    14  
    15  func toWin32Cursor(icon cursors.Icon) uintptr {
    16  	switch icon {
    17  	case cursors.Default, cursors.Pointer:
    18  		return procs.IDC_ARROW
    19  
    20  	case cursors.Help:
    21  		return procs.IDC_HELP
    22  
    23  	case cursors.Progress:
    24  		return procs.IDC_APPSTARTING
    25  
    26  	case cursors.Wait:
    27  		return procs.IDC_WAIT
    28  
    29  	case cursors.Crosshair:
    30  		return procs.IDC_CROSS
    31  
    32  	case cursors.Text, cursors.VerticalText:
    33  		return procs.IDC_IBEAM
    34  
    35  	case cursors.Move:
    36  		return procs.IDC_SIZEALL
    37  
    38  	case cursors.NoDrop, cursors.NotAllowed:
    39  		return procs.IDC_NO
    40  
    41  	case cursors.AllScroll:
    42  		return procs.IDC_SIZEALL
    43  
    44  	case cursors.ColResize,
    45  		cursors.EResize,
    46  		cursors.WResize,
    47  		cursors.EWResize:
    48  		return procs.IDC_SIZEWE
    49  
    50  	case cursors.RowResize,
    51  		cursors.NResize,
    52  		cursors.SResize,
    53  		cursors.NSResize:
    54  		return procs.IDC_SIZENS
    55  
    56  	case cursors.NEResize,
    57  		cursors.SWResize,
    58  		cursors.NESWResize:
    59  		return procs.IDC_SIZENESW
    60  
    61  	case cursors.NWResize,
    62  		cursors.SEResize,
    63  		cursors.NWSEResize:
    64  		return procs.IDC_SIZENWSE
    65  
    66  	case cursors.ContextMenu,
    67  		cursors.Cell,
    68  		cursors.Alias,
    69  		cursors.Copy,
    70  		cursors.Grab,
    71  		cursors.Grabbing,
    72  		cursors.ZoomIn,
    73  		cursors.ZoomOut:
    74  		return procs.IDC_ARROW
    75  
    76  	default:
    77  		return procs.IDC_ARROW
    78  	}
    79  }