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


Last updated: 22 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