lights FAQ Forum   github.com/luapower/winapi

Native OS APIs
winapi
objc
syscall
xlib
shm

winapi

win32 windows & controls


Scope

Windows, common controls and dialogs, message loop, system APIs, OpenGL and cairo.

Features

  • UTF8 Lua strings everywhere (also works with wide char buffers)
  • OpenGL, cairo and bitmap widgets
  • anchor-based layout model for all controls
  • object system with virtual properties (win.title = 'hello' sets the title)
  • binding helpers for easy binding of new and future APIs
  • all calls are error-checked
  • automatic memory management (ownership; buffers)
  • flags can be passed as 'FLAG1 FLAG2'
  • counting from 1 everywhere.

Status

Current status and issues.

Hello World

local winapi = require'winapi'
require'winapi.windowclass'

local win = winapi.Window{
   w = 500,                --all these are "initial fields"
   h = 300,
   title = 'Lua rulez',
   autoquit = true,        --this is to quit app when the window is closed
   visible = false,        --this field is from BaseWindow
}

function win:on_close()    --this is an event handler
   print'Bye'
end

print(win.title)           --this is how to read the value of a property
win.title = 'Lua rulez!'   --this is how to set the value of a property
win:show()                 --this is a method call

os.exit(winapi.MessageLoop()) --start the message loop

Demos

Check out winapi_demo to see all the controls in action:

screnshot

screnshot

Also, many modules can be run as standalone scripts, which will showcase their functionality, so there's lots of little demos there too.

Documentation

Architecture

Classes

  • Object - objects
    • VObject - objects with virtual properties
      • BaseWindow - base class for top-level windows and controls
      • [Menu][winapi.menuclass] - menus and menu bars
      • [NotifyIcon][winapi.notifyiconclass] - system tray icons

Functions

The "proc" layer is documented in the code, including API quirks and empirical knowledge, so do check out the source code.

Modules

bindinglast updated
winapi.bitmask bitmask encoding and decoding 22 months ago
winapi.debug strict mode and debug tools (optional module) 21 months ago
winapi.namespace namespace module and utils 22 months ago
winapi.struct struct ctype wrapper 21 months ago
winapi.util binding utilities 21 months ago
winapi.wcs utf8 <-> wide char conversions 21 months ago
winapi.init main winapi module 21 months ago
winapi [doc] loader for winapi.init (or the demo if run standalone) 21 months ago
oo/abstractlast updated
winapi.basewindowclass [doc] base class for top-level windows and controls 21 months ago
winapi.controlclass [doc] base class for standard controls 21 months ago
winapi.handlelist handle to Lua object mapping 22 months ago
winapi.itemlist base class for lists of objects 22 months ago
oo/controlslast updated
winapi.basebuttonclass [doc] base class for button-like controls 21 months ago
winapi.bitmappanel [doc] RGBA bitmap control 21 months ago
winapi.buttonclass [doc] push-button control 21 months ago
winapi.cairopanel [doc] cairo pixman surface control 17 months ago
winapi.cairosgpanel cairo scene graph panel 22 months ago
winapi.checkboxclass [doc] checkbox control 21 months ago
winapi.comboboxclass [doc] ComboBoxEx32 control 21 months ago
winapi.editclass [doc] standard edit control 21 months ago
winapi.groupboxclass [doc] groupbox control 22 months ago
winapi.labelclass [doc] standard label control 21 months ago
winapi.listboxclass [doc] standard listbox control 21 months ago
winapi.listviewclass standard listview control 21 months ago
winapi.menuclass standard menu control 21 months ago
winapi.notifyiconclass system tray icons 16 months ago
winapi.panelclass [doc] custom frameless child windows 21 months ago
winapi.radiobuttonclass [doc] radio button control 21 months ago
winapi.tabcontrolclass standard tab control 21 months ago
winapi.toolbarclass standard toolbar control 21 months ago
winapi.waitemlistclass accelerator item list 21 months ago
winapi.wglpanel [doc] opengl-enabled panel 21 months ago
oo/oo-systemlast updated
winapi.class [doc] single inheritance object model 22 months ago
winapi.object [doc] base object class 22 months ago
winapi.vobject [doc] object class with virtual properties 21 months ago
oo/resourceslast updated
winapi.imagelistclass image lists 22 months ago
oo/systemlast updated
winapi.mmdeviceclass Windows Multimedia Device API 22 months ago
oo/windowslast updated
winapi.windowclass [doc] overlapping (aka top-level) windows 20 months ago
proc/controlslast updated
winapi.accelerator accelerator tables 22 months ago
winapi.button button and button-like controls 21 months ago
winapi.combobox old combobox control 22 months ago
winapi.comboboxex comctl32 combobox control 22 months ago
winapi.comctl common controls API 21 months ago
winapi.edit standard edit control 22 months ago
winapi.filedialogs standard open and save dialogs 22 months ago
winapi.headercontrol standard header control 22 months ago
winapi.listbox standard listbox control 21 months ago
winapi.listview standard listview control 22 months ago
winapi.menu standard menu control 22 months ago
winapi.messagebox standard message box dialog 22 months ago
winapi.richedit standard richedit control 22 months ago
winapi.static label/shape/image control 21 months ago
winapi.tabcontrol standard tab control 21 months ago
winapi.toolbar standard toolbar control 21 months ago
winapi.tooltip standard tooltip control 22 months ago
winapi.treeview standard treeview control 22 months ago
proc/dialogslast updated
winapi.colorchooser color chooser dialog 22 months ago
winapi.comdlg common dialogs API 22 months ago
proc/gdilast updated
winapi.bitmap bitmap API 22 months ago
winapi.ddev Display Devices API 21 months ago
winapi.devcaps device capabilities API 22 months ago
winapi.dibitmap RGBA device independent bitmaps 21 months ago
proc/inputlast updated
winapi.keyboard Keyboard API 22 months ago
winapi.mouse Mouse API 22 months ago
winapi.rawinput Raw Input API 21 months ago
proc/multimedialast updated
winapi.dsound DirectSound API 20 months ago
proc/olelast updated
winapi.idataobject IDataObject interface 22 months ago
winapi.dragdrop drag & drop OLE API 2 years ago
winapi.ienumformatetc IEnumFormatETC interface 22 months ago
proc/opengllast updated
winapi.gl opengl dynamic namespace 22 months ago
winapi.gl11 OpenGL 1.1 API 22 months ago
winapi.gl21 OpenGL 2.1 API 22 months ago
winapi.wgl WGL API from wingdi.h 22 months ago
winapi.wglext opengl WGL API from wglext.h 22 months ago
proc/resourceslast updated
winapi.color standard color brushes 22 months ago
winapi.cursor cursor resources 21 months ago
winapi.font font resources (the old API) 21 months ago
winapi.fontex font resources (the new API) 22 months ago
winapi.icon icon resources 22 months ago
winapi.imagelist image lists 21 months ago
winapi.resource LoadImage API 22 months ago
proc/systemlast updated
winapi.clipboard clipboard API 22 months ago
winapi.file file I/O 22 months ago
winapi.filemapping memory mapped files 22 months ago
winapi.memory Memory Management API 22 months ago
winapi.mmdevice Windows Multimedia Device API 22 months ago
winapi.mmsystem Multimedia API 20 months ago
winapi.module LoadLibrary API 22 months ago
winapi.monitor Monitor API 21 months ago
winapi.ole OLE API 20 months ago
winapi.process Process API 22 months ago
winapi.propsys Property System API 22 months ago
winapi.registry Registry API 21 months ago
winapi.rpc RPC types 22 months ago
winapi.shellapi Shell32 API 22 months ago
winapi.spi System Parameters Info API 22 months ago
winapi.sstorage Structured Storage API 22 months ago
winapi.sysinfo System Info API 22 months ago
winapi.systemmetrics System Metrics API 22 months ago
winapi.time time functions 22 months ago
winapi.uuid UUID API from rpcdce.h 22 months ago
winapi.winbase winbase.h. incomplete :) 22 months ago
winapi.winnt don't know the scope of this yet. 22 months ago
proc/windowslast updated
winapi.windowclasses WNDCLASSEX API 21 months ago
winapi.dpiaware DPI-awareness API 22 months ago
winapi.gdi GDI API 20 months ago
winapi.window Windows (as in HWND) API 21 months ago
winapi.wmapp user-defined (WM_APP+N) messages 22 months ago
testlast updated
winapi.showcase testing utilities 22 months ago
typeslast updated
winapi.logfonttype LOGFONTW type 22 months ago
winapi.types types and macros from multiple headers 20 months ago
winapi.winuser winuser types and macros from multiple headers 21 months ago


Last updated: 21 months ago | Edit on GitHub

Pkg type:Lua+ffi
Version: r3-6-g9e08232
Last commit:
License: PD
Requires: cairo  glue  luajit  opengl  sg  +eq  +ffi_reflect  +path2d  +pp 
Required by: cairo  cplayer  nw  opengl  sg 

Top