Skip to content

Instantly share code, notes, and snippets.

@treeform
Created April 18, 2019 21:44
Show Gist options
  • Select an option

  • Save treeform/47865e7d06694fc224f0c492cdee41d3 to your computer and use it in GitHub Desktop.

Select an option

Save treeform/47865e7d06694fc224f0c492cdee41d3 to your computer and use it in GitHub Desktop.
{.compile: "openwl/source/osx-cocoa/MainThreadExecutor.mm".}
{.compile: "openwl/source/osx-cocoa/WLAppDelegate.mm".}
{.compile: "openwl/source/osx-cocoa/WLContentView.mm".}
{.compile: "openwl/source/osx-cocoa/WLWindowObject.mm".}
{.compile: "openwl/source/osx-cocoa/globals.mm".}
{.compile: "openwl/source/osx-cocoa/keystuff.mm".}
{.compile: "openwl/source/osx-cocoa/miscutil.mm".}
{.compile: "openwl/source/osx-cocoa/openwl.mm".}
{.compile: "openwl/source/osx-cocoa/private_defs.mm".}
{.passL: "-framework Foundation" .}
{.passL: "-framework AppKit" .}
{.passL: "-framework ApplicationServices" .}
type
wlWindow* {.bycopy.} = object
wlTimer* {.bycopy.} = object
wlMenuBar* {.bycopy.} = object
wlMenu* {.bycopy.} = object
wlMenuItem* {.bycopy.} = object
wlIcon* {.bycopy.} = object
wlAccelerator* {.bycopy.} = object
wlAction* {.bycopy.} = object
wlDragData* {.bycopy.} = object
wlDropData* {.bycopy.} = object
wlEventPrivate* {.bycopy.} = object
wlRenderPayload* {.bycopy.} = object
WLKeyEnum* = enum
WLKey_Unknown, WLKey_Escape, WLKey_Tab, WLKey_Backspace, WLKey_Return,
WLKey_Space, WLKey_F1, WLKey_F2, WLKey_F3, WLKey_F4, WLKey_F5, WLKey_F6, WLKey_F7,
WLKey_F8, WLKey_F9, WLKey_F10, WLKey_F11, WLKey_F12, WLKey_F13, WLKey_F14,
WLKey_F15, WLKey_F16, WLKey_F17, WLKey_F18, WLKey_F19, WLKey_0, WLKey_1, WLKey_2,
WLKey_3, WLKey_4, WLKey_5, WLKey_6, WLKey_7, WLKey_8, WLKey_9, WLKey_A, WLKey_B,
WLKey_C, WLKey_D, WLKey_E, WLKey_F, WLKey_G, WLKey_H, WLKey_I, WLKey_J, WLKey_K,
WLKey_L, WLKey_M, WLKey_N, WLKey_O, WLKey_P, WLKey_Q, WLKey_R, WLKey_S, WLKey_T,
WLKey_U, WLKey_V, WLKey_W, WLKey_X, WLKey_Y, WLKey_Z, WLKey_Control, WLKey_Shift,
WLKey_AltOption, WLKey_WinCommand, WLKey_Fn, WLKey_Insert, WLKey_Delete,
WLKey_PageUp, WLKey_PageDown, WLKey_Home, WLKey_End, WLKey_LeftArrow,
WLKey_UpArrow, WLKey_RightArrow, WLKey_DownArrow, WLKey_KP_0, WLKey_KP_1,
WLKey_KP_2, WLKey_KP_3, WLKey_KP_4, WLKey_KP_5, WLKey_KP_6, WLKey_KP_7,
WLKey_KP_8, WLKey_KP_9, WLKey_KP_Clear, WLKey_KP_Equals, WLKey_KP_Divide,
WLKey_KP_Multiply, WLKey_KP_Subtract, WLKey_KP_Add, WLKey_KP_Enter,
WLKey_KP_Decimal, WLKey_CapsLock, WLKey_NumLock, WLKey_ScrollLock,
WLKey_PrintScreen, WLKey_Pause, WLKey_Cancel, WLKey_MediaMute,
WLKey_MediaVolumeDown, WLKey_MediaVolumeUp, WLKey_MediaNext, WLKey_MediaPrev,
WLKey_MediaStop, WLKey_MediaPlayPause
type
WLEventType* = enum
WLEventType_None, WLEventType_Action, WLEventType_WindowCloseRequest,
WLEventType_WindowDestroyed, WLEventType_WindowResized,
WLEventType_WindowRepaint, WLEventType_Timer, WLEventType_Mouse,
WLEventType_Key, WLEventType_Drop, WLEventType_DragRender,
WLEventType_ClipboardClear, WLEventType_PlatformSpecific = 4999,
WLEventType_D2DTargetRecreated, WLEventType_UserBegin = 9999
type
WLMouseEventType* = enum
WLMouseEventType_MouseDown, WLMouseEventType_MouseUp,
WLMouseEventType_MouseMove, WLMouseEventType_MouseEnter,
WLMouseEventType_MouseLeave, WLMouseEventType_MouseClick,
WLMouseEventType_MouseWheel
type
WLMouseButton* = enum
WLMouseButton_None, WLMouseButton_Left, WLMouseButton_Middle,
WLMouseButton_Right, WLMouseButton_Other
type
WLKeyEventType* = enum
WLKeyEventType_Up, WLKeyEventType_Down, WLKeyEventType_Char
type
WLModifiers* = enum
WLModifier_Shift = 1 shl 0, WLModifier_Control = 1 shl 1, WLModifier_Alt = 1 shl 2,
WLModifier_MacControl = 1 shl 3
type
WLKeyLocation* = enum
WLKeyLocation_Default, WLKeyLocation_Left, WLKeyLocation_Right,
WLKeyLocation_NumPad
type
WLDropEventType* = enum
WLDropEventType_Feedback, WLDropEventType_Drop
type
WLDropEffect* = enum
WLDropEffect_None = 0, WLDropEffect_Copy = 1 shl 0, WLDropEffect_Move = 1 shl 1,
WLDropEffect_Link = 1 shl 2, WLDropEffect_Other = 1 shl 3
type
WLPlatformContextD2D* {.bycopy.} = object
factory*: pointer # ptr ID2D1Factory
target*: pointer # ptr ID2D1RenderTarget
WLActionEvent* {.bycopy.} = object
action*: wlAction
id*: cint
WLCloseRequestEvent* {.bycopy.} = object
cancelClose*: bool
WLDestroyEvent* {.bycopy.} = object
reserved*: cint
WLResizeEvent* {.bycopy.} = object
oldWidth*: cint
oldHeight*: cint
newWidth*: cint
newHeight*: cint
WLRepaintEvent* {.bycopy.} = object
platformContext*: pointer
x*: cint
y*: cint
width*: cint
height*: cint
WLTimerEvent* {.bycopy.} = object
timer*: wlTimer
timerID*: cint
stopTimer*: bool
secondsSinceLast*: cdouble
WLMouseEvent* {.bycopy.} = object
eventType*: WLMouseEventType
x*: cint
y*: cint
wheelDelta*: cint
button*: WLMouseButton
modifiers*: cuint
WLKeyEvent* {.bycopy.} = object
eventType*: WLKeyEventType
key*: WLKeyEnum
string*: cstring
modifiers*: cuint
location*: WLKeyLocation
WLDropEvent* {.bycopy.} = object
eventType*: WLDropEventType
data*: wlDropData
modifiers*: cuint
x*: cint
y*: cint
defaultModifierAction*: WLDropEffect
allowedEffectMask*: cuint
WLDragRenderEvent* {.bycopy.} = object
dragFormat*: cstring
payload*: wlRenderPayload
WLClipboardClearEvent* {.bycopy.} = object
reserved*: cint
WLD2DTargetRecreatedEvent* {.bycopy.} = object
newTarget*: pointer # ptr ID2D1RenderTarget
oldTarget*: pointer # ptr ID2D1RenderTarget
INNER_C_UNION_openwl_p_254* {.bycopy.} = object {.union.}
actionEvent*: WLActionEvent
closeRequestEvent*: WLCloseRequestEvent
destroyEvent*: WLDestroyEvent
resizeEvent*: WLResizeEvent
repaintEvent*: WLRepaintEvent
timerEvent*: WLTimerEvent
mouseEvent*: WLMouseEvent
keyEvent*: WLKeyEvent
dropEvent*: WLDropEvent
dragRenderEvent*: WLDragRenderEvent
clipboardClearEvent*: WLClipboardClearEvent
d2dTargetRecreatedEvent*: WLD2DTargetRecreatedEvent
WLEvent* {.bycopy.} = object
private*: wlEventPrivate
eventType*: WLEventType
handled*: bool
ano_openwl_p_266*: INNER_C_UNION_openwl_p_254
WLWindowPropertyEnum* = enum
WLWindowProp_MinWidth = 1, WLWindowProp_MinHeight = 1 shl 1,
WLWindowProp_MaxWidth = 1 shl 2, WLWindowProp_MaxHeight = 1 shl 3,
WLWindowProp_Style = 1 shl 4
type
WLWindowStyleEnum* = enum
WLWindowStyle_Default, WLWindowStyle_Frameless
type
WLWindowProperties* {.bycopy.} = object
usedFields*: cuint
minWidth*: cint
minHeight*: cint
maxWidth*: cint
maxHeight*: cint
style*: WLWindowStyleEnum
WLPlatform* = enum
WLPlatform_Windows, WLPlatform_Linux, WLPlatform_Mac
type
WLFiles* {.bycopy.} = object
filenames*: cstringArray
numFiles*: cint
wlEventCallback* = proc (window: wlWindow; event: ptr WLEvent; userData: pointer): cint {.cdecl.}
wlVoidCallback* = proc (data: pointer)
type
INNER_C_STRUCT_openwl_p_301* {.bycopy.} = object
factory*: pointer # ptr ID2D1Factory
WLPlatformOptions* {.bycopy.} = object
reserved*: cint
useDirect2D*: bool
outParams*: INNER_C_STRUCT_openwl_p_301
{.push importc.}
proc wl_GetPlatform*(): WLPlatform
proc wl_Init*(callback: wlEventCallback; options: ptr WLPlatformOptions): cint
proc wl_Runloop*(): cint
proc wl_ExitRunloop*()
proc wl_Shutdown*()
proc wl_WindowCreate*(width: cint; height: cint; title: cstring; userData: pointer;
props: ptr WLWindowProperties): wlWindow
proc wl_WindowDestroy*(window: wlWindow)
proc wl_WindowShow*(window: wlWindow)
proc wl_WindowShowRelative*(window: wlWindow; relativeTo: wlWindow; x: cint; y: cint;
newWidth: cint; newHeight: cint)
proc wl_WindowHide*(window: wlWindow)
proc wl_WindowInvalidate*(window: wlWindow; x: cint; y: cint; width: cint; height: cint)
proc wl_WindowGetOSHandle*(window: wlWindow): csize
proc wl_WindowSetFocus*(window: wlWindow)
proc wl_MouseGrab*(window: wlWindow)
proc wl_MouseUngrab*()
proc wl_TimerCreate*(window: wlWindow; timerID: cint; msTimeout: cuint): wlTimer
proc wl_TimerDestroy*(timer: wlTimer)
proc wl_IconLoadFromFile*(filename: cstring; sizeToWidth: cint): wlIcon
proc wl_AccelCreate*(key: WLKeyEnum; modifiers: cuint): wlAccelerator
proc wl_ActionCreate*(id: cint; label: cstring; icon: wlIcon; accel: wlAccelerator): wlAction
proc wl_MenuCreate*(): wlMenu
proc wl_MenuAddAction*(menu: wlMenu; action: wlAction): wlMenuItem
proc wl_MenuAddSubmenu*(menu: wlMenu; label: cstring; sub: wlMenu): wlMenuItem
proc wl_MenuAddSeparator*(menu: wlMenu)
proc wl_MenuBarAddMenu*(menuBar: wlMenuBar; label: cstring; menu: wlMenu): wlMenuItem
proc wl_WindowShowContextMenu*(window: wlWindow; x: cint; y: cint; menu: wlMenu;
fromEvent: ptr WLEvent)
proc wl_MenuBarCreate*(): wlMenuBar
proc wl_WindowSetMenuBar*(window: wlWindow; menuBar: wlMenuBar)
var kWLDragFormatUTF8*: cstring
var kWLDragFormatFiles*: cstring
proc wl_DragDataCreate*(forWindow: wlWindow): wlDragData
proc wl_DragDataRelease*(dragData: ptr wlDragData)
proc wl_DragAddFormat*(dragData: wlDragData; dragFormatMIME: cstring)
proc wl_DragExec*(dragData: wlDragData; dropActionsMask: cuint; fromEvent: ptr WLEvent): WLDropEffect
proc wl_DropHasFormat*(dropData: wlDropData; dropFormatMIME: cstring): bool
proc wl_DropGetFormat*(dropData: wlDropData; dropFormatMIME: cstring;
data: ptr pointer; dataSize: ptr csize): bool
proc wl_DropGetFiles*(dropData: wlDropData; files: ptr ptr WLFiles): bool
proc wl_DragRenderUTF8*(payload: wlRenderPayload; text: cstring)
proc wl_DragRenderFiles*(payload: wlRenderPayload; files: ptr WLFiles)
proc wl_DragRenderFormat*(payload: wlRenderPayload; formatMIME: cstring;
data: pointer; dataSize: csize)
proc wl_WindowEnableDrops*(window: wlWindow; enabled: bool)
proc wl_ClipboardSet*(dragData: wlDragData)
proc wl_ClipboardGet*(): wlDropData
proc wl_ClipboardRelease*(dropData: wlDropData)
proc wl_ClipboardFlush*()
proc wl_ExecuteOnMainThread*(window: wlWindow; callback: wlVoidCallback; data: pointer)
proc wl_Sleep*(millis: cuint)
proc wl_SystemMillis*(): csize
{.pop.}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment