func MustRegisterWindowClassWithWndProcPtr(className string, wndProcPtr uintptr) { if registeredWindowClasses[className] { panic("window class already registered") } hInst := win.GetModuleHandle(nil) if hInst == 0 { panic("GetModuleHandle") } hIcon := win.LoadIcon(0, (*uint16)(unsafe.Pointer(uintptr(win.IDI_APPLICATION)))) if hIcon == 0 { panic("LoadIcon") } hCursor := win.LoadCursor(0, (*uint16)(unsafe.Pointer(uintptr(win.IDC_ARROW)))) if hCursor == 0 { panic("LoadCursor") } var wc win.WNDCLASSEX wc.CbSize = uint32(unsafe.Sizeof(wc)) wc.LpfnWndProc = wndProcPtr wc.HInstance = hInst wc.HIcon = hIcon wc.HCursor = hCursor wc.HbrBackground = win.COLOR_BTNFACE + 1 wc.LpszClassName = syscall.StringToUTF16Ptr(className) if atom := win.RegisterClassEx(&wc); atom == 0 { panic("RegisterClassEx") } registeredWindowClasses[className] = true }
func CursorSize() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_SIZE))} }
func CursorIcon() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_ICON))} }
func CursorHelp() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_HELP))} }
func CursorAppStarting() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_APPSTARTING))} }
func CursorHand() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_HAND))} }
func CursorNo() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_NO))} }
func CursorUpArrow() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_UPARROW))} }
func CursorCross() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_CROSS))} }
func CursorWait() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_WAIT))} }
func CursorIBeam() Cursor { return stockCursor{win.LoadCursor(0, win.MAKEINTRESOURCE(win.IDC_IBEAM))} }